Add pointers to the git repos
[exim-website.git] / docbook / 4.67 / 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
4
5 <?sdop
6   foot_right_recto="&chaptertitle; (&chapternumber;)"
7   foot_right_verso="&chaptertitle; (&chapternumber;)"
8   toc_chapter_blanks="yes,yes"
9   table_warn_soft_overflow="no"
10 ?>
11 <book>
12 <bookinfo>
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>10 April 2007</date>
16 <author><firstname>Philip</firstname><surname>Hazel</surname></author>
17 <authorinitials>PH</authorinitials>
18 <affiliation><orgname>University of Cambridge Computing Service</orgname></affiliation>
19 <address>New Museums Site, Pembroke Street, Cambridge CB2 3QH, England</address>
20 <revhistory><revision>
21   <revnumber>4.67</revnumber>
22   <date>10 April 2007</date>
23   <authorinitials>PH</authorinitials>
24 </revision></revhistory>
25 <copyright><year>2007</year><holder>University of Cambridge</holder></copyright>
26 </bookinfo>
27 <chapter id="CHID1">
28 <title>Introduction</title>
29
30 <indexterm role="variable">
31   <primary>$1, $2, etc.</primary>
32   <see><emphasis>numerical variables</emphasis></see>
33 </indexterm>
34 <indexterm role="concept">
35   <primary>address</primary>
36   <secondary>rewriting</secondary>
37   <see><emphasis>rewriting</emphasis></see>
38 </indexterm>
39 <indexterm role="concept">
40   <primary>Bounce Address Tag Validation</primary>
41   <see><emphasis>BATV</emphasis></see>
42 </indexterm>
43 <indexterm role="concept">
44   <primary>Client SMTP Authorization</primary>
45   <see><emphasis>CSA</emphasis></see>
46 </indexterm>
47 <indexterm role="concept">
48   <primary>CR character</primary>
49   <see><emphasis>carriage return</emphasis></see>
50 </indexterm>
51 <indexterm role="concept">
52   <primary>CRL</primary>
53   <see><emphasis>certificate revocation list</emphasis></see>
54 </indexterm>
55 <indexterm role="concept">
56   <primary>delivery</primary>
57   <secondary>failure report</secondary>
58   <see><emphasis>bounce message</emphasis></see>
59 </indexterm>
60 <indexterm role="concept">
61   <primary>dialup</primary>
62   <see><emphasis>intermittently connected hosts</emphasis></see>
63 </indexterm>
64 <indexterm role="concept">
65   <primary>exiscan</primary>
66   <see><emphasis>content scanning</emphasis></see>
67 </indexterm>
68 <indexterm role="concept">
69   <primary>failover</primary>
70   <see><emphasis>fallback</emphasis></see>
71 </indexterm>
72 <indexterm role="concept">
73   <primary>fallover</primary>
74   <see><emphasis>fallback</emphasis></see>
75 </indexterm>
76 <indexterm role="concept">
77   <primary>filter</primary>
78   <secondary>Sieve</secondary>
79   <see><emphasis>Sieve filter</emphasis></see>
80 </indexterm>
81 <indexterm role="concept">
82   <primary>ident</primary>
83   <see><emphasis>RFC 1413</emphasis></see>
84 </indexterm>
85 <indexterm role="concept">
86   <primary>LF character</primary>
87   <see><emphasis>linefeed</emphasis></see>
88 </indexterm>
89 <indexterm role="concept">
90   <primary>maximum</primary>
91   <see><emphasis>limit</emphasis></see>
92 </indexterm>
93 <indexterm role="concept">
94   <primary>monitor</primary>
95   <see><emphasis>Exim monitor</emphasis></see>
96 </indexterm>
97 <indexterm role="concept">
98   <primary>no_<emphasis>xxx</emphasis></primary>
99   <see>entry for xxx</see>
100 </indexterm>
101 <indexterm role="concept">
102   <primary>NUL</primary>
103   <see><emphasis>binary zero</emphasis></see>
104 </indexterm>
105 <indexterm role="concept">
106   <primary>passwd file</primary>
107   <see><emphasis>/etc/passwd</emphasis></see>
108 </indexterm>
109 <indexterm role="concept">
110   <primary>process id</primary>
111   <see><emphasis>pid</emphasis></see>
112 </indexterm>
113 <indexterm role="concept">
114   <primary>RBL</primary>
115   <see><emphasis>DNS list</emphasis></see>
116 </indexterm>
117 <indexterm role="concept">
118   <primary>redirection</primary>
119   <see><emphasis>address redirection</emphasis></see>
120 </indexterm>
121 <indexterm role="concept">
122   <primary>return path</primary>
123   <seealso><emphasis>envelope sender</emphasis></seealso>
124 </indexterm>
125 <indexterm role="concept">
126   <primary>scanning</primary>
127   <see><emphasis>content scanning</emphasis></see>
128 </indexterm>
129 <indexterm role="concept">
130   <primary>SSL</primary>
131   <see><emphasis>TLS</emphasis></see>
132 </indexterm>
133 <indexterm role="concept">
134   <primary>string</primary>
135   <secondary>expansion</secondary>
136   <see><emphasis>expansion</emphasis></see>
137 </indexterm>
138 <indexterm role="concept">
139   <primary>top bit</primary>
140   <see><emphasis>8-bit characters</emphasis></see>
141 </indexterm>
142 <indexterm role="concept">
143   <primary>variables</primary>
144   <see><emphasis>expansion, variables</emphasis></see>
145 </indexterm>
146 <indexterm role="concept">
147   <primary>zero, binary</primary>
148   <see><emphasis>binary zero</emphasis></see>
149 </indexterm>
150
151 <para>
152 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
153 Unix-like operating systems. It was designed on the assumption that it would be
154 run on hosts that are permanently connected to the Internet. However, it can be
155 used on intermittently connected hosts with suitable configuration adjustments.
156 </para>
157 <para>
158 Configuration files currently exist for the following operating systems: AIX,
159 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
160 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
161 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
162 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
163 Some of these operating systems are no longer current and cannot easily be
164 tested, so the configuration files may no longer work in practice.
165 </para>
166 <para>
167 There are also configuration files for compiling Exim in the Cygwin environment
168 that can be installed on systems running Windows. However, this document does
169 not contain any information about running Exim in the Cygwin environment.
170 </para>
171 <para>
172 The terms and conditions for the use and distribution of Exim are contained in
173 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
174 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
175 </para>
176 <para>
177 The use, supply or promotion of Exim for the purpose of sending bulk,
178 unsolicited electronic mail is incompatible with the basic aims of the program,
179 which revolve around the free provision of a service that enhances the quality
180 of personal communications. The author of Exim regards indiscriminate
181 mass-mailing as an antisocial, irresponsible abuse of the Internet.
182 </para>
183 <para>
184 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
185 experience of running and working on the Smail 3 code, I could never have
186 contemplated starting to write a new MTA. Many of the ideas and user interfaces
187 were originally taken from Smail 3, though the actual code of Exim is entirely
188 new, and has developed far beyond the initial concept.
189 </para>
190 <para>
191 Many people, both in Cambridge and around the world, have contributed to the
192 development and the testing of Exim, and to porting it to various operating
193 systems. I am grateful to them all. The distribution now contains a file called
194 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
195 contributors.
196 </para>
197 <section id="SECID1">
198 <title>Exim documentation</title>
199 <para revisionflag="changed">
200 <indexterm role="concept">
201 <primary>documentation</primary>
202 </indexterm>
203 This edition of the Exim specification applies to version 4.67 of Exim.
204 Substantive changes from the 4.66 edition are marked in some
205 renditions of the document; this paragraph is so marked if the rendition is
206 capable of showing a change indicator.
207 </para>
208 <para>
209 This document is very much a reference manual; it is not a tutorial. The reader
210 is expected to have some familiarity with the SMTP mail transfer protocol and
211 with general Unix system administration. Although there are some discussions
212 and examples in places, the information is mostly organized in a way that makes
213 it easy to look up, rather than in a natural order for sequential reading.
214 Furthermore, the manual aims to cover every aspect of Exim in detail, including
215 a number of rarely-used, special-purpose features that are unlikely to be of
216 very wide interest.
217 </para>
218 <para>
219 <indexterm role="concept">
220 <primary>books about Exim</primary>
221 </indexterm>
222 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
223 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
224 SMTP Mail Server</emphasis>, published by UIT Cambridge
225 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
226 </para>
227 <para>
228 This book also contains a chapter that gives a general introduction to SMTP and
229 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
230 with the latest release of Exim. (Note that the earlier book about Exim,
231 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
232 </para>
233 <para>
234 <indexterm role="concept">
235 <primary>Debian</primary>
236 <secondary>information sources</secondary>
237 </indexterm>
238 If you are using a Debian distribution of Exim, you will find information about
239 Debian-specific features in the file
240 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
241 The command <command>man update-exim.conf</command> is another source of Debian-specific
242 information.
243 </para>
244 <para>
245 <indexterm role="concept">
246 <primary><filename>doc/NewStuff</filename></primary>
247 </indexterm>
248 <indexterm role="concept">
249 <primary><filename>doc/ChangeLog</filename></primary>
250 </indexterm>
251 <indexterm role="concept">
252 <primary>change log</primary>
253 </indexterm>
254 As the program develops, there may be features in newer versions that have not
255 yet made it into this document, which is updated only when the most significant
256 digit of the fractional part of the version number changes. Specifications of
257 new features that are not yet in this manual are placed in the file
258 <filename>doc/NewStuff</filename> in the Exim distribution.
259 </para>
260 <para>
261 Some features may be classified as <quote>experimental</quote>. These may change
262 incompatibly while they are developing, or even be withdrawn. For this reason,
263 they are not documented in this manual. Information about experimental features
264 can be found in the file <filename>doc/experimental.txt</filename>.
265 </para>
266 <para>
267 All changes to the program (whether new features, bug fixes, or other kinds of
268 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
269 </para>
270 <para>
271 <indexterm role="concept">
272 <primary><filename>doc/spec.txt</filename></primary>
273 </indexterm>
274 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
275 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
276 directory are:
277 </para>
278 <informaltable frame="none">
279 <tgroup cols="2" colsep="0" rowsep="0">
280 <colspec colwidth="100pt" align="left"/>
281 <colspec colwidth="254pt" align="left"/>
282 <tbody>
283 <row>
284 <entry><filename>OptionLists.txt</filename></entry>
285 <entry>list of all options in alphabetical order</entry>
286 </row>
287 <row>
288 <entry><filename>dbm.discuss.txt</filename></entry>
289 <entry>discussion about DBM libraries</entry>
290 </row>
291 <row>
292 <entry><filename>exim.8</filename></entry>
293 <entry>a man page of Exim&#x2019;s command line options</entry>
294 </row>
295 <row>
296 <entry><filename>experimental.txt</filename></entry>
297 <entry>documentation of experimental features</entry>
298 </row>
299 <row>
300 <entry><filename>filter.txt</filename></entry>
301 <entry>specification of the filter language</entry>
302 </row>
303 <row>
304 <entry><filename>pcrepattern.txt</filename></entry>
305 <entry>specification of PCRE regular expressions</entry>
306 </row>
307 <row>
308 <entry><filename>pcretest.txt</filename></entry>
309 <entry>specification of the PCRE testing program</entry>
310 </row>
311 <row>
312 <entry><filename>Exim3.upgrade</filename></entry>
313 <entry>upgrade notes from release 2 to release 3</entry>
314 </row>
315 <row>
316 <entry><filename>Exim4.upgrade</filename></entry>
317 <entry>upgrade notes from release 3 to release 4</entry>
318 </row>
319 </tbody>
320 </tgroup>
321 </informaltable>
322 <para>
323 The main specification and the specification of the filtering language are also
324 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
325 <xref linkend="SECTavail"/> below tells you how to get hold of these.
326 </para>
327 </section>
328 <section id="SECID2">
329 <title>FTP and web sites</title>
330 <para>
331 <indexterm role="concept">
332 <primary>web site</primary>
333 </indexterm>
334 <indexterm role="concept">
335 <primary>FTP site</primary>
336 </indexterm>
337 The primary site for Exim source distributions is currently the University of
338 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
339 distribution</emphasis> below. In addition, there is a web site and an FTP site at
340 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
341 <option>exim.org</option> site was previously hosted for a number of years by Energis
342 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
343 </para>
344 <para>
345 <indexterm role="concept">
346 <primary>wiki</primary>
347 </indexterm>
348 <indexterm role="concept">
349 <primary>FAQ</primary>
350 </indexterm>
351 </para>
352 <para revisionflag="changed">
353 As well as Exim distribution tar files, the Exim web site contains a number of
354 differently formatted versions of the documentation. A recent addition to the
355 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/">http://www.exim.org/eximwiki/</ulink></emphasis>),
356 which contains what used to be a separate FAQ, as well as various other
357 examples, tips, and know-how that have been contributed by Exim users.
358 </para>
359 <para revisionflag="changed">
360 <indexterm role="concept">
361 <primary>Bugzilla</primary>
362 </indexterm>
363 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://www.exim.org/bugzilla/">http://www.exim.org/bugzilla/</ulink></emphasis>. You can use
364 this to report bugs, and also to add items to the wish list. Please search
365 first to check that you are not duplicating a previous entry.
366 </para>
367 </section>
368 <section id="SECID3">
369 <title>Mailing lists</title>
370 <para>
371 <indexterm role="concept">
372 <primary>mailing lists</primary>
373 <secondary>for Exim users</secondary>
374 </indexterm>
375 </para>
376 <para revisionflag="changed">
377 The following Exim mailing lists exist:
378 </para>
379 <informaltable frame="none" revisionflag="changed">
380 <tgroup cols="2" colsep="0" rowsep="0">
381 <colspec colwidth="140pt" align="left"/>
382 <colspec colwidth="254pt" align="left"/>
383 <tbody>
384 <row>
385 <entry><emphasis>exim-users@exim.org</emphasis></entry>
386 <entry>General discussion list</entry>
387 </row>
388 <row>
389 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
390 <entry>Discussion of bugs, enhancements, etc.</entry>
391 </row>
392 <row>
393 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
394 <entry>Moderated, low volume announcements list</entry>
395 </row>
396 <row>
397 <entry><emphasis>exim-future@exim.org</emphasis></entry>
398 <entry>Discussion of long-term development</entry>
399 </row>
400 </tbody>
401 </tgroup>
402 </informaltable>
403 <para>
404 You can subscribe to these lists, change your existing subscriptions, and view
405 or search the archives via the mailing lists link on the Exim home page.
406 <indexterm role="concept">
407 <primary>Debian</primary>
408 <secondary>mailing list for</secondary>
409 </indexterm>
410 If you are using a Debian distribution of Exim, you may wish to subscribe to
411 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
412 via this web page:
413 </para>
414 <literallayout>
415 <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>
416 </literallayout>
417 <para>
418 Please ask Debian-specific questions on this list and not on the general Exim
419 lists.
420 </para>
421 </section>
422 <section id="SECID4">
423 <title>Exim training</title>
424 <para>
425 <indexterm role="concept">
426 <primary>training courses</primary>
427 </indexterm>
428 From time to time (approximately annually at the time of writing), training
429 courses are run by the author of Exim in Cambridge, UK. Details of any
430 forthcoming courses can be found on the web site
431 <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>.
432 </para>
433 </section>
434 <section id="SECID5">
435 <title>Bug reports</title>
436 <para>
437 <indexterm role="concept">
438 <primary>bug reports</primary>
439 </indexterm>
440 <indexterm role="concept">
441 <primary>reporting bugs</primary>
442 </indexterm>
443 Reports of obvious bugs should be emailed to <emphasis>bugs@exim.org</emphasis>. However, if you
444 are unsure whether some behaviour is a bug or not, the best thing to do is to
445 post a message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
446 </para>
447 </section>
448 <section id="SECTavail">
449 <title>Where to find the Exim distribution</title>
450 <para>
451 <indexterm role="concept">
452 <primary>FTP site</primary>
453 </indexterm>
454 <indexterm role="concept">
455 <primary>distribution</primary>
456 <secondary>ftp site</secondary>
457 </indexterm>
458 The master ftp site for the Exim distribution is
459 </para>
460 <literallayout>
461 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
462 </literallayout>
463 <para>
464 This is mirrored by
465 </para>
466 <literallayout>
467 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
468 </literallayout>
469 <para>
470 The file references that follow are relative to the <filename>exim</filename> directories at
471 these sites. There are now quite a number of independent mirror sites around
472 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
473 </para>
474 <para>
475 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
476 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
477 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
478 subdirectory, the current release can always be found in files called
479 </para>
480 <literallayout>
481 <filename>exim-n.nn.tar.gz</filename>
482 <filename>exim-n.nn.tar.bz2</filename>
483 </literallayout>
484 <para>
485 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
486 files contain identical data; the only difference is the type of compression.
487 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
488 </para>
489 <para>
490 <indexterm role="concept">
491 <primary>distribution</primary>
492 <secondary>signing details</secondary>
493 </indexterm>
494 <indexterm role="concept">
495 <primary>distribution</primary>
496 <secondary>public key</secondary>
497 </indexterm>
498 <indexterm role="concept">
499 <primary>public key for signed distribution</primary>
500 </indexterm>
501 The distributions are currently signed with Philip Hazel&#x2019;s GPG key. The
502 corresponding public key is available from a number of keyservers, and there is
503 also a copy in the file <filename>Public-Key</filename>. The signatures for the tar bundles are
504 in:
505 </para>
506 <literallayout>
507 <filename>exim-n.nn.tar.gz.sig</filename>
508 <filename>exim-n.nn.tar.bz2.sig</filename>
509 </literallayout>
510 <para>
511 For each released version, the log of changes is made separately available in a
512 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
513 find out what has changed without having to download the entire distribution.
514 </para>
515 <para>
516 <indexterm role="concept">
517 <primary>documentation</primary>
518 <secondary>available formats</secondary>
519 </indexterm>
520 The main distribution contains ASCII versions of this specification and other
521 documentation; other formats of the documents are available in separate files
522 inside the <filename>exim4</filename> directory of the FTP site:
523 </para>
524 <literallayout>
525 <filename>exim-html-n.nn.tar.gz</filename>
526 <filename>exim-pdf-n.nn.tar.gz</filename>
527 <filename>exim-postscript-n.nn.tar.gz</filename>
528 <filename>exim-texinfo-n.nn.tar.gz</filename>
529 </literallayout>
530 <para>
531 These tar files contain only the <filename>doc</filename> directory, not the complete
532 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
533 </para>
534 </section>
535 <section id="SECID6">
536 <title>Limitations</title>
537 <itemizedlist>
538 <listitem>
539 <para>
540 <indexterm role="concept">
541 <primary>limitations of Exim</primary>
542 </indexterm>
543 <indexterm role="concept">
544 <primary>bang paths</primary>
545 <secondary>not handled by Exim</secondary>
546 </indexterm>
547 Exim is designed for use as an Internet MTA, and therefore handles addresses in
548 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
549 simple two-component bang paths can be converted by a straightforward rewriting
550 configuration. This restriction does not prevent Exim from being interfaced to
551 UUCP as a transport mechanism, provided that domain addresses are used.
552 </para>
553 </listitem>
554 <listitem>
555 <para>
556 <indexterm role="concept">
557 <primary>domainless addresses</primary>
558 </indexterm>
559 <indexterm role="concept">
560 <primary>address</primary>
561 <secondary>without domain</secondary>
562 </indexterm>
563 Exim insists that every address it handles has a domain attached. For incoming
564 local messages, domainless addresses are automatically qualified with a
565 configured domain value. Configuration options specify from which remote
566 systems unqualified addresses are acceptable. These are then qualified on
567 arrival.
568 </para>
569 </listitem>
570 <listitem>
571 <para>
572 <indexterm role="concept">
573 <primary>transport</primary>
574 <secondary>external</secondary>
575 </indexterm>
576 <indexterm role="concept">
577 <primary>external transports</primary>
578 </indexterm>
579 The only external transport mechanisms that are currently implemented are SMTP
580 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
581 transport is available, and there are facilities for writing messages to files
582 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
583 to send messages to other transport mechanisms such as UUCP, provided they can
584 handle domain-style addresses. Batched SMTP input is also catered for.
585 </para>
586 </listitem>
587 <listitem>
588 <para>
589 Exim is not designed for storing mail for dial-in hosts. When the volumes of
590 such mail are large, it is better to get the messages <quote>delivered</quote> into files
591 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
592 other means.
593 </para>
594 </listitem>
595 <listitem>
596 <para>
597 Although Exim does have basic facilities for scanning incoming messages, these
598 are not comprehensive enough to do full virus or spam scanning. Such operations
599 are best carried out using additional specialized software packages. If you
600 compile Exim with the content-scanning extension, straightforward interfaces to
601 a number of common scanners are provided.
602 </para>
603 </listitem>
604 </itemizedlist>
605 </section>
606 <section id="SECID7">
607 <title>Run time configuration</title>
608 <para>
609 Exim&#x2019;s run time configuration is held in a single text file that is divided
610 into a number of sections. The entries in this file consist of keywords and
611 values, in the style of Smail 3 configuration files. A default configuration
612 file which is suitable for simple online installations is provided in the
613 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
614 </para>
615 </section>
616 <section id="SECID8">
617 <title>Calling interface</title>
618 <para>
619 <indexterm role="concept">
620 <primary>Sendmail compatibility</primary>
621 <secondary>command line interface</secondary>
622 </indexterm>
623 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
624 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
625 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
626 about Sendmail in order to run Exim. For actions other than sending messages,
627 Sendmail-compatible options also exist, but those that produce output (for
628 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
629 format. There are also some additional options that are compatible with Smail
630 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
631 documents all Exim&#x2019;s command line options. This information is automatically
632 made into the man page that forms part of the Exim distribution.
633 </para>
634 <para>
635 Control of messages on the queue can be done via certain privileged command
636 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
637 which displays current information in an X window, and which contains a menu
638 interface to Exim&#x2019;s command line administration options.
639 </para>
640 </section>
641 <section id="SECID9">
642 <title>Terminology</title>
643 <para>
644 <indexterm role="concept">
645 <primary>terminology definitions</primary>
646 </indexterm>
647 <indexterm role="concept">
648 <primary>body of message</primary>
649 <secondary>definition of</secondary>
650 </indexterm>
651 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
652 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
653 below) by a blank line.
654 </para>
655 <para>
656 <indexterm role="concept">
657 <primary>bounce message</primary>
658 <secondary>definition of</secondary>
659 </indexterm>
660 When a message cannot be delivered, it is normally returned to the sender in a
661 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
662 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
663 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
664 failure error report</quote>. Such messages have an empty sender address in the
665 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
666 rise to further bounce messages.
667 </para>
668 <para>
669 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
670 value which is used in the absence of any setting in the configuration. It may
671 also qualify an action which is taken unless a configuration setting specifies
672 otherwise.
673 </para>
674 <para>
675 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
676 destination cannot immediately take place for some reason (a remote host may be
677 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
678 until a later time.
679 </para>
680 <para>
681 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
682 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
683 the part of an email address following the @ sign.
684 </para>
685 <para>
686 <indexterm role="concept">
687 <primary>envelope, definition of</primary>
688 </indexterm>
689 <indexterm role="concept">
690 <primary>sender</primary>
691 <secondary>definition of</secondary>
692 </indexterm>
693 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
694 body. The envelope contains a sender address (to which bounce messages should
695 be delivered), and any number of recipient addresses. References to the
696 sender or the recipients of a message usually mean the addresses in the
697 envelope. An MTA uses these addresses for delivery, and for returning bounce
698 messages, not the addresses that appear in the header lines.
699 </para>
700 <para>
701 <indexterm role="concept">
702 <primary>message</primary>
703 <secondary>header, definition of</secondary>
704 </indexterm>
705 <indexterm role="concept">
706 <primary>header section</primary>
707 <secondary>definition of</secondary>
708 </indexterm>
709 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
710 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
711 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
712 indenting the continuations. The header is separated from the body by a blank
713 line.
714 </para>
715 <para>
716 <indexterm role="concept">
717 <primary>local part</primary>
718 <secondary>definition of</secondary>
719 </indexterm>
720 <indexterm role="concept">
721 <primary>domain</primary>
722 <secondary>definition of</secondary>
723 </indexterm>
724 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
725 part of an email address that precedes the @ sign. The part that follows the
726 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
727 </para>
728 <para>
729 <indexterm role="concept">
730 <primary>local delivery</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 <indexterm role="concept">
734 <primary>remote delivery, definition of</primary>
735 </indexterm>
736 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
737 delivery to a file or a pipe on the local host from delivery by SMTP over
738 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
739 host it is running on are <emphasis>remote</emphasis>.
740 </para>
741 <para>
742 <indexterm role="concept">
743 <primary>return path</primary>
744 <secondary>definition of</secondary>
745 </indexterm>
746 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
747 message&#x2019;s envelope.
748 </para>
749 <para>
750 <indexterm role="concept">
751 <primary>queue</primary>
752 <secondary>definition of</secondary>
753 </indexterm>
754 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
755 because this term is in widespread use in the context of MTAs. However, in
756 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
757 normally no ordering of waiting messages.
758 </para>
759 <para>
760 <indexterm role="concept">
761 <primary>queue runner</primary>
762 <secondary>definition of</secondary>
763 </indexterm>
764 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
765 and attempts to deliver those messages whose retry times have come. This term
766 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
767 the waiting messages are normally processed in an unpredictable order.
768 </para>
769 <para>
770 <indexterm role="concept">
771 <primary>spool directory</primary>
772 <secondary>definition of</secondary>
773 </indexterm>
774 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
775 messages on its queue &ndash; that is, those that it is in the process of
776 delivering. This should not be confused with the directory in which local
777 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
778 the Exim documentation, <quote>spool</quote> is always used in the first sense.
779 </para>
780 </section>
781 </chapter>
782
783 <chapter id="CHID2">
784 <title>Incorporated code</title>
785 <para>
786 <indexterm role="concept">
787 <primary>incorporated code</primary>
788 </indexterm>
789 <indexterm role="concept">
790 <primary>regular expressions</primary>
791 <secondary>library</secondary>
792 </indexterm>
793 <indexterm role="concept">
794 <primary>PCRE</primary>
795 </indexterm>
796 A number of pieces of external code are included in the Exim distribution.
797 </para>
798 <itemizedlist>
799 <listitem>
800 <para>
801 Regular expressions are supported in the main Exim program and in the Exim
802 monitor using the freely-distributable PCRE library, copyright &copy;
803 University of Cambridge. The source is distributed in the directory
804 <filename>src/pcre</filename>. However, this is a cut-down version of PCRE. If you want to use
805 the PCRE library in other programs, you should obtain and install the full
806 version of the library from
807 <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>.
808 </para>
809 </listitem>
810 <listitem>
811 <para>
812 <indexterm role="concept">
813 <primary>cdb</primary>
814 <secondary>acknowledgment</secondary>
815 </indexterm>
816 Support for the cdb (Constant DataBase) lookup method is provided by code
817 contributed by Nigel Metheringham of (at the time he contributed it) Planet
818 Online Ltd. The implementation is completely contained within the code of Exim.
819 It does not link against an external cdb library. The code contains the
820 following statements:
821 </para>
822 <blockquote>
823 <para>
824 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
825 </para>
826 <para>
827 This program is free software; you can redistribute it and/or modify it under
828 the terms of the GNU General Public License as published by the Free Software
829 Foundation; either version 2 of the License, or (at your option) any later
830 version.
831 </para>
832 <para>
833 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
834 the spec and sample code for cdb can be obtained from
835 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
836 some code from Dan Bernstein&#x2019;s implementation (which has no license
837 restrictions applied to it).
838 </para>
839 </blockquote>
840 </listitem>
841 <listitem>
842 <para>
843 <indexterm role="concept">
844 <primary>SPA authentication</primary>
845 </indexterm>
846 <indexterm role="concept">
847 <primary>Samba project</primary>
848 </indexterm>
849 <indexterm role="concept">
850 <primary>Microsoft Secure Password Authentication</primary>
851 </indexterm>
852 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
853 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
854 Tom Kistner. This includes code taken from the Samba project, which is released
855 under the Gnu GPL.
856 </para>
857 </listitem>
858 <listitem>
859 <para>
860 <indexterm role="concept">
861 <primary>Cyrus</primary>
862 </indexterm>
863 <indexterm role="concept">
864 <primary><emphasis>pwcheck</emphasis> daemon</primary>
865 </indexterm>
866 <indexterm role="concept">
867 <primary><emphasis>pwauthd</emphasis> daemon</primary>
868 </indexterm>
869 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
870 by code taken from the Cyrus-SASL library and adapted by Alexander S.
871 Sabourenkov. The permission notice appears below, in accordance with the
872 conditions expressed therein.
873 </para>
874 <blockquote>
875 <para>
876 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
877 </para>
878 <para>
879 Redistribution and use in source and binary forms, with or without
880 modification, are permitted provided that the following conditions
881 are met:
882 </para>
883 <orderedlist numeration="arabic">
884 <listitem>
885 <para>
886 Redistributions of source code must retain the above copyright
887 notice, this list of conditions and the following disclaimer.
888 </para>
889 </listitem>
890 <listitem>
891 <para>
892 Redistributions in binary form must reproduce the above copyright
893 notice, this list of conditions and the following disclaimer in
894 the documentation and/or other materials provided with the
895 distribution.
896 </para>
897 </listitem>
898 <listitem>
899 <para>
900 The name <quote>Carnegie Mellon University</quote> must not be used to
901 endorse or promote products derived from this software without
902 prior written permission. For permission or any other legal
903 details, please contact
904 </para>
905 <literallayout>
906               Office of Technology Transfer
907               Carnegie Mellon University
908               5000 Forbes Avenue
909               Pittsburgh, PA  15213-3890
910               (412) 268-4387, fax: (412) 268-7395
911               tech-transfer@andrew.cmu.edu
912 </literallayout>
913 </listitem>
914 <listitem>
915 <para>
916 Redistributions of any form whatsoever must retain the following
917 acknowledgment:
918 </para>
919 <para>
920 <quote>This product includes software developed by Computing Services
921 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
922 </para>
923 <para>
924 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
925 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
926 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
927 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
928 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
929 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
930 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
931 </para>
932 </listitem>
933 </orderedlist>
934 </blockquote>
935 </listitem>
936 <listitem>
937 <para>
938 <indexterm role="concept">
939 <primary>Exim monitor</primary>
940 <secondary>acknowledgment</secondary>
941 </indexterm>
942 <indexterm role="concept">
943 <primary>X-windows</primary>
944 </indexterm>
945 <indexterm role="concept">
946 <primary>Athena</primary>
947 </indexterm>
948 The Exim Monitor program, which is an X-Window application, includes
949 modified versions of the Athena StripChart and TextPop widgets.
950 This code is copyright by DEC and MIT, and their permission notice appears
951 below, in accordance with the conditions expressed therein.
952 </para>
953 <blockquote>
954 <para>
955 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
956 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
957 </para>
958 <para>
959 All Rights Reserved
960 </para>
961 <para>
962 Permission to use, copy, modify, and distribute this software and its
963 documentation for any purpose and without fee is hereby granted,
964 provided that the above copyright notice appear in all copies and that
965 both that copyright notice and this permission notice appear in
966 supporting documentation, and that the names of Digital or MIT not be
967 used in advertising or publicity pertaining to distribution of the
968 software without specific, written prior permission.
969 </para>
970 <para>
971 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
972 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
973 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
974 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
975 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
976 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
977 SOFTWARE.
978 </para>
979 </blockquote>
980 </listitem>
981 <listitem>
982 <para>
983 Many people have contributed code fragments, some large, some small, that were
984 not covered by any specific licence requirements. It is assumed that the
985 contributors are happy to see their code incorporated into Exim under the GPL.
986 </para>
987 </listitem>
988 </itemizedlist>
989 </chapter>
990
991 <chapter id="CHID11">
992 <title>How Exim receives and delivers mail</title>
993 <titleabbrev>Receiving and delivering mail</titleabbrev>
994 <section id="SECID10">
995 <title>Overall philosophy</title>
996 <para>
997 <indexterm role="concept">
998 <primary>design philosophy</primary>
999 </indexterm>
1000 Exim is designed to work efficiently on systems that are permanently connected
1001 to the Internet and are handling a general mix of mail. In such circumstances,
1002 most messages can be delivered immediately. Consequently, Exim does not
1003 maintain independent queues of messages for specific domains or hosts, though
1004 it does try to send several messages in a single SMTP connection after a host
1005 has been down, and it also maintains per-host retry information.
1006 </para>
1007 </section>
1008 <section id="SECID11">
1009 <title>Policy control</title>
1010 <para>
1011 <indexterm role="concept">
1012 <primary>policy control</primary>
1013 <secondary>overview</secondary>
1014 </indexterm>
1015 Policy controls are now an important feature of MTAs that are connected to the
1016 Internet. Perhaps their most important job is to stop MTAs being abused as
1017 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1018 unsolicited junk, and want to disguise its source. Exim provides flexible
1019 facilities for specifying policy controls on incoming mail:
1020 </para>
1021 <itemizedlist>
1022 <listitem>
1023 <para>
1024 <indexterm role="concept">
1025 <primary>access control lists (ACLs)</primary>
1026 <secondary>introduction</secondary>
1027 </indexterm>
1028 Exim 4 (unlike previous versions of Exim) implements policy controls on
1029 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1030 series of statements that may either grant or deny access. ACLs can be used at
1031 several places in the SMTP dialogue while receiving a message from a remote
1032 host. However, the most common places are after each RCPT command, and at the
1033 very end of the message. The sysadmin can specify conditions for accepting or
1034 rejecting individual recipients or the entire message, respectively, at these
1035 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1036 error code.
1037 </para>
1038 </listitem>
1039 <listitem>
1040 <para>
1041 An ACL is also available for locally generated, non-SMTP messages. In this
1042 case, the only available actions are to accept or deny the entire message.
1043 </para>
1044 </listitem>
1045 <listitem>
1046 <para>
1047 When Exim is compiled with the content-scanning extension, facilities are
1048 provided in the ACL mechanism for passing the message to external virus and/or
1049 spam scanning software. The result of such a scan is passed back to the ACL,
1050 which can then use it to decide what to do with the message.
1051 </para>
1052 </listitem>
1053 <listitem>
1054 <para>
1055 When a message has been received, either from a remote host or from the local
1056 host, but before the final acknowledgment has been sent, a locally supplied C
1057 function called <function>local_scan()</function> can be run to inspect the message and decide
1058 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1059 is accepted, the list of recipients can be modified by the function.
1060 </para>
1061 </listitem>
1062 <listitem>
1063 <para>
1064 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1065 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1066 Exim to be compiled with the content-scanning extension.
1067 </para>
1068 </listitem>
1069 <listitem>
1070 <para>
1071 After a message has been accepted, a further checking mechanism is available in
1072 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1073 runs at the start of every delivery process.
1074 </para>
1075 </listitem>
1076 </itemizedlist>
1077 </section>
1078 <section id="SECID12">
1079 <title>User filters</title>
1080 <para>
1081 <indexterm role="concept">
1082 <primary>filter</primary>
1083 <secondary>introduction</secondary>
1084 </indexterm>
1085 <indexterm role="concept">
1086 <primary>Sieve filter</primary>
1087 </indexterm>
1088 In a conventional Exim configuration, users are able to run private filters by
1089 setting up appropriate <filename>.forward</filename> files in their home directories. See
1090 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1091 configuration needed to support this, and the separate document entitled
1092 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1093 of filtering are available:
1094 </para>
1095 <itemizedlist>
1096 <listitem>
1097 <para>
1098 Sieve filters are written in the standard filtering language that is defined
1099 by RFC 3028.
1100 </para>
1101 </listitem>
1102 <listitem>
1103 <para>
1104 Exim filters are written in a syntax that is unique to Exim, but which is more
1105 powerful than Sieve, which it pre-dates.
1106 </para>
1107 </listitem>
1108 </itemizedlist>
1109 <para>
1110 User filters are run as part of the routing process, described below.
1111 </para>
1112 </section>
1113 <section id="SECTmessiden">
1114 <title>Message identification</title>
1115 <para>
1116 <indexterm role="concept">
1117 <primary>message ids</primary>
1118 <secondary>details of format</secondary>
1119 </indexterm>
1120 <indexterm role="concept">
1121 <primary>format</primary>
1122 <secondary>of message id</secondary>
1123 </indexterm>
1124 <indexterm role="concept">
1125 <primary>id of message</primary>
1126 </indexterm>
1127 <indexterm role="concept">
1128 <primary>base62</primary>
1129 </indexterm>
1130 <indexterm role="concept">
1131 <primary>base36</primary>
1132 </indexterm>
1133 <indexterm role="concept">
1134 <primary>Darwin</primary>
1135 </indexterm>
1136 <indexterm role="concept">
1137 <primary>Cygwin</primary>
1138 </indexterm>
1139 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1140 characters long. It is divided into three parts, separated by hyphens, for
1141 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1142 normally encoding numbers in base 62. However, in the Darwin operating
1143 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1144 (avoiding the use of lower case letters) is used instead, because the message
1145 id is used to construct file names, and the names of files in those systems are
1146 not always case-sensitive.
1147 </para>
1148 <para>
1149 <indexterm role="concept">
1150 <primary>pid (process id)</primary>
1151 <secondary>re-use of</secondary>
1152 </indexterm>
1153 The detail of the contents of the message id have changed as Exim has evolved.
1154 Earlier versions relied on the operating system not re-using a process id (pid)
1155 within one second. On modern operating systems, this assumption can no longer
1156 be made, so the algorithm had to be changed. To retain backward compatibility,
1157 the format of the message id was retained, which is why the following rules are
1158 somewhat eccentric:
1159 </para>
1160 <itemizedlist>
1161 <listitem>
1162 <para>
1163 The first six characters of the message id are the time at which the message
1164 started to be received, to a granularity of one second. That is, this field
1165 contains the number of seconds since the start of the epoch (the normal Unix
1166 way of representing the date and time of day).
1167 </para>
1168 </listitem>
1169 <listitem>
1170 <para>
1171 After the first hyphen, the next six characters are the id of the process that
1172 received the message.
1173 </para>
1174 </listitem>
1175 <listitem>
1176 <para>
1177 There are two different possibilities for the final two characters:
1178 </para>
1179 <orderedlist numeration="arabic">
1180 <listitem>
1181 <para>
1182 <indexterm role="option">
1183 <primary><option>localhost_number</option></primary>
1184 </indexterm>
1185 If <option>localhost_number</option> is not set, this value is the fractional part of the
1186 time of reception, normally in units of 1/2000 of a second, but for systems
1187 that must use base 36 instead of base 62 (because of case-insensitive file
1188 systems), the units are 1/1000 of a second.
1189 </para>
1190 </listitem>
1191 <listitem>
1192 <para>
1193 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1194 the fractional part of the time, which in this case is in units of 1/200
1195 (1/100) of a second.
1196 </para>
1197 </listitem>
1198 </orderedlist>
1199 </listitem>
1200 </itemizedlist>
1201 <para>
1202 After a message has been received, Exim waits for the clock to tick at the
1203 appropriate resolution before proceeding, so that if another message is
1204 received by the same process, or by another process with the same (re-used)
1205 pid, it is guaranteed that the time will be different. In most cases, the clock
1206 will already have ticked while the message was being received.
1207 </para>
1208 </section>
1209 <section id="SECID13">
1210 <title>Receiving mail</title>
1211 <para>
1212 <indexterm role="concept">
1213 <primary>receiving mail</primary>
1214 </indexterm>
1215 <indexterm role="concept">
1216 <primary>message</primary>
1217 <secondary>reception</secondary>
1218 </indexterm>
1219 The only way Exim can receive mail from another host is using SMTP over
1220 TCP/IP, in which case the sender and recipient addresses are transferred using
1221 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1222 there are several possibilities:
1223 </para>
1224 <itemizedlist>
1225 <listitem>
1226 <para>
1227 If the process runs Exim with the <option>-bm</option> option, the message is read
1228 non-interactively (usually via a pipe), with the recipients taken from the
1229 command line, or from the body of the message if <option>-t</option> is also used.
1230 </para>
1231 </listitem>
1232 <listitem>
1233 <para>
1234 If the process runs Exim with the <option>-bS</option> option, the message is also read
1235 non-interactively, but in this case the recipients are listed at the start of
1236 the message in a series of SMTP RCPT commands, terminated by a DATA
1237 command. This is so-called <quote>batch SMTP</quote> format,
1238 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1239 envelope addresses in a non-interactive submission.
1240 </para>
1241 </listitem>
1242 <listitem>
1243 <para>
1244 If the process runs Exim with the <option>-bs</option> option, the message is read
1245 interactively, using the SMTP protocol. A two-way pipe is normally used for
1246 passing data between the local process and the Exim process.
1247 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1248 example, the ACLs for SMTP commands are used for this form of submission.
1249 </para>
1250 </listitem>
1251 <listitem>
1252 <para>
1253 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1254 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1255 does not treat the loopback address specially. It treats all such connections
1256 in the same way as connections from other hosts.
1257 </para>
1258 </listitem>
1259 </itemizedlist>
1260 <para>
1261 <indexterm role="concept">
1262 <primary>message sender, constructed by Exim</primary>
1263 </indexterm>
1264 <indexterm role="concept">
1265 <primary>sender</primary>
1266 <secondary>constructed by Exim</secondary>
1267 </indexterm>
1268 In the three cases that do not involve TCP/IP, the sender address is
1269 constructed from the login name of the user that called Exim and a default
1270 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1271 option). For local or batch SMTP, a sender address that is passed using the
1272 SMTP MAIL command is ignored. However, the system administrator may allow
1273 certain users (<quote>trusted users</quote>) to specify a different sender address
1274 unconditionally, or all users to specify certain forms of different sender
1275 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1276 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1277 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1278 users to change sender addresses.
1279 </para>
1280 <para>
1281 Messages received by either of the non-interactive mechanisms are subject to
1282 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1283 (either over TCP/IP, or interacting with a local process) can be checked by a
1284 number of ACLs that operate at different times during the SMTP session. Either
1285 individual recipients, or the entire message, can be rejected if local policy
1286 requirements are not met. The <function>local_scan()</function> function (see chapter
1287 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1288 </para>
1289 <para>
1290 Exim can be configured not to start a delivery process when a message is
1291 received; this can be unconditional, or depend on the number of incoming SMTP
1292 connections or the system load. In these situations, new messages wait on the
1293 queue until a queue runner process picks them up. However, in standard
1294 configurations under normal conditions, delivery is started as soon as a
1295 message is received.
1296 </para>
1297 </section>
1298 <section id="SECID14">
1299 <title>Handling an incoming message</title>
1300 <para>
1301 <indexterm role="concept">
1302 <primary>spool directory</primary>
1303 <secondary>files that hold a message</secondary>
1304 </indexterm>
1305 <indexterm role="concept">
1306 <primary>file</primary>
1307 <secondary>how a message is held</secondary>
1308 </indexterm>
1309 When Exim accepts a message, it writes two files in its spool directory. The
1310 first contains the envelope information, the current status of the message, and
1311 the header lines, and the second contains the body of the message. The names of
1312 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1313 file containing the envelope and header, and <literal>-D</literal> for the data file.
1314 </para>
1315 <para>
1316 <indexterm role="concept">
1317 <primary>spool directory</primary>
1318 <secondary><filename>input</filename> sub-directory</secondary>
1319 </indexterm>
1320 By default all these message files are held in a single directory called
1321 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1322 not perform very well if the number of files in a directory gets large; to
1323 improve performance in such cases, the <option>split_spool_directory</option> option can be
1324 used. This causes Exim to split up the input files into 62 sub-directories
1325 whose names are single letters or digits. When this is done, the queue is
1326 processed one sub-directory at a time instead of all at once, which can improve
1327 overall performance even when there are not enough files in each directory to
1328 affect file system performance.
1329 </para>
1330 <para>
1331 The envelope information consists of the address of the message&#x2019;s sender and
1332 the addresses of the recipients. This information is entirely separate from
1333 any addresses contained in the header lines. The status of the message includes
1334 a list of recipients who have already received the message. The format of the
1335 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1336 </para>
1337 <para>
1338 <indexterm role="concept">
1339 <primary>rewriting</primary>
1340 <secondary>addresses</secondary>
1341 </indexterm>
1342 Address rewriting that is specified in the rewrite section of the configuration
1343 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1344 both in the header lines and the envelope, at the time the message is accepted.
1345 If during the course of delivery additional addresses are generated (for
1346 example, via aliasing), these new addresses are rewritten as soon as they are
1347 generated. At the time a message is actually delivered (transported) further
1348 rewriting can take place; because this is a transport option, it can be
1349 different for different forms of delivery. It is also possible to specify the
1350 addition or removal of certain header lines at the time the message is
1351 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1352 <xref linkend="CHAPtransportgeneric"/>).
1353 </para>
1354 </section>
1355 <section id="SECID15">
1356 <title>Life of a message</title>
1357 <para>
1358 <indexterm role="concept">
1359 <primary>message</primary>
1360 <secondary>life of</secondary>
1361 </indexterm>
1362 <indexterm role="concept">
1363 <primary>message</primary>
1364 <secondary>frozen</secondary>
1365 </indexterm>
1366 A message remains in the spool directory until it is completely delivered to
1367 its recipients or to an error address, or until it is deleted by an
1368 administrator or by the user who originally created it. In cases when delivery
1369 cannot proceed &ndash; for example, when a message can neither be delivered to its
1370 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1371 spool, and no more deliveries are attempted.
1372 </para>
1373 <para>
1374 <indexterm role="concept">
1375 <primary>frozen messages</primary>
1376 <secondary>thawing</secondary>
1377 </indexterm>
1378 <indexterm role="concept">
1379 <primary>message</primary>
1380 <secondary>thawing frozen</secondary>
1381 </indexterm>
1382 An administrator can <quote>thaw</quote> such messages when the problem has been
1383 corrected, and can also freeze individual messages by hand if necessary. In
1384 addition, an administrator can force a delivery error, causing a bounce message
1385 to be sent.
1386 </para>
1387 <para>
1388 <indexterm role="option">
1389 <primary><option>timeout_frozen_after</option></primary>
1390 </indexterm>
1391 <indexterm role="option">
1392 <primary><option>ignore_bounce_errors_after</option></primary>
1393 </indexterm>
1394 There are options called <option>ignore_bounce_errors_after</option> and
1395 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1396 The first applies only to frozen bounces, the second to any frozen messages.
1397 </para>
1398 <para>
1399 <indexterm role="concept">
1400 <primary>message</primary>
1401 <secondary>log file for</secondary>
1402 </indexterm>
1403 <indexterm role="concept">
1404 <primary>log</primary>
1405 <secondary>file for each message</secondary>
1406 </indexterm>
1407 While Exim is working on a message, it writes information about each delivery
1408 attempt to its main log file. This includes successful, unsuccessful, and
1409 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1410 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1411 These logs are solely for the benefit of the administrator, and are normally
1412 deleted along with the spool files when processing of a message is complete.
1413 The use of individual message logs can be disabled by setting
1414 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1415 systems.
1416 </para>
1417 <para>
1418 <indexterm role="concept">
1419 <primary>journal file</primary>
1420 </indexterm>
1421 <indexterm role="concept">
1422 <primary>file</primary>
1423 <secondary>journal</secondary>
1424 </indexterm>
1425 All the information Exim itself needs to set up a delivery is kept in the first
1426 spool file, along with the header lines. When a successful delivery occurs, the
1427 address is immediately written at the end of a journal file, whose name is the
1428 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1429 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1430 is updated to indicate which these are, and the journal file is then deleted.
1431 Updating the spool file is done by writing a new file and renaming it, to
1432 minimize the possibility of data loss.
1433 </para>
1434 <para>
1435 Should the system or the program crash after a successful delivery but before
1436 the spool file has been updated, the journal is left lying around. The next
1437 time Exim attempts to deliver the message, it reads the journal file and
1438 updates the spool file before proceeding. This minimizes the chances of double
1439 deliveries caused by crashes.
1440 </para>
1441 </section>
1442 <section id="SECTprocaddress">
1443 <title>Processing an address for delivery</title>
1444 <para>
1445 <indexterm role="concept">
1446 <primary>drivers</primary>
1447 <secondary>definition of</secondary>
1448 </indexterm>
1449 <indexterm role="concept">
1450 <primary>router</primary>
1451 <secondary>definition of</secondary>
1452 </indexterm>
1453 <indexterm role="concept">
1454 <primary>transport</primary>
1455 <secondary>definition of</secondary>
1456 </indexterm>
1457 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1458 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1459 number of them is provided in the source distribution, and compile-time options
1460 specify which ones are included in the binary. Run time options specify which
1461 ones are actually used for delivering messages.
1462 </para>
1463 <para>
1464 <indexterm role="concept">
1465 <primary>drivers</primary>
1466 <secondary>instance definition</secondary>
1467 </indexterm>
1468 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1469 of that particular driver type. Multiple instances are allowed; for example,
1470 you can set up several different <command>smtp</command> transports, each with different
1471 option values that might specify different ports or different timeouts. Each
1472 instance has its own identifying name. In what follows we will normally use the
1473 instance name when discussing one particular instance (that is, one specific
1474 configuration of the driver), and the generic driver name when discussing
1475 the driver&#x2019;s features in general.
1476 </para>
1477 <para>
1478 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1479 its delivery should happen, by assigning it to a specific transport, or
1480 converting the address into one or more new addresses (for example, via an
1481 alias file). A router may also explicitly choose to fail an address, causing it
1482 to be bounced.
1483 </para>
1484 <para>
1485 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1486 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1487 transport, the destination is a file or a pipe on the local host, whereas for a
1488 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1489 to a specific transport as a result of successful routing. If a message has
1490 several recipients, it may be passed to a number of different transports.
1491 </para>
1492 <para>
1493 <indexterm role="concept">
1494 <primary>preconditions</primary>
1495 <secondary>definition of</secondary>
1496 </indexterm>
1497 An address is processed by passing it to each configured router instance in
1498 turn, subject to certain preconditions, until a router accepts the address or
1499 specifies that it should be bounced. We will describe this process in more
1500 detail shortly. First, as a simple example, we consider how each recipient
1501 address in a message is processed in a small configuration of three routers.
1502 </para>
1503 <para>
1504 To make this a more concrete example, it is described in terms of some actual
1505 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1506 routers in many different ways, and there may be any number of routers in a
1507 configuration.
1508 </para>
1509 <para>
1510 The first router that is specified in a configuration is often one that handles
1511 addresses in domains that are not recognized specially by the local host. These
1512 are typically addresses for arbitrary domains on the Internet. A precondition
1513 is set up which looks for the special domains known to the host (for example,
1514 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1515 match. Typically, this is a router that looks up domains in the DNS in order to
1516 find the hosts to which this address routes. If it succeeds, the address is
1517 assigned to a suitable SMTP transport; if it does not succeed, the router is
1518 configured to fail the address.
1519 </para>
1520 <para>
1521 The second router is reached only when the domain is recognized as one that
1522 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1523 aliasing and forwarding. When it generates one or more new addresses from the
1524 original, each of them is routed independently from the start. Otherwise, the
1525 router may cause an address to fail, or it may simply decline to handle the
1526 address, in which case the address is passed to the next router.
1527 </para>
1528 <para>
1529 The final router in many configurations is one that checks to see if the
1530 address belongs to a local mailbox. The precondition may involve a check to
1531 see if the local part is the name of a login account, or it may look up the
1532 local part in a file or a database. If its preconditions are not met, or if
1533 the router declines, we have reached the end of the routers. When this happens,
1534 the address is bounced.
1535 </para>
1536 </section>
1537 <section id="SECID16">
1538 <title>Processing an address for verification</title>
1539 <para>
1540 <indexterm role="concept">
1541 <primary>router</primary>
1542 <secondary>for verification</secondary>
1543 </indexterm>
1544 <indexterm role="concept">
1545 <primary>verifying address</primary>
1546 <secondary>overview</secondary>
1547 </indexterm>
1548 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1549 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1550 one of the checks to be performed in an ACL for incoming messages, on both
1551 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1552 <option>-bvs</option> command line options.
1553 </para>
1554 <para>
1555 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1556 does not affect the way the routers work, but it is a state that can be
1557 detected. By this means, a router can be skipped or made to behave differently
1558 when verifying. A common example is a configuration in which the first router
1559 sends all messages to a message-scanning program, unless they have been
1560 previously scanned. Thus, the first router accepts all addresses without any
1561 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1562 would be set for such a router, causing it to be skipped in verify mode.
1563 </para>
1564 </section>
1565 <section id="SECTrunindrou">
1566 <title>Running an individual router</title>
1567 <para>
1568 <indexterm role="concept">
1569 <primary>router</primary>
1570 <secondary>running details</secondary>
1571 </indexterm>
1572 <indexterm role="concept">
1573 <primary>preconditions</primary>
1574 <secondary>checking</secondary>
1575 </indexterm>
1576 <indexterm role="concept">
1577 <primary>router</primary>
1578 <secondary>result of running</secondary>
1579 </indexterm>
1580 As explained in the example above, a number of preconditions are checked before
1581 running a router. If any are not met, the router is skipped, and the address is
1582 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1583 the router is run. What happens next depends on the outcome, which is one of
1584 the following:
1585 </para>
1586 <itemizedlist>
1587 <listitem>
1588 <para>
1589 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1590 transport, or generates one or more <quote>child</quote> addresses. Processing the
1591 original address ceases,
1592 <indexterm role="option">
1593 <primary><option>unseen</option></primary>
1594 </indexterm>
1595 unless the <option>unseen</option> option is set on the router. This option
1596 can be used to set up multiple deliveries with different routing (for example,
1597 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1598 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1599 end of routing.
1600 </para>
1601 <para>
1602 Any child addresses generated by the router are processed independently,
1603 starting with the first router by default. It is possible to change this by
1604 setting the <option>redirect_router</option> option to specify which router to start at for
1605 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1606 <option>redirect_router</option> may be anywhere in the router configuration.
1607 </para>
1608 </listitem>
1609 <listitem>
1610 <para>
1611 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1612 requests that the address be passed to another router. By default the address
1613 is passed to the next router, but this can be changed by setting the
1614 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1615 must be below the current router (to avoid loops).
1616 </para>
1617 </listitem>
1618 <listitem>
1619 <para>
1620 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1621 recognize it at all. By default, the address is passed to the next router, but
1622 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1623 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1624 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1625 </para>
1626 </listitem>
1627 <listitem>
1628 <para>
1629 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1630 the generation of a bounce message. There is no further processing of the
1631 original address unless <option>unseen</option> is set on the router.
1632 </para>
1633 </listitem>
1634 <listitem>
1635 <para>
1636 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1637 database may be offline, or a DNS lookup may have timed out.) No further
1638 processing of the address happens in this delivery attempt. It is tried again
1639 next time the message is considered for delivery.
1640 </para>
1641 </listitem>
1642 <listitem>
1643 <para>
1644 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1645 its configuration). The action is as for defer.
1646 </para>
1647 </listitem>
1648 </itemizedlist>
1649 <para>
1650 If an address reaches the end of the routers without having been accepted by
1651 any of them, it is bounced as unrouteable. The default error message in this
1652 situation is <quote>unrouteable address</quote>, but you can set your own message by
1653 making use of the <option>cannot_route_message</option> option. This can be set for any
1654 router; the value from the last router that <quote>saw</quote> the address is used.
1655 </para>
1656 <para>
1657 Sometimes while routing you want to fail a delivery when some conditions are
1658 met but others are not, instead of passing the address on for further routing.
1659 You can do this by having a second router that explicitly fails the delivery
1660 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1661 facility for this purpose.
1662 </para>
1663 </section>
1664 <section id="SECID17">
1665 <title>Duplicate addresses</title>
1666 <para>
1667 <indexterm role="concept">
1668 <primary>case of local parts</primary>
1669 </indexterm>
1670 <indexterm role="concept">
1671 <primary>address duplicate, discarding</primary>
1672 </indexterm>
1673 <indexterm role="concept">
1674 <primary>duplicate addresses</primary>
1675 </indexterm>
1676 Once routing is complete, Exim scans the addresses that are assigned to local
1677 and remote transports, and discards any duplicates that it finds. During this
1678 check, local parts are treated as case-sensitive. This happens only when
1679 actually delivering a message; when testing routers with <option>-bt</option>, all the
1680 routed addresses are shown.
1681 </para>
1682 </section>
1683 <section id="SECTrouprecon">
1684 <title>Router preconditions</title>
1685 <para>
1686 <indexterm role="concept">
1687 <primary>router</primary>
1688 <secondary>preconditions, order of processing</secondary>
1689 </indexterm>
1690 <indexterm role="concept">
1691 <primary>preconditions</primary>
1692 <secondary>order of processing</secondary>
1693 </indexterm>
1694 The preconditions that are tested for each router are listed below, in the
1695 order in which they are tested. The individual configuration options are
1696 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1697 </para>
1698 <itemizedlist>
1699 <listitem>
1700 <para>
1701 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1702 the local parts handled by the router may or must have certain prefixes and/or
1703 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1704 skipped. These conditions are tested first. When an affix is present, it is
1705 removed from the local part before further processing, including the evaluation
1706 of any other conditions.
1707 </para>
1708 </listitem>
1709 <listitem>
1710 <para>
1711 Routers can be designated for use only when not verifying an address, that is,
1712 only when routing it for delivery (or testing its delivery routing). If the
1713 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1714 address.
1715 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1716 <option>verify_recipient</option>, which independently control the use of the router for
1717 sender and recipient verification. You can set these options directly if
1718 you want a router to be used for only one type of verification.
1719 </para>
1720 </listitem>
1721 <listitem>
1722 <para>
1723 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1724 run with the <option>-bt</option> option to test an address routing. This can be helpful
1725 when the first router sends all new messages to a scanner of some sort; it
1726 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1727 having to simulate the effect of the scanner.
1728 </para>
1729 </listitem>
1730 <listitem>
1731 <para>
1732 Routers can be designated for use only when verifying an address, as
1733 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1734 </para>
1735 </listitem>
1736 <listitem>
1737 <para>
1738 Individual routers can be explicitly skipped when running the routers to
1739 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1740 </para>
1741 </listitem>
1742 <listitem>
1743 <para>
1744 If the <option>domains</option> option is set, the domain of the address must be in the set
1745 of domains that it defines.
1746 </para>
1747 </listitem>
1748 <listitem>
1749 <para>
1750 <indexterm role="variable">
1751 <primary><varname>$local_part_prefix</varname></primary>
1752 </indexterm>
1753 <indexterm role="variable">
1754 <primary><varname>$local_part</varname></primary>
1755 </indexterm>
1756 <indexterm role="variable">
1757 <primary><varname>$local_part_suffix</varname></primary>
1758 </indexterm>
1759 If the <option>local_parts</option> option is set, the local part of the address must be in
1760 the set of local parts that it defines. If <option>local_part_prefix</option> or
1761 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1762 part before this check. If you want to do precondition tests on local parts
1763 that include affixes, you can do so by using a <option>condition</option> option (see below)
1764 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1765 <varname>$local_part_suffix</varname> as necessary.
1766 </para>
1767 </listitem>
1768 <listitem>
1769 <para>
1770 <indexterm role="variable">
1771 <primary><varname>$local_user_uid</varname></primary>
1772 </indexterm>
1773 <indexterm role="variable">
1774 <primary><varname>$local_user_gid</varname></primary>
1775 </indexterm>
1776 <indexterm role="variable">
1777 <primary><varname>$home</varname></primary>
1778 </indexterm>
1779 If the <option>check_local_user</option> option is set, the local part must be the name of
1780 an account on the local host. If this check succeeds, the uid and gid of the
1781 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1782 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1783 remaining preconditions.
1784 </para>
1785 </listitem>
1786 <listitem>
1787 <para>
1788 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1789 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1790 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1791 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1792 could lead to confusion.
1793 </para>
1794 </listitem>
1795 <listitem>
1796 <para>
1797 If the <option>senders</option> option is set, the envelope sender address must be in the
1798 set of addresses that it defines.
1799 </para>
1800 </listitem>
1801 <listitem>
1802 <para>
1803 If the <option>require_files</option> option is set, the existence or non-existence of
1804 specified files is tested.
1805 </para>
1806 </listitem>
1807 <listitem>
1808 <para>
1809 <indexterm role="concept">
1810 <primary>customizing</primary>
1811 <secondary>precondition</secondary>
1812 </indexterm>
1813 If the <option>condition</option> option is set, it is evaluated and tested. This option
1814 uses an expanded string to allow you to set up your own custom preconditions.
1815 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1816 </para>
1817 </listitem>
1818 </itemizedlist>
1819 <para>
1820 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1821 it to check for the existence of a file in which to lookup up a domain, local
1822 part, or sender. However, as these options are all expanded, you can use the
1823 <option>exists</option> expansion condition to make such tests within each condition. The
1824 <option>require_files</option> option is intended for checking files that the router may be
1825 going to use internally, or which are needed by a specific transport (for
1826 example, <filename>.procmailrc</filename>).
1827 </para>
1828 </section>
1829 <section id="SECID18">
1830 <title>Delivery in detail</title>
1831 <para>
1832 <indexterm role="concept">
1833 <primary>delivery</primary>
1834 <secondary>in detail</secondary>
1835 </indexterm>
1836 When a message is to be delivered, the sequence of events is as follows:
1837 </para>
1838 <itemizedlist>
1839 <listitem>
1840 <para>
1841 If a system-wide filter file is specified, the message is passed to it. The
1842 filter may add recipients to the message, replace the recipients, discard the
1843 message, cause a new message to be generated, or cause the message delivery to
1844 fail. The format of the system filter file is the same as for Exim user filter
1845 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1846 filtering</emphasis>.
1847 <indexterm role="concept">
1848 <primary>Sieve filter</primary>
1849 <secondary>not available for system filter</secondary>
1850 </indexterm>
1851 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1852 </para>
1853 <para>
1854 Some additional features are available in system filters &ndash; see chapter
1855 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1856 filter only once per delivery attempt, however many recipients it has. However,
1857 if there are several delivery attempts because one or more addresses could not
1858 be immediately delivered, the system filter is run each time. The filter
1859 condition <option>first_delivery</option> can be used to detect the first run of the system
1860 filter.
1861 </para>
1862 </listitem>
1863 <listitem>
1864 <para>
1865 Each recipient address is offered to each configured router in turn, subject to
1866 its preconditions, until one is able to handle it. If no router can handle the
1867 address, that is, if they all decline, the address is failed. Because routers
1868 can be targeted at particular domains, several locally handled domains can be
1869 processed entirely independently of each other.
1870 </para>
1871 </listitem>
1872 <listitem>
1873 <para>
1874 <indexterm role="concept">
1875 <primary>routing</primary>
1876 <secondary>loops in</secondary>
1877 </indexterm>
1878 <indexterm role="concept">
1879 <primary>loop</primary>
1880 <secondary>while routing</secondary>
1881 </indexterm>
1882 A router that accepts an address may assign it to a local or a remote
1883 transport. However, the transport is not run at this time. Instead, the address
1884 is placed on a list for the particular transport, which will be run later.
1885 Alternatively, the router may generate one or more new addresses (typically
1886 from alias, forward, or filter files). New addresses are fed back into this
1887 process from the top, but in order to avoid loops, a router ignores any address
1888 which has an identically-named ancestor that was processed by itself.
1889 </para>
1890 </listitem>
1891 <listitem>
1892 <para>
1893 When all the routing has been done, addresses that have been successfully
1894 handled are passed to their assigned transports. When local transports are
1895 doing real local deliveries, they handle only one address at a time, but if a
1896 local transport is being used as a pseudo-remote transport (for example, to
1897 collect batched SMTP messages for transmission by some other means) multiple
1898 addresses can be handled. Remote transports can always handle more than one
1899 address at a time, but can be configured not to do so, or to restrict multiple
1900 addresses to the same domain.
1901 </para>
1902 </listitem>
1903 <listitem>
1904 <para>
1905 Each local delivery to a file or a pipe runs in a separate process under a
1906 non-privileged uid, and these deliveries are run one at a time. Remote
1907 deliveries also run in separate processes, normally under a uid that is private
1908 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1909 run in parallel. The maximum number of simultaneous remote deliveries for any
1910 one message is set by the <option>remote_max_parallel</option> option.
1911 The order in which deliveries are done is not defined, except that all local
1912 deliveries happen before any remote deliveries.
1913 </para>
1914 </listitem>
1915 <listitem>
1916 <para>
1917 <indexterm role="concept">
1918 <primary>queue runner</primary>
1919 </indexterm>
1920 When it encounters a local delivery during a queue run, Exim checks its retry
1921 database to see if there has been a previous temporary delivery failure for the
1922 address before running the local transport. If there was a previous failure,
1923 Exim does not attempt a new delivery until the retry time for the address is
1924 reached. However, this happens only for delivery attempts that are part of a
1925 queue run. Local deliveries are always attempted when delivery immediately
1926 follows message reception, even if retry times are set for them. This makes for
1927 better behaviour if one particular message is causing problems (for example,
1928 causing quota overflow, or provoking an error in a filter file).
1929 </para>
1930 </listitem>
1931 <listitem>
1932 <para>
1933 <indexterm role="concept">
1934 <primary>delivery</primary>
1935 <secondary>retry in remote transports</secondary>
1936 </indexterm>
1937 Remote transports do their own retry handling, since an address may be
1938 deliverable to one of a number of hosts, each of which may have a different
1939 retry time. If there have been previous temporary failures and no host has
1940 reached its retry time, no delivery is attempted, whether in a queue run or
1941 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1942 </para>
1943 </listitem>
1944 <listitem>
1945 <para>
1946 If there were any permanent errors, a bounce message is returned to an
1947 appropriate address (the sender in the common case), with details of the error
1948 for each failing address. Exim can be configured to send copies of bounce
1949 messages to other addresses.
1950 </para>
1951 </listitem>
1952 <listitem>
1953 <para>
1954 <indexterm role="concept">
1955 <primary>delivery</primary>
1956 <secondary>deferral</secondary>
1957 </indexterm>
1958 If one or more addresses suffered a temporary failure, the message is left on
1959 the queue, to be tried again later. Delivery of these addresses is said to be
1960 <emphasis>deferred</emphasis>.
1961 </para>
1962 </listitem>
1963 <listitem>
1964 <para>
1965 When all the recipient addresses have either been delivered or bounced,
1966 handling of the message is complete. The spool files and message log are
1967 deleted, though the message log can optionally be preserved if required.
1968 </para>
1969 </listitem>
1970 </itemizedlist>
1971 </section>
1972 <section id="SECID19">
1973 <title>Retry mechanism</title>
1974 <para>
1975 <indexterm role="concept">
1976 <primary>delivery</primary>
1977 <secondary>retry mechanism</secondary>
1978 </indexterm>
1979 <indexterm role="concept">
1980 <primary>retry</primary>
1981 <secondary>description of mechanism</secondary>
1982 </indexterm>
1983 <indexterm role="concept">
1984 <primary>queue runner</primary>
1985 </indexterm>
1986 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
1987 attempt is the queue runner process. You must either run an Exim daemon that
1988 uses the <option>-q</option> option with a time interval to start queue runners at regular
1989 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
1990 not arrange for queue runners to be run, messages that fail temporarily at the
1991 first attempt will remain on your queue for ever. A queue runner process works
1992 its way through the queue, one message at a time, trying each delivery that has
1993 passed its retry time.
1994 You can run several queue runners at once.
1995 </para>
1996 <para>
1997 Exim uses a set of configured rules to determine when next to retry the failing
1998 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
1999 should give up trying to deliver to the address, at which point it generates a
2000 bounce message. If no retry rules are set for a particular host, address, and
2001 error combination, no retries are attempted, and temporary errors are treated
2002 as permanent.
2003 </para>
2004 </section>
2005 <section id="SECID20">
2006 <title>Temporary delivery failure</title>
2007 <para>
2008 <indexterm role="concept">
2009 <primary>delivery</primary>
2010 <secondary>temporary failure</secondary>
2011 </indexterm>
2012 There are many reasons why a message may not be immediately deliverable to a
2013 particular address. Failure to connect to a remote machine (because it, or the
2014 connection to it, is down) is one of the most common. Temporary failures may be
2015 detected during routing as well as during the transport stage of delivery.
2016 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2017 is on a file system where the user is over quota. Exim can be configured to
2018 impose its own quotas on local mailboxes; where system quotas are set they will
2019 also apply.
2020 </para>
2021 <para>
2022 If a host is unreachable for a period of time, a number of messages may be
2023 waiting for it by the time it recovers, and sending them in a single SMTP
2024 connection is clearly beneficial. Whenever a delivery to a remote host is
2025 deferred,
2026 </para>
2027 <para>
2028 <indexterm role="concept">
2029 <primary>hints database</primary>
2030 </indexterm>
2031 Exim makes a note in its hints database, and whenever a successful
2032 SMTP delivery has happened, it looks to see if any other messages are waiting
2033 for the same host. If any are found, they are sent over the same SMTP
2034 connection, subject to a configuration limit as to the maximum number in any
2035 one connection.
2036 </para>
2037 </section>
2038 <section id="SECID21">
2039 <title>Permanent delivery failure</title>
2040 <para>
2041 <indexterm role="concept">
2042 <primary>delivery</primary>
2043 <secondary>permanent failure</secondary>
2044 </indexterm>
2045 <indexterm role="concept">
2046 <primary>bounce message</primary>
2047 <secondary>when generated</secondary>
2048 </indexterm>
2049 When a message cannot be delivered to some or all of its intended recipients, a
2050 bounce message is generated. Temporary delivery failures turn into permanent
2051 errors when their timeout expires. All the addresses that fail in a given
2052 delivery attempt are listed in a single message. If the original message has
2053 many recipients, it is possible for some addresses to fail in one delivery
2054 attempt and others to fail subsequently, giving rise to more than one bounce
2055 message. The wording of bounce messages can be customized by the administrator.
2056 See chapter <xref linkend="CHAPemsgcust"/> for details.
2057 </para>
2058 <para>
2059 <indexterm role="concept">
2060 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2061 </indexterm>
2062 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2063 failed addresses, for the benefit of programs that try to analyse such messages
2064 automatically.
2065 </para>
2066 <para>
2067 <indexterm role="concept">
2068 <primary>bounce message</primary>
2069 <secondary>recipient of</secondary>
2070 </indexterm>
2071 A bounce message is normally sent to the sender of the original message, as
2072 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2073 address given in the MAIL command. However, when an address is expanded via a
2074 forward or alias file, an alternative address can be specified for delivery
2075 failures of the generated addresses. For a mailing list expansion (see section
2076 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2077 of the list.
2078 </para>
2079 </section>
2080 <section id="SECID22">
2081 <title>Failures to deliver bounce messages</title>
2082 <para>
2083 <indexterm role="concept">
2084 <primary>bounce message</primary>
2085 <secondary>failure to deliver</secondary>
2086 </indexterm>
2087 If a bounce message (either locally generated or received from a remote host)
2088 itself suffers a permanent delivery failure, the message is left on the queue,
2089 but it is frozen, awaiting the attention of an administrator. There are options
2090 that can be used to make Exim discard such failed messages, or to keep them
2091 for only a short time (see <option>timeout_frozen_after</option> and
2092 <option>ignore_bounce_errors_after</option>).
2093 </para>
2094 </section>
2095 </chapter>
2096
2097 <chapter id="CHID3">
2098 <title>Building and installing Exim</title>
2099 <para>
2100 <indexterm role="concept" id="IIDbuex" class="startofrange">
2101 <primary>building Exim</primary>
2102 </indexterm>
2103 </para>
2104 <section id="SECID23">
2105 <title>Unpacking</title>
2106 <para>
2107 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2108 creates a directory with the name of the current release (for example,
2109 <filename>exim-4.67</filename>) into which the following files are placed:
2110 </para>
2111 <informaltable frame="none">
2112 <tgroup cols="2" colsep="0" rowsep="0">
2113 <colspec colwidth="140pt" align="left"/>
2114 <colspec colwidth="254pt" align="left"/>
2115 <tbody>
2116 <row>
2117 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2118 <entry>contains some acknowledgments</entry>
2119 </row>
2120 <row>
2121 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2122 <entry>contains a reference to where changes are documented</entry>
2123 </row>
2124 <row>
2125 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2126 <entry>the GNU General Public Licence</entry>
2127 </row>
2128 <row>
2129 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2130 <entry>top-level make file</entry>
2131 </row>
2132 <row>
2133 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2134 <entry>conditions for the use of Exim</entry>
2135 </row>
2136 <row>
2137 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2138 <entry>list of files, directories and simple build instructions</entry>
2139 </row>
2140 </tbody>
2141 </tgroup>
2142 </informaltable>
2143 <para>
2144 Other files whose names begin with <filename>README</filename> may also be present. The
2145 following subdirectories are created:
2146 </para>
2147 <informaltable frame="none">
2148 <tgroup cols="2" colsep="0" rowsep="0">
2149 <colspec colwidth="140pt" align="left"/>
2150 <colspec colwidth="254pt" align="left"/>
2151 <tbody>
2152 <row>
2153 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2154 <entry>an empty directory for local configuration files</entry>
2155 </row>
2156 <row>
2157 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2158 <entry>OS-specific files</entry>
2159 </row>
2160 <row>
2161 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2162 <entry>documentation files</entry>
2163 </row>
2164 <row>
2165 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2166 <entry>source files for the Exim monitor</entry>
2167 </row>
2168 <row>
2169 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2170 <entry>scripts used in the build process</entry>
2171 </row>
2172 <row>
2173 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2174 <entry>remaining source files</entry>
2175 </row>
2176 <row>
2177 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2178 <entry>independent utilities</entry>
2179 </row>
2180 </tbody>
2181 </tgroup>
2182 </informaltable>
2183 <para>
2184 The main utility programs are contained in the <filename>src</filename> directory, and are built
2185 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2186 that may be useful to some sites.
2187 </para>
2188 </section>
2189 <section id="SECID24">
2190 <title>Multiple machine architectures and operating systems</title>
2191 <para>
2192 <indexterm role="concept">
2193 <primary>building Exim</primary>
2194 <secondary>multiple OS/architectures</secondary>
2195 </indexterm>
2196 The building process for Exim is arranged to make it easy to build binaries for
2197 a number of different architectures and operating systems from the same set of
2198 source files. Compilation does not take place in the <filename>src</filename> directory.
2199 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2200 system.
2201 <indexterm role="concept">
2202 <primary>symbolic link</primary>
2203 <secondary>to build directory</secondary>
2204 </indexterm>
2205 Symbolic links to the sources are installed in this directory, which is where
2206 the actual building takes place. In most cases, Exim can discover the machine
2207 architecture and operating system for itself, but the defaults can be
2208 overridden if necessary.
2209 </para>
2210 </section>
2211 <section id="SECTdb">
2212 <title>DBM libraries</title>
2213 <para>
2214 <indexterm role="concept">
2215 <primary>DBM libraries</primary>
2216 <secondary>discussion of</secondary>
2217 </indexterm>
2218 <indexterm role="concept">
2219 <primary>hints database</primary>
2220 <secondary>DBM files used for</secondary>
2221 </indexterm>
2222 Even if you do not use any DBM files in your configuration, Exim still needs a
2223 DBM library in order to operate, because it uses indexed files for its hints
2224 databases. Unfortunately, there are a number of DBM libraries in existence, and
2225 different operating systems often have different ones installed.
2226 </para>
2227 <para>
2228 <indexterm role="concept">
2229 <primary>Solaris</primary>
2230 <secondary>DBM library for</secondary>
2231 </indexterm>
2232 <indexterm role="concept">
2233 <primary>IRIX, DBM library for</primary>
2234 </indexterm>
2235 <indexterm role="concept">
2236 <primary>BSD, DBM library for</primary>
2237 </indexterm>
2238 <indexterm role="concept">
2239 <primary>Linux, DBM library for</primary>
2240 </indexterm>
2241 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2242 Linux distribution, the DBM configuration should happen automatically, and you
2243 may be able to ignore this section. Otherwise, you may have to learn more than
2244 you would like about DBM libraries from what follows.
2245 </para>
2246 <para>
2247 <indexterm role="concept">
2248 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2249 </indexterm>
2250 Licensed versions of Unix normally contain a library of DBM functions operating
2251 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2252 versions of Unix seem to vary in what they contain as standard. In particular,
2253 some early versions of Linux have no default DBM library, and different
2254 distributors have chosen to bundle different libraries with their packaged
2255 versions. However, the more recent releases seem to have standardized on the
2256 Berkeley DB library.
2257 </para>
2258 <para>
2259 Different DBM libraries have different conventions for naming the files they
2260 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2261 possibilities:
2262 </para>
2263 <orderedlist numeration="arabic">
2264 <listitem>
2265 <para>
2266 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2267 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2268 </para>
2269 </listitem>
2270 <listitem>
2271 <para>
2272 <indexterm role="concept">
2273 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2274 </indexterm>
2275 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2276 compatibility interface it makes two different hard links to it with names
2277 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2278 file name is used unmodified.
2279 </para>
2280 </listitem>
2281 <listitem>
2282 <para>
2283 <indexterm role="concept">
2284 <primary>Berkeley DB library</primary>
2285 </indexterm>
2286 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2287 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2288 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2289 </para>
2290 </listitem>
2291 <listitem>
2292 <para>
2293 If the Berkeley package is used in its native mode, it operates on a single
2294 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2295 the traditional <emphasis>ndbm</emphasis> interface.
2296 </para>
2297 </listitem>
2298 <listitem>
2299 <para>
2300 To complicate things further, there are several very different versions of the
2301 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2302 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2303 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2304 versions of Berkeley DB can be obtained from
2305 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2306 </para>
2307 </listitem>
2308 <listitem>
2309 <para>
2310 <indexterm role="concept">
2311 <primary><emphasis>tdb</emphasis> DBM library</primary>
2312 </indexterm>
2313 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2314 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2315 operates on a single file.
2316 </para>
2317 </listitem>
2318 </orderedlist>
2319 <para>
2320 <indexterm role="concept">
2321 <primary>USE_DB</primary>
2322 </indexterm>
2323 <indexterm role="concept">
2324 <primary>DBM libraries</primary>
2325 <secondary>configuration for building</secondary>
2326 </indexterm>
2327 Exim and its utilities can be compiled to use any of these interfaces. In order
2328 to use any version of the Berkeley DB package in native mode, you must set
2329 USE_DB in an appropriate configuration file (typically
2330 <filename>Local/Makefile</filename>). For example:
2331 </para>
2332 <literallayout class="monospaced">
2333 USE_DB=yes
2334 </literallayout>
2335 <para>
2336 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2337 error is diagnosed if you set more than one of these.
2338 </para>
2339 <para>
2340 At the lowest level, the build-time configuration sets none of these options,
2341 thereby assuming an interface of type (1). However, some operating system
2342 configuration files (for example, those for the BSD operating systems and
2343 Linux) assume type (4) by setting USE_DB as their default, and the
2344 configuration files for Cygwin set USE_GDBM. Anything you set in
2345 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2346 </para>
2347 <para>
2348 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2349 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2350 in one of these lines:
2351 </para>
2352 <literallayout class="monospaced">
2353 DBMLIB = -ldb
2354 DBMLIB = -ltdb
2355 </literallayout>
2356 <para>
2357 Settings like that will work if the DBM library is installed in the standard
2358 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2359 the default path. You may need to set INCLUDE to specify where the header
2360 file is, and to specify the path to the library more fully in DBMLIB, as in
2361 this example:
2362 </para>
2363 <literallayout class="monospaced">
2364 INCLUDE=-I/usr/local/include/db-4.1
2365 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2366 </literallayout>
2367 <para>
2368 There is further detailed discussion about the various DBM libraries in the
2369 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2370 </para>
2371 </section>
2372 <section id="SECID25">
2373 <title>Pre-building configuration</title>
2374 <para>
2375 <indexterm role="concept">
2376 <primary>building Exim</primary>
2377 <secondary>pre-building configuration</secondary>
2378 </indexterm>
2379 <indexterm role="concept">
2380 <primary>configuration for building Exim</primary>
2381 </indexterm>
2382 <indexterm role="concept">
2383 <primary><filename>Local/Makefile</filename></primary>
2384 </indexterm>
2385 <indexterm role="concept">
2386 <primary><filename>src/EDITME</filename></primary>
2387 </indexterm>
2388 Before building Exim, a local configuration file that specifies options
2389 independent of any operating system has to be created with the name
2390 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2391 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2392 therein. These descriptions are therefore not repeated here. If you are
2393 building Exim for the first time, the simplest thing to do is to copy
2394 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2395 </para>
2396 <para>
2397 There are three settings that you must supply, because Exim will not build
2398 without them. They are the location of the run time configuration file
2399 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2400 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2401 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2402 a colon-separated list of file names; Exim uses the first of them that exists.
2403 </para>
2404 <para>
2405 There are a few other parameters that can be specified either at build time or
2406 at run time, to enable the same binary to be used on a number of different
2407 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2408 directory (if not within the spool directory) are fixed, it is recommended that
2409 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2410 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2411 be logged.
2412 </para>
2413 <para>
2414 <indexterm role="concept">
2415 <primary>content scanning</primary>
2416 <secondary>specifying at build time</secondary>
2417 </indexterm>
2418 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2419 access control lists are not compiled by default. If you want to include these
2420 facilities, you need to set
2421 </para>
2422 <literallayout class="monospaced">
2423 WITH_CONTENT_SCAN=yes
2424 </literallayout>
2425 <para>
2426 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2427 chapter <xref linkend="CHAPexiscan"/>.
2428 </para>
2429 <para>
2430 <indexterm role="concept">
2431 <primary><filename>Local/eximon.conf</filename></primary>
2432 </indexterm>
2433 <indexterm role="concept">
2434 <primary><filename>exim_monitor/EDITME</filename></primary>
2435 </indexterm>
2436 If you are going to build the Exim monitor, a similar configuration process is
2437 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2438 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2439 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2440 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2441 </para>
2442 <para>
2443 This is all the configuration that is needed in straightforward cases for known
2444 operating systems. However, the building process is set up so that it is easy
2445 to override options that are set by default or by operating-system-specific
2446 configuration files, for example to change the name of the C compiler, which
2447 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2448 do this.
2449 </para>
2450 </section>
2451 <section id="SECID26">
2452 <title>Support for iconv()</title>
2453 <para>
2454 <indexterm role="concept">
2455 <primary><function>iconv()</function> support</primary>
2456 </indexterm>
2457 <indexterm role="concept">
2458 <primary>RFC 2047</primary>
2459 </indexterm>
2460 The contents of header lines in messages may be encoded according to the rules
2461 described RFC 2047. This makes it possible to transmit characters that are not
2462 in the ASCII character set, and to label them as being in a particular
2463 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2464 mechanism, it decodes them, and translates them into a specified character set
2465 (default ISO-8859-1). The translation is possible only if the operating system
2466 supports the <function>iconv()</function> function.
2467 </para>
2468 <para>
2469 However, some of the operating systems that supply <function>iconv()</function> do not support
2470 very many conversions. The GNU <option>libiconv</option> library (available from
2471 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2472 systems to remedy this deficiency, as well as on systems that do not supply
2473 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2474 </para>
2475 <literallayout class="monospaced">
2476 HAVE_ICONV=yes
2477 </literallayout>
2478 <para>
2479 to your <filename>Local/Makefile</filename> and rebuild Exim.
2480 </para>
2481 </section>
2482 <section id="SECTinctlsssl">
2483 <title>Including TLS/SSL encryption support</title>
2484 <para>
2485 <indexterm role="concept">
2486 <primary>TLS</primary>
2487 <secondary>including support for TLS</secondary>
2488 </indexterm>
2489 <indexterm role="concept">
2490 <primary>encryption</primary>
2491 <secondary>including support for</secondary>
2492 </indexterm>
2493 <indexterm role="concept">
2494 <primary>SUPPORT_TLS</primary>
2495 </indexterm>
2496 <indexterm role="concept">
2497 <primary>OpenSSL</primary>
2498 <secondary>building Exim with</secondary>
2499 </indexterm>
2500 <indexterm role="concept">
2501 <primary>GnuTLS</primary>
2502 <secondary>building Exim with</secondary>
2503 </indexterm>
2504 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2505 command as per RFC 2487. It can also support legacy clients that expect to
2506 start a TLS session immediately on connection to a non-standard port (see the
2507 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2508 line option).
2509 </para>
2510 <para>
2511 If you want to build Exim with TLS support, you must first install either the
2512 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2513 implementing SSL.
2514 </para>
2515 <para>
2516 If OpenSSL is installed, you should set
2517 </para>
2518 <literallayout class="monospaced">
2519 SUPPORT_TLS=yes
2520 TLS_LIBS=-lssl -lcrypto
2521 </literallayout>
2522 <para>
2523 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2524 OpenSSL library and include files. For example:
2525 </para>
2526 <literallayout class="monospaced">
2527 SUPPORT_TLS=yes
2528 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2529 TLS_INCLUDE=-I/usr/local/openssl/include/
2530 </literallayout>
2531 <para>
2532 <indexterm role="concept">
2533 <primary>USE_GNUTLS</primary>
2534 </indexterm>
2535 If GnuTLS is installed, you should set
2536 </para>
2537 <literallayout class="monospaced">
2538 SUPPORT_TLS=yes
2539 USE_GNUTLS=yes
2540 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2541 </literallayout>
2542 <para>
2543 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2544 library and include files. For example:
2545 </para>
2546 <literallayout class="monospaced">
2547 SUPPORT_TLS=yes
2548 USE_GNUTLS=yes
2549 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2550 TLS_INCLUDE=-I/usr/gnu/include
2551 </literallayout>
2552 <para>
2553 You do not need to set TLS_INCLUDE if the relevant directory is already
2554 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2555 given in chapter <xref linkend="CHAPTLS"/>.
2556 </para>
2557 </section>
2558 <section id="SECID27">
2559 <title>Use of tcpwrappers</title>
2560 <para>
2561 <indexterm role="concept">
2562 <primary>tcpwrappers, building Exim to support</primary>
2563 </indexterm>
2564 <indexterm role="concept">
2565 <primary>USE_TCP_WRAPPERS</primary>
2566 </indexterm>
2567 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2568 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2569 alternative to Exim&#x2019;s own checking facilities for installations that are
2570 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2571 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2572 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2573 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2574 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2575 you might have
2576 </para>
2577 <literallayout class="monospaced">
2578 USE_TCP_WRAPPERS=yes
2579 CFLAGS=-O -I/usr/local/include
2580 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2581 </literallayout>
2582 <para>
2583 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2584 <quote>exim</quote>. For example, the line
2585 </para>
2586 <literallayout class="monospaced">
2587 exim : LOCAL  192.168.1.  .friendly.domain.example
2588 </literallayout>
2589 <para>
2590 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2591 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2592 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2593 further details.
2594 </para>
2595 </section>
2596 <section id="SECID28">
2597 <title>Including support for IPv6</title>
2598 <para>
2599 <indexterm role="concept">
2600 <primary>IPv6</primary>
2601 <secondary>including support for</secondary>
2602 </indexterm>
2603 Exim contains code for use on systems that have IPv6 support. Setting
2604 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2605 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2606 where the IPv6 support is not fully integrated into the normal include and
2607 library files.
2608 </para>
2609 <para>
2610 Two different types of DNS record for handling IPv6 addresses have been
2611 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2612 currently seen as the mainstream. Another record type called A6 was proposed
2613 as better than AAAA because it had more flexibility. However, it was felt to be
2614 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2615 if anyone is actually using A6 records. Exim has support for A6 records, but
2616 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2617 support has not been tested for some time.
2618 </para>
2619 </section>
2620 <section id="SECID29">
2621 <title>The building process</title>
2622 <para>
2623 <indexterm role="concept">
2624 <primary>build directory</primary>
2625 </indexterm>
2626 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2627 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2628 operating system types, and creates a build directory if one does not exist.
2629 For example, on a Sun system running Solaris 8, the directory
2630 <filename>build-SunOS5-5.8-sparc</filename> is created.
2631 <indexterm role="concept">
2632 <primary>symbolic link</primary>
2633 <secondary>to source files</secondary>
2634 </indexterm>
2635 Symbolic links to relevant source files are installed in the build directory.
2636 </para>
2637 <para>
2638 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2639 building process fails if it is set.
2640 </para>
2641 <para>
2642 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2643 a make file inside the build directory, using the configuration files from the
2644 <filename>Local</filename> directory. The new make file is then passed to another instance of
2645 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2646 then compiling and linking the binaries for the Exim monitor (if configured), a
2647 number of utility programs, and finally Exim itself. The command <literal>make
2648 makefile</literal> can be used to force a rebuild of the make file in the build
2649 directory, should this ever be necessary.
2650 </para>
2651 <para>
2652 If you have problems building Exim, check for any comments there may be in the
2653 <filename>README</filename> file concerning your operating system, and also take a look at the
2654 FAQ, where some common problems are covered.
2655 </para>
2656 </section>
2657 <section id="SECID283">
2658 <title>Output from <quote>make</quote></title>
2659 <para>
2660 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2661 unreadable, because these lines can be very long. For this reason, the normal
2662 output is suppressed by default, and instead output similar to that which
2663 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2664 each module that is being compiled or linked. However, it is still possible to
2665 get the full output, by calling <emphasis>make</emphasis> like this:
2666 </para>
2667 <literallayout class="monospaced">
2668 FULLECHO='' make -e
2669 </literallayout>
2670 <para>
2671 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2672 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2673 given in addition to the short output.
2674 </para>
2675 </section>
2676 <section id="SECToverride">
2677 <title>Overriding build-time options for Exim</title>
2678 <para>
2679 <indexterm role="concept">
2680 <primary>build-time options, overriding</primary>
2681 </indexterm>
2682 The main make file that is created at the beginning of the building process
2683 consists of the concatenation of a number of files which set configuration
2684 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2685 more than once, the last setting overrides any previous ones. This provides a
2686 convenient way of overriding defaults. The files that are concatenated are, in
2687 order:
2688 </para>
2689 <literallayout>
2690 <filename>OS/Makefile-Default</filename>
2691 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2692 <filename>Local/Makefile</filename>
2693 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2694 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2695 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2696 <filename>OS/Makefile-Base</filename>
2697 </literallayout>
2698 <para>
2699 <indexterm role="concept">
2700 <primary><filename>Local/Makefile</filename></primary>
2701 </indexterm>
2702 <indexterm role="concept">
2703 <primary>building Exim</primary>
2704 <secondary>operating system type</secondary>
2705 </indexterm>
2706 <indexterm role="concept">
2707 <primary>building Exim</primary>
2708 <secondary>architecture type</secondary>
2709 </indexterm>
2710 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2711 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2712 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2713 and are often not needed.
2714 </para>
2715 <para>
2716 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2717 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2718 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2719 values are used, thereby providing a means of forcing particular settings.
2720 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2721 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2722 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2723 that Exim expects. You can run these scripts directly from the shell in order
2724 to find out what values are being used on your system.
2725 </para>
2726 <para>
2727 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2728 therein. Some (but not all) are mentioned below. If there is something that
2729 needs changing, review the contents of this file and the contents of the make
2730 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2731 default values are.
2732 </para>
2733 <para>
2734 <indexterm role="concept">
2735 <primary>building Exim</primary>
2736 <secondary>overriding default settings</secondary>
2737 </indexterm>
2738 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2739 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2740 need to change the original files. Instead, you should make the changes by
2741 putting the new values in an appropriate <filename>Local</filename> file. For example,
2742 <indexterm role="concept">
2743 <primary>Tru64-Unix build-time settings</primary>
2744 </indexterm>
2745 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2746 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2747 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2748 called with the option <option>-std1</option>, to make it recognize some of the features of
2749 Standard C that Exim uses. (Most other compilers recognize Standard C by
2750 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2751 containing the lines
2752 </para>
2753 <literallayout class="monospaced">
2754 CC=cc
2755 CFLAGS=-std1
2756 </literallayout>
2757 <para>
2758 If you are compiling for just one operating system, it may be easier to put
2759 these lines directly into <filename>Local/Makefile</filename>.
2760 </para>
2761 <para>
2762 Keeping all your local configuration settings separate from the distributed
2763 files makes it easy to transfer them to new versions of Exim simply by copying
2764 the contents of the <filename>Local</filename> directory.
2765 </para>
2766 <para>
2767 <indexterm role="concept">
2768 <primary>NIS lookup type</primary>
2769 <secondary>including support for</secondary>
2770 </indexterm>
2771 <indexterm role="concept">
2772 <primary>NIS+ lookup type</primary>
2773 <secondary>including support for</secondary>
2774 </indexterm>
2775 <indexterm role="concept">
2776 <primary>LDAP</primary>
2777 <secondary>including support for</secondary>
2778 </indexterm>
2779 <indexterm role="concept">
2780 <primary>lookup</primary>
2781 <secondary>inclusion in binary</secondary>
2782 </indexterm>
2783 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2784 lookup, but not all systems have these components installed, so the default is
2785 not to include the relevant code in the binary. All the different kinds of file
2786 and database lookup that Exim supports are implemented as separate code modules
2787 which are included only if the relevant compile-time options are set. In the
2788 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2789 </para>
2790 <literallayout class="monospaced">
2791 LOOKUP_LDAP=yes
2792 LOOKUP_NIS=yes
2793 LOOKUP_NISPLUS=yes
2794 </literallayout>
2795 <para>
2796 and similar settings apply to the other lookup types. They are all listed in
2797 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2798 libraries need to be installed before compiling Exim.
2799 <indexterm role="concept">
2800 <primary>cdb</primary>
2801 <secondary>including support for</secondary>
2802 </indexterm>
2803 However, there are some optional lookup types (such as cdb) for which
2804 the code is entirely contained within Exim, and no external include
2805 files or libraries are required. When a lookup type is not included in the
2806 binary, attempts to configure Exim to use it cause run time configuration
2807 errors.
2808 </para>
2809 <para>
2810 <indexterm role="concept">
2811 <primary>Perl</primary>
2812 <secondary>including support for</secondary>
2813 </indexterm>
2814 Exim can be linked with an embedded Perl interpreter, allowing Perl
2815 subroutines to be called during string expansion. To enable this facility,
2816 </para>
2817 <literallayout class="monospaced">
2818 EXIM_PERL=perl.o
2819 </literallayout>
2820 <para>
2821 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2822 chapter <xref linkend="CHAPperl"/>.
2823 </para>
2824 <para>
2825 <indexterm role="concept">
2826 <primary>X11 libraries, location of</primary>
2827 </indexterm>
2828 The location of the X11 libraries is something that varies a lot between
2829 operating systems, and there may be different versions of X11 to cope
2830 with. Exim itself makes no use of X11, but if you are compiling the Exim
2831 monitor, the X11 libraries must be available.
2832 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2833 </para>
2834 <literallayout class="monospaced">
2835 X11=/usr/X11R6
2836 XINCLUDE=-I$(X11)/include
2837 XLFLAGS=-L$(X11)/lib
2838 </literallayout>
2839 <para>
2840 These are overridden in some of the operating-system configuration files. For
2841 example, in <filename>OS/Makefile-SunOS5</filename> there is
2842 </para>
2843 <literallayout class="monospaced">
2844 X11=/usr/openwin
2845 XINCLUDE=-I$(X11)/include
2846 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2847 </literallayout>
2848 <para>
2849 If you need to override the default setting for your operating system, place a
2850 definition of all three of these variables into your
2851 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2852 </para>
2853 <para>
2854 <indexterm role="concept">
2855 <primary>EXTRALIBS</primary>
2856 </indexterm>
2857 If you need to add any extra libraries to the link steps, these can be put in a
2858 variable called EXTRALIBS, which appears in all the link commands, but by
2859 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2860 command for linking the main Exim binary, and not for any associated utilities.
2861 </para>
2862 <para>
2863 <indexterm role="concept">
2864 <primary>DBM libraries</primary>
2865 <secondary>configuration for building</secondary>
2866 </indexterm>
2867 There is also DBMLIB, which appears in the link commands for binaries that
2868 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2869 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2870 binary, and which can be used, for example, to include additional X11
2871 libraries.
2872 </para>
2873 <para>
2874 <indexterm role="concept">
2875 <primary>configuration file</primary>
2876 <secondary>editing</secondary>
2877 </indexterm>
2878 The make file copes with rebuilding Exim correctly if any of the configuration
2879 files are edited. However, if an optional configuration file is deleted, it is
2880 necessary to touch the associated non-optional file (that is,
2881 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2882 </para>
2883 </section>
2884 <section id="SECID30">
2885 <title>OS-specific header files</title>
2886 <para>
2887 <indexterm role="concept">
2888 <primary><filename>os.h</filename></primary>
2889 </indexterm>
2890 <indexterm role="concept">
2891 <primary>building Exim</primary>
2892 <secondary>OS-specific C header files</secondary>
2893 </indexterm>
2894 The <filename>OS</filename> directory contains a number of files with names of the form
2895 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
2896 normally need to be changed. There is a list of macro settings that are
2897 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2898 are porting Exim to a new operating system.
2899 </para>
2900 </section>
2901 <section id="SECID31">
2902 <title>Overriding build-time options for the monitor</title>
2903 <para>
2904 <indexterm role="concept">
2905 <primary>building Eximon</primary>
2906 </indexterm>
2907 A similar process is used for overriding things when building the Exim monitor,
2908 where the files that are involved are
2909 </para>
2910 <literallayout>
2911 <filename>OS/eximon.conf-Default</filename>
2912 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2913 <filename>Local/eximon.conf</filename>
2914 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2915 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2916 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2917 </literallayout>
2918 <para>
2919 <indexterm role="concept">
2920 <primary><filename>Local/eximon.conf</filename></primary>
2921 </indexterm>
2922 As with Exim itself, the final three files need not exist, and in this case the
2923 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
2924 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2925 variables of the same name, preceded by EXIMON_. For example, setting
2926 EXIMON_LOG_DEPTH in the environment overrides the value of
2927 LOG_DEPTH at run time.
2928 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2929 </para>
2930 </section>
2931 <section id="SECID32">
2932 <title>Installing Exim binaries and scripts</title>
2933 <para>
2934 <indexterm role="concept">
2935 <primary>installing Exim</primary>
2936 </indexterm>
2937 <indexterm role="concept">
2938 <primary>BIN_DIRECTORY</primary>
2939 </indexterm>
2940 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2941 arguments. The script copies binaries and utility scripts into the directory
2942 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2943 <indexterm role="concept">
2944 <primary>setuid</primary>
2945 <secondary>installing Exim with</secondary>
2946 </indexterm>
2947 The install script copies files only if they are newer than the files they are
2948 going to replace. The Exim binary is required to be owned by root and have the
2949 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2950 install</literal> as root so that it can set up the Exim binary in this way. However, in
2951 some special situations (for example, if a host is doing no local deliveries)
2952 it may be possible to run Exim without making the binary setuid root (see
2953 chapter <xref linkend="CHAPsecurity"/> for details).
2954 </para>
2955 <para>
2956 <indexterm role="concept">
2957 <primary>CONFIGURE_FILE</primary>
2958 </indexterm>
2959 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
2960 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2961 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2962 by the installation script. If a run time configuration file already exists, it
2963 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2964 alternative files, no default is installed.
2965 </para>
2966 <para>
2967 <indexterm role="concept">
2968 <primary>system aliases file</primary>
2969 </indexterm>
2970 <indexterm role="concept">
2971 <primary><filename>/etc/aliases</filename></primary>
2972 </indexterm>
2973 One change is made to the default configuration file when it is installed: the
2974 default configuration contains a router that references a system aliases file.
2975 The path to this file is set to the value specified by
2976 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
2977 If the system aliases file does not exist, the installation script creates it,
2978 and outputs a comment to the user.
2979 </para>
2980 <para>
2981 The created file contains no aliases, but it does contain comments about the
2982 aliases a site should normally have. Mail aliases have traditionally been
2983 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
2984 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
2985 Exim&#x2019;s configuration if necessary.
2986 </para>
2987 <para>
2988 The default configuration uses the local host&#x2019;s name as the only local domain,
2989 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
2990 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
2991 directories are supported, but no NIS or NIS+ support is configured. Domains
2992 other than the name of the local host are routed using the DNS, with delivery
2993 over SMTP.
2994 </para>
2995 <para>
2996 It is possible to install Exim for special purposes (such as building a binary
2997 distribution) in a private part of the file system. You can do this by a
2998 command such as
2999 </para>
3000 <literallayout class="monospaced">
3001 make DESTDIR=/some/directory/ install
3002 </literallayout>
3003 <para>
3004 This has the effect of pre-pending the specified directory to all the file
3005 paths, except the name of the system aliases file that appears in the default
3006 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3007 For backwards compatibility, ROOT is used if DESTDIR is not set,
3008 but this usage is deprecated.
3009 </para>
3010 <para>
3011 <indexterm role="concept">
3012 <primary>installing Exim</primary>
3013 <secondary>what is not installed</secondary>
3014 </indexterm>
3015 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3016 <emphasis>convert4r4</emphasis>, or the <emphasis>pcretest</emphasis> test program. You will probably run the
3017 first of these only once (if you are upgrading from Exim 3), and the second
3018 isn&#x2019;t really part of Exim. None of the documentation files in the <filename>doc</filename>
3019 directory are copied, except for the info files when you have set
3020 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3021 </para>
3022 <para>
3023 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3024 to their names. The Exim binary itself, however, is handled differently. It is
3025 installed under a name that includes the version number and the compile number,
3026 for example <filename>exim-4.67-1</filename>. The script then arranges for a symbolic link
3027 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3028 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3029 from the directory (as seen by other processes).
3030 </para>
3031 <para>
3032 <indexterm role="concept">
3033 <primary>installing Exim</primary>
3034 <secondary>testing the script</secondary>
3035 </indexterm>
3036 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3037 real, you can pass the <option>-n</option> option to the installation script by this
3038 command:
3039 </para>
3040 <literallayout class="monospaced">
3041 make INSTALL_ARG=-n install
3042 </literallayout>
3043 <para>
3044 The contents of the variable INSTALL_ARG are passed to the installation
3045 script. You do not need to be root to run this test. Alternatively, you can run
3046 the installation script directly, but this must be from within the build
3047 directory. For example, from the top-level Exim directory you could use this
3048 command:
3049 </para>
3050 <literallayout class="monospaced">
3051 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3052 </literallayout>
3053 <para>
3054 <indexterm role="concept">
3055 <primary>installing Exim</primary>
3056 <secondary>install script options</secondary>
3057 </indexterm>
3058 There are two other options that can be supplied to the installation script.
3059 </para>
3060 <itemizedlist>
3061 <listitem>
3062 <para>
3063 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3064 to root, and the call to make it a setuid binary.
3065 </para>
3066 </listitem>
3067 <listitem>
3068 <para>
3069 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3070 installed binary.
3071 </para>
3072 </listitem>
3073 </itemizedlist>
3074 <para>
3075 INSTALL_ARG can be used to pass these options to the script. For example:
3076 </para>
3077 <literallayout class="monospaced">
3078 make INSTALL_ARG=-no_symlink install
3079 </literallayout>
3080 <para>
3081 The installation script can also be given arguments specifying which files are
3082 to be copied. For example, to install just the Exim binary, and nothing else,
3083 without creating the symbolic link, you could use:
3084 </para>
3085 <literallayout class="monospaced">
3086 make INSTALL_ARG='-no_symlink exim' install
3087 </literallayout>
3088 </section>
3089 <section id="SECTinsinfdoc">
3090 <title>Installing info documentation</title>
3091 <para>
3092 <indexterm role="concept">
3093 <primary>installing Exim</primary>
3094 <secondary><emphasis>info</emphasis> documentation</secondary>
3095 </indexterm>
3096 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3097 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3098 distribution. Instead it is available separately from the ftp site (see section
3099 <xref linkend="SECTavail"/>).
3100 </para>
3101 <para>
3102 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3103 source of the documentation is found in the source tree, running <literal>make
3104 install</literal> automatically builds the info files and installs them.
3105 </para>
3106 </section>
3107 <section id="SECID33">
3108 <title>Setting up the spool directory</title>
3109 <para>
3110 <indexterm role="concept">
3111 <primary>spool directory</primary>
3112 <secondary>creating</secondary>
3113 </indexterm>
3114 When it starts up, Exim tries to create its spool directory if it does not
3115 exist. The Exim uid and gid are used for the owner and group of the spool
3116 directory. Sub-directories are automatically created in the spool directory as
3117 necessary.
3118 </para>
3119 </section>
3120 <section id="SECID34">
3121 <title>Testing</title>
3122 <para>
3123 <indexterm role="concept">
3124 <primary>testing</primary>
3125 <secondary>installation</secondary>
3126 </indexterm>
3127 Having installed Exim, you can check that the run time configuration file is
3128 syntactically valid by running the following command, which assumes that the
3129 Exim binary directory is within your PATH environment variable:
3130 </para>
3131 <literallayout class="monospaced">
3132 exim -bV
3133 </literallayout>
3134 <para>
3135 If there are any errors in the configuration file, Exim outputs error messages.
3136 Otherwise it outputs the version number and build date,
3137 the DBM library that is being used, and information about which drivers and
3138 other optional code modules are included in the binary.
3139 Some simple routing tests can be done by using the address testing option. For
3140 example,
3141 </para>
3142 <literallayout>
3143 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3144 </literallayout>
3145 <para>
3146 should verify that it recognizes a local mailbox, and
3147 </para>
3148 <literallayout>
3149 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3150 </literallayout>
3151 <para>
3152 a remote one. Then try getting it to deliver mail, both locally and remotely.
3153 This can be done by passing messages directly to Exim, without going through a
3154 user agent. For example:
3155 </para>
3156 <literallayout class="monospaced">
3157 exim -v postmaster@your.domain.example
3158 From: user@your.domain.example
3159 To: postmaster@your.domain.example
3160 Subject: Testing Exim
3161
3162 This is a test message.
3163 ^D
3164 </literallayout>
3165 <para>
3166 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3167 In this case you should see copies of three log lines, one for the message&#x2019;s
3168 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3169 </para>
3170 <para>
3171 <indexterm role="concept">
3172 <primary>delivery</primary>
3173 <secondary>problems with</secondary>
3174 </indexterm>
3175 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3176 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3177 of information is running Exim with debugging turned on, by specifying the
3178 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3179 with debugging turned on by a command of the form
3180 </para>
3181 <literallayout>
3182 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3183 </literallayout>
3184 <para>
3185 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3186 produces rather a lot of output, but you can cut this down to specific areas.
3187 For example, if you use <option>-d-all+route</option> only the debugging information
3188 relevant to routing is included. (See the <option>-d</option> option in chapter
3189 <xref linkend="CHAPcommandline"/> for more details.)
3190 </para>
3191 <para>
3192 <indexterm role="concept">
3193 <primary><quote>sticky</quote> bit</primary>
3194 </indexterm>
3195 <indexterm role="concept">
3196 <primary>lock files</primary>
3197 </indexterm>
3198 One specific problem that has shown up on some sites is the inability to do
3199 local deliveries into a shared mailbox directory, because it does not have the
3200 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3201 writing to a mailbox file, and if it cannot create the lock file, the delivery
3202 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3203 directory, or by setting a specific group for local deliveries and allowing
3204 that group to create files in the directory (see the comments above the
3205 <command>local_delivery</command> transport in the default configuration file). Another
3206 approach is to configure Exim not to use lock files, but just to rely on
3207 <function>fcntl()</function> locking instead. However, you should do this only if all user
3208 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3209 see chapter <xref linkend="CHAPappendfile"/>.
3210 </para>
3211 <para>
3212 One thing that cannot be tested on a system that is already running an MTA is
3213 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3214 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3215 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3216 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3217 incoming SMTP mail.
3218 </para>
3219 <para>
3220 Testing a new version on a system that is already running Exim can most easily
3221 be done by building a binary with a different CONFIGURE_FILE setting. From
3222 within the run time configuration, all other file and directory names
3223 that Exim uses can be altered, in order to keep it entirely clear of the
3224 production version.
3225 </para>
3226 </section>
3227 <section id="SECID35">
3228 <title>Replacing another MTA with Exim</title>
3229 <para>
3230 <indexterm role="concept">
3231 <primary>replacing another MTA</primary>
3232 </indexterm>
3233 Building and installing Exim for the first time does not of itself put it in
3234 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3235 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3236 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3237 binary in order to get the user agents to pass messages to Exim. This is
3238 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3239 or <filename>/usr/lib/sendmail</filename>
3240 <indexterm role="concept">
3241 <primary>symbolic link</primary>
3242 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3243 </indexterm>
3244 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3245 privilege and executable status from the old MTA. It is then necessary to stop
3246 and restart the mailer daemon, if one is running.
3247 </para>
3248 <para>
3249 <indexterm role="concept">
3250 <primary>FreeBSD, MTA indirection</primary>
3251 </indexterm>
3252 <indexterm role="concept">
3253 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3254 </indexterm>
3255 Some operating systems have introduced alternative ways of switching MTAs. For
3256 example, if you are running FreeBSD, you need to edit the file
3257 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3258 described. A typical example of the contents of this file for running Exim is
3259 as follows:
3260 </para>
3261 <literallayout class="monospaced">
3262 sendmail            /usr/exim/bin/exim
3263 send-mail           /usr/exim/bin/exim
3264 mailq               /usr/exim/bin/exim -bp
3265 newaliases          /usr/bin/true
3266 </literallayout>
3267 <para>
3268 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3269 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3270 favourite user agent.
3271 </para>
3272 <para>
3273 You should consider what to tell your users about the change of MTA. Exim may
3274 have different capabilities to what was previously running, and there are
3275 various operational differences such as the text of messages produced by
3276 command line options and in bounce messages. If you allow your users to make
3277 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3278 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3279 </para>
3280 </section>
3281 <section id="SECID36">
3282 <title>Upgrading Exim</title>
3283 <para>
3284 <indexterm role="concept">
3285 <primary>upgrading Exim</primary>
3286 </indexterm>
3287 If you are already running Exim on your host, building and installing a new
3288 version automatically makes it available to MUAs, or any other programs that
3289 call the MTA directly. However, if you are running an Exim daemon, you do need
3290 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3291 new binary. You do not need to stop processing mail in order to install a new
3292 version of Exim. The install script does not modify an existing runtime
3293 configuration file.
3294 </para>
3295 </section>
3296 <section id="SECID37">
3297 <title>Stopping the Exim daemon on Solaris</title>
3298 <para>
3299 <indexterm role="concept">
3300 <primary>Solaris</primary>
3301 <secondary>stopping Exim on</secondary>
3302 </indexterm>
3303 The standard command for stopping the mailer daemon on Solaris is
3304 </para>
3305 <literallayout class="monospaced">
3306 /etc/init.d/sendmail stop
3307 </literallayout>
3308 <para>
3309 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3310 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3311 for the text <quote>sendmail</quote>; this is not present because the actual program name
3312 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3313 solution is to replace the line that finds the process id with something like
3314 </para>
3315 <literallayout class="monospaced">
3316 pid=`cat /var/spool/exim/exim-daemon.pid`
3317 </literallayout>
3318 <para>
3319 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3320 </para>
3321 <para>
3322 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3323 still be received from local processes, and if automatic delivery is configured
3324 (the normal case), deliveries will still occur.
3325 </para>
3326 </section>
3327 </chapter>
3328
3329 <chapter id="CHAPcommandline">
3330 <title>The Exim command line</title>
3331 <para>
3332 <indexterm role="concept" id="IIDclo1" class="startofrange">
3333 <primary>command line</primary>
3334 <secondary>options</secondary>
3335 </indexterm>
3336 <indexterm role="concept" id="IIDclo2" class="startofrange">
3337 <primary>options</primary>
3338 <secondary>command line</secondary>
3339 </indexterm>
3340 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3341 each starting with a hyphen character, followed by a number of arguments. The
3342 options are compatible with the main options of Sendmail, and there are also
3343 some additional options, some of which are compatible with Smail 3. Certain
3344 combinations of options do not make sense, and provoke an error if used.
3345 The form of the arguments depends on which options are set.
3346 </para>
3347 <section id="SECID38">
3348 <title>Setting options by program name</title>
3349 <para>
3350 <indexterm role="concept">
3351 <primary><emphasis>mailq</emphasis></primary>
3352 </indexterm>
3353 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3354 were present before any other options.
3355 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3356 standard output.
3357 This feature is for compatibility with some systems that contain a command of
3358 that name in one of the standard libraries, symbolically linked to
3359 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3360 </para>
3361 <para>
3362 <indexterm role="concept">
3363 <primary><emphasis>rsmtp</emphasis></primary>
3364 </indexterm>
3365 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3366 were present before any other options, for compatibility with Smail. The
3367 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3368 format.
3369 </para>
3370 <para>
3371 <indexterm role="concept">
3372 <primary><emphasis>rmail</emphasis></primary>
3373 </indexterm>
3374 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3375 <option>-oee</option> options were present before any other options, for compatibility with
3376 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3377 </para>
3378 <para>
3379 <indexterm role="concept">
3380 <primary><emphasis>runq</emphasis></primary>
3381 </indexterm>
3382 <indexterm role="concept">
3383 <primary>queue runner</primary>
3384 </indexterm>
3385 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3386 were present before any other options, for compatibility with Smail. The <option>-q</option>
3387 option causes a single queue runner process to be started.
3388 </para>
3389 <para>
3390 <indexterm role="concept">
3391 <primary><emphasis>newaliases</emphasis></primary>
3392 </indexterm>
3393 <indexterm role="concept">
3394 <primary>alias file</primary>
3395 <secondary>building</secondary>
3396 </indexterm>
3397 <indexterm role="concept">
3398 <primary>Sendmail compatibility</primary>
3399 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3400 </indexterm>
3401 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3402 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3403 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3404 the concept of a single alias file, but can be configured to run a given
3405 command if called with the <option>-bi</option> option.
3406 </para>
3407 </section>
3408 <section id="SECTtrustedadmin">
3409 <title>Trusted and admin users</title>
3410 <para>
3411 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3412 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3413 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3414 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3415 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3416 </para>
3417 <itemizedlist>
3418 <listitem>
3419 <para>
3420 <indexterm role="concept">
3421 <primary>trusted users</primary>
3422 <secondary>definition of</secondary>
3423 </indexterm>
3424 <indexterm role="concept">
3425 <primary>user</primary>
3426 <secondary>trusted definition of</secondary>
3427 </indexterm>
3428 The trusted users are root, the Exim user, any user listed in the
3429 <option>trusted_users</option> configuration option, and any user whose current group or any
3430 supplementary group is one of those listed in the <option>trusted_groups</option>
3431 configuration option. Note that the Exim group is not automatically trusted.
3432 </para>
3433 <para>
3434 <indexterm role="concept">
3435 <primary><quote>From</quote> line</primary>
3436 </indexterm>
3437 <indexterm role="concept">
3438 <primary>envelope sender</primary>
3439 </indexterm>
3440 Trusted users are always permitted to use the <option>-f</option> option or a leading
3441 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3442 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3443 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3444 users to set envelope senders.
3445 </para>
3446 <para>
3447 <indexterm role="concept">
3448 <primary><emphasis>From:</emphasis> header line</primary>
3449 </indexterm>
3450 <indexterm role="concept">
3451 <primary><emphasis>Sender:</emphasis> header line</primary>
3452 </indexterm>
3453 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3454 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3455 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3456 </para>
3457 <para>
3458 Trusted users may also specify a host name, host address, interface address,
3459 protocol name, ident value, and authentication data when submitting a message
3460 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3461 have the characteristics of messages received from a remote host. Untrusted
3462 users may in some circumstances use <option>-f</option>, but can never set the other values
3463 that are available to trusted users.
3464 </para>
3465 </listitem>
3466 <listitem>
3467 <para>
3468 <indexterm role="concept">
3469 <primary>user</primary>
3470 <secondary>admin definition of</secondary>
3471 </indexterm>
3472 <indexterm role="concept">
3473 <primary>admin user</primary>
3474 <secondary>definition of</secondary>
3475 </indexterm>
3476 The admin users are root, the Exim user, and any user that is a member of the
3477 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3478 The current group does not have to be one of these groups.
3479 </para>
3480 <para>
3481 Admin users are permitted to list the queue, and to carry out certain
3482 operations on messages, for example, to force delivery failures. It is also
3483 necessary to be an admin user in order to see the full information provided by
3484 the Exim monitor, and full debugging output.
3485 </para>
3486 <para>
3487 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3488 Exim to attempt delivery of messages on its queue is restricted to admin users.
3489 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3490 option false (that is, specifying <option>no_prod_requires_admin</option>).
3491 </para>
3492 <para>
3493 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3494 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3495 false.
3496 </para>
3497 </listitem>
3498 </itemizedlist>
3499 <para>
3500 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3501 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3502 getting root. There is further discussion of this issue at the start of chapter
3503 <xref linkend="CHAPconf"/>.
3504 </para>
3505 </section>
3506 <section id="SECID39">
3507 <title>Command line options</title>
3508 <para>
3509 Exim&#x2019;s command line options are described in alphabetical order below. If none
3510 of the options that specifies a specific action (such as starting the daemon or
3511 a queue runner, or testing an address, or receiving a message in a specific
3512 format, or listing the queue) are present, and there is at least one argument
3513 on the command line, <option>-bm</option> (accept a local message on the standard input,
3514 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3515 outputs a brief message about itself and exits.
3516 </para>
3517 <!-- === Start of command line options === -->
3518 <variablelist>
3519 <varlistentry>
3520 <term><option>--</option></term>
3521 <listitem>
3522 <para>
3523 <indexterm role="option">
3524 <primary>--</primary>
3525 </indexterm>
3526 <indexterm role="concept">
3527 <primary>options</primary>
3528 <secondary>command line; terminating</secondary>
3529 </indexterm>
3530 This is a pseudo-option whose only purpose is to terminate the options and
3531 therefore to cause subsequent command line items to be treated as arguments
3532 rather than options, even if they begin with hyphens.
3533 </para>
3534 </listitem></varlistentry>
3535 <varlistentry>
3536 <term><option>--help</option></term>
3537 <listitem>
3538 <para>
3539 <indexterm role="option">
3540 <primary><option>--help</option></primary>
3541 </indexterm>
3542 This option causes Exim to output a few sentences stating what it is.
3543 The same output is generated if the Exim binary is called with no options and
3544 no arguments.
3545 </para>
3546 </listitem></varlistentry>
3547 <varlistentry>
3548 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3549 <listitem>
3550 <para>
3551 <indexterm role="option">
3552 <primary><option>-B</option></primary>
3553 </indexterm>
3554 <indexterm role="concept">
3555 <primary>8-bit characters</primary>
3556 </indexterm>
3557 <indexterm role="concept">
3558 <primary>Sendmail compatibility</primary>
3559 <secondary>8-bit characters</secondary>
3560 </indexterm>
3561 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3562 clean; it ignores this option.
3563 </para>
3564 </listitem></varlistentry>
3565 <varlistentry>
3566 <term><option>-bd</option></term>
3567 <listitem>
3568 <para>
3569 <indexterm role="option">
3570 <primary><option>-bd</option></primary>
3571 </indexterm>
3572 <indexterm role="concept">
3573 <primary>daemon</primary>
3574 </indexterm>
3575 <indexterm role="concept">
3576 <primary>SMTP</primary>
3577 <secondary>listener</secondary>
3578 </indexterm>
3579 <indexterm role="concept">
3580 <primary>queue runner</primary>
3581 </indexterm>
3582 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3583 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3584 that the daemon should also initiate periodic queue runs.
3585 </para>
3586 <para>
3587 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3588 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3589 disconnect from the controlling terminal. When running this way, it can be
3590 stopped by pressing ctrl-C.
3591 </para>
3592 <para>
3593 By default, Exim listens for incoming connections to the standard SMTP port on
3594 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3595 ports, on multiple ports, and only on specific interfaces. Chapter
3596 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3597 </para>
3598 <para>
3599 When a listening daemon
3600 <indexterm role="concept">
3601 <primary>daemon</primary>
3602 <secondary>process id (pid)</secondary>
3603 </indexterm>
3604 <indexterm role="concept">
3605 <primary>pid (process id)</primary>
3606 <secondary>of daemon</secondary>
3607 </indexterm>
3608 is started without the use of <option>-oX</option> (that is, without overriding the normal
3609 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3610 in Exim&#x2019;s spool directory. This location can be overridden by setting
3611 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3612 running as root.
3613 </para>
3614 <para>
3615 When <option>-oX</option> is used on the command line to start a listening daemon, the
3616 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3617 used to specify a path on the command line if a pid file is required.
3618 </para>
3619 <para>
3620 The SIGHUP signal
3621 <indexterm role="concept">
3622 <primary>SIGHUP</primary>
3623 </indexterm>
3624 <indexterm role="concept">
3625 <primary>daemon</primary>
3626 <secondary>restarting</secondary>
3627 </indexterm>
3628 can be used to cause the daemon to re-execute itself. This should be done
3629 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3630 means of the <option>.include</option> facility, is changed, and also whenever a new version
3631 of Exim is installed. It is not necessary to do this when other files that are
3632 referenced from the configuration (for example, alias files) are changed,
3633 because these are reread each time they are used.
3634 </para>
3635 </listitem></varlistentry>
3636 <varlistentry>
3637 <term><option>-bdf</option></term>
3638 <listitem>
3639 <para>
3640 <indexterm role="option">
3641 <primary><option>-bdf</option></primary>
3642 </indexterm>
3643 This option has the same effect as <option>-bd</option> except that it never disconnects
3644 from the controlling terminal, even when no debugging is specified.
3645 </para>
3646 </listitem></varlistentry>
3647 <varlistentry>
3648 <term><option>-be</option></term>
3649 <listitem>
3650 <para>
3651 <indexterm role="option">
3652 <primary><option>-be</option></primary>
3653 </indexterm>
3654 <indexterm role="concept">
3655 <primary>testing</primary>
3656 <secondary>string expansion</secondary>
3657 </indexterm>
3658 <indexterm role="concept">
3659 <primary>expansion</primary>
3660 <secondary>testing</secondary>
3661 </indexterm>
3662 Run Exim in expansion testing mode. Exim discards its root privilege, to
3663 prevent ordinary users from using this mode to read otherwise inaccessible
3664 files. If no arguments are given, Exim runs interactively, prompting for lines
3665 of data. Otherwise, it processes each argument in turn.
3666 </para>
3667 <para>
3668 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3669 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3670 used without command line arguments. If successful, it uses the <function>readline()</function>
3671 function, which provides extensive line-editing facilities, for reading the
3672 test data. A line history is supported.
3673 </para>
3674 <para>
3675 Long expansion expressions can be split over several lines by using backslash
3676 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3677 continuation lines is ignored. Each argument or data line is passed through the
3678 string expansion mechanism, and the result is output. Variable values from the
3679 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3680 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3681 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3682 </para>
3683 <para>
3684 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3685 files or databases you are using, you must exit and restart Exim before trying
3686 the same lookup again. Otherwise, because each Exim process caches the results
3687 of lookups, you will just get the same result as before.
3688 </para>
3689 </listitem></varlistentry>
3690 <varlistentry>
3691 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3692 <listitem>
3693 <para>
3694 <indexterm role="option">
3695 <primary><option>-bem</option></primary>
3696 </indexterm>
3697 <indexterm role="concept">
3698 <primary>testing</primary>
3699 <secondary>string expansion</secondary>
3700 </indexterm>
3701 <indexterm role="concept">
3702 <primary>expansion</primary>
3703 <secondary>testing</secondary>
3704 </indexterm>
3705 This option operates like <option>-be</option> except that it must be followed by the name
3706 of a file. For example:
3707 </para>
3708 <literallayout class="monospaced">
3709 exim -bem /tmp/testmessage
3710 </literallayout>
3711 <para>
3712 The file is read as a message (as if receiving a locally-submitted non-SMTP
3713 message) before any of the test expansions are done. Thus, message-specific
3714 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3715 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3716 recipients are read from the headers in the normal way, and are shown in the
3717 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3718 line, because further arguments are taken as strings to expand (just like
3719 <option>-be</option>).
3720 </para>
3721 </listitem></varlistentry>
3722 <varlistentry>
3723 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3724 <listitem>
3725 <para>
3726 <indexterm role="option">
3727 <primary><option>-bF</option></primary>
3728 </indexterm>
3729 <indexterm role="concept">
3730 <primary>system filter</primary>
3731 <secondary>testing</secondary>
3732 </indexterm>
3733 <indexterm role="concept">
3734 <primary>testing</primary>
3735 <secondary>system filter</secondary>
3736 </indexterm>
3737 This option is the same as <option>-bf</option> except that it assumes that the filter being
3738 tested is a system filter. The additional commands that are available only in
3739 system filters are recognized.
3740 </para>
3741 </listitem></varlistentry>
3742 <varlistentry>
3743 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3744 <listitem>
3745 <para>
3746 <indexterm role="option">
3747 <primary><option>-bf</option></primary>
3748 </indexterm>
3749 <indexterm role="concept">
3750 <primary>filter</primary>
3751 <secondary>testing</secondary>
3752 </indexterm>
3753 <indexterm role="concept">
3754 <primary>testing</primary>
3755 <secondary>filter file</secondary>
3756 </indexterm>
3757 <indexterm role="concept">
3758 <primary>forward file</primary>
3759 <secondary>testing</secondary>
3760 </indexterm>
3761 <indexterm role="concept">
3762 <primary>testing</primary>
3763 <secondary>forward file</secondary>
3764 </indexterm>
3765 <indexterm role="concept">
3766 <primary>Sieve filter</primary>
3767 <secondary>testing</secondary>
3768 </indexterm>
3769 This option runs Exim in user filter testing mode; the file is the filter file
3770 to be tested, and a test message must be supplied on the standard input. If
3771 there are no message-dependent tests in the filter, an empty file can be
3772 supplied.
3773 </para>
3774 <para>
3775 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3776 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3777 filter and a user filter in the same run. For example:
3778 </para>
3779 <literallayout class="monospaced">
3780 exim -bF /system/filter -bf /user/filter &lt;/test/message
3781 </literallayout>
3782 <para>
3783 This is helpful when the system filter adds header lines or sets filter
3784 variables that are used by the user filter.
3785 </para>
3786 <para>
3787 If the test filter file does not begin with one of the special lines
3788 </para>
3789 <literallayout class="monospaced">
3790 # Exim filter
3791 # Sieve filter
3792 </literallayout>
3793 <para>
3794 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3795 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3796 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3797 redirection lists.
3798 </para>
3799 <para>
3800 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3801 detected, is a list of the actions that Exim would try to take if presented
3802 with the message for real. More details of filter testing are given in the
3803 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3804 </para>
3805 <para>
3806 When testing a filter file,
3807 <indexterm role="concept">
3808 <primary><quote>From</quote> line</primary>
3809 </indexterm>
3810 <indexterm role="concept">
3811 <primary>envelope sender</primary>
3812 </indexterm>
3813 <indexterm role="option">
3814 <primary><option>-f</option></primary>
3815 <secondary>for filter testing</secondary>
3816 </indexterm>
3817 the envelope sender can be set by the <option>-f</option> option,
3818 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3819 that would normally be taken from the envelope recipient address of the message
3820 can be set by means of additional command line options (see the next four
3821 options).
3822 </para>
3823 </listitem></varlistentry>
3824 <varlistentry>
3825 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3826 <listitem>
3827 <para>
3828 <indexterm role="option">
3829 <primary><option>-bfd</option></primary>
3830 </indexterm>
3831 <indexterm role="variable">
3832 <primary><varname>$qualify_domain</varname></primary>
3833 </indexterm>
3834 This sets the domain of the recipient address when a filter file is being
3835 tested by means of the <option>-bf</option> option. The default is the value of
3836 <varname>$qualify_domain</varname>.
3837 </para>
3838 </listitem></varlistentry>
3839 <varlistentry>
3840 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
3841 <listitem>
3842 <para>
3843 <indexterm role="option">
3844 <primary><option>-bfl</option></primary>
3845 </indexterm>
3846 This sets the local part of the recipient address when a filter file is being
3847 tested by means of the <option>-bf</option> option. The default is the username of the
3848 process that calls Exim. A local part should be specified with any prefix or
3849 suffix stripped, because that is how it appears to the filter when a message is
3850 actually being delivered.
3851 </para>
3852 </listitem></varlistentry>
3853 <varlistentry>
3854 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
3855 <listitem>
3856 <para>
3857 <indexterm role="option">
3858 <primary><option>-bfp</option></primary>
3859 </indexterm>
3860 This sets the prefix of the local part of the recipient address when a filter
3861 file is being tested by means of the <option>-bf</option> option. The default is an empty
3862 prefix.
3863 </para>
3864 </listitem></varlistentry>
3865 <varlistentry>
3866 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
3867 <listitem>
3868 <para>
3869 <indexterm role="option">
3870 <primary><option>-bfs</option></primary>
3871 </indexterm>
3872 This sets the suffix of the local part of the recipient address when a filter
3873 file is being tested by means of the <option>-bf</option> option. The default is an empty
3874 suffix.
3875 </para>
3876 </listitem></varlistentry>
3877 <varlistentry>
3878 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3879 <listitem>
3880 <para>
3881 <indexterm role="option">
3882 <primary><option>-bh</option></primary>
3883 </indexterm>
3884 <indexterm role="concept">
3885 <primary>testing</primary>
3886 <secondary>incoming SMTP</secondary>
3887 </indexterm>
3888 <indexterm role="concept">
3889 <primary>SMTP</primary>
3890 <secondary>testing incoming</secondary>
3891 </indexterm>
3892 <indexterm role="concept">
3893 <primary>testing</primary>
3894 <secondary>relay control</secondary>
3895 </indexterm>
3896 <indexterm role="concept">
3897 <primary>relaying</primary>
3898 <secondary>testing configuration</secondary>
3899 </indexterm>
3900 <indexterm role="concept">
3901 <primary>policy control</primary>
3902 <secondary>testing</secondary>
3903 </indexterm>
3904 <indexterm role="concept">
3905 <primary>debugging</primary>
3906 <secondary><option>-bh</option> option</secondary>
3907 </indexterm>
3908 This option runs a fake SMTP session as if from the given IP address, using the
3909 standard input and output. The IP address may include a port number at the end,
3910 after a full stop. For example:
3911 </para>
3912 <literallayout class="monospaced">
3913 exim -bh 10.9.8.7.1234
3914 exim -bh fe80::a00:20ff:fe86:a061.5678
3915 </literallayout>
3916 <para>
3917 When an IPv6 address is given, it is converted into canonical form. In the case
3918 of the second example above, the value of <varname>$sender_host_address</varname> after
3919 conversion to the canonical form is
3920 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3921 </para>
3922 <para>
3923 Comments as to what is going on are written to the standard error file. These
3924 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3925 This facility is provided for testing configuration options for incoming
3926 messages, to make sure they implement the required policy. For example, you can
3927 test your relay controls using <option>-bh</option>.
3928 </para>
3929 <para>
3930 <emphasis role="bold">Warning 1</emphasis>:
3931 <indexterm role="concept">
3932 <primary>RFC 1413</primary>
3933 </indexterm>
3934 You can test features of the configuration that rely on ident (RFC 1413)
3935 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3936 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3937 connection.
3938 </para>
3939 <para>
3940 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3941 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3942 occur, use <option>-bhc</option> instead.
3943 </para>
3944 <para>
3945 Messages supplied during the testing session are discarded, and nothing is
3946 written to any of the real log files. There may be pauses when DNS (and other)
3947 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3948 can be used to specify a specific IP interface and port if this is important,
3949 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3950 session were authenticated.
3951 </para>
3952 <para>
3953 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3954 output just states whether a given recipient address from a given host is
3955 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3956 </para>
3957 <para revisionflag="changed">
3958 Features such as authentication and encryption, where the client input is not
3959 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
3960 specialized SMTP test program such as
3961 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
3962 </para>
3963 </listitem></varlistentry>
3964 <varlistentry>
3965 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3966 <listitem>
3967 <para>
3968 <indexterm role="option">
3969 <primary><option>-bhc</option></primary>
3970 </indexterm>
3971 This option operates in the same way as <option>-bh</option>, except that address
3972 verification callouts are performed if required. This includes consulting and
3973 updating the callout cache database.
3974 </para>
3975 </listitem></varlistentry>
3976 <varlistentry>
3977 <term><option>-bi</option></term>
3978 <listitem>
3979 <para>
3980 <indexterm role="option">
3981 <primary><option>-bi</option></primary>
3982 </indexterm>
3983 <indexterm role="concept">
3984 <primary>alias file</primary>
3985 <secondary>building</secondary>
3986 </indexterm>
3987 <indexterm role="concept">
3988 <primary>building alias file</primary>
3989 </indexterm>
3990 <indexterm role="concept">
3991 <primary>Sendmail compatibility</primary>
3992 <secondary><option>-bi</option> option</secondary>
3993 </indexterm>
3994 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
3995 Exim does not have the concept of a single alias file, and so it cannot mimic
3996 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
3997 tend to appear in various scripts such as NIS make files, so the option must be
3998 recognized.
3999 </para>
4000 <para>
4001 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4002 configuration option is run, under the uid and gid of the caller of Exim. If
4003 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4004 The command set by <option>bi_command</option> may not contain arguments. The command can
4005 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4006 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4007 <option>-bi</option> is a no-op.
4008 </para>
4009 </listitem></varlistentry>
4010 <varlistentry>
4011 <term><option>-bm</option></term>
4012 <listitem>
4013 <para>
4014 <indexterm role="option">
4015 <primary><option>-bm</option></primary>
4016 </indexterm>
4017 <indexterm role="concept">
4018 <primary>local message reception</primary>
4019 </indexterm>
4020 This option runs an Exim receiving process that accepts an incoming,
4021 locally-generated message on the current input. The recipients are given as the
4022 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4023 argument can be a comma-separated list of RFC 2822 addresses. This is the
4024 default option for selecting the overall action of an Exim call; it is assumed
4025 if no other conflicting option is present.
4026 </para>
4027 <para>
4028 If any addresses in the message are unqualified (have no domain), they are
4029 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4030 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4031 suppressing this for special cases.
4032 </para>
4033 <para>
4034 Policy checks on the contents of local messages can be enforced by means of
4035 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4036 </para>
4037 <para>
4038 <indexterm role="concept">
4039 <primary>return code</primary>
4040 <secondary>for <option>-bm</option></secondary>
4041 </indexterm>
4042 The return code is zero if the message is successfully accepted. Otherwise, the
4043 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4044 </para>
4045 <para>
4046 The format
4047 <indexterm role="concept">
4048 <primary>message</primary>
4049 <secondary>format</secondary>
4050 </indexterm>
4051 <indexterm role="concept">
4052 <primary>format</primary>
4053 <secondary>message</secondary>
4054 </indexterm>
4055 <indexterm role="concept">
4056 <primary><quote>From</quote> line</primary>
4057 </indexterm>
4058 <indexterm role="concept">
4059 <primary>UUCP</primary>
4060 <secondary><quote>From</quote> line</secondary>
4061 </indexterm>
4062 <indexterm role="concept">
4063 <primary>Sendmail compatibility</primary>
4064 <secondary><quote>From</quote> line</secondary>
4065 </indexterm>
4066 of the message must be as defined in RFC 2822, except that, for
4067 compatibility with Sendmail and Smail, a line in one of the forms
4068 </para>
4069 <literallayout class="monospaced">
4070 From sender Fri Jan  5 12:55 GMT 1997
4071 From sender Fri, 5 Jan 97 12:55:01
4072 </literallayout>
4073 <para>
4074 (with the weekday optional, and possibly with additional text after the date)
4075 is permitted to appear at the start of the message. There appears to be no
4076 authoritative specification of the format of this line. Exim recognizes it by
4077 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4078 option, which can be changed if necessary.
4079 </para>
4080 <para>
4081 <indexterm role="option">
4082 <primary><option>-f</option></primary>
4083 <secondary>overriding <quote>From</quote> line</secondary>
4084 </indexterm>
4085 The specified sender is treated as if it were given as the argument to the
4086 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4087 preference to the address taken from the message. The caller of Exim must be a
4088 trusted user for the sender of a message to be set in this way.
4089 </para>
4090 </listitem></varlistentry>
4091 <varlistentry>
4092 <term><option>-bnq</option></term>
4093 <listitem>
4094 <para>
4095 <indexterm role="option">
4096 <primary><option>-bnq</option></primary>
4097 </indexterm>
4098 <indexterm role="concept">
4099 <primary>address qualification, suppressing</primary>
4100 </indexterm>
4101 By default, Exim automatically qualifies unqualified addresses (those
4102 without domains) that appear in messages that are submitted locally (that
4103 is, not over TCP/IP). This qualification applies both to addresses in
4104 envelopes, and addresses in header lines. Sender addresses are qualified using
4105 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4106 defaults to the value of <option>qualify_domain</option>).
4107 </para>
4108 <para>
4109 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4110 being used to re-submit messages that originally came from remote hosts after
4111 content scanning, you probably do not want to qualify unqualified addresses in
4112 header lines. (Such lines will be present only if you have not enabled a header
4113 syntax check in the appropriate ACL.)
4114 </para>
4115 <para>
4116 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4117 messages that originate on the local host. When this is used, unqualified
4118 addresses in the envelope provoke errors (causing message rejection) and
4119 unqualified addresses in header lines are left alone.
4120 </para>
4121 </listitem></varlistentry>
4122 <varlistentry>
4123 <term><option>-bP</option></term>
4124 <listitem>
4125 <para>
4126 <indexterm role="option">
4127 <primary><option>-bP</option></primary>
4128 </indexterm>
4129 <indexterm role="concept">
4130 <primary>configuration options, extracting</primary>
4131 </indexterm>
4132 <indexterm role="concept">
4133 <primary>options</primary>
4134 <secondary>configuration &ndash; extracting</secondary>
4135 </indexterm>
4136 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4137 main configuration options to be written to the standard output. The values
4138 of one or more specific options can be requested by giving their names as
4139 arguments, for example:
4140 </para>
4141 <literallayout class="monospaced">
4142 exim -bP qualify_domain hold_domains
4143 </literallayout>
4144 <para>
4145 However, any option setting that is preceded by the word <quote>hide</quote> in the
4146 configuration file is not shown in full, except to an admin user. For other
4147 users, the output is as in this example:
4148 </para>
4149 <literallayout class="monospaced">
4150 mysql_servers = &lt;value not displayable&gt;
4151 </literallayout>
4152 <para>
4153 If <option>configure_file</option> is given as an argument, the name of the run time
4154 configuration file is output.
4155 If a list of configuration files was supplied, the value that is output here
4156 is the name of the file that was actually used.
4157 </para>
4158 <para>
4159 <indexterm role="concept">
4160 <primary>daemon</primary>
4161 <secondary>process id (pid)</secondary>
4162 </indexterm>
4163 <indexterm role="concept">
4164 <primary>pid (process id)</primary>
4165 <secondary>of daemon</secondary>
4166 </indexterm>
4167 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4168 directories where log files and daemon pid files are written are output,
4169 respectively. If these values are unset, log files are written in a
4170 sub-directory of the spool directory called <option>log</option>, and the pid file is
4171 written directly into the spool directory.
4172 </para>
4173 <para>
4174 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4175 </para>
4176 <literallayout class="monospaced">
4177 exim -bP +local_domains
4178 </literallayout>
4179 <para>
4180 it searches for a matching named list of any type (domain, host, address, or
4181 local part) and outputs what it finds.
4182 </para>
4183 <para>
4184 <indexterm role="concept">
4185 <primary>options</primary>
4186 <secondary>router &ndash; extracting</secondary>
4187 </indexterm>
4188 <indexterm role="concept">
4189 <primary>options</primary>
4190 <secondary>transport &ndash; extracting</secondary>
4191 </indexterm>
4192 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4193 followed by the name of an appropriate driver instance, the option settings for
4194 that driver are output. For example:
4195 </para>
4196 <literallayout class="monospaced">
4197 exim -bP transport local_delivery
4198 </literallayout>
4199 <para>
4200 The generic driver options are output first, followed by the driver&#x2019;s private
4201 options. A list of the names of drivers of a particular type can be obtained by
4202 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4203 <option>authenticator_list</option>, and a complete list of all drivers with their option
4204 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4205 <option>authenticators</option>.
4206 </para>
4207 </listitem></varlistentry>
4208 <varlistentry>
4209 <term><option>-bp</option></term>
4210 <listitem>
4211 <para>
4212 <indexterm role="option">
4213 <primary><option>-bp</option></primary>
4214 </indexterm>
4215 <indexterm role="concept">
4216 <primary>queue</primary>
4217 <secondary>listing messages on</secondary>
4218 </indexterm>
4219 <indexterm role="concept">
4220 <primary>listing</primary>
4221 <secondary>messages on the queue</secondary>
4222 </indexterm>
4223 This option requests a listing of the contents of the mail queue on the
4224 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4225 just those messages are listed. By default, this option can be used only by an
4226 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4227 to allow any user to see the queue.
4228 </para>
4229 <para>
4230 Each message on the queue is displayed as in the following example:
4231 </para>
4232 <literallayout class="monospaced">
4233 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4234           red.king@looking-glass.fict.example
4235           &lt;other addresses&gt;
4236 </literallayout>
4237 <para>
4238 <indexterm role="concept">
4239 <primary>message</primary>
4240 <secondary>size in queue listing</secondary>
4241 </indexterm>
4242 <indexterm role="concept">
4243 <primary>size</primary>
4244 <secondary>of message</secondary>
4245 </indexterm>
4246 The first line contains the length of time the message has been on the queue
4247 (in this case 25 minutes), the size of the message (2.9K), the unique local
4248 identifier for the message, and the message sender, as contained in the
4249 envelope. For bounce messages, the sender address is empty, and appears as
4250 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4251 the default sender address, the user&#x2019;s login name is shown in parentheses
4252 before the sender address.
4253 </para>
4254 <para>
4255 <indexterm role="concept">
4256 <primary>frozen messages</primary>
4257 <secondary>in queue listing</secondary>
4258 </indexterm>
4259 If the message is frozen (attempts to deliver it are suspended) then the text
4260 <quote>*** frozen ***</quote> is displayed at the end of this line.
4261 </para>
4262 <para>
4263 The recipients of the message (taken from the envelope, not the headers) are
4264 displayed on subsequent lines. Those addresses to which the message has already
4265 been delivered are marked with the letter D. If an original address gets
4266 expanded into several addresses via an alias or forward file, the original is
4267 displayed with a D only when deliveries for all of its child addresses are
4268 complete.
4269 </para>
4270 </listitem></varlistentry>
4271 <varlistentry>
4272 <term><option>-bpa</option></term>
4273 <listitem>
4274 <para>
4275 <indexterm role="option">
4276 <primary><option>-bpa</option></primary>
4277 </indexterm>
4278 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4279 that were generated from the original top level address(es) in each message by
4280 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4281 of just <quote>D</quote>.
4282 </para>
4283 </listitem></varlistentry>
4284 <varlistentry>
4285 <term><option>-bpc</option></term>
4286 <listitem>
4287 <para>
4288 <indexterm role="option">
4289 <primary><option>-bpc</option></primary>
4290 </indexterm>
4291 <indexterm role="concept">
4292 <primary>queue</primary>
4293 <secondary>count of messages on</secondary>
4294 </indexterm>
4295 This option counts the number of messages on the queue, and writes the total
4296 to the standard output. It is restricted to admin users, unless
4297 <option>queue_list_requires_admin</option> is set false.
4298 </para>
4299 </listitem></varlistentry>
4300 <varlistentry>
4301 <term><option>-bpr</option></term>
4302 <listitem>
4303 <para>
4304 <indexterm role="option">
4305 <primary><option>-bpr</option></primary>
4306 </indexterm>
4307 This option operates like <option>-bp</option>, but the output is not sorted into
4308 chronological order of message arrival. This can speed it up when there are
4309 lots of messages on the queue, and is particularly useful if the output is
4310 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4311 </para>
4312 </listitem></varlistentry>
4313 <varlistentry>
4314 <term><option>-bpra</option></term>
4315 <listitem>
4316 <para>
4317 <indexterm role="option">
4318 <primary><option>-bpra</option></primary>
4319 </indexterm>
4320 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4321 </para>
4322 </listitem></varlistentry>
4323 <varlistentry>
4324 <term><option>-bpru</option></term>
4325 <listitem>
4326 <para>
4327 <indexterm role="option">
4328 <primary><option>-bpru</option></primary>
4329 </indexterm>
4330 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4331 </para>
4332 </listitem></varlistentry>
4333 <varlistentry>
4334 <term><option>-bpu</option></term>
4335 <listitem>
4336 <para>
4337 <indexterm role="option">
4338 <primary><option>-bpu</option></primary>
4339 </indexterm>
4340 This option operates like <option>-bp</option> but shows only undelivered top-level
4341 addresses for each message displayed. Addresses generated by aliasing or
4342 forwarding are not shown, unless the message was deferred after processing by a
4343 router with the <option>one_time</option> option set.
4344 </para>
4345 </listitem></varlistentry>
4346 <varlistentry>
4347 <term><option>-brt</option></term>
4348 <listitem>
4349 <para>
4350 <indexterm role="option">
4351 <primary><option>-brt</option></primary>
4352 </indexterm>
4353 <indexterm role="concept">
4354 <primary>testing</primary>
4355 <secondary>retry configuration</secondary>
4356 </indexterm>
4357 <indexterm role="concept">
4358 <primary>retry</primary>
4359 <secondary>configuration testing</secondary>
4360 </indexterm>
4361 This option is for testing retry rules, and it must be followed by up to three
4362 arguments. It causes Exim to look for a retry rule that matches the values
4363 and to write it to the standard output. For example:
4364 </para>
4365 <literallayout class="monospaced">
4366 exim -brt bach.comp.mus.example
4367 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4368 </literallayout>
4369 <para>
4370 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4371 argument, which is required, can be a complete address in the form
4372 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4373 contains a dot, it is interpreted as an optional second domain name; if no
4374 retry rule is found for the first argument, the second is tried. This ties in
4375 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4376 rule is found that matches the host, one that matches the mail domain is
4377 sought. Finally, an argument that is the name of a specific delivery error, as
4378 used in setting up retry rules, can be given. For example:
4379 </para>
4380 <literallayout class="monospaced">
4381 exim -brt haydn.comp.mus.example quota_3d
4382 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4383 </literallayout>
4384 </listitem></varlistentry>
4385 <varlistentry>
4386 <term><option>-brw</option></term>
4387 <listitem>
4388 <para>
4389 <indexterm role="option">
4390 <primary><option>-brw</option></primary>
4391 </indexterm>
4392 <indexterm role="concept">
4393 <primary>testing</primary>
4394 <secondary>rewriting</secondary>
4395 </indexterm>
4396 <indexterm role="concept">
4397 <primary>rewriting</primary>
4398 <secondary>testing</secondary>
4399 </indexterm>
4400 This option is for testing address rewriting rules, and it must be followed by
4401 a single argument, consisting of either a local part without a domain, or a
4402 complete address with a fully qualified domain. Exim outputs how this address
4403 would be rewritten for each possible place it might appear. See chapter
4404 <xref linkend="CHAPrewrite"/> for further details.
4405 </para>
4406 </listitem></varlistentry>
4407 <varlistentry>
4408 <term><option>-bS</option></term>
4409 <listitem>
4410 <para>
4411 <indexterm role="option">
4412 <primary><option>-bS</option></primary>
4413 </indexterm>
4414 <indexterm role="concept">
4415 <primary>SMTP</primary>
4416 <secondary>batched incoming</secondary>
4417 </indexterm>
4418 <indexterm role="concept">
4419 <primary>batched SMTP input</primary>
4420 </indexterm>
4421 This option is used for batched SMTP input, which is an alternative interface
4422 for non-interactive local message submission. A number of messages can be
4423 submitted in a single run. However, despite its name, this is not really SMTP
4424 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4425 input, but generates no responses. If the caller is trusted, or
4426 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4427 believed; otherwise the sender is always the caller of Exim.
4428 </para>
4429 <para>
4430 The message itself is read from the standard input, in SMTP format (leading
4431 dots doubled), terminated by a line containing just a single dot. An error is
4432 provoked if the terminating dot is missing. A further message may then follow.
4433 </para>
4434 <para>
4435 As for other local message submissions, the contents of incoming batch SMTP
4436 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4437 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4438 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4439 </para>
4440 <para>
4441 Some other SMTP commands are recognized in the input. HELO and EHLO act
4442 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4443 QUIT quits, ignoring the rest of the standard input.
4444 </para>
4445 <para>
4446 <indexterm role="concept">
4447 <primary>return code</primary>
4448 <secondary>for <option>-bS</option></secondary>
4449 </indexterm>
4450 If any error is encountered, reports are written to the standard output and
4451 error streams, and Exim gives up immediately. The return code is 0 if no error
4452 was detected; it is 1 if one or more messages were accepted before the error
4453 was detected; otherwise it is 2.
4454 </para>
4455 <para>
4456 More details of input using batched SMTP are given in section
4457 <xref linkend="SECTincomingbatchedSMTP"/>.
4458 </para>
4459 </listitem></varlistentry>
4460 <varlistentry>
4461 <term><option>-bs</option></term>
4462 <listitem>
4463 <para>
4464 <indexterm role="option">
4465 <primary><option>-bs</option></primary>
4466 </indexterm>
4467 <indexterm role="concept">
4468 <primary>SMTP</primary>
4469 <secondary>local input</secondary>
4470 </indexterm>
4471 <indexterm role="concept">
4472 <primary>local SMTP input</primary>
4473 </indexterm>
4474 This option causes Exim to accept one or more messages by reading SMTP commands
4475 on the standard input, and producing SMTP replies on the standard output. SMTP
4476 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4477 Some user agents use this interface as a way of passing locally-generated
4478 messages to the MTA.
4479 </para>
4480 <para>
4481 In
4482 <indexterm role="concept">
4483 <primary>sender</primary>
4484 <secondary>source of</secondary>
4485 </indexterm>
4486 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4487 set, the senders of messages are taken from the SMTP MAIL commands.
4488 Otherwise the content of these commands is ignored and the sender is set up as
4489 the calling user. Unqualified addresses are automatically qualified using
4490 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4491 <option>-bnq</option> option is used.
4492 </para>
4493 <para>
4494 <indexterm role="concept">
4495 <primary>inetd</primary>
4496 </indexterm>
4497 The
4498 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4499 using a listening daemon. Exim can distinguish the two cases by checking
4500 whether the standard input is a TCP/IP socket. When Exim is called from
4501 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4502 above concerning senders and qualification do not apply. In this situation,
4503 Exim behaves in exactly the same way as it does when receiving a message via
4504 the listening daemon.
4505 </para>
4506 </listitem></varlistentry>
4507 <varlistentry>
4508 <term><option>-bt</option></term>
4509 <listitem>
4510 <para>
4511 <indexterm role="option">
4512 <primary><option>-bt</option></primary>
4513 </indexterm>
4514 <indexterm role="concept">
4515 <primary>testing</primary>
4516 <secondary>addresses</secondary>
4517 </indexterm>
4518 <indexterm role="concept">
4519 <primary>address</primary>
4520 <secondary>testing</secondary>
4521 </indexterm>
4522 This option runs Exim in address testing mode, in which each argument is taken
4523 as a <phrase revisionflag="changed">recipient</phrase> address to be tested for deliverability. The results are
4524 written to the standard output. If a test fails, and the caller is not an admin
4525 user, no details of the failure are output, because these might contain
4526 sensitive information such as usernames and passwords for database lookups.
4527 </para>
4528 <para>
4529 If no arguments are given, Exim runs in an interactive manner, prompting with a
4530 right angle bracket for addresses to be tested.
4531 </para>
4532 <para>
4533 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4534 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4535 security issues.
4536 </para>
4537 <para>
4538 Each address is handled as if it were the recipient address of a message
4539 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4540 written to the standard output. However, any router that has
4541 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4542 genuine routing tests if your first router passes everything to a scanner
4543 program.
4544 </para>
4545 <para>
4546 <indexterm role="concept">
4547 <primary>return code</primary>
4548 <secondary>for <option>-bt</option></secondary>
4549 </indexterm>
4550 The return code is 2 if any address failed outright; it is 1 if no address
4551 failed outright but at least one could not be resolved for some reason. Return
4552 code 0 is given only when all addresses succeed.
4553 </para>
4554 <para>
4555 <indexterm role="concept">
4556 <primary>duplicate addresses</primary>
4557 </indexterm>
4558 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4559 addresses after routing is complete, so that only one delivery takes place.
4560 This does not happen when testing with <option>-bt</option>; the full results of routing are
4561 always shown.
4562 </para>
4563 <para>
4564 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4565 routers in the configuration makes any tests on the sender address of a
4566 message,
4567 <indexterm role="option">
4568 <primary><option>-f</option></primary>
4569 <secondary>for address testing</secondary>
4570 </indexterm>
4571 you can use the <option>-f</option> option to set an appropriate sender when running
4572 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4573 default qualifying domain. However, if you have set up (for example) routers
4574 whose behaviour depends on the contents of an incoming message, you cannot test
4575 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4576 doing such tests.
4577 </para>
4578 </listitem></varlistentry>
4579 <varlistentry>
4580 <term><option>-bV</option></term>
4581 <listitem>
4582 <para>
4583 <indexterm role="option">
4584 <primary><option>-bV</option></primary>
4585 </indexterm>
4586 <indexterm role="concept">
4587 <primary>version number of Exim</primary>
4588 </indexterm>
4589 This option causes Exim to write the current version number, compilation
4590 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4591 It also lists the DBM library this is being used, the optional modules (such as
4592 specific lookup types), the drivers that are included in the binary, and the
4593 name of the run time configuration file that is in use.
4594 </para>
4595 <para>
4596 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4597 configuration file. However, this is a static check only. It cannot check
4598 values that are to be expanded. For example, although a misspelt ACL verb is
4599 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4600 alone to discover (for example) all the typos in the configuration; some
4601 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4602 dynamic testing facilities.
4603 </para>
4604 </listitem></varlistentry>
4605 <varlistentry>
4606 <term><option>-bv</option></term>
4607 <listitem>
4608 <para>
4609 <indexterm role="option">
4610 <primary><option>-bv</option></primary>
4611 </indexterm>
4612 <indexterm role="concept">
4613 <primary>verifying address</primary>
4614 <secondary>using <option>-bv</option></secondary>
4615 </indexterm>
4616 <indexterm role="concept">
4617 <primary>address</primary>
4618 <secondary>verification</secondary>
4619 </indexterm>
4620 This option runs Exim in address verification mode, in which each argument is
4621 taken as a <phrase revisionflag="changed">recipient</phrase> address to be verified by the routers. (This does
4622 not involve any verification callouts). During normal operation, verification
4623 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4624 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4625 including callouts, 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. Without <option>-v</option>, generating more than one address by redirection
4652 causes verification to end successfully, without considering the generated
4653 addresses. However, if just one address is generated, processing continues,
4654 and the generated address must verify successfully for the overall verification
4655 to succeed.
4656 </para>
4657 <para>
4658 When <option>-v</option> is set, more details are given of how the address has been handled,
4659 and in the case of address redirection, all the generated addresses are also
4660 considered. Verification may succeed for some and fail for others.
4661 </para>
4662 <para>
4663 The
4664 <indexterm role="concept">
4665 <primary>return code</primary>
4666 <secondary>for <option>-bv</option></secondary>
4667 </indexterm>
4668 return code is 2 if any address failed outright; it is 1 if no address
4669 failed outright but at least one could not be resolved for some reason. Return
4670 code 0 is given only when all addresses succeed.
4671 </para>
4672 <para>
4673 If any of the routers in the configuration makes any tests on the sender
4674 address of a message, you should use the <option>-f</option> option to set an appropriate
4675 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4676 calling user at the default qualifying domain.
4677 </para>
4678 </listitem></varlistentry>
4679 <varlistentry>
4680 <term><option>-bvs</option></term>
4681 <listitem>
4682 <para>
4683 <indexterm role="option">
4684 <primary><option>-bvs</option></primary>
4685 </indexterm>
4686 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4687 than a recipient address. This affects any rewriting and qualification that
4688 might happen.
4689 </para>
4690 </listitem></varlistentry>
4691 <varlistentry>
4692 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
4693 <listitem>
4694 <para>
4695 <indexterm role="option">
4696 <primary><option>-C</option></primary>
4697 </indexterm>
4698 <indexterm role="concept">
4699 <primary>configuration file</primary>
4700 <secondary>alternate</secondary>
4701 </indexterm>
4702 <indexterm role="concept">
4703 <primary>CONFIGURE_FILE</primary>
4704 </indexterm>
4705 <indexterm role="concept">
4706 <primary>alternate configuration file</primary>
4707 </indexterm>
4708 This option causes Exim to find the run time configuration file from the given
4709 list instead of from the list specified by the CONFIGURE_FILE
4710 compile-time setting. Usually, the list will consist of just a single file
4711 name, but it can be a colon-separated list of names. In this case, the first
4712 file that exists is used. Failure to open an existing file stops Exim from
4713 proceeding any further along the list, and an error is generated.
4714 </para>
4715 <para>
4716 When this option is used by a caller other than root or the Exim user, and the
4717 list is different from the compiled-in list, Exim gives up its root privilege
4718 immediately, and runs with the real and effective uid and gid set to those of
4719 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4720 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4721 Exim is root.
4722 </para>
4723 <para>
4724 That is, the Exim user is no longer privileged in this regard. This build-time
4725 option is not set by default in the Exim source distribution tarbundle.
4726 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4727 the packagers might have enabled it.
4728 </para>
4729 <para>
4730 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4731 configuration using <option>-C</option> right through message reception and delivery, even
4732 if the caller is root. The reception works, but by that time, Exim is running
4733 as the Exim user, so when it re-executes to regain privilege for the delivery,
4734 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4735 and delivery using two separate commands (one to put a message on the queue,
4736 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4737 </para>
4738 <para>
4739 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4740 prefix string with which any file named in a <option>-C</option> command line option
4741 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4742 However, if the value of the <option>-C</option> option is identical to the value of
4743 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4744 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4745 unset, any file name can be used with <option>-C</option>.
4746 </para>
4747 <para>
4748 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4749 to a directory to which only root has access. This prevents someone who has
4750 broken into the Exim account from running a privileged Exim with an arbitrary
4751 configuration file.
4752 </para>
4753 <para>
4754 The <option>-C</option> facility is useful for ensuring that configuration files are
4755 syntactically correct, but cannot be used for test deliveries, unless the
4756 caller is privileged, or unless it is an exotic configuration that does not
4757 require privilege. No check is made on the owner or group of the files
4758 specified by this option.
4759 </para>
4760 </listitem></varlistentry>
4761 <varlistentry>
4762 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
4763 <listitem>
4764 <para>
4765 <indexterm role="option">
4766 <primary><option>-D</option></primary>
4767 </indexterm>
4768 <indexterm role="concept">
4769 <primary>macro</primary>
4770 <secondary>setting on command line</secondary>
4771 </indexterm>
4772 This option can be used to override macro definitions in the configuration file
4773 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4774 unprivileged caller, it causes Exim to give up its root privilege.
4775 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4776 completely disabled, and its use causes an immediate error exit.
4777 </para>
4778 <para>
4779 The entire option (including equals sign if present) must all be within one
4780 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4781 string, in which case the equals sign is optional. These two commands are
4782 synonymous:
4783 </para>
4784 <literallayout class="monospaced">
4785 exim -DABC  ...
4786 exim -DABC= ...
4787 </literallayout>
4788 <para>
4789 To include spaces in a macro definition item, quotes must be used. If you use
4790 quotes, spaces are permitted around the macro name and the equals sign. For
4791 example:
4792 </para>
4793 <literallayout class="monospaced">
4794 exim '-D ABC = something' ...
4795 </literallayout>
4796 <para>
4797 <option>-D</option> may be repeated up to 10 times on a command line.
4798 </para>
4799 </listitem></varlistentry>
4800 <varlistentry>
4801 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4802 <listitem>
4803 <para>
4804 <indexterm role="option">
4805 <primary><option>-d</option></primary>
4806 </indexterm>
4807 <indexterm role="concept">
4808 <primary>debugging</primary>
4809 <secondary>list of selectors</secondary>
4810 </indexterm>
4811 <indexterm role="concept">
4812 <primary>debugging</primary>
4813 <secondary><option>-d</option> option</secondary>
4814 </indexterm>
4815 This option causes debugging information to be written to the standard
4816 error stream. It is restricted to admin users because debugging output may show
4817 database queries that contain password information. Also, the details of users&#x2019;
4818 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
4819 writes an error message to the standard error stream and exits with a non-zero
4820 return code.
4821 </para>
4822 <para>
4823 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4824 standard debugging data is output. This can be reduced, or increased to include
4825 some more rarely needed information, by directly following <option>-d</option> with a string
4826 made up of names preceded by plus or minus characters. These add or remove sets
4827 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4828 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4829 no spaces are allowed in the debug setting. The available debugging categories
4830 are:
4831 </para>
4832 <literallayout>
4833 <literal>acl            </literal> ACL interpretation
4834 <literal>auth           </literal> authenticators
4835 <literal>deliver        </literal> general delivery logic
4836 <literal>dns            </literal> DNS lookups (see also resolver)
4837 <literal>dnsbl          </literal> DNS black list (aka RBL) code
4838 <literal>exec           </literal> arguments for <function>execv()</function> calls
4839 <literal>expand         </literal> detailed debugging for string expansions
4840 <literal>filter         </literal> filter handling
4841 <literal>hints_lookup   </literal> hints data lookups
4842 <literal>host_lookup    </literal> all types of name-to-IP address handling
4843 <literal>ident          </literal> ident lookup
4844 <literal>interface      </literal> lists of local interfaces
4845 <literal>lists          </literal> matching things in lists
4846 <literal>load           </literal> system load checks
4847 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4848 <literal>lookup         </literal> general lookup code and all lookups
4849 <literal>memory         </literal> memory handling
4850 <literal>pid            </literal> add pid to debug output lines
4851 <literal>process_info   </literal> setting info for the process log
4852 <literal>queue_run      </literal> queue runs
4853 <literal>receive        </literal> general message reception logic
4854 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
4855 <literal>retry          </literal> retry handling
4856 <literal>rewrite        </literal> address rewriting
4857 <literal>route          </literal> address routing
4858 <literal>timestamp      </literal> add timestamp to debug output lines
4859 <literal>tls            </literal> TLS logic
4860 <literal>transport      </literal> transports
4861 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
4862 <literal>verify         </literal> address verification logic
4863 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
4864 </literallayout>
4865 <para>
4866 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4867 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4868 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4869 is included, an awful lot of output that is very rarely of interest is
4870 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4871 turn everything off.
4872 </para>
4873 <para>
4874 <indexterm role="concept">
4875 <primary>resolver, debugging output</primary>
4876 </indexterm>
4877 <indexterm role="concept">
4878 <primary>DNS resolver, debugging output</primary>
4879 </indexterm>
4880 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4881 with DEBUG enabled. This is not the case in some operating systems. Also,
4882 unfortunately, debugging output from the DNS resolver is written to stdout
4883 rather than stderr.
4884 </para>
4885 <para>
4886 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4887 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4888 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4889 daemon, which then passes it on to any re-executed Exims. Exim also
4890 automatically adds the pid to debug lines when several remote deliveries are
4891 run in parallel.
4892 </para>
4893 <para>
4894 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4895 of all debug output lines. This can be useful when trying to track down delays
4896 in processing.
4897 </para>
4898 <para>
4899 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4900 any debugging is selected, or if <option>-v</option> is used.
4901 </para>
4902 </listitem></varlistentry>
4903 <varlistentry>
4904 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4905 <listitem>
4906 <para>
4907 <indexterm role="option">
4908 <primary><option>-dd</option></primary>
4909 </indexterm>
4910 This option behaves exactly like <option>-d</option> except when used on a command that
4911 starts a daemon process. In that case, debugging is turned off for the
4912 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4913 behaviour of the daemon without creating as much output as full debugging does.
4914 </para>
4915 </listitem></varlistentry>
4916 <varlistentry>
4917 <term><option>-dropcr</option></term>
4918 <listitem>
4919 <para>
4920 <indexterm role="option">
4921 <primary><option>-dropcr</option></primary>
4922 </indexterm>
4923 This is an obsolete option that is now a no-op. It used to affect the way Exim
4924 handled CR and LF characters in incoming messages. What happens now is
4925 described in section <xref linkend="SECTlineendings"/>.
4926 </para>
4927 </listitem></varlistentry>
4928 <varlistentry>
4929 <term><option>-E</option></term>
4930 <listitem>
4931 <para>
4932 <indexterm role="option">
4933 <primary><option>-E</option></primary>
4934 </indexterm>
4935 <indexterm role="concept">
4936 <primary>bounce message</primary>
4937 <secondary>generating</secondary>
4938 </indexterm>
4939 This option specifies that an incoming message is a locally-generated delivery
4940 failure report. It is used internally by Exim when handling delivery failures
4941 and is not intended for external use. Its only effect is to stop Exim
4942 generating certain messages to the postmaster, as otherwise message cascades
4943 could occur in some situations. As part of the same option, a message id may
4944 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4945 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4946 </para>
4947 </listitem></varlistentry>
4948 <varlistentry>
4949 <term><option>-e</option><emphasis>x</emphasis></term>
4950 <listitem>
4951 <para>
4952 <indexterm role="option">
4953 <primary><option>-e</option><emphasis>x</emphasis></primary>
4954 </indexterm>
4955 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4956 called by various programs without the leading <option>o</option> in the option. For
4957 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4958 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
4959 </para>
4960 </listitem></varlistentry>
4961 <varlistentry>
4962 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
4963 <listitem>
4964 <para>
4965 <indexterm role="option">
4966 <primary><option>-F</option></primary>
4967 </indexterm>
4968 <indexterm role="concept">
4969 <primary>sender</primary>
4970 <secondary>name</secondary>
4971 </indexterm>
4972 <indexterm role="concept">
4973 <primary>name</primary>
4974 <secondary>of sender</secondary>
4975 </indexterm>
4976 This option sets the sender&#x2019;s full name for use when a locally-generated
4977 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
4978 entry from the password data is used. As users are generally permitted to alter
4979 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
4980 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
4981 </para>
4982 </listitem></varlistentry>
4983 <varlistentry>
4984 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
4985 <listitem>
4986 <para>
4987 <indexterm role="option">
4988 <primary><option>-f</option></primary>
4989 </indexterm>
4990 <indexterm role="concept">
4991 <primary>sender</primary>
4992 <secondary>address</secondary>
4993 </indexterm>
4994 <indexterm role="concept">
4995 <primary>address</primary>
4996 <secondary>sender</secondary>
4997 </indexterm>
4998 <indexterm role="concept">
4999 <primary>trusted users</primary>
5000 </indexterm>
5001 <indexterm role="concept">
5002 <primary>envelope sender</primary>
5003 </indexterm>
5004 <indexterm role="concept">
5005 <primary>user</primary>
5006 <secondary>trusted</secondary>
5007 </indexterm>
5008 This option sets the address of the envelope sender of a locally-generated
5009 message (also known as the return path). The option can normally be used only
5010 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5011 users to use it.
5012 </para>
5013 <para>
5014 Processes running as root or the Exim user are always trusted. Other
5015 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5016 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5017 of a local message is set to the caller&#x2019;s login name at the default qualify
5018 domain.
5019 </para>
5020 <para>
5021 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5022 can be specified by any user, trusted or not, to create a message that can
5023 never provoke a bounce. An empty sender can be specified either as an empty
5024 string, or as a pair of angle brackets with nothing between them, as in these
5025 examples of shell commands:
5026 </para>
5027 <literallayout class="monospaced">
5028 exim -f '&lt;&gt;' user@domain
5029 exim -f "" user@domain
5030 </literallayout>
5031 <para>
5032 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5033 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5034 <option>-bv</option> options.
5035 </para>
5036 <para>
5037 Allowing untrusted users to change the sender address does not of itself make
5038 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5039 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5040 though this can be overridden by setting <option>no_local_from_check</option>.
5041 </para>
5042 <para>
5043 White
5044 <indexterm role="concept">
5045 <primary><quote>From</quote> line</primary>
5046 </indexterm>
5047 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5048 given as two arguments or one combined argument). The sender of a
5049 locally-generated message can also be set (when permitted) by an initial
5050 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5051 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5052 </para>
5053 </listitem></varlistentry>
5054 <varlistentry>
5055 <term><option>-G</option></term>
5056 <listitem>
5057 <para>
5058 <indexterm role="option">
5059 <primary><option>-G</option></primary>
5060 </indexterm>
5061 <indexterm role="concept">
5062 <primary>Sendmail compatibility</primary>
5063 <secondary><option>-G</option> option ignored</secondary>
5064 </indexterm>
5065 This is a Sendmail option which is ignored by Exim.
5066 </para>
5067 </listitem></varlistentry>
5068 <varlistentry>
5069 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5070 <listitem>
5071 <para>
5072 <indexterm role="option">
5073 <primary><option>-h</option></primary>
5074 </indexterm>
5075 <indexterm role="concept">
5076 <primary>Sendmail compatibility</primary>
5077 <secondary><option>-h</option> option ignored</secondary>
5078 </indexterm>
5079 This option is accepted for compatibility with Sendmail, but has no effect. (In
5080 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5081 headers.)
5082 </para>
5083 </listitem></varlistentry>
5084 <varlistentry>
5085 <term><option>-i</option></term>
5086 <listitem>
5087 <para>
5088 <indexterm role="option">
5089 <primary><option>-i</option></primary>
5090 </indexterm>
5091 <indexterm role="concept">
5092 <primary>Solaris</primary>
5093 <secondary><emphasis>mail</emphasis> command</secondary>
5094 </indexterm>
5095 <indexterm role="concept">
5096 <primary>dot</primary>
5097 <secondary>in incoming non-SMTP message</secondary>
5098 </indexterm>
5099 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5100 line by itself should not terminate an incoming, non-SMTP message. I can find
5101 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5102 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5103 </para>
5104 </listitem></varlistentry>
5105 <varlistentry>
5106 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5107 <listitem>
5108 <para>
5109 <indexterm role="option">
5110 <primary><option>-M</option></primary>
5111 </indexterm>
5112 <indexterm role="concept">
5113 <primary>forcing delivery</primary>
5114 </indexterm>
5115 <indexterm role="concept">
5116 <primary>delivery</primary>
5117 <secondary>forcing attempt</secondary>
5118 </indexterm>
5119 <indexterm role="concept">
5120 <primary>frozen messages</primary>
5121 <secondary>forcing delivery</secondary>
5122 </indexterm>
5123 This option requests Exim to run a delivery attempt on each message in turn. If
5124 any of the messages are frozen, they are automatically thawed before the
5125 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5126 and <option>hold_domains</option> are ignored.
5127 </para>
5128 <para>
5129 Retry
5130 <indexterm role="concept">
5131 <primary>hints database</primary>
5132 <secondary>overriding retry hints</secondary>
5133 </indexterm>
5134 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5135 the normal retry time has not yet been reached. This option requires the caller
5136 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5137 which can be set false to relax this restriction (and also the same requirement
5138 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5139 </para>
5140 <para>
5141 The deliveries happen synchronously, that is, the original Exim process does
5142 not terminate until all the delivery attempts have finished. No output is
5143 produced unless there is a serious error. If you want to see what is happening,
5144 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5145 </para>
5146 </listitem></varlistentry>
5147 <varlistentry>
5148 <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>
5149 <listitem>
5150 <para>
5151 <indexterm role="option">
5152 <primary><option>-Mar</option></primary>
5153 </indexterm>
5154 <indexterm role="concept">
5155 <primary>message</primary>
5156 <secondary>adding recipients</secondary>
5157 </indexterm>
5158 <indexterm role="concept">
5159 <primary>recipient</primary>
5160 <secondary>adding</secondary>
5161 </indexterm>
5162 This option requests Exim to add the addresses to the list of recipients of the
5163 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5164 id, and the remaining ones must be email addresses. However, if the message is
5165 active (in the middle of a delivery attempt), it is not altered. This option
5166 can be used only by an admin user.
5167 </para>
5168 </listitem></varlistentry>
5169 <varlistentry>
5170 <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>
5171 <listitem>
5172 <para>
5173 <indexterm role="option">
5174 <primary><option>-MC</option></primary>
5175 </indexterm>
5176 <indexterm role="concept">
5177 <primary>SMTP</primary>
5178 <secondary>passed connection</secondary>
5179 </indexterm>
5180 <indexterm role="concept">
5181 <primary>SMTP</primary>
5182 <secondary>multiple deliveries</secondary>
5183 </indexterm>
5184 <indexterm role="concept">
5185 <primary>multiple SMTP deliveries</primary>
5186 </indexterm>
5187 This option is not intended for use by external callers. It is used internally
5188 by Exim to invoke another instance of itself to deliver a waiting message using
5189 an existing SMTP connection, which is passed as the standard input. Details are
5190 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5191 must be root or the Exim user in order to use it.
5192 </para>
5193 </listitem></varlistentry>
5194 <varlistentry>
5195 <term><option>-MCA</option></term>
5196 <listitem>
5197 <para>
5198 <indexterm role="option">
5199 <primary><option>-MCA</option></primary>
5200 </indexterm>
5201 This option is not intended for use by external callers. It is used internally
5202 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5203 connection to the remote host has been authenticated.
5204 </para>
5205 </listitem></varlistentry>
5206 <varlistentry>
5207 <term><option>-MCP</option></term>
5208 <listitem>
5209 <para>
5210 <indexterm role="option">
5211 <primary><option>-MCP</option></primary>
5212 </indexterm>
5213 This option is not intended for use by external callers. It is used internally
5214 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5215 which Exim is connected supports pipelining.
5216 </para>
5217 </listitem></varlistentry>
5218 <varlistentry>
5219 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5220 <listitem>
5221 <para>
5222 <indexterm role="option">
5223 <primary><option>-MCQ</option></primary>
5224 </indexterm>
5225 This option is not intended for use by external callers. It is used internally
5226 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5227 started by a queue runner. It passes on the process id of the queue runner,
5228 together with the file descriptor number of an open pipe. Closure of the pipe
5229 signals the final completion of the sequence of processes that are passing
5230 messages through the same SMTP connection.
5231 </para>
5232 </listitem></varlistentry>
5233 <varlistentry>
5234 <term><option>-MCS</option></term>
5235 <listitem>
5236 <para>
5237 <indexterm role="option">
5238 <primary><option>-MCS</option></primary>
5239 </indexterm>
5240 This option is not intended for use by external callers. It is used internally
5241 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5242 SMTP SIZE option should be used on messages delivered down the existing
5243 connection.
5244 </para>
5245 </listitem></varlistentry>
5246 <varlistentry>
5247 <term><option>-MCT</option></term>
5248 <listitem>
5249 <para>
5250 <indexterm role="option">
5251 <primary><option>-MCT</option></primary>
5252 </indexterm>
5253 This option is not intended for use by external callers. It is used internally
5254 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5255 host to which Exim is connected supports TLS encryption.
5256 </para>
5257 </listitem></varlistentry>
5258 <varlistentry>
5259 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5260 <listitem>
5261 <para>
5262 <indexterm role="option">
5263 <primary><option>-Mc</option></primary>
5264 </indexterm>
5265 <indexterm role="concept">
5266 <primary>hints database</primary>
5267 <secondary>not overridden by <option>-Mc</option></secondary>
5268 </indexterm>
5269 <indexterm role="concept">
5270 <primary>delivery</primary>
5271 <secondary>manually started &ndash; not forced</secondary>
5272 </indexterm>
5273 This option requests Exim to run a delivery attempt on each message in turn,
5274 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5275 that are found. This option is not very useful to external callers. It is
5276 provided mainly for internal use by Exim when it needs to re-invoke itself in
5277 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5278 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5279 respects retry times and other options such as <option>hold_domains</option> that are
5280 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5281 If you want to run a specific delivery as if in a queue run, you should use
5282 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5283 and other deliveries is made in one or two places.
5284 </para>
5285 </listitem></varlistentry>
5286 <varlistentry>
5287 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5288 <listitem>
5289 <para>
5290 <indexterm role="option">
5291 <primary><option>-Mes</option></primary>
5292 </indexterm>
5293 <indexterm role="concept">
5294 <primary>message</primary>
5295 <secondary>changing sender</secondary>
5296 </indexterm>
5297 <indexterm role="concept">
5298 <primary>sender</primary>
5299 <secondary>changing</secondary>
5300 </indexterm>
5301 This option requests Exim to change the sender address in the message to the
5302 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5303 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5304 be a message id, and the second one an email address. However, if the message
5305 is active (in the middle of a delivery attempt), its status is not altered.
5306 This option can be used only by an admin user.
5307 </para>
5308 </listitem></varlistentry>
5309 <varlistentry>
5310 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5311 <listitem>
5312 <para>
5313 <indexterm role="option">
5314 <primary><option>-Mf</option></primary>
5315 </indexterm>
5316 <indexterm role="concept">
5317 <primary>freezing messages</primary>
5318 </indexterm>
5319 <indexterm role="concept">
5320 <primary>message</primary>
5321 <secondary>manually freezing</secondary>
5322 </indexterm>
5323 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5324 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5325 either manually or as a result of the <option>auto_thaw</option> configuration option.
5326 However, if any of the messages are active (in the middle of a delivery
5327 attempt), their status is not altered. This option can be used only by an admin
5328 user.
5329 </para>
5330 </listitem></varlistentry>
5331 <varlistentry>
5332 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5333 <listitem>
5334 <para>
5335 <indexterm role="option">
5336 <primary><option>-Mg</option></primary>
5337 </indexterm>
5338 <indexterm role="concept">
5339 <primary>giving up on messages</primary>
5340 </indexterm>
5341 <indexterm role="concept">
5342 <primary>message</primary>
5343 <secondary>abandoning delivery attempts</secondary>
5344 </indexterm>
5345 <indexterm role="concept">
5346 <primary>delivery</primary>
5347 <secondary>abandoning further attempts</secondary>
5348 </indexterm>
5349 This option requests Exim to give up trying to deliver the listed messages,
5350 including any that are frozen. However, if any of the messages are active,
5351 their status is not altered. For non-bounce messages, a delivery error message
5352 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5353 Bounce messages are just discarded. This option can be used only by an admin
5354 user.
5355 </para>
5356 </listitem></varlistentry>
5357 <varlistentry>
5358 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5359 <listitem>
5360 <para>
5361 <indexterm role="option">
5362 <primary><option>-Mmad</option></primary>
5363 </indexterm>
5364 <indexterm role="concept">
5365 <primary>delivery</primary>
5366 <secondary>cancelling all</secondary>
5367 </indexterm>
5368 This option requests Exim to mark all the recipient addresses in the messages
5369 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5370 message is active (in the middle of a delivery attempt), its status is not
5371 altered. This option can be used only by an admin user.
5372 </para>
5373 </listitem></varlistentry>
5374 <varlistentry>
5375 <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>
5376 <listitem>
5377 <para>
5378 <indexterm role="option">
5379 <primary><option>-Mmd</option></primary>
5380 </indexterm>
5381 <indexterm role="concept">
5382 <primary>delivery</primary>
5383 <secondary>cancelling by address</secondary>
5384 </indexterm>
5385 <indexterm role="concept">
5386 <primary>recipient</primary>
5387 <secondary>removing</secondary>
5388 </indexterm>
5389 <indexterm role="concept">
5390 <primary>removing recipients</primary>
5391 </indexterm>
5392 This option requests Exim to mark the given addresses as already delivered
5393 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5394 the remaining ones must be email addresses. These are matched to recipient
5395 addresses in the message in a case-sensitive manner. If the message is active
5396 (in the middle of a delivery attempt), its status is not altered. This option
5397 can be used only by an admin user.
5398 </para>
5399 </listitem></varlistentry>
5400 <varlistentry>
5401 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5402 <listitem>
5403 <para>
5404 <indexterm role="option">
5405 <primary><option>-Mrm</option></primary>
5406 </indexterm>
5407 <indexterm role="concept">
5408 <primary>removing messages</primary>
5409 </indexterm>
5410 <indexterm role="concept">
5411 <primary>abandoning mail</primary>
5412 </indexterm>
5413 <indexterm role="concept">
5414 <primary>message</primary>
5415 <secondary>manually discarding</secondary>
5416 </indexterm>
5417 This option requests Exim to remove the given messages from the queue. No
5418 bounce messages are sent; each message is simply forgotten. However, if any of
5419 the messages are active, their status is not altered. This option can be used
5420 only by an admin user or by the user who originally caused the message to be
5421 placed on the queue.
5422 </para>
5423 </listitem></varlistentry>
5424 <varlistentry>
5425 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5426 <listitem>
5427 <para>
5428 <indexterm role="option">
5429 <primary><option>-Mset</option></primary>
5430 </indexterm>
5431 <indexterm role="concept">
5432 <primary>testing</primary>
5433 <secondary>string expansion</secondary>
5434 </indexterm>
5435 <indexterm role="concept">
5436 <primary>expansion</primary>
5437 <secondary>testing</secondary>
5438 </indexterm>
5439 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5440 string expansions). Exim loads the given message from its spool before doing
5441 the test expansions, thus setting message-specific variables such as
5442 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5443 available. This feature is provided to make it easier to test expansions that
5444 make use of these variables. However, this option can be used only by an admin
5445 user. See also <option>-bem</option>.
5446 </para>
5447 </listitem></varlistentry>
5448 <varlistentry>
5449 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5450 <listitem>
5451 <para>
5452 <indexterm role="option">
5453 <primary><option>-Mt</option></primary>
5454 </indexterm>
5455 <indexterm role="concept">
5456 <primary>thawing messages</primary>
5457 </indexterm>
5458 <indexterm role="concept">
5459 <primary>unfreezing messages</primary>
5460 </indexterm>
5461 <indexterm role="concept">
5462 <primary>frozen messages</primary>
5463 <secondary>thawing</secondary>
5464 </indexterm>
5465 <indexterm role="concept">
5466 <primary>message</primary>
5467 <secondary>thawing frozen</secondary>
5468 </indexterm>
5469 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5470 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5471 messages are active, their status is not altered. This option can be used only
5472 by an admin user.
5473 </para>
5474 </listitem></varlistentry>
5475 <varlistentry>
5476 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5477 <listitem>
5478 <para>
5479 <indexterm role="option">
5480 <primary><option>-Mvb</option></primary>
5481 </indexterm>
5482 <indexterm role="concept">
5483 <primary>listing</primary>
5484 <secondary>message body</secondary>
5485 </indexterm>
5486 <indexterm role="concept">
5487 <primary>message</primary>
5488 <secondary>listing body of</secondary>
5489 </indexterm>
5490 This option causes the contents of the message body (-D) spool file to be
5491 written to the standard output. This option can be used only by an admin user.
5492 </para>
5493 </listitem></varlistentry>
5494 <varlistentry>
5495 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5496 <listitem>
5497 <para>
5498 <indexterm role="option">
5499 <primary><option>-Mvh</option></primary>
5500 </indexterm>
5501 <indexterm role="concept">
5502 <primary>listing</primary>
5503 <secondary>message headers</secondary>
5504 </indexterm>
5505 <indexterm role="concept">
5506 <primary>header lines</primary>
5507 <secondary>listing</secondary>
5508 </indexterm>
5509 <indexterm role="concept">
5510 <primary>message</primary>
5511 <secondary>listing header lines</secondary>
5512 </indexterm>
5513 This option causes the contents of the message headers (-H) spool file to be
5514 written to the standard output. This option can be used only by an admin user.
5515 </para>
5516 </listitem></varlistentry>
5517 <varlistentry>
5518 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5519 <listitem>
5520 <para>
5521 <indexterm role="option">
5522 <primary><option>-Mvl</option></primary>
5523 </indexterm>
5524 <indexterm role="concept">
5525 <primary>listing</primary>
5526 <secondary>message log</secondary>
5527 </indexterm>
5528 <indexterm role="concept">
5529 <primary>message</primary>
5530 <secondary>listing message log</secondary>
5531 </indexterm>
5532 This option causes the contents of the message log spool file to be written to
5533 the standard output. This option can be used only by an admin user.
5534 </para>
5535 </listitem></varlistentry>
5536 <varlistentry>
5537 <term><option>-m</option></term>
5538 <listitem>
5539 <para>
5540 <indexterm role="option">
5541 <primary><option>-m</option></primary>
5542 </indexterm>
5543 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5544 treats it that way too.
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>debugging</primary>
5556 <secondary><option>-N</option> option</secondary>
5557 </indexterm>
5558 <indexterm role="concept">
5559 <primary>debugging</primary>
5560 <secondary>suppressing delivery</secondary>
5561 </indexterm>
5562 This is a debugging option that inhibits delivery of a message at the transport
5563 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5564 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5565 had successfully done so. However, it does not make any updates to the retry
5566 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5567 than <quote>=&gt;</quote>.
5568 </para>
5569 <para>
5570 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5571 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5572 words, an ordinary user can use it only when supplying an incoming message to
5573 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5574 address may be deferred because of a configuration problem on a transport, or a
5575 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5576 the message, and applies to any subsequent delivery attempts that may happen
5577 for that message.
5578 </para>
5579 </listitem></varlistentry>
5580 <varlistentry>
5581 <term><option>-n</option></term>
5582 <listitem>
5583 <para>
5584 <indexterm role="option">
5585 <primary><option>-n</option></primary>
5586 </indexterm>
5587 <indexterm role="concept">
5588 <primary>Sendmail compatibility</primary>
5589 <secondary><option>-n</option> option ignored</secondary>
5590 </indexterm>
5591 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5592 by Exim.
5593 </para>
5594 </listitem></varlistentry>
5595 <varlistentry>
5596 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5597 <listitem>
5598 <para>
5599 <indexterm role="option">
5600 <primary><option>-O</option></primary>
5601 </indexterm>
5602 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5603 Exim.
5604 </para>
5605 </listitem></varlistentry>
5606 <varlistentry>
5607 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5608 <listitem>
5609 <para>
5610 <indexterm role="option">
5611 <primary><option>-oA</option></primary>
5612 </indexterm>
5613 <indexterm role="concept">
5614 <primary>Sendmail compatibility</primary>
5615 <secondary><option>-oA</option> option</secondary>
5616 </indexterm>
5617 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5618 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5619 description above.
5620 </para>
5621 </listitem></varlistentry>
5622 <varlistentry>
5623 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5624 <listitem>
5625 <para>
5626 <indexterm role="option">
5627 <primary><option>-oB</option></primary>
5628 </indexterm>
5629 <indexterm role="concept">
5630 <primary>SMTP</primary>
5631 <secondary>passed connection</secondary>
5632 </indexterm>
5633 <indexterm role="concept">
5634 <primary>SMTP</primary>
5635 <secondary>multiple deliveries</secondary>
5636 </indexterm>
5637 <indexterm role="concept">
5638 <primary>multiple SMTP deliveries</primary>
5639 </indexterm>
5640 This is a debugging option which limits the maximum number of messages that can
5641 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5642 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
5643 </para>
5644 </listitem></varlistentry>
5645 <varlistentry>
5646 <term><option>-odb</option></term>
5647 <listitem>
5648 <para>
5649 <indexterm role="option">
5650 <primary><option>-odb</option></primary>
5651 </indexterm>
5652 <indexterm role="concept">
5653 <primary>background delivery</primary>
5654 </indexterm>
5655 <indexterm role="concept">
5656 <primary>delivery</primary>
5657 <secondary>in the background</secondary>
5658 </indexterm>
5659 This option applies to all modes in which Exim accepts incoming messages,
5660 including the listening daemon. It requests <quote>background</quote> delivery of such
5661 messages, which means that the accepting process automatically starts a
5662 delivery process for each message received, but does not wait for the delivery
5663 processes to finish.
5664 </para>
5665 <para>
5666 When all the messages have been received, the reception process exits,
5667 leaving the delivery processes to finish in their own time. The standard output
5668 and error streams are closed at the start of each delivery process.
5669 This is the default action if none of the <option>-od</option> options are present.
5670 </para>
5671 <para>
5672 If one of the queueing options in the configuration file
5673 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5674 overrides it if <option>queue_only_override</option> is set true, which is the default
5675 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5676 </para>
5677 </listitem></varlistentry>
5678 <varlistentry>
5679 <term><option>-odf</option></term>
5680 <listitem>
5681 <para>
5682 <indexterm role="option">
5683 <primary><option>-odf</option></primary>
5684 </indexterm>
5685 <indexterm role="concept">
5686 <primary>foreground delivery</primary>
5687 </indexterm>
5688 <indexterm role="concept">
5689 <primary>delivery</primary>
5690 <secondary>in the foreground</secondary>
5691 </indexterm>
5692 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5693 accepted a locally-generated message. (For the daemon it is exactly the same as
5694 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5695 and Exim waits for it to complete before proceeding.
5696 </para>
5697 <para>
5698 The original Exim reception process does not finish until the delivery
5699 process for the final message has ended. The standard error stream is left open
5700 during deliveries.
5701 </para>
5702 <para>
5703 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5704 false and one of the queueing options in the configuration file is in effect.
5705 </para>
5706 <para>
5707 If there is a temporary delivery error during foreground delivery, the
5708 message is left on the queue for later delivery, and the original reception
5709 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5710 restricted configuration that never queues messages.
5711 </para>
5712 </listitem></varlistentry>
5713 <varlistentry>
5714 <term><option>-odi</option></term>
5715 <listitem>
5716 <para>
5717 <indexterm role="option">
5718 <primary><option>-odi</option></primary>
5719 </indexterm>
5720 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5721 Sendmail.
5722 </para>
5723 </listitem></varlistentry>
5724 <varlistentry>
5725 <term><option>-odq</option></term>
5726 <listitem>
5727 <para>
5728 <indexterm role="option">
5729 <primary><option>-odq</option></primary>
5730 </indexterm>
5731 <indexterm role="concept">
5732 <primary>non-immediate delivery</primary>
5733 </indexterm>
5734 <indexterm role="concept">
5735 <primary>delivery</primary>
5736 <secondary>suppressing immediate</secondary>
5737 </indexterm>
5738 <indexterm role="concept">
5739 <primary>queueing incoming messages</primary>
5740 </indexterm>
5741 This option applies to all modes in which Exim accepts incoming messages,
5742 including the listening daemon. It specifies that the accepting process should
5743 not automatically start a delivery process for each message received. Messages
5744 are placed on the queue, and remain there until a subsequent queue runner
5745 process encounters them. There are several configuration options (such as
5746 <option>queue_only</option>) that can be used to queue incoming messages under certain
5747 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5748 forces queueing.
5749 </para>
5750 </listitem></varlistentry>
5751 <varlistentry>
5752 <term><option>-odqs</option></term>
5753 <listitem>
5754 <para>
5755 <indexterm role="option">
5756 <primary><option>-odqs</option></primary>
5757 </indexterm>
5758 <indexterm role="concept">
5759 <primary>SMTP</primary>
5760 <secondary>delaying delivery</secondary>
5761 </indexterm>
5762 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5763 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5764 <option>queue_only_override</option> is false and one of the queueing options in the
5765 configuration file is in effect.
5766 </para>
5767 <para>
5768 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5769 message, in the background by default, but in the foreground if <option>-odi</option> is
5770 also present. The recipient addresses are routed, and local deliveries are done
5771 in the normal way. However, if any SMTP deliveries are required, they are not
5772 done at this time, so the message remains on the queue until a subsequent queue
5773 runner process encounters it. Because routing was done, Exim knows which
5774 messages are waiting for which hosts, and so a number of messages for the same
5775 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5776 configuration option has the same effect for specific domains. See also the
5777 <option>-qq</option> option.
5778 </para>
5779 </listitem></varlistentry>
5780 <varlistentry>
5781 <term><option>-oee</option></term>
5782 <listitem>
5783 <para>
5784 <indexterm role="option">
5785 <primary><option>-oee</option></primary>
5786 </indexterm>
5787 <indexterm role="concept">
5788 <primary>error</primary>
5789 <secondary>reporting</secondary>
5790 </indexterm>
5791 If an error is detected while a non-SMTP message is being received (for
5792 example, a malformed address), the error is reported to the sender in a mail
5793 message.
5794 </para>
5795 <para>
5796 <indexterm role="concept">
5797 <primary>return code</primary>
5798 <secondary>for <option>-oee</option></secondary>
5799 </indexterm>
5800 Provided
5801 this error message is successfully sent, the Exim receiving process
5802 exits with a return code of zero. If not, the return code is 2 if the problem
5803 is that the original message has no recipients, or 1 any other error. This is
5804 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5805 </para>
5806 </listitem></varlistentry>
5807 <varlistentry>
5808 <term><option>-oem</option></term>
5809 <listitem>
5810 <para>
5811 <indexterm role="option">
5812 <primary><option>-oem</option></primary>
5813 </indexterm>
5814 <indexterm role="concept">
5815 <primary>error</primary>
5816 <secondary>reporting</secondary>
5817 </indexterm>
5818 <indexterm role="concept">
5819 <primary>return code</primary>
5820 <secondary>for <option>-oem</option></secondary>
5821 </indexterm>
5822 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5823 return code, whether or not the error message was successfully sent.
5824 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5825 </para>
5826 </listitem></varlistentry>
5827 <varlistentry>
5828 <term><option>-oep</option></term>
5829 <listitem>
5830 <para>
5831 <indexterm role="option">
5832 <primary><option>-oep</option></primary>
5833 </indexterm>
5834 <indexterm role="concept">
5835 <primary>error</primary>
5836 <secondary>reporting</secondary>
5837 </indexterm>
5838 If an error is detected while a non-SMTP message is being received, the
5839 error is reported by writing a message to the standard error file (stderr).
5840 <indexterm role="concept">
5841 <primary>return code</primary>
5842 <secondary>for <option>-oep</option></secondary>
5843 </indexterm>
5844 The return code is 1 for all errors.
5845 </para>
5846 </listitem></varlistentry>
5847 <varlistentry>
5848 <term><option>-oeq</option></term>
5849 <listitem>
5850 <para>
5851 <indexterm role="option">
5852 <primary><option>-oeq</option></primary>
5853 </indexterm>
5854 <indexterm role="concept">
5855 <primary>error</primary>
5856 <secondary>reporting</secondary>
5857 </indexterm>
5858 This option is supported for compatibility with Sendmail, but has the same
5859 effect as <option>-oep</option>.
5860 </para>
5861 </listitem></varlistentry>
5862 <varlistentry>
5863 <term><option>-oew</option></term>
5864 <listitem>
5865 <para>
5866 <indexterm role="option">
5867 <primary><option>-oew</option></primary>
5868 </indexterm>
5869 <indexterm role="concept">
5870 <primary>error</primary>
5871 <secondary>reporting</secondary>
5872 </indexterm>
5873 This option is supported for compatibility with Sendmail, but has the same
5874 effect as <option>-oem</option>.
5875 </para>
5876 </listitem></varlistentry>
5877 <varlistentry>
5878 <term><option>-oi</option></term>
5879 <listitem>
5880 <para>
5881 <indexterm role="option">
5882 <primary><option>-oi</option></primary>
5883 </indexterm>
5884 <indexterm role="concept">
5885 <primary>dot</primary>
5886 <secondary>in incoming non-SMTP message</secondary>
5887 </indexterm>
5888 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5889 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5890 single dot does terminate, though Exim does no special processing for other
5891 lines that start with a dot. This option is set by default if Exim is called as
5892 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5893 </para>
5894 </listitem></varlistentry>
5895 <varlistentry>
5896 <term><option>-oitrue</option></term>
5897 <listitem>
5898 <para>
5899 <indexterm role="option">
5900 <primary><option>-oitrue</option></primary>
5901 </indexterm>
5902 This option is treated as synonymous with <option>-oi</option>.
5903 </para>
5904 </listitem></varlistentry>
5905 <varlistentry>
5906 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
5907 <listitem>
5908 <para>
5909 <indexterm role="option">
5910 <primary><option>-oMa</option></primary>
5911 </indexterm>
5912 <indexterm role="concept">
5913 <primary>sender</primary>
5914 <secondary>host address, specifying for local message</secondary>
5915 </indexterm>
5916 A number of options starting with <option>-oM</option> can be used to set values associated
5917 with remote hosts on locally-submitted messages (that is, messages not received
5918 over TCP/IP). These options can be used by any caller in conjunction with the
5919 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5920 other circumstances, they are ignored unless the caller is trusted.
5921 </para>
5922 <para>
5923 The <option>-oMa</option> option sets the sender host address. This may include a port
5924 number at the end, after a full stop (period). For example:
5925 </para>
5926 <literallayout class="monospaced">
5927 exim -bs -oMa 10.9.8.7.1234
5928 </literallayout>
5929 <para>
5930 An alternative syntax is to enclose the IP address in square brackets,
5931 followed by a colon and the port number:
5932 </para>
5933 <literallayout class="monospaced">
5934 exim -bs -oMa [10.9.8.7]:1234
5935 </literallayout>
5936 <para>
5937 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5938 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
5939 are present on the command line, the sender host IP address is taken from
5940 whichever one is last.
5941 </para>
5942 </listitem></varlistentry>
5943 <varlistentry>
5944 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
5945 <listitem>
5946 <para>
5947 <indexterm role="option">
5948 <primary><option>-oMaa</option></primary>
5949 </indexterm>
5950 <indexterm role="concept">
5951 <primary>authentication</primary>
5952 <secondary>name, specifying for local message</secondary>
5953 </indexterm>
5954 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
5955 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
5956 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
5957 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
5958 authenticated SMTP session without actually using the SMTP AUTH command.
5959 </para>
5960 </listitem></varlistentry>
5961 <varlistentry>
5962 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5963 <listitem>
5964 <para>
5965 <indexterm role="option">
5966 <primary><option>-oMai</option></primary>
5967 </indexterm>
5968 <indexterm role="concept">
5969 <primary>authentication</primary>
5970 <secondary>id, specifying for local message</secondary>
5971 </indexterm>
5972 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
5973 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
5974 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
5975 where there is no default) for messages from local sources. See chapter
5976 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
5977 </para>
5978 </listitem></varlistentry>
5979 <varlistentry>
5980 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5981 <listitem>
5982 <para>
5983 <indexterm role="option">
5984 <primary><option>-oMas</option></primary>
5985 </indexterm>
5986 <indexterm role="concept">
5987 <primary>authentication</primary>
5988 <secondary>sender, specifying for local message</secondary>
5989 </indexterm>
5990 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
5991 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
5992 overrides the sender address that is created from the caller&#x2019;s login id for
5993 messages from local sources, except when <option>-bh</option> is used, when there is no
5994 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
5995 specified on a MAIL command overrides this value. See chapter
5996 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
5997 </para>
5998 </listitem></varlistentry>
5999 <varlistentry>
6000 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6001 <listitem>
6002 <para>
6003 <indexterm role="option">
6004 <primary><option>-oMi</option></primary>
6005 </indexterm>
6006 <indexterm role="concept">
6007 <primary>interface</primary>
6008 <secondary>address, specifying for local message</secondary>
6009 </indexterm>
6010 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6011 option sets the IP interface address value. A port number may be included,
6012 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6013 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6014 </para>
6015 </listitem></varlistentry>
6016 <varlistentry>
6017 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6018 <listitem>
6019 <para>
6020 <indexterm role="option">
6021 <primary><option>-oMr</option></primary>
6022 </indexterm>
6023 <indexterm role="concept">
6024 <primary>protocol, specifying for local message</primary>
6025 </indexterm>
6026 <indexterm role="variable">
6027 <primary><varname>$received_protocol</varname></primary>
6028 </indexterm>
6029 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6030 option sets the received protocol value that is stored in
6031 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6032 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6033 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6034 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6035 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6036 be set by <option>-oMr</option>.
6037 </para>
6038 </listitem></varlistentry>
6039 <varlistentry>
6040 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6041 <listitem>
6042 <para>
6043 <indexterm role="option">
6044 <primary><option>-oMs</option></primary>
6045 </indexterm>
6046 <indexterm role="concept">
6047 <primary>sender</primary>
6048 <secondary>host name, specifying for local message</secondary>
6049 </indexterm>
6050 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6051 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6052 present, Exim does not attempt to look up a host name from an IP address; it
6053 uses the name it is given.
6054 </para>
6055 </listitem></varlistentry>
6056 <varlistentry>
6057 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6058 <listitem>
6059 <para>
6060 <indexterm role="option">
6061 <primary><option>-oMt</option></primary>
6062 </indexterm>
6063 <indexterm role="concept">
6064 <primary>sender</primary>
6065 <secondary>ident string, specifying for local message</secondary>
6066 </indexterm>
6067 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6068 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6069 local callers is the login id of the calling process, except when <option>-bh</option> is
6070 used, when there is no default.
6071 </para>
6072 </listitem></varlistentry>
6073 <varlistentry>
6074 <term><option>-om</option></term>
6075 <listitem>
6076 <para>
6077 <indexterm role="option">
6078 <primary><option>-om</option></primary>
6079 </indexterm>
6080 <indexterm role="concept">
6081 <primary>Sendmail compatibility</primary>
6082 <secondary><option>-om</option> option ignored</secondary>
6083 </indexterm>
6084 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6085 message should receive a copy of the message if the sender appears in an alias
6086 expansion. Exim always does this, so the option does nothing.
6087 </para>
6088 </listitem></varlistentry>
6089 <varlistentry>
6090 <term><option>-oo</option></term>
6091 <listitem>
6092 <para>
6093 <indexterm role="option">
6094 <primary><option>-oo</option></primary>
6095 </indexterm>
6096 <indexterm role="concept">
6097 <primary>Sendmail compatibility</primary>
6098 <secondary><option>-oo</option> option ignored</secondary>
6099 </indexterm>
6100 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6101 whatever that means.
6102 </para>
6103 </listitem></varlistentry>
6104 <varlistentry>
6105 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6106 <listitem>
6107 <para>
6108 <indexterm role="option">
6109 <primary><option>-oP</option></primary>
6110 </indexterm>
6111 <indexterm role="concept">
6112 <primary>pid (process id)</primary>
6113 <secondary>of daemon</secondary>
6114 </indexterm>
6115 <indexterm role="concept">
6116 <primary>daemon</primary>
6117 <secondary>process id (pid)</secondary>
6118 </indexterm>
6119 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6120 value. The option specifies the file to which the process id of the daemon is
6121 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6122 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6123 because in those cases, the normal pid file is not used.
6124 </para>
6125 </listitem></varlistentry>
6126 <varlistentry>
6127 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6128 <listitem>
6129 <para>
6130 <indexterm role="option">
6131 <primary><option>-or</option></primary>
6132 </indexterm>
6133 <indexterm role="concept">
6134 <primary>timeout</primary>
6135 <secondary>for non-SMTP input</secondary>
6136 </indexterm>
6137 This option sets a timeout value for incoming non-SMTP messages. If it is not
6138 set, Exim will wait forever for the standard input. The value can also be set
6139 by the <option>receive_timeout</option> option. The format used for specifying times is
6140 described in section <xref linkend="SECTtimeformat"/>.
6141 </para>
6142 </listitem></varlistentry>
6143 <varlistentry>
6144 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6145 <listitem>
6146 <para>
6147 <indexterm role="option">
6148 <primary><option>-os</option></primary>
6149 </indexterm>
6150 <indexterm role="concept">
6151 <primary>timeout</primary>
6152 <secondary>for SMTP input</secondary>
6153 </indexterm>
6154 <indexterm role="concept">
6155 <primary>SMTP</primary>
6156 <secondary>input timeout</secondary>
6157 </indexterm>
6158 This option sets a timeout value for incoming SMTP messages. The timeout
6159 applies to each SMTP command and block of data. The value can also be set by
6160 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6161 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6162 </para>
6163 </listitem></varlistentry>
6164 <varlistentry>
6165 <term><option>-ov</option></term>
6166 <listitem>
6167 <para>
6168 <indexterm role="option">
6169 <primary><option>-ov</option></primary>
6170 </indexterm>
6171 This option has exactly the same effect as <option>-v</option>.
6172 </para>
6173 </listitem></varlistentry>
6174 <varlistentry>
6175 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6176 <listitem>
6177 <para>
6178 <indexterm role="option">
6179 <primary><option>-oX</option></primary>
6180 </indexterm>
6181 <indexterm role="concept">
6182 <primary>TCP/IP</primary>
6183 <secondary>setting listening ports</secondary>
6184 </indexterm>
6185 <indexterm role="concept">
6186 <primary>TCP/IP</primary>
6187 <secondary>setting listening interfaces</secondary>
6188 </indexterm>
6189 <indexterm role="concept">
6190 <primary>port</primary>
6191 <secondary>receiving TCP/IP</secondary>
6192 </indexterm>
6193 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6194 is also given. It controls which ports and interfaces the daemon uses. Details
6195 of the syntax, and how it interacts with configuration file options, are given
6196 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6197 file is written unless <option>-oP</option> is also present to specify a pid file name.
6198 </para>
6199 </listitem></varlistentry>
6200 <varlistentry>
6201 <term><option>-pd</option></term>
6202 <listitem>
6203 <para>
6204 <indexterm role="option">
6205 <primary><option>-pd</option></primary>
6206 </indexterm>
6207 <indexterm role="concept">
6208 <primary>Perl</primary>
6209 <secondary>starting the interpreter</secondary>
6210 </indexterm>
6211 This option applies when an embedded Perl interpreter is linked with Exim (see
6212 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6213 option, forcing the starting of the interpreter to be delayed until it is
6214 needed.
6215 </para>
6216 </listitem></varlistentry>
6217 <varlistentry>
6218 <term><option>-ps</option></term>
6219 <listitem>
6220 <para>
6221 <indexterm role="option">
6222 <primary><option>-ps</option></primary>
6223 </indexterm>
6224 <indexterm role="concept">
6225 <primary>Perl</primary>
6226 <secondary>starting the interpreter</secondary>
6227 </indexterm>
6228 This option applies when an embedded Perl interpreter is linked with Exim (see
6229 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6230 option, forcing the starting of the interpreter to occur as soon as Exim is
6231 started.
6232 </para>
6233 </listitem></varlistentry>
6234 <varlistentry>
6235 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6236 <listitem>
6237 <para>
6238 <indexterm role="option">
6239 <primary><option>-p</option></primary>
6240 </indexterm>
6241 For compatibility with Sendmail, this option is equivalent to
6242 </para>
6243 <literallayout>
6244 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6245 </literallayout>
6246 <para>
6247 It sets the incoming protocol and host name (for trusted callers). The
6248 host name and its colon can be omitted when only the protocol is to be set.
6249 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6250 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6251 or <literal>s</literal> using this option (but that does not seem a real limitation).
6252 </para>
6253 </listitem></varlistentry>
6254 <varlistentry>
6255 <term><option>-q</option></term>
6256 <listitem>
6257 <para>
6258 <indexterm role="option">
6259 <primary><option>-q</option></primary>
6260 </indexterm>
6261 <indexterm role="concept">
6262 <primary>queue runner</primary>
6263 <secondary>starting manually</secondary>
6264 </indexterm>
6265 This option is normally restricted to admin users. However, there is a
6266 configuration option called <option>prod_requires_admin</option> which can be set false to
6267 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6268 and <option>-S</option> options).
6269 </para>
6270 <para>
6271 <indexterm role="concept">
6272 <primary>queue runner</primary>
6273 <secondary>description of operation</secondary>
6274 </indexterm>
6275 The <option>-q</option> option starts one queue runner process. This scans the queue of
6276 waiting messages, and runs a delivery process for each one in turn. It waits
6277 for each delivery process to finish before starting the next one. A delivery
6278 process may not actually do any deliveries if the retry times for the addresses
6279 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6280 </para>
6281 <para>
6282 If
6283 <indexterm role="concept">
6284 <primary>SMTP</primary>
6285 <secondary>passed connection</secondary>
6286 </indexterm>
6287 <indexterm role="concept">
6288 <primary>SMTP</primary>
6289 <secondary>multiple deliveries</secondary>
6290 </indexterm>
6291 <indexterm role="concept">
6292 <primary>multiple SMTP deliveries</primary>
6293 </indexterm>
6294 the delivery process spawns other processes to deliver other messages down
6295 passed SMTP connections, the queue runner waits for these to finish before
6296 proceeding.
6297 </para>
6298 <para>
6299 When all the queued messages have been considered, the original queue runner
6300 process terminates. In other words, a single pass is made over the waiting
6301 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6302 this to be repeated periodically.
6303 </para>
6304 <para>
6305 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6306 random, but it is likely to be different each time, which is all that matters.
6307 If one particular message screws up a remote MTA, other messages to the same
6308 MTA have a chance of getting through if they get tried first.
6309 </para>
6310 <para>
6311 It is possible to cause the messages to be processed in lexical message id
6312 order, which is essentially the order in which they arrived, by setting the
6313 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6314 </para>
6315 </listitem></varlistentry>
6316 <varlistentry>
6317 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6318 <listitem>
6319 <para>
6320 The <option>-q</option> option may be followed by one or more flag letters that change its
6321 behaviour. They are all optional, but if more than one is present, they must
6322 appear in the correct order. Each flag is described in a separate item below.
6323 </para>
6324 </listitem></varlistentry>
6325 <varlistentry>
6326 <term><option>-qq...</option></term>
6327 <listitem>
6328 <para>
6329 <indexterm role="option">
6330 <primary><option>-qq</option></primary>
6331 </indexterm>
6332 <indexterm role="concept">
6333 <primary>queue</primary>
6334 <secondary>double scanning</secondary>
6335 </indexterm>
6336 <indexterm role="concept">
6337 <primary>queue</primary>
6338 <secondary>routing</secondary>
6339 </indexterm>
6340 <indexterm role="concept">
6341 <primary>routing</primary>
6342 <secondary>whole queue before delivery</secondary>
6343 </indexterm>
6344 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6345 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6346 every domain. Addresses are routed, local deliveries happen, but no remote
6347 transports are run.
6348 </para>
6349 <para>
6350 <indexterm role="concept">
6351 <primary>hints database</primary>
6352 <secondary>remembering routing</secondary>
6353 </indexterm>
6354 The hints database that remembers which messages are waiting for specific hosts
6355 is updated, as if delivery to those hosts had been deferred. After this is
6356 complete, a second, normal queue scan happens, with routing and delivery taking
6357 place as normal. Messages that are routed to the same host should mostly be
6358 delivered down a single SMTP
6359 <indexterm role="concept">
6360 <primary>SMTP</primary>
6361 <secondary>passed connection</secondary>
6362 </indexterm>
6363 <indexterm role="concept">
6364 <primary>SMTP</primary>
6365 <secondary>multiple deliveries</secondary>
6366 </indexterm>
6367 <indexterm role="concept">
6368 <primary>multiple SMTP deliveries</primary>
6369 </indexterm>
6370 connection because of the hints that were set up during the first queue scan.
6371 This option may be useful for hosts that are connected to the Internet
6372 intermittently.
6373 </para>
6374 </listitem></varlistentry>
6375 <varlistentry>
6376 <term><option>-q[q]i...</option></term>
6377 <listitem>
6378 <para>
6379 <indexterm role="option">
6380 <primary><option>-qi</option></primary>
6381 </indexterm>
6382 <indexterm role="concept">
6383 <primary>queue</primary>
6384 <secondary>initial delivery</secondary>
6385 </indexterm>
6386 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6387 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6388 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6389 <option>-odq</option> and want a queue runner just to process the new messages.
6390 </para>
6391 </listitem></varlistentry>
6392 <varlistentry>
6393 <term><option>-q[q][i]f...</option></term>
6394 <listitem>
6395 <para>
6396 <indexterm role="option">
6397 <primary><option>-qf</option></primary>
6398 </indexterm>
6399 <indexterm role="concept">
6400 <primary>queue</primary>
6401 <secondary>forcing delivery</secondary>
6402 </indexterm>
6403 <indexterm role="concept">
6404 <primary>delivery</primary>
6405 <secondary>forcing in queue run</secondary>
6406 </indexterm>
6407 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6408 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6409 their retry times are tried.
6410 </para>
6411 </listitem></varlistentry>
6412 <varlistentry>
6413 <term><option>-q[q][i]ff...</option></term>
6414 <listitem>
6415 <para>
6416 <indexterm role="option">
6417 <primary><option>-qff</option></primary>
6418 </indexterm>
6419 <indexterm role="concept">
6420 <primary>frozen messages</primary>
6421 <secondary>forcing delivery</secondary>
6422 </indexterm>
6423 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6424 frozen or not.
6425 </para>
6426 </listitem></varlistentry>
6427 <varlistentry>
6428 <term><option>-q[q][i][f[f]]l</option></term>
6429 <listitem>
6430 <para>
6431 <indexterm role="option">
6432 <primary><option>-ql</option></primary>
6433 </indexterm>
6434 <indexterm role="concept">
6435 <primary>queue</primary>
6436 <secondary>local deliveries only</secondary>
6437 </indexterm>
6438 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6439 be done. If a message requires any remote deliveries, it remains on the queue
6440 for later delivery.
6441 </para>
6442 </listitem></varlistentry>
6443 <varlistentry>
6444 <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>
6445 <listitem>
6446 <para>
6447 <indexterm role="concept">
6448 <primary>queue</primary>
6449 <secondary>delivering specific messages</secondary>
6450 </indexterm>
6451 When scanning the queue, Exim can be made to skip over messages whose ids are
6452 lexically less than a given value by following the <option>-q</option> option with a
6453 starting message id. For example:
6454 </para>
6455 <literallayout class="monospaced">
6456 exim -q 0t5C6f-0000c8-00
6457 </literallayout>
6458 <para>
6459 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6460 second message id is given, messages whose ids are lexically greater than it
6461 are also skipped. If the same id is given twice, for example,
6462 </para>
6463 <literallayout class="monospaced">
6464 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6465 </literallayout>
6466 <para>
6467 just one delivery process is started, for that message. This differs from
6468 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6469 that it counts as a delivery from a queue run. Note that the selection
6470 mechanism does not affect the order in which the messages are scanned. There
6471 are also other ways of selecting specific sets of messages for delivery in a
6472 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6473 </para>
6474 </listitem></varlistentry>
6475 <varlistentry>
6476 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6477 <listitem>
6478 <para>
6479 <indexterm role="concept">
6480 <primary>queue runner</primary>
6481 <secondary>starting periodically</secondary>
6482 </indexterm>
6483 <indexterm role="concept">
6484 <primary>periodic queue running</primary>
6485 </indexterm>
6486 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6487 starting a queue runner process at intervals specified by the given time value
6488 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6489 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6490 single daemon process handles both functions. A common way of starting up a
6491 combined daemon at system boot time is to use a command such as
6492 </para>
6493 <literallayout class="monospaced">
6494 /usr/exim/bin/exim -bd -q30m
6495 </literallayout>
6496 <para>
6497 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6498 process every 30 minutes.
6499 </para>
6500 <para>
6501 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6502 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6503 </para>
6504 </listitem></varlistentry>
6505 <varlistentry>
6506 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6507 <listitem>
6508 <para>
6509 <indexterm role="option">
6510 <primary><option>-qR</option></primary>
6511 </indexterm>
6512 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6513 compatibility.
6514 </para>
6515 </listitem></varlistentry>
6516 <varlistentry>
6517 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6518 <listitem>
6519 <para>
6520 <indexterm role="option">
6521 <primary><option>-qS</option></primary>
6522 </indexterm>
6523 This option is synonymous with <option>-S</option>.
6524 </para>
6525 </listitem></varlistentry>
6526 <varlistentry>
6527 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6528 <listitem>
6529 <para>
6530 <indexterm role="option">
6531 <primary><option>-R</option></primary>
6532 </indexterm>
6533 <indexterm role="concept">
6534 <primary>queue runner</primary>
6535 <secondary>for specific recipients</secondary>
6536 </indexterm>
6537 <indexterm role="concept">
6538 <primary>delivery</primary>
6539 <secondary>to given domain</secondary>
6540 </indexterm>
6541 <indexterm role="concept">
6542 <primary>domain</primary>
6543 <secondary>delivery to</secondary>
6544 </indexterm>
6545 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6546 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6547 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6548 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6549 </para>
6550 <para>
6551 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6552 perform a single queue run, except that, when scanning the messages on the
6553 queue, Exim processes only those that have at least one undelivered recipient
6554 address containing the given string, which is checked in a case-independent
6555 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6556 regular expression; otherwise it is a literal string.
6557 </para>
6558 <para>
6559 If you want to do periodic queue runs for messages with specific recipients,
6560 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6561 </para>
6562 <literallayout class="monospaced">
6563 exim -q25m -R @special.domain.example
6564 </literallayout>
6565 <para>
6566 This example does a queue run for messages with recipients in the given domain
6567 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6568 applied to each queue run.
6569 </para>
6570 <para>
6571 Once a message is selected for delivery by this mechanism, all its addresses
6572 are processed. For the first selected message, Exim overrides any retry
6573 information and forces a delivery attempt for each undelivered address. This
6574 means that if delivery of any address in the first message is successful, any
6575 existing retry information is deleted, and so delivery attempts for that
6576 address in subsequently selected messages (which are processed without forcing)
6577 will run. However, if delivery of any address does not succeed, the retry
6578 information is updated, and in subsequently selected messages, the failing
6579 address will be skipped.
6580 </para>
6581 <para>
6582 <indexterm role="concept">
6583 <primary>frozen messages</primary>
6584 <secondary>forcing delivery</secondary>
6585 </indexterm>
6586 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6587 all selected messages, not just the first; frozen messages are included when
6588 <emphasis>ff</emphasis> is present.
6589 </para>
6590 <para>
6591 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6592 to a given domain after a host has been down for some time. When the SMTP
6593 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6594 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6595 an arbitrary command instead.
6596 </para>
6597 </listitem></varlistentry>
6598 <varlistentry>
6599 <term><option>-r</option></term>
6600 <listitem>
6601 <para>
6602 <indexterm role="option">
6603 <primary><option>-r</option></primary>
6604 </indexterm>
6605 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6606 </para>
6607 </listitem></varlistentry>
6608 <varlistentry>
6609 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6610 <listitem>
6611 <para>
6612 <indexterm role="option">
6613 <primary><option>-S</option></primary>
6614 </indexterm>
6615 <indexterm role="concept">
6616 <primary>delivery</primary>
6617 <secondary>from given sender</secondary>
6618 </indexterm>
6619 <indexterm role="concept">
6620 <primary>queue runner</primary>
6621 <secondary>for specific senders</secondary>
6622 </indexterm>
6623 This option acts like <option>-R</option> except that it checks the string against each
6624 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6625 conditions must be met for a message to be selected. If either of the options
6626 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6627 </para>
6628 </listitem></varlistentry>
6629 <varlistentry>
6630 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
6631 <listitem>
6632 <para>
6633 <indexterm role="option">
6634 <primary><option>-Tqt</option></primary>
6635 </indexterm>
6636 This an option that is exclusively for use by the Exim testing suite. It is not
6637 recognized when Exim is run normally. It allows for the setting up of explicit
6638 <quote>queue times</quote> so that various warning/retry features can be tested.
6639 </para>
6640 </listitem></varlistentry>
6641 <varlistentry>
6642 <term><option>-t</option></term>
6643 <listitem>
6644 <para>
6645 <indexterm role="option">
6646 <primary><option>-t</option></primary>
6647 </indexterm>
6648 <indexterm role="concept">
6649 <primary>recipient</primary>
6650 <secondary>extracting from header lines</secondary>
6651 </indexterm>
6652 <indexterm role="concept">
6653 <primary><emphasis>Bcc:</emphasis> header line</primary>
6654 </indexterm>
6655 <indexterm role="concept">
6656 <primary><emphasis>Cc:</emphasis> header line</primary>
6657 </indexterm>
6658 <indexterm role="concept">
6659 <primary><emphasis>To:</emphasis> header line</primary>
6660 </indexterm>
6661 When Exim is receiving a locally-generated, non-SMTP message on its standard
6662 input, the <option>-t</option> option causes the recipients of the message to be obtained
6663 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6664 from the command arguments. The addresses are extracted before any rewriting
6665 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6666 </para>
6667 <para>
6668 <indexterm role="concept">
6669 <primary>Sendmail compatibility</primary>
6670 <secondary><option>-t</option> option</secondary>
6671 </indexterm>
6672 If the command has any arguments, they specify addresses to which the message
6673 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6674 the recipients list obtained from the headers. This is compatible with Smail 3
6675 and in accordance with the documented behaviour of several versions of
6676 Sendmail, as described in man pages on a number of operating systems (e.g.
6677 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6678 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
6679 Sendmail book documents it that way. Exim can be made to add argument addresses
6680 instead of subtracting them by setting the option
6681 <option>extract_addresses_remove_arguments</option> false.
6682 </para>
6683 <para>
6684 <indexterm role="concept">
6685 <primary><option>Resent-</option> header lines</primary>
6686 <secondary>with <option>-t</option></secondary>
6687 </indexterm>
6688 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6689 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6690 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6691 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6692 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6693 </para>
6694 <para>
6695 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6696 message is resent several times). The RFC also specifies that they should be
6697 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6698 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6699 nor indeed exactly what constitutes a <quote>set</quote>.
6700 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6701 are often added at the end of the header, and if a message is resent more than
6702 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6703 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6704 </para>
6705 </listitem></varlistentry>
6706 <varlistentry>
6707 <term><option>-ti</option></term>
6708 <listitem>
6709 <para>
6710 <indexterm role="option">
6711 <primary><option>-ti</option></primary>
6712 </indexterm>
6713 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6714 compatibility with Sendmail.
6715 </para>
6716 </listitem></varlistentry>
6717 <varlistentry>
6718 <term><option>-tls-on-connect</option></term>
6719 <listitem>
6720 <para>
6721 <indexterm role="option">
6722 <primary><option>-tls-on-connect</option></primary>
6723 </indexterm>
6724 <indexterm role="concept">
6725 <primary>TLS</primary>
6726 <secondary>use without STARTTLS</secondary>
6727 </indexterm>
6728 <indexterm role="concept">
6729 <primary>TLS</primary>
6730 <secondary>automatic start</secondary>
6731 </indexterm>
6732 This option is available when Exim is compiled with TLS support. It forces all
6733 incoming SMTP connections to behave as if the incoming port is listed in the
6734 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6735 <xref linkend="CHAPTLS"/> for further details.
6736 </para>
6737 </listitem></varlistentry>
6738 <varlistentry>
6739 <term><option>-U</option></term>
6740 <listitem>
6741 <para>
6742 <indexterm role="option">
6743 <primary><option>-U</option></primary>
6744 </indexterm>
6745 <indexterm role="concept">
6746 <primary>Sendmail compatibility</primary>
6747 <secondary><option>-U</option> option ignored</secondary>
6748 </indexterm>
6749 Sendmail uses this option for <quote>initial message submission</quote>, and its
6750 documentation states that in future releases, it may complain about
6751 syntactically invalid messages rather than fixing them when this flag is not
6752 set. Exim ignores this option.
6753 </para>
6754 </listitem></varlistentry>
6755 <varlistentry>
6756 <term><option>-v</option></term>
6757 <listitem>
6758 <para>
6759 <indexterm role="option">
6760 <primary><option>-v</option></primary>
6761 </indexterm>
6762 This option causes Exim to write information to the standard error stream,
6763 describing what it is doing. In particular, it shows the log lines for
6764 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6765 dialogue is shown. Some of the log lines shown may not actually be written to
6766 the log if the setting of <option>log_selector</option> discards them. Any relevant
6767 selectors are shown with each log line. If none are shown, the logging is
6768 unconditional.
6769 </para>
6770 </listitem></varlistentry>
6771 <varlistentry>
6772 <term><option>-x</option></term>
6773 <listitem>
6774 <para>
6775 <indexterm role="option">
6776 <primary><option>-x</option></primary>
6777 </indexterm>
6778 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6779 National Language Support extended characters in the body of the mail item</quote>).
6780 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6781 this option.
6782 </para>
6783 </listitem></varlistentry>
6784 </variablelist>
6785 <para>
6786 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6787 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6788 </para>
6789 <!-- === End of command line options === -->
6790 </section>
6791 </chapter>
6792
6793 <chapter id="CHAPconf">
6794 <title>The Exim run time configuration file</title>
6795 <titleabbrev>The runtime configuration file</titleabbrev>
6796 <para>
6797 <indexterm role="concept">
6798 <primary>run time configuration</primary>
6799 </indexterm>
6800 <indexterm role="concept">
6801 <primary>configuration file</primary>
6802 <secondary>general description</secondary>
6803 </indexterm>
6804 <indexterm role="concept">
6805 <primary>CONFIGURE_FILE</primary>
6806 </indexterm>
6807 <indexterm role="concept">
6808 <primary>configuration file</primary>
6809 <secondary>errors in</secondary>
6810 </indexterm>
6811 <indexterm role="concept">
6812 <primary>error</primary>
6813 <secondary>in configuration file</secondary>
6814 </indexterm>
6815 <indexterm role="concept">
6816 <primary>return code</primary>
6817 <secondary>for bad configuration</secondary>
6818 </indexterm>
6819 Exim uses a single run time configuration file that is read whenever an Exim
6820 binary is executed. Note that in normal operation, this happens frequently,
6821 because Exim is designed to operate in a distributed manner, without central
6822 control.
6823 </para>
6824 <para>
6825 If a syntax error is detected while reading the configuration file, Exim
6826 writes a message on the standard error, and exits with a non-zero return code.
6827 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6828 errors can be detected at this time. The values of any expanded options are
6829 not checked until the expansion happens, even when the expansion does not
6830 actually alter the string.
6831 </para>
6832 <para>
6833 The name of the configuration file is compiled into the binary for security
6834 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6835 most configurations, this specifies a single file. However, it is permitted to
6836 give a colon-separated list of file names, in which case Exim uses the first
6837 existing file in the list.
6838 </para>
6839 <para>
6840 <indexterm role="concept">
6841 <primary>EXIM_USER</primary>
6842 </indexterm>
6843 <indexterm role="concept">
6844 <primary>EXIM_GROUP</primary>
6845 </indexterm>
6846 <indexterm role="concept">
6847 <primary>CONFIGURE_OWNER</primary>
6848 </indexterm>
6849 <indexterm role="concept">
6850 <primary>CONFIGURE_GROUP</primary>
6851 </indexterm>
6852 <indexterm role="concept">
6853 <primary>configuration file</primary>
6854 <secondary>ownership</secondary>
6855 </indexterm>
6856 <indexterm role="concept">
6857 <primary>ownership</primary>
6858 <secondary>configuration file</secondary>
6859 </indexterm>
6860 The run time configuration file must be owned by root or by the user that is
6861 specified at compile time by the EXIM_USER option, or by the user that is
6862 specified at compile time by the CONFIGURE_OWNER option (if set). The
6863 configuration file must not be world-writeable or group-writeable, unless its
6864 group is the one specified at compile time by the EXIM_GROUP option or by the
6865 CONFIGURE_GROUP option.
6866 </para>
6867 <para>
6868 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6869 to root, anybody who is able to edit the run time configuration file has an
6870 easy way to run commands as root. If you make your mail administrators members
6871 of the Exim group, but do not trust them with root, make sure that the run time
6872 configuration is not group writeable.
6873 </para>
6874 <para>
6875 A default configuration file, which will work correctly in simple situations,
6876 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6877 defines just one file name, the installation process copies the default
6878 configuration to a new file of that name if it did not previously exist. If
6879 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6880 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6881 configuration.
6882 </para>
6883 <section id="SECID40">
6884 <title>Using a different configuration file</title>
6885 <para>
6886 <indexterm role="concept">
6887 <primary>configuration file</primary>
6888 <secondary>alternate</secondary>
6889 </indexterm>
6890 A one-off alternate configuration can be specified by the <option>-C</option> command line
6891 option, which may specify a single file or a list of files. However, when
6892 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6893 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6894 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6895 configuration files before installing them. No owner or group checks are done
6896 on a configuration file specified by <option>-C</option>.
6897 </para>
6898 <para>
6899 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6900 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6901 if you do this, you also lock out the possibility of testing a
6902 configuration using <option>-C</option> right through message reception and delivery, even
6903 if the caller is root. The reception works, but by that time, Exim is running
6904 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6905 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6906 delivery using two separate commands (one to put a message on the queue, using
6907 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6908 </para>
6909 <para>
6910 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6911 prefix string with which any file named in a <option>-C</option> command line option must
6912 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6913 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6914 name can be used with <option>-C</option>.
6915 </para>
6916 <para>
6917 One-off changes to a configuration can be specified by the <option>-D</option> command line
6918 option, which defines and overrides values for macros used inside the
6919 configuration file. However, like <option>-C</option>, the use of this option by a
6920 non-privileged user causes Exim to discard its root privilege.
6921 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6922 completely disabled, and its use causes an immediate error exit.
6923 </para>
6924 <para>
6925 Some sites may wish to use the same Exim binary on different machines that
6926 share a file system, but to use different configuration files on each machine.
6927 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6928 looks for a file whose name is the configuration file name followed by a dot
6929 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
6930 file does not exist, the standard name is tried. This processing occurs for
6931 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6932 </para>
6933 <para>
6934 In some esoteric situations different versions of Exim may be run under
6935 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6936 help with this. See the comments in <filename>src/EDITME</filename> for details.
6937 </para>
6938 </section>
6939 <section id="SECTconffilfor">
6940 <title>Configuration file format</title>
6941 <para>
6942 <indexterm role="concept">
6943 <primary>configuration file</primary>
6944 <secondary>format of</secondary>
6945 </indexterm>
6946 <indexterm role="concept">
6947 <primary>format</primary>
6948 <secondary>configuration file</secondary>
6949 </indexterm>
6950 Exim&#x2019;s configuration file is divided into a number of different parts. General
6951 option settings must always appear at the start of the file. The other parts
6952 are all optional, and may appear in any order. Each part other than the first
6953 is introduced by the word <quote>begin</quote> followed by the name of the part. The
6954 optional parts are:
6955 </para>
6956 <itemizedlist>
6957 <listitem>
6958 <para>
6959 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail.
6960 </para>
6961 </listitem>
6962 <listitem>
6963 <para>
6964 <indexterm role="concept">
6965 <primary>AUTH</primary>
6966 <secondary>configuration</secondary>
6967 </indexterm>
6968 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
6969 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
6970 </para>
6971 </listitem>
6972 <listitem>
6973 <para>
6974 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
6975 addresses and determine how the message is to be delivered.
6976 </para>
6977 </listitem>
6978 <listitem>
6979 <para>
6980 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
6981 define mechanisms for copying messages to destinations.
6982 </para>
6983 </listitem>
6984 <listitem>
6985 <para>
6986 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be immediately delivered.
6987 </para>
6988 </listitem>
6989 <listitem>
6990 <para>
6991 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
6992 when new addresses are generated during delivery.
6993 </para>
6994 </listitem>
6995 <listitem>
6996 <para>
6997 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
6998 want to use this feature, you must set
6999 </para>
7000 <literallayout class="monospaced">
7001 LOCAL_SCAN_HAS_OPTIONS=yes
7002 </literallayout>
7003 <para>
7004 in <filename>Local/Makefile</filename> before building Exim. Full details of the
7005 <function>local_scan()</function> facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7006 </para>
7007 </listitem>
7008 </itemizedlist>
7009 <para>
7010 <indexterm role="concept">
7011 <primary>configuration file</primary>
7012 <secondary>leading white space in</secondary>
7013 </indexterm>
7014 <indexterm role="concept">
7015 <primary>configuration file</primary>
7016 <secondary>trailing white space in</secondary>
7017 </indexterm>
7018 <indexterm role="concept">
7019 <primary>white space</primary>
7020 <secondary>in configuration file</secondary>
7021 </indexterm>
7022 Leading and trailing white space in configuration lines is always ignored.
7023 </para>
7024 <para>
7025 Blank lines in the file, and lines starting with a # character (ignoring
7026 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7027 # character other than at the beginning of a line is not treated specially,
7028 and does not introduce a comment.
7029 </para>
7030 <para>
7031 Any non-comment line can be continued by ending it with a backslash. Note that
7032 the general rule for white space means that trailing white space after the
7033 backslash and leading white space at the start of continuation
7034 lines is ignored. Comment lines beginning with # (but not empty lines) may
7035 appear in the middle of a sequence of continuation lines.
7036 </para>
7037 <para>
7038 A convenient way to create a configuration file is to start from the
7039 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7040 change settings as required.
7041 </para>
7042 <para>
7043 The ACLs, retry rules, and rewriting rules have their own syntax which is
7044 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7045 respectively. The other parts of the configuration file have some syntactic
7046 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7047 onwards. Before that, the inclusion, macro, and conditional facilities are
7048 described.
7049 </para>
7050 </section>
7051 <section id="SECID41">
7052 <title>File inclusions in the configuration file</title>
7053 <para>
7054 <indexterm role="concept">
7055 <primary>inclusions in configuration file</primary>
7056 </indexterm>
7057 <indexterm role="concept">
7058 <primary>configuration file</primary>
7059 <secondary>including other files</secondary>
7060 </indexterm>
7061 <indexterm role="concept">
7062 <primary><literal>.include</literal> in configuration file</primary>
7063 </indexterm>
7064 <indexterm role="concept">
7065 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7066 </indexterm>
7067 You can include other files inside Exim&#x2019;s run time configuration file by
7068 using this syntax:
7069 </para>
7070 <literallayout>
7071 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7072 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7073 </literallayout>
7074 <para>
7075 on a line by itself. Double quotes round the file name are optional. If you use
7076 the first form, a configuration error occurs if the file does not exist; the
7077 second form does nothing for non-existent files. In all cases, an absolute file
7078 name is required.
7079 </para>
7080 <para>
7081 Includes may be nested to any depth, but remember that Exim reads its
7082 configuration file often, so it is a good idea to keep them to a minimum.
7083 If you change the contents of an included file, you must HUP the daemon,
7084 because an included file is read only when the configuration itself is read.
7085 </para>
7086 <para>
7087 The processing of inclusions happens early, at a physical line level, so, like
7088 comment lines, an inclusion can be used in the middle of an option setting,
7089 for example:
7090 </para>
7091 <literallayout class="monospaced">
7092 hosts_lookup = a.b.c \
7093                .include /some/file
7094 </literallayout>
7095 <para>
7096 Include processing happens after macro processing (see below). Its effect is to
7097 process the lines of the included file as if they occurred inline where the
7098 inclusion appears.
7099 </para>
7100 </section>
7101 <section id="SECTmacrodefs">
7102 <title>Macros in the configuration file</title>
7103 <para>
7104 <indexterm role="concept">
7105 <primary>macro</primary>
7106 <secondary>description of</secondary>
7107 </indexterm>
7108 <indexterm role="concept">
7109 <primary>configuration file</primary>
7110 <secondary>macros</secondary>
7111 </indexterm>
7112 If a line in the main part of the configuration (that is, before the first
7113 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7114 definition, and must be of the form
7115 </para>
7116 <literallayout>
7117 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7118 </literallayout>
7119 <para>
7120 The name must consist of letters, digits, and underscores, and need not all be
7121 in upper case, though that is recommended. The rest of the line, including any
7122 continuations, is the replacement text, and has leading and trailing white
7123 space removed. Quotes are not removed. The replacement text can never end with
7124 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7125 </para>
7126 <para>
7127 Macros may also be defined between router, transport, authenticator, or ACL
7128 definitions. They may not, however, be defined within an individual driver or
7129 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7130 </para>
7131 </section>
7132 <section id="SECID42">
7133 <title>Macro substitution</title>
7134 <para>
7135 Once a macro is defined, all subsequent lines in the file (and any included
7136 files) are scanned for the macro name; if there are several macros, the line is
7137 scanned for each in turn, in the order in which the macros are defined. The
7138 replacement text is not re-scanned for the current macro, though it is scanned
7139 for subsequently defined macros. For this reason, a macro name may not contain
7140 the name of a previously defined macro as a substring. You could, for example,
7141 define
7142 </para>
7143 <literallayout>
7144 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7145 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7146 </literallayout>
7147 <para>
7148 but putting the definitions in the opposite order would provoke a configuration
7149 error. Macro expansion is applied to individual physical lines from the file,
7150 before checking for line continuation or file inclusion (see above). If a line
7151 consists solely of a macro name, and the expansion of the macro is empty, the
7152 line is ignored. A macro at the start of a line may turn the line into a
7153 comment line or a <literal>.include</literal> line.
7154 </para>
7155 </section>
7156 <section id="SECID43">
7157 <title>Redefining macros</title>
7158 <para>
7159 Once defined, the value of a macro can be redefined later in the configuration
7160 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7161 <emphasis>=</emphasis>. For example:
7162 </para>
7163 <literallayout class="monospaced">
7164 MAC =  initial value
7165 ...
7166 MAC == updated value
7167 </literallayout>
7168 <para>
7169 Redefinition does not alter the order in which the macros are applied to the
7170 subsequent lines of the configuration file. It is still the same order in which
7171 the macros were originally defined. All that changes is the macro&#x2019;s value.
7172 Redefinition makes it possible to accumulate values. For example:
7173 </para>
7174 <literallayout class="monospaced">
7175 MAC =  initial value
7176 ...
7177 MAC == MAC and something added
7178 </literallayout>
7179 <para>
7180 This can be helpful in situations where the configuration file is built
7181 from a number of other files.
7182 </para>
7183 </section>
7184 <section id="SECID44">
7185 <title>Overriding macro values</title>
7186 <para>
7187 The values set for macros in the configuration file can be overridden by the
7188 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7189 used, unless called by root or the Exim user. A definition on the command line
7190 using the <option>-D</option> option causes all definitions and redefinitions within the
7191 file to be ignored.
7192 </para>
7193 </section>
7194 <section id="SECID45">
7195 <title>Example of macro usage</title>
7196 <para>
7197 As an example of macro usage, consider a configuration where aliases are looked
7198 up in a MySQL database. It helps to keep the file less cluttered if long
7199 strings such as SQL statements are defined separately as macros, for example:
7200 </para>
7201 <literallayout class="monospaced">
7202 ALIAS_QUERY = select mailbox from user where \
7203               login=${quote_mysql:$local_part};
7204 </literallayout>
7205 <para>
7206 This can then be used in a <command>redirect</command> router setting like this:
7207 </para>
7208 <literallayout class="monospaced">
7209 data = ${lookup mysql{ALIAS_QUERY}}
7210 </literallayout>
7211 <para>
7212 In earlier versions of Exim macros were sometimes used for domain, host, or
7213 address lists. In Exim 4 these are handled better by named lists &ndash; see
7214 section <xref linkend="SECTnamedlists"/>.
7215 </para>
7216 </section>
7217 <section id="SECID46">
7218 <title>Conditional skips in the configuration file</title>
7219 <para>
7220 <indexterm role="concept">
7221 <primary>configuration file</primary>
7222 <secondary>conditional skips</secondary>
7223 </indexterm>
7224 <indexterm role="concept">
7225 <primary><literal>.ifdef</literal></primary>
7226 </indexterm>
7227 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7228 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7229 portions of the configuration file. The processing happens whenever the file is
7230 read (that is, when an Exim binary starts to run).
7231 </para>
7232 <para>
7233 The implementation is very simple. Instances of the first four directives must
7234 be followed by text that includes the names of one or macros. The condition
7235 that is tested is whether or not any macro substitution has taken place in the
7236 line. Thus:
7237 </para>
7238 <literallayout class="monospaced">
7239 .ifdef AAA
7240 message_size_limit = 50M
7241 .else
7242 message_size_limit = 100M
7243 .endif
7244 </literallayout>
7245 <para>
7246 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7247 otherwise. If there is more than one macro named on the line, the condition
7248 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7249 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7250 </para>
7251 <para>
7252 Although you can use a macro expansion to generate one of these directives,
7253 it is not very useful, because the condition <quote>there was a macro substitution
7254 in this line</quote> will always be true.
7255 </para>
7256 <para>
7257 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7258 to clarify complicated nestings.
7259 </para>
7260 </section>
7261 <section id="SECTcos">
7262 <title>Common option syntax</title>
7263 <para>
7264 <indexterm role="concept">
7265 <primary>common option syntax</primary>
7266 </indexterm>
7267 <indexterm role="concept">
7268 <primary>syntax of common options</primary>
7269 </indexterm>
7270 <indexterm role="concept">
7271 <primary>configuration file</primary>
7272 <secondary>common option syntax</secondary>
7273 </indexterm>
7274 For the main set of options, driver options, and <function>local_scan()</function> options,
7275 each setting is on a line by itself, and starts with a name consisting of
7276 lower-case letters and underscores. Many options require a data value, and in
7277 these cases the name must be followed by an equals sign (with optional white
7278 space) and then the value. For example:
7279 </para>
7280 <literallayout class="monospaced">
7281 qualify_domain = mydomain.example.com
7282 </literallayout>
7283 <para>
7284 Some option settings may contain sensitive data, for example, passwords for
7285 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7286 line option to read these values, you can precede the option settings with the
7287 word <quote>hide</quote>. For example:
7288 </para>
7289 <literallayout class="monospaced">
7290 hide mysql_servers = localhost/users/admin/secret-password
7291 </literallayout>
7292 <para>
7293 For non-admin users, such options are displayed like this:
7294 </para>
7295 <literallayout class="monospaced">
7296 mysql_servers = &lt;value not displayable&gt;
7297 </literallayout>
7298 <para>
7299 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7300 all instances of the same driver.
7301 </para>
7302 <para>
7303 The following sections describe the syntax used for the different data types
7304 that are found in option settings.
7305 </para>
7306 </section>
7307 <section id="SECID47">
7308 <title>Boolean options</title>
7309 <para>
7310 <indexterm role="concept">
7311 <primary>format</primary>
7312 <secondary>boolean</secondary>
7313 </indexterm>
7314 <indexterm role="concept">
7315 <primary>boolean configuration values</primary>
7316 </indexterm>
7317 <indexterm role="option">
7318 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7319 </indexterm>
7320 <indexterm role="option">
7321 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7322 </indexterm>
7323 Options whose type is given as boolean are on/off switches. There are two
7324 different ways of specifying such options: with and without a data value. If
7325 the option name is specified on its own without data, the switch is turned on;
7326 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7327 boolean options may be followed by an equals sign and one of the words
7328 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7329 the following two settings have exactly the same effect:
7330 </para>
7331 <literallayout class="monospaced">
7332 queue_only
7333 queue_only = true
7334 </literallayout>
7335 <para>
7336 The following two lines also have the same (opposite) effect:
7337 </para>
7338 <literallayout class="monospaced">
7339 no_queue_only
7340 queue_only = false
7341 </literallayout>
7342 <para>
7343 You can use whichever syntax you prefer.
7344 </para>
7345 </section>
7346 <section id="SECID48">
7347 <title>Integer values</title>
7348 <para>
7349 <indexterm role="concept">
7350 <primary>integer configuration values</primary>
7351 </indexterm>
7352 <indexterm role="concept">
7353 <primary>format</primary>
7354 <secondary>integer</secondary>
7355 </indexterm>
7356 </para>
7357 <para revisionflag="changed">
7358 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7359 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7360 number is assumed. Otherwise, it is treated as an octal number unless it starts
7361 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7362 hexadecimal number.
7363 </para>
7364 <para>
7365 If an integer value is followed by the letter K, it is multiplied by 1024; if
7366 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7367 of integer option settings are output, values which are an exact multiple of
7368 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7369 and M. The printing style is independent of the actual input format that was
7370 used.
7371 </para>
7372 </section>
7373 <section id="SECID49">
7374 <title>Octal integer values</title>
7375 <para>
7376 <indexterm role="concept">
7377 <primary>integer format</primary>
7378 </indexterm>
7379 <indexterm role="concept">
7380 <primary>format</primary>
7381 <secondary>octal integer</secondary>
7382 </indexterm>
7383 </para>
7384 <para revisionflag="changed">
7385 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7386 interpreted as an octal number, whether or not it starts with the digit zero.
7387 Such options are always output in octal.
7388 </para>
7389 </section>
7390 <section id="SECID50">
7391 <title>Fixed point numbers</title>
7392 <para>
7393 <indexterm role="concept">
7394 <primary>fixed point configuration values</primary>
7395 </indexterm>
7396 <indexterm role="concept">
7397 <primary>format</primary>
7398 <secondary>fixed point</secondary>
7399 </indexterm>
7400 </para>
7401 <para revisionflag="changed">
7402 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7403 integer, optionally followed by a decimal point and up to three further digits.
7404 </para>
7405 </section>
7406 <section id="SECTtimeformat">
7407 <title>Time intervals</title>
7408 <para>
7409 <indexterm role="concept">
7410 <primary>time interval</primary>
7411 <secondary>specifying in configuration</secondary>
7412 </indexterm>
7413 <indexterm role="concept">
7414 <primary>format</primary>
7415 <secondary>time interval</secondary>
7416 </indexterm>
7417 A time interval is specified as a sequence of numbers, each followed by one of
7418 the following letters, with no intervening white space:
7419 </para>
7420 <informaltable frame="none">
7421 <tgroup cols="2" colsep="0" rowsep="0">
7422 <colspec colwidth="30pt" align="left"/>
7423 <colspec colwidth="254pt" align="left"/>
7424 <tbody>
7425 <row>
7426 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7427 <entry>seconds</entry>
7428 </row>
7429 <row>
7430 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7431 <entry>minutes</entry>
7432 </row>
7433 <row>
7434 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7435 <entry>hours</entry>
7436 </row>
7437 <row>
7438 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7439 <entry>days</entry>
7440 </row>
7441 <row>
7442 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7443 <entry>weeks</entry>
7444 </row>
7445 </tbody>
7446 </tgroup>
7447 </informaltable>
7448 <para>
7449 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7450 intervals are output in the same format. Exim does not restrict the values; it
7451 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7452 </para>
7453 </section>
7454 <section id="SECTstrings">
7455 <title>String values</title>
7456 <para>
7457 <indexterm role="concept">
7458 <primary>string</primary>
7459 <secondary>format of configuration values</secondary>
7460 </indexterm>
7461 <indexterm role="concept">
7462 <primary>format</primary>
7463 <secondary>string</secondary>
7464 </indexterm>
7465 </para>
7466 <para revisionflag="changed">
7467 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7468 or without double-quotes. If it does not start with a double-quote, the value
7469 consists of the remainder of the line plus any continuation lines, starting at
7470 the first character after any leading white space, with trailing white space
7471 removed, and with no interpretation of the characters in the string. Because
7472 Exim removes comment lines (those beginning with #) at an early stage, they can
7473 appear in the middle of a multi-line string. The following two settings are
7474 therefore equivalent:
7475 </para>
7476 <literallayout class="monospaced">
7477 trusted_users = uucp:mail
7478 trusted_users = uucp:\
7479                 # This comment line is ignored
7480                 mail
7481 </literallayout>
7482 <para>
7483 <indexterm role="concept">
7484 <primary>string</primary>
7485 <secondary>quoted</secondary>
7486 </indexterm>
7487 <indexterm role="concept">
7488 <primary>escape characters in quoted strings</primary>
7489 </indexterm>
7490 If a string does start with a double-quote, it must end with a closing
7491 double-quote, and any backslash characters other than those used for line
7492 continuation are interpreted as escape characters, as follows:
7493 </para>
7494 <informaltable frame="none">
7495 <tgroup cols="2" colsep="0" rowsep="0">
7496 <colspec colwidth="100pt" align="left"/>
7497 <colspec colwidth="254pt" align="left"/>
7498 <tbody>
7499 <row>
7500 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7501 <entry>single backslash</entry>
7502 </row>
7503 <row>
7504 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7505 <entry>newline</entry>
7506 </row>
7507 <row>
7508 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7509 <entry>carriage return</entry>
7510 </row>
7511 <row>
7512 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7513 <entry>tab</entry>
7514 </row>
7515 <row>
7516 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7517 <entry>up to 3 octal digits specify one character</entry>
7518 </row>
7519 <row>
7520 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7521 <entry>up to 2 hexadecimal digits specify one character</entry>
7522 </row>
7523 </tbody>
7524 </tgroup>
7525 </informaltable>
7526 <para>
7527 If a backslash is followed by some other character, including a double-quote
7528 character, that character replaces the pair.
7529 </para>
7530 <para>
7531 Quoting is necessary only if you want to make use of the backslash escapes to
7532 insert special characters, or if you need to specify a value with leading or
7533 trailing spaces. These cases are rare, so quoting is almost never needed in
7534 current versions of Exim. In versions of Exim before 3.14, quoting was required
7535 in order to continue lines, so you may come across older configuration files
7536 and examples that apparently quote unnecessarily.
7537 </para>
7538 </section>
7539 <section id="SECID51">
7540 <title>Expanded strings</title>
7541 <para>
7542 <indexterm role="concept">
7543 <primary>expansion</primary>
7544 <secondary>definition of</secondary>
7545 </indexterm>
7546 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7547 by which means various parts of the string may be changed according to the
7548 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7549 is as just described; in particular, the handling of backslashes in quoted
7550 strings is done as part of the input process, before expansion takes place.
7551 However, backslash is also an escape character for the expander, so any
7552 backslashes that are required for that reason must be doubled if they are
7553 within a quoted configuration string.
7554 </para>
7555 </section>
7556 <section id="SECID52">
7557 <title>User and group names</title>
7558 <para>
7559 <indexterm role="concept">
7560 <primary>user name</primary>
7561 <secondary>format of</secondary>
7562 </indexterm>
7563 <indexterm role="concept">
7564 <primary>format</primary>
7565 <secondary>user name</secondary>
7566 </indexterm>
7567 <indexterm role="concept">
7568 <primary>groups</primary>
7569 <secondary>name format</secondary>
7570 </indexterm>
7571 <indexterm role="concept">
7572 <primary>format</primary>
7573 <secondary>group name</secondary>
7574 </indexterm>
7575 User and group names are specified as strings, using the syntax described
7576 above, but the strings are interpreted specially. A user or group name must
7577 either consist entirely of digits, or be a name that can be looked up using the
7578 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7579 </para>
7580 </section>
7581 <section id="SECTlistconstruct">
7582 <title>List construction</title>
7583 <para>
7584 <indexterm role="concept">
7585 <primary>list</primary>
7586 <secondary>syntax of in configuration</secondary>
7587 </indexterm>
7588 <indexterm role="concept">
7589 <primary>format</primary>
7590 <secondary>list item in configuration</secondary>
7591 </indexterm>
7592 <indexterm role="concept">
7593 <primary>string</primary>
7594 <secondary>list, definition of</secondary>
7595 </indexterm>
7596 The data for some configuration options is a list of items, with colon as the
7597 default separator. Many of these options are shown with type <quote>string list</quote> in
7598 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7599 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7600 are all the same; however, those other than <quote>string list</quote> are subject to
7601 particular kinds of interpretation, as described in chapter
7602 <xref linkend="CHAPdomhosaddlists"/>.
7603 </para>
7604 <para>
7605 In all these cases, the entire list is treated as a single string as far as the
7606 input syntax is concerned. The <option>trusted_users</option> setting in section
7607 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7608 in a list, it must be entered as two colons. Leading and trailing white space
7609 on each item in a list is ignored. This makes it possible to include items that
7610 start with a colon, and in particular, certain forms of IPv6 address. For
7611 example, the list
7612 </para>
7613 <literallayout class="monospaced">
7614 local_interfaces = 127.0.0.1 : ::::1
7615 </literallayout>
7616 <para>
7617 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7618 </para>
7619 <para>
7620 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7621 list items, it is not ignored when parsing the list. The space after the first
7622 colon in the example above is necessary. If it were not there, the list would
7623 be interpreted as the two items 127.0.0.1:: and 1.
7624 </para>
7625 </section>
7626 <section id="SECID53" revisionflag="changed">
7627 <title>Changing list separators</title>
7628 <para revisionflag="changed">
7629 <indexterm role="concept">
7630 <primary>list separator</primary>
7631 <secondary>changing</secondary>
7632 </indexterm>
7633 <indexterm role="concept">
7634 <primary>IPv6</primary>
7635 <secondary>addresses in lists</secondary>
7636 </indexterm>
7637 </para>
7638 <para>
7639 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7640 introduced to allow the separator character to be changed. If a list begins
7641 with a left angle bracket, followed by any punctuation character, that
7642 character is used instead of colon as the list separator. For example, the list
7643 above can be rewritten to use a semicolon separator like this:
7644 </para>
7645 <literallayout class="monospaced">
7646 local_interfaces = &lt;; 127.0.0.1 ; ::1
7647 </literallayout>
7648 <para>
7649 This facility applies to all lists, with the exception of the list in
7650 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7651 confined to circumstances where they really are needed.
7652 </para>
7653 <para revisionflag="changed">
7654 <indexterm role="concept">
7655 <primary>list separator</primary>
7656 <secondary>newline as</secondary>
7657 </indexterm>
7658 <indexterm role="concept">
7659 <primary>newline as list separator</primary>
7660 </indexterm>
7661 It is also possible to use newline and other control characters (those with
7662 code values less than 32, plus DEL) as separators in lists. Such separators
7663 must be provided literally at the time the list is processed. For options that
7664 are string-expanded, you can write the separator using a normal escape
7665 sequence. This will be processed by the expander before the string is
7666 interpreted as a list. For example, if a newline-separated list of domains is
7667 generated by a lookup, you can process it directly by a line such as this:
7668 </para>
7669 <literallayout class="monospaced" revisionflag="changed">
7670 domains = &lt;\n ${lookup mysql{.....}}
7671 </literallayout>
7672 <para revisionflag="changed">
7673 This avoids having to change the list separator in such data. You are unlikely
7674 to want to use a control character as a separator in an option that is not
7675 expanded, because the value is literal text. However, it can be done by giving
7676 the value in quotes. For example:
7677 </para>
7678 <literallayout class="monospaced" revisionflag="changed">
7679 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
7680 </literallayout>
7681 <para revisionflag="changed">
7682 Unlike printing character separators, which can be included in list items by
7683 doubling, it is not possible to include a control character as data when it is
7684 set as the separator. Two such characters in succession are interpreted as
7685 enclosing an empty list item.
7686 </para>
7687 </section>
7688 <section id="SECTempitelis">
7689 <title>Empty items in lists</title>
7690 <para>
7691 <indexterm role="concept">
7692 <primary>list</primary>
7693 <secondary>empty item in</secondary>
7694 </indexterm>
7695 An empty item at the end of a list is always ignored. In other words, trailing
7696 separator characters are ignored. Thus, the list in
7697 </para>
7698 <literallayout class="monospaced">
7699 senders = user@domain :
7700 </literallayout>
7701 <para>
7702 contains only a single item. If you want to include an empty string as one item
7703 in a list, it must not be the last item. For example, this list contains three
7704 items, the second of which is empty:
7705 </para>
7706 <literallayout class="monospaced">
7707 senders = user1@domain : : user2@domain
7708 </literallayout>
7709 <para>
7710 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7711 are interpreted as representing a single colon data character (and the list
7712 would then contain just one item). If you want to specify a list that contains
7713 just one, empty item, you can do it as in this example:
7714 </para>
7715 <literallayout class="monospaced">
7716 senders = :
7717 </literallayout>
7718 <para>
7719 In this case, the first item is empty, and the second is discarded because it
7720 is at the end of the list.
7721 </para>
7722 </section>
7723 <section id="SECTfordricon">
7724 <title>Format of driver configurations</title>
7725 <para>
7726 <indexterm role="concept">
7727 <primary>drivers</primary>
7728 <secondary>configuration format</secondary>
7729 </indexterm>
7730 There are separate parts in the configuration for defining routers, transports,
7731 and authenticators. In each part, you are defining a number of driver
7732 instances, each with its own set of options. Each driver instance is defined by
7733 a sequence of lines like this:
7734 </para>
7735 <literallayout>
7736 &lt;<emphasis>instance name</emphasis>&gt;:
7737   &lt;<emphasis>option</emphasis>&gt;
7738   ...
7739   &lt;<emphasis>option</emphasis>&gt;
7740 </literallayout>
7741 <para>
7742 In the following example, the instance name is <command>localuser</command>, and it is
7743 followed by three options settings:
7744 </para>
7745 <literallayout class="monospaced">
7746 localuser:
7747   driver = accept
7748   check_local_user
7749   transport = local_delivery
7750 </literallayout>
7751 <para>
7752 For each driver instance, you specify which Exim code module it uses &ndash; by the
7753 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
7754 settings. For example, in the case of transports, if you want a transport to
7755 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7756 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7757 described in detail in its own separate chapter later in this manual.
7758 </para>
7759 <para>
7760 You can have several routers, transports, or authenticators that are based on
7761 the same underlying driver (each must have a different instance name).
7762 </para>
7763 <para>
7764 The order in which routers are defined is important, because addresses are
7765 passed to individual routers one by one, in order. The order in which
7766 transports are defined does not matter at all. The order in which
7767 authenticators are defined is used only when Exim, as a client, is searching
7768 them to find one that matches an authentication mechanism offered by the
7769 server.
7770 </para>
7771 <para>
7772 <indexterm role="concept">
7773 <primary>generic options</primary>
7774 </indexterm>
7775 <indexterm role="concept">
7776 <primary>options</primary>
7777 <secondary>generic &ndash; definition of</secondary>
7778 </indexterm>
7779 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7780 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7781 same type (that is, all routers, all transports or all authenticators). The
7782 <option>driver</option> option is a generic option that must appear in every definition.
7783 <indexterm role="concept">
7784 <primary>private options</primary>
7785 </indexterm>
7786 The private options are special for each driver, and none need appear, because
7787 they all have default values.
7788 </para>
7789 <para>
7790 The options may appear in any order, except that the <option>driver</option> option must
7791 precede any private options, since these depend on the particular driver. For
7792 this reason, it is recommended that <option>driver</option> always be the first option.
7793 </para>
7794 <para>
7795 Driver instance names, which are used for reference in log entries and
7796 elsewhere, can be any sequence of letters, digits, and underscores (starting
7797 with a letter) and must be unique among drivers of the same type. A router and
7798 a transport (for example) can each have the same name, but no two router
7799 instances can have the same name. The name of a driver instance should not be
7800 confused with the name of the underlying driver module. For example, the
7801 configuration lines:
7802 </para>
7803 <literallayout class="monospaced">
7804 remote_smtp:
7805   driver = smtp
7806 </literallayout>
7807 <para>
7808 create an instance of the <command>smtp</command> transport driver whose name is
7809 <command>remote_smtp</command>. The same driver code can be used more than once, with
7810 different instance names and different option settings each time. A second
7811 instance of the <command>smtp</command> transport, with different options, might be defined
7812 thus:
7813 </para>
7814 <literallayout class="monospaced">
7815 special_smtp:
7816   driver = smtp
7817   port = 1234
7818   command_timeout = 10s
7819 </literallayout>
7820 <para>
7821 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7822 these transport instances from routers, and these names would appear in log
7823 lines.
7824 </para>
7825 <para>
7826 Comment lines may be present in the middle of driver specifications. The full
7827 list of option settings for any particular driver instance, including all the
7828 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7829 option.
7830 </para>
7831 </section>
7832 </chapter>
7833
7834 <chapter id="CHAPdefconfil">
7835 <title>The default configuration file</title>
7836 <para>
7837 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7838 <primary>configuration file</primary>
7839 <secondary>default <quote>walk through</quote></secondary>
7840 </indexterm>
7841 <indexterm role="concept">
7842 <primary>default</primary>
7843 <secondary>configuration file <quote>walk through</quote></secondary>
7844 </indexterm>
7845 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7846 is sufficient for a host with simple mail requirements. As an introduction to
7847 the way Exim is configured, this chapter <quote>walks through</quote> the default
7848 configuration, giving brief explanations of the settings. Detailed descriptions
7849 of the options are given in subsequent chapters. The default configuration file
7850 itself contains extensive comments about ways you might want to modify the
7851 initial settings. However, note that there are many options that are not
7852 mentioned at all in the default configuration.
7853 </para>
7854 <section id="SECTdefconfmain">
7855 <title>Main configuration settings</title>
7856 <para>
7857 The main (global) configuration option settings must always come first in the
7858 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
7859 the line
7860 </para>
7861 <literallayout class="monospaced">
7862 # primary_hostname =
7863 </literallayout>
7864 <para>
7865 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7866 to know the official, fully qualified name of your host, and this is where you
7867 can specify it. However, in most cases you do not need to set this option. When
7868 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7869 </para>
7870 <para>
7871 The first three non-comment configuration lines are as follows:
7872 </para>
7873 <literallayout class="monospaced">
7874 domainlist local_domains = @
7875 domainlist relay_to_domains =
7876 hostlist   relay_from_hosts = 127.0.0.1
7877 </literallayout>
7878 <para>
7879 These are not, in fact, option settings. They are definitions of two named
7880 domain lists and one named host list. Exim allows you to give names to lists of
7881 domains, hosts, and email addresses, in order to make it easier to manage the
7882 configuration file (see section <xref linkend="SECTnamedlists"/>).
7883 </para>
7884 <para>
7885 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7886 later in the configuration to identify domains that are to be delivered
7887 on the local host.
7888 </para>
7889 <para>
7890 <indexterm role="concept">
7891 <primary>@ in a domain list</primary>
7892 </indexterm>
7893 There is just one item in this list, the string <quote>@</quote>. This is a special form
7894 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7895 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7896 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
7897 the same configuration file can be used on different hosts.
7898 </para>
7899 <para>
7900 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7901 list itself is empty. Later in the configuration we will come to the part that
7902 controls mail relaying through the local host; it allows relaying to any
7903 domains in this list. By default, therefore, no relaying on the basis of a mail
7904 domain is permitted.
7905 </para>
7906 <para>
7907 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7908 used later in the configuration to permit relaying from any host or IP address
7909 that matches the list. The default contains just the IP address of the IPv4
7910 loopback interface, which means that processes on the local host are able to
7911 submit mail for relaying by sending it over TCP/IP to that interface. No other
7912 hosts are permitted to submit messages for relaying.
7913 </para>
7914 <para>
7915 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
7916 we aren&#x2019;t actually setting up any controls. We are just defining some domains
7917 and hosts that will be used in the controls that are specified later.
7918 </para>
7919 <para>
7920 The next two configuration lines are genuine option settings:
7921 </para>
7922 <literallayout class="monospaced">
7923 acl_smtp_rcpt = acl_check_rcpt
7924 acl_smtp_data = acl_check_data
7925 </literallayout>
7926 <para>
7927 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7928 during an incoming SMTP session for every recipient of a message (every RCPT
7929 command), and after the contents of the message have been received,
7930 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7931 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7932 section of the configuration. The RCPT ACL controls which recipients are
7933 accepted for an incoming message &ndash; if a configuration does not provide an ACL
7934 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7935 contents of a message to be checked.
7936 </para>
7937 <para>
7938 Two commented-out option settings are next:
7939 </para>
7940 <literallayout class="monospaced">
7941 # av_scanner = clamd:/tmp/clamd
7942 # spamd_address = 127.0.0.1 783
7943 </literallayout>
7944 <para>
7945 These are example settings that can be used when Exim is compiled with the
7946 content-scanning extension. The first specifies the interface to the virus
7947 scanner, and the second specifies the interface to SpamAssassin. Further
7948 details are given in chapter <xref linkend="CHAPexiscan"/>.
7949 </para>
7950 <para>
7951 Three more commented-out option settings follow:
7952 </para>
7953 <literallayout class="monospaced">
7954 # tls_advertise_hosts = *
7955 # tls_certificate = /etc/ssl/exim.crt
7956 # tls_privatekey = /etc/ssl/exim.pem
7957 </literallayout>
7958 <para>
7959 These are example settings that can be used when Exim is compiled with
7960 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
7961 first one specifies the list of clients that are allowed to use TLS when
7962 connecting to this server; in this case the wildcard means all clients. The
7963 other options specify where Exim should find its TLS certificate and private
7964 key, which together prove the server&#x2019;s identity to any clients that connect.
7965 More details are given in chapter <xref linkend="CHAPTLS"/>.
7966 </para>
7967 <para>
7968 Another two commented-out option settings follow:
7969 </para>
7970 <literallayout class="monospaced">
7971 # daemon_smtp_ports = 25 : 465 : 587
7972 # tls_on_connect_ports = 465
7973 </literallayout>
7974 <para>
7975 <indexterm role="concept">
7976 <primary>port</primary>
7977 <secondary>465 and 587</secondary>
7978 </indexterm>
7979 <indexterm role="concept">
7980 <primary>port</primary>
7981 <secondary>for message submission</secondary>
7982 </indexterm>
7983 <indexterm role="concept">
7984 <primary>message</primary>
7985 <secondary>submission, ports for</secondary>
7986 </indexterm>
7987 <indexterm role="concept">
7988 <primary>ssmtp protocol</primary>
7989 </indexterm>
7990 <indexterm role="concept">
7991 <primary>smtps protocol</primary>
7992 </indexterm>
7993 <indexterm role="concept">
7994 <primary>SMTP</primary>
7995 <secondary>ssmtp protocol</secondary>
7996 </indexterm>
7997 <indexterm role="concept">
7998 <primary>SMTP</primary>
7999 <secondary>smtps protocol</secondary>
8000 </indexterm>
8001 These options provide better support for roaming users who wish to use this
8002 server for message submission. They are not much use unless you have turned on
8003 TLS (as described in the previous paragraph) and authentication (about which
8004 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8005 on end-user networks, so RFC 4409 specifies that message submission should use
8006 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8007 configured to use port 587 correctly, so these settings also enable the
8008 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8009 <xref linkend="SECTsupobssmt"/>).
8010 </para>
8011 <para>
8012 Two more commented-out options settings follow:
8013 </para>
8014 <literallayout class="monospaced">
8015 # qualify_domain =
8016 # qualify_recipient =
8017 </literallayout>
8018 <para>
8019 The first of these specifies a domain that Exim uses when it constructs a
8020 complete email address from a local login name. This is often needed when Exim
8021 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8022 the value of <option>primary_hostname</option> is used. If you set both of these options,
8023 you can have different qualification domains for sender and recipient
8024 addresses. If you set only the first one, its value is used in both cases.
8025 </para>
8026 <para>
8027 <indexterm role="concept">
8028 <primary>domain literal</primary>
8029 <secondary>recognizing format</secondary>
8030 </indexterm>
8031 The following line must be uncommented if you want Exim to recognize
8032 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8033 (an IP address within square brackets) instead of a named domain.
8034 </para>
8035 <literallayout class="monospaced">
8036 # allow_domain_literals
8037 </literallayout>
8038 <para>
8039 The RFCs still require this form, but many people think that in the modern
8040 Internet it makes little sense to permit mail to be sent to specific hosts by
8041 quoting their IP addresses. This ancient format has been used by people who
8042 try to abuse hosts by using them for unwanted relaying. However, some
8043 people believe there are circumstances (for example, messages addressed to
8044 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8045 </para>
8046 <para>
8047 The next configuration line is a kind of trigger guard:
8048 </para>
8049 <literallayout class="monospaced">
8050 never_users = root
8051 </literallayout>
8052 <para>
8053 It specifies that no delivery must ever be run as the root user. The normal
8054 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8055 setting is a guard against slips in the configuration.
8056 The list of users specified by <option>never_users</option> is not, however, the complete
8057 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8058 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8059 contents of <option>never_users</option> are added to this list. By default
8060 FIXED_NEVER_USERS also specifies root.
8061 </para>
8062 <para>
8063 When a remote host connects to Exim in order to send mail, the only information
8064 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8065 line,
8066 </para>
8067 <literallayout class="monospaced">
8068 host_lookup = *
8069 </literallayout>
8070 <para>
8071 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8072 in order to get a host name. This improves the quality of the logging
8073 information, but if you feel it is too expensive, you can remove it entirely,
8074 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8075 Note that it is not always possible to find a host name from an IP address,
8076 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8077 unreachable.
8078 </para>
8079 <para>
8080 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8081 1413 (hence their names):
8082 </para>
8083 <literallayout class="monospaced">
8084 rfc1413_hosts = *
8085 rfc1413_query_timeout = 5s
8086 </literallayout>
8087 <para>
8088 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8089 You can limit the hosts to which these calls are made, or change the timeout
8090 that is used. If you set the timeout to zero, all ident calls are disabled.
8091 Although they are cheap and can provide useful information for tracing problem
8092 messages, some hosts and firewalls have problems with ident calls. This can
8093 result in a timeout instead of an immediate refused connection, leading to
8094 delays on starting up an incoming SMTP session.
8095 </para>
8096 <para>
8097 When Exim receives messages over SMTP connections, it expects all addresses to
8098 be fully qualified with a domain, as required by the SMTP definition. However,
8099 if you are running a server to which simple clients submit messages, you may
8100 find that they send unqualified addresses. The two commented-out options:
8101 </para>
8102 <literallayout class="monospaced">
8103 # sender_unqualified_hosts =
8104 # recipient_unqualified_hosts =
8105 </literallayout>
8106 <para>
8107 show how you can specify hosts that are permitted to send unqualified sender
8108 and recipient addresses, respectively.
8109 </para>
8110 <para>
8111 The <option>percent_hack_domains</option> option is also commented out:
8112 </para>
8113 <literallayout class="monospaced">
8114 # percent_hack_domains =
8115 </literallayout>
8116 <para>
8117 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8118 This is an almost obsolete form of explicit email routing. If you do not know
8119 anything about it, you can safely ignore this topic.
8120 </para>
8121 <para>
8122 The last two settings in the main part of the default configuration are
8123 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8124 message is frozen, Exim no longer continues to try to deliver it. Freezing
8125 occurs when a bounce message encounters a permanent failure because the sender
8126 address of the original message that caused the bounce is invalid, so the
8127 bounce cannot be delivered. This is probably the most common case, but there
8128 are also other conditions that cause freezing, and frozen messages are not
8129 always bounce messages.
8130 </para>
8131 <literallayout class="monospaced">
8132 ignore_bounce_errors_after = 2d
8133 timeout_frozen_after = 7d
8134 </literallayout>
8135 <para>
8136 The first of these options specifies that failing bounce messages are to be
8137 discarded after 2 days on the queue. The second specifies that any frozen
8138 message (whether a bounce message or not) is to be timed out (and discarded)
8139 after a week. In this configuration, the first setting ensures that no failing
8140 bounce message ever lasts a week.
8141 </para>
8142 </section>
8143 <section id="SECID54">
8144 <title>ACL configuration</title>
8145 <para>
8146 <indexterm role="concept">
8147 <primary>default</primary>
8148 <secondary>ACLs</secondary>
8149 </indexterm>
8150 <indexterm role="concept">
8151 <primary>access control lists (ACLs)</primary>
8152 <secondary>default configuration</secondary>
8153 </indexterm>
8154 In the default configuration, the ACL section follows the main configuration.
8155 It starts with the line
8156 </para>
8157 <literallayout class="monospaced">
8158 begin acl
8159 </literallayout>
8160 <para>
8161 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8162 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8163 and <option>acl_smtp_data</option> above.
8164 </para>
8165 <para>
8166 <indexterm role="concept">
8167 <primary>RCPT</primary>
8168 <secondary>ACL for</secondary>
8169 </indexterm>
8170 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8171 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8172 are considered in order, until the recipient address is either accepted or
8173 rejected. The RCPT command is then accepted or rejected, according to the
8174 result of the ACL processing.
8175 </para>
8176 <literallayout class="monospaced">
8177 acl_check_rcpt:
8178 </literallayout>
8179 <para>
8180 This line, consisting of a name terminated by a colon, marks the start of the
8181 ACL, and names it.
8182 </para>
8183 <literallayout class="monospaced">
8184 accept  hosts = :
8185 </literallayout>
8186 <para>
8187 This ACL statement accepts the recipient if the sending host matches the list.
8188 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8189 names or IP addresses. The presence of the colon puts an empty item in the
8190 list; Exim matches this only if the incoming message did not come from a remote
8191 host, because in that case, the remote hostname is empty. The colon is
8192 important. Without it, the list itself is empty, and can never match anything.
8193 </para>
8194 <para>
8195 What this statement is doing is to accept unconditionally all recipients in
8196 messages that are submitted by SMTP from local processes using the standard
8197 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8198 manner.
8199 </para>
8200 <literallayout class="monospaced">
8201 deny    message       = Restricted characters in address
8202         domains       = +local_domains
8203         local_parts   = ^[.] : ^.*[@%!/|]
8204
8205 deny    message       = Restricted characters in address
8206         domains       = !+local_domains
8207         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8208 </literallayout>
8209 <para>
8210 These statements are concerned with local parts that contain any of the
8211 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8212 Although these characters are entirely legal in local parts (in the case of
8213 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8214 in Internet mail addresses.
8215 </para>
8216 <para>
8217 The first three have in the past been associated with explicitly routed
8218 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8219 option). Addresses containing these characters are regularly tried by spammers
8220 in an attempt to bypass relaying restrictions, and also by open relay testing
8221 programs. Unless you really need them it is safest to reject these characters
8222 at this early stage. This configuration is heavy-handed in rejecting these
8223 characters for all messages it accepts from remote hosts. This is a deliberate
8224 policy of being as safe as possible.
8225 </para>
8226 <para>
8227 The first rule above is stricter, and is applied to messages that are addressed
8228 to one of the local domains handled by this host. This is implemented by the
8229 first condition, which restricts it to domains that are listed in the
8230 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8231 reference to a named list. In this configuration, there is just one domain in
8232 <emphasis>local_domains</emphasis>, but in general there may be many.
8233 </para>
8234 <para>
8235 The second condition on the first statement uses two regular expressions to
8236 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8237 or <quote>|</quote>. If you have local accounts that include these characters, you will
8238 have to modify this rule.
8239 </para>
8240 <para>
8241 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8242 allows them because they have been encountered in practice. (Consider the
8243 common convention of local parts constructed as
8244 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8245 the author of Exim, who has no second initial.) However, a local part starting
8246 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8247 file name (for example, for a mailing list). This is also true for local parts
8248 that contain slashes. A pipe symbol can also be troublesome if the local part
8249 is incorporated unthinkingly into a shell command line.
8250 </para>
8251 <para>
8252 The second rule above applies to all other domains, and is less strict. This
8253 allows your own users to send outgoing messages to sites that use slashes
8254 and vertical bars in their local parts. It blocks local parts that begin
8255 with a dot, slash, or vertical bar, but allows these characters within the
8256 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8257 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8258 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8259 </para>
8260 <literallayout class="monospaced">
8261 accept  local_parts   = postmaster
8262         domains       = +local_domains
8263 </literallayout>
8264 <para>
8265 This statement, which has two conditions, accepts an incoming address if the
8266 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8267 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8268 reference to a named list. In this configuration, there is just one domain in
8269 <emphasis>local_domains</emphasis>, but in general there may be many.
8270 </para>
8271 <para>
8272 The presence of this statement means that mail to postmaster is never blocked
8273 by any of the subsequent tests. This can be helpful while sorting out problems
8274 in cases where the subsequent tests are incorrectly denying access.
8275 </para>
8276 <literallayout class="monospaced">
8277 require verify        = sender
8278 </literallayout>
8279 <para>
8280 This statement requires the sender address to be verified before any subsequent
8281 ACL statement can be used. If verification fails, the incoming recipient
8282 address is refused. Verification consists of trying to route the address, to
8283 see if a bounce message could be delivered to it. In the case of remote
8284 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8285 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8286 discusses the details of address verification.
8287 </para>
8288 <literallayout class="monospaced">
8289 accept  hosts         = +relay_from_hosts
8290         control       = submission
8291 </literallayout>
8292 <para>
8293 This statement accepts the address if the message is coming from one of the
8294 hosts that are defined as being allowed to relay through this host. Recipient
8295 verification is omitted here, because in many cases the clients are dumb MUAs
8296 that do not cope well with SMTP error responses. For the same reason, the
8297 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8298 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8299 messages that are deficient in some way, for example, because they lack a
8300 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8301 probably add recipient verification here, and disable submission mode.
8302 </para>
8303 <literallayout class="monospaced">
8304 accept  authenticated = *
8305         control       = submission
8306 </literallayout>
8307 <para>
8308 This statement accepts the address if the client host has authenticated itself.
8309 Submission mode is again specified, on the grounds that such messages are most
8310 likely to come from MUAs. The default configuration does not define any
8311 authenticators, though it does include some nearly complete commented-out
8312 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8313 fact authenticate until you complete the authenticator definitions.
8314 </para>
8315 <literallayout class="monospaced">
8316 require message = relay not permitted
8317         domains = +local_domains : +relay_domains
8318 </literallayout>
8319 <para>
8320 This statement rejects the address if its domain is neither a local domain nor
8321 one of the domains for which this host is a relay.
8322 </para>
8323 <literallayout class="monospaced">
8324 require verify = recipient
8325 </literallayout>
8326 <para>
8327 This statement requires the recipient address to be verified; if verification
8328 fails, the address is rejected.
8329 </para>
8330 <literallayout class="monospaced">
8331 # deny    message     = rejected because $sender_host_address \
8332 #                       is in a black list at $dnslist_domain\n\
8333 #                       $dnslist_text
8334 #         dnslists    = black.list.example
8335 #
8336 # warn    dnslists    = black.list.example
8337 #         add_header  = X-Warning: $sender_host_address is in \
8338 #                       a black list at $dnslist_domain
8339 #         log_message = found in $dnslist_domain
8340 </literallayout>
8341 <para>
8342 These commented-out lines are examples of how you could configure Exim to check
8343 sending hosts against a DNS black list. The first statement rejects messages
8344 from blacklisted hosts, whereas the second just inserts a warning header
8345 line.
8346 </para>
8347 <literallayout class="monospaced">
8348 # require verify = csa
8349 </literallayout>
8350 <para>
8351 This commented-out line is an example of how you could turn on client SMTP
8352 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8353 records.
8354 </para>
8355 <literallayout class="monospaced">
8356 accept
8357 </literallayout>
8358 <para>
8359 The final statement in the first ACL unconditionally accepts any recipient
8360 address that has successfully passed all the previous tests.
8361 </para>
8362 <literallayout class="monospaced">
8363 acl_check_data:
8364 </literallayout>
8365 <para>
8366 This line marks the start of the second ACL, and names it. Most of the contents
8367 of this ACL are commented out:
8368 </para>
8369 <literallayout class="monospaced">
8370 # deny    malware   = *
8371 #         message   = This message contains a virus \
8372 #                     ($malware_name).
8373 </literallayout>
8374 <para>
8375 These lines are examples of how to arrange for messages to be scanned for
8376 viruses when Exim has been compiled with the content-scanning extension, and a
8377 suitable virus scanner is installed. If the message is found to contain a
8378 virus, it is rejected with the given custom error message.
8379 </para>
8380 <literallayout class="monospaced">
8381 # warn    spam      = nobody
8382 #         message   = X-Spam_score: $spam_score\n\
8383 #                     X-Spam_score_int: $spam_score_int\n\
8384 #                     X-Spam_bar: $spam_bar\n\
8385 #                     X-Spam_report: $spam_report
8386 </literallayout>
8387 <para>
8388 These lines are an example of how to arrange for messages to be scanned by
8389 SpamAssassin when Exim has been compiled with the content-scanning extension,
8390 and SpamAssassin has been installed. The SpamAssassin check is run with
8391 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8392 series of extra header line. In this case, the message is not rejected,
8393 whatever the spam score.
8394 </para>
8395 <literallayout class="monospaced">
8396 accept
8397 </literallayout>
8398 <para>
8399 This final line in the DATA ACL accepts the message unconditionally.
8400 </para>
8401 </section>
8402 <section id="SECID55">
8403 <title>Router configuration</title>
8404 <para>
8405 <indexterm role="concept">
8406 <primary>default</primary>
8407 <secondary>routers</secondary>
8408 </indexterm>
8409 <indexterm role="concept">
8410 <primary>routers</primary>
8411 <secondary>default</secondary>
8412 </indexterm>
8413 The router configuration comes next in the default configuration, introduced
8414 by the line
8415 </para>
8416 <literallayout class="monospaced">
8417 begin routers
8418 </literallayout>
8419 <para>
8420 Routers are the modules in Exim that make decisions about where to send
8421 messages. An address is passed to each router in turn, until it is either
8422 accepted, or failed. This means that the order in which you define the routers
8423 matters. Each router is fully described in its own chapter later in this
8424 manual. Here we give only brief overviews.
8425 </para>
8426 <literallayout class="monospaced">
8427 # domain_literal:
8428 #   driver = ipliteral
8429 #   domains = !+local_domains
8430 #   transport = remote_smtp
8431 </literallayout>
8432 <para>
8433 <indexterm role="concept">
8434 <primary>domain literal</primary>
8435 <secondary>default router</secondary>
8436 </indexterm>
8437 This router is commented out because the majority of sites do not want to
8438 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8439 you uncomment this router, you also need to uncomment the setting of
8440 <option>allow_domain_literals</option> in the main part of the configuration.
8441 </para>
8442 <literallayout class="monospaced">
8443 dnslookup:
8444   driver = dnslookup
8445   domains = ! +local_domains
8446   transport = remote_smtp
8447   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8448   no_more
8449 </literallayout>
8450 <para>
8451 The first uncommented router handles addresses that do not involve any local
8452 domains. This is specified by the line
8453 </para>
8454 <literallayout class="monospaced">
8455 domains = ! +local_domains
8456 </literallayout>
8457 <para>
8458 The <option>domains</option> option lists the domains to which this router applies, but the
8459 exclamation mark is a negation sign, so the router is used only for domains
8460 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8461 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8462 indicates that it is referring to a named list. Addresses in other domains are
8463 passed on to the following routers.
8464 </para>
8465 <para>
8466 The name of the router driver is <command>dnslookup</command>,
8467 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8468 the name of this router instance is the same as the name of the driver. The
8469 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8470 one of the driver modules that is in the Exim binary.
8471 </para>
8472 <para>
8473 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8474 DNS in order to obtain a list of hosts to which the address is routed. If the
8475 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8476 specified by the <option>transport</option> option. If the router does not find the domain
8477 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8478 the address fails and is bounced.
8479 </para>
8480 <para>
8481 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8482 be entirely ignored. This option is present because a number of cases have been
8483 encountered where MX records in the DNS point to host names
8484 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8485 Completely ignoring these IP addresses causes Exim to fail to route the
8486 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8487 continue to try to deliver the message periodically until the address timed
8488 out.
8489 </para>
8490 <literallayout class="monospaced">
8491 system_aliases:
8492   driver = redirect
8493   allow_fail
8494   allow_defer
8495   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8496 # user = exim
8497   file_transport = address_file
8498   pipe_transport = address_pipe
8499 </literallayout>
8500 <para>
8501 Control reaches this and subsequent routers only for addresses in the local
8502 domains. This router checks to see whether the local part is defined as an
8503 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8504 data that it looks up from that file. If no data is found for the local part,
8505 the value of the <option>data</option> option is empty, causing the address to be passed to
8506 the next router.
8507 </para>
8508 <para>
8509 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8510 often used. That is why it is referenced by from the default configuration
8511 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8512 <filename>Local/Makefile</filename> before building Exim.
8513 </para>
8514 <literallayout class="monospaced">
8515 userforward:
8516   driver = redirect
8517   check_local_user
8518 # local_part_suffix = +* : -*
8519 # local_part_suffix_optional
8520   file = $home/.forward
8521 # allow_filter
8522   no_verify
8523   no_expn
8524   check_ancestor
8525   file_transport = address_file
8526   pipe_transport = address_pipe
8527   reply_transport = address_reply
8528 </literallayout>
8529 <para>
8530 This is the most complicated router in the default configuration. It is another
8531 redirection router, but this time it is looking for forwarding data set up by
8532 individual users. The <option>check_local_user</option> setting specifies a check that the
8533 local part of the address is the login name of a local user. If it is not, the
8534 router is skipped. The two commented options that follow <option>check_local_user</option>,
8535 namely:
8536 </para>
8537 <literallayout class="monospaced">
8538 # local_part_suffix = +* : -*
8539 # local_part_suffix_optional
8540 </literallayout>
8541 <para>
8542 <indexterm role="variable">
8543 <primary><varname>$local_part_suffix</varname></primary>
8544 </indexterm>
8545 show how you can specify the recognition of local part suffixes. If the first
8546 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8547 by any sequence of characters, is removed from the local part and placed in the
8548 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8549 presence of a suffix in the local part is optional. When a suffix is present,
8550 the check for a local login uses the local part with the suffix removed.
8551 </para>
8552 <para>
8553 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8554 home directory is consulted. If it does not exist, or is empty, the router
8555 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8556 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8557 </para>
8558 <para>
8559 <indexterm role="concept">
8560 <primary>Sieve filter</primary>
8561 <secondary>enabling in default router</secondary>
8562 </indexterm>
8563 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8564 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8565 is commented out by default), the contents of the file are interpreted as a set
8566 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8567 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8568 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8569 </para>
8570 <para>
8571 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8572 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8573 There are two reasons for doing this:
8574 </para>
8575 <orderedlist numeration="arabic">
8576 <listitem>
8577 <para>
8578 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8579 checking an address for validity; it makes sense not to waste resources doing
8580 unnecessary work.
8581 </para>
8582 </listitem>
8583 <listitem>
8584 <para>
8585 More importantly, when Exim is verifying addresses or handling an EXPN
8586 command during an SMTP session, it is running as the Exim user, not as root.
8587 The group is the Exim group, and no additional groups are set up.
8588 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
8589 this time.
8590 </para>
8591 </listitem>
8592 </orderedlist>
8593 <para>
8594 The setting of <option>check_ancestor</option> prevents the router from generating a new
8595 address that is the same as any previous address that was redirected. (This
8596 works round a problem concerning a bad interaction between aliasing and
8597 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
8598 </para>
8599 <para>
8600 The final three option settings specify the transports that are to be used when
8601 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8602 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8603 </para>
8604 <literallayout class="monospaced">
8605 a.nother@elsewhere.example, /home/spqr/archive
8606 </literallayout>
8607 <para>
8608 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8609 transport.
8610 </para>
8611 <literallayout class="monospaced">
8612 localuser:
8613   driver = accept
8614   check_local_user
8615 # local_part_suffix = +* : -*
8616 # local_part_suffix_optional
8617   transport = local_delivery
8618 </literallayout>
8619 <para>
8620 The final router sets up delivery into local mailboxes, provided that the local
8621 part is the name of a local login, by accepting the address and assigning it to
8622 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8623 routers, so the address is bounced. The commented suffix settings fulfil the
8624 same purpose as they do for the <command>userforward</command> router.
8625 </para>
8626 </section>
8627 <section id="SECID56">
8628 <title>Transport configuration</title>
8629 <para>
8630 <indexterm role="concept">
8631 <primary>default</primary>
8632 <secondary>transports</secondary>
8633 </indexterm>
8634 <indexterm role="concept">
8635 <primary>transports</primary>
8636 <secondary>default</secondary>
8637 </indexterm>
8638 Transports define mechanisms for actually delivering messages. They operate
8639 only when referenced from routers, so the order in which they are defined does
8640 not matter. The transports section of the configuration starts with
8641 </para>
8642 <literallayout class="monospaced">
8643 begin transports
8644 </literallayout>
8645 <para>
8646 One remote transport and four local transports are defined.
8647 </para>
8648 <literallayout class="monospaced">
8649 remote_smtp:
8650   driver = smtp
8651 </literallayout>
8652 <para>
8653 This transport is used for delivering messages over SMTP connections. All its
8654 options are defaulted. The list of remote hosts comes from the router.
8655 </para>
8656 <literallayout class="monospaced">
8657 local_delivery:
8658   driver = appendfile
8659   file = /var/mail/$local_part
8660   delivery_date_add
8661   envelope_to_add
8662   return_path_add
8663 # group = mail
8664 # mode = 0660
8665 </literallayout>
8666 <para>
8667 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8668 traditional BSD mailbox format. By default it runs under the uid and gid of the
8669 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8670 directory. Some systems use the alternative approach of running mail deliveries
8671 under a particular group instead of using the sticky bit. The commented options
8672 show how this can be done.
8673 </para>
8674 <para>
8675 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8676 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8677 similarly-named options above.
8678 </para>
8679 <literallayout class="monospaced">
8680 address_pipe:
8681   driver = pipe
8682   return_output
8683 </literallayout>
8684 <para>
8685 This transport is used for handling deliveries to pipes that are generated by
8686 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
8687 option specifies that any output generated by the pipe is to be returned to the
8688 sender.
8689 </para>
8690 <literallayout class="monospaced">
8691 address_file:
8692   driver = appendfile
8693   delivery_date_add
8694   envelope_to_add
8695   return_path_add
8696 </literallayout>
8697 <para>
8698 This transport is used for handling deliveries to files that are generated by
8699 redirection. The name of the file is not specified in this instance of
8700 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8701 </para>
8702 <literallayout class="monospaced">
8703 address_reply:
8704   driver = autoreply
8705 </literallayout>
8706 <para>
8707 This transport is used for handling automatic replies generated by users&#x2019;
8708 filter files.
8709 </para>
8710 </section>
8711 <section id="SECID57">
8712 <title>Default retry rule</title>
8713 <para>
8714 <indexterm role="concept">
8715 <primary>retry</primary>
8716 <secondary>default rule</secondary>
8717 </indexterm>
8718 <indexterm role="concept">
8719 <primary>default</primary>
8720 <secondary>retry rule</secondary>
8721 </indexterm>
8722 The retry section of the configuration file contains rules which affect the way
8723 Exim retries deliveries that cannot be completed at the first attempt. It is
8724 introduced by the line
8725 </para>
8726 <literallayout class="monospaced">
8727 begin retry
8728 </literallayout>
8729 <para>
8730 In the default configuration, there is just one rule, which applies to all
8731 errors:
8732 </para>
8733 <literallayout class="monospaced">
8734 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
8735 </literallayout>
8736 <para>
8737 This causes any temporarily failing address to be retried every 15 minutes for
8738 2 hours, then at intervals starting at one hour and increasing by a factor of
8739 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8740 is not delivered after 4 days of temporary failure, it is bounced.
8741 </para>
8742 </section>
8743 <section id="SECID58">
8744 <title>Rewriting configuration</title>
8745 <para>
8746 The rewriting section of the configuration, introduced by
8747 </para>
8748 <literallayout class="monospaced">
8749 begin rewrite
8750 </literallayout>
8751 <para>
8752 contains rules for rewriting addresses in messages as they arrive. There are no
8753 rewriting rules in the default configuration file.
8754 </para>
8755 </section>
8756 <section id="SECTdefconfauth">
8757 <title>Authenticators configuration</title>
8758 <para>
8759 <indexterm role="concept">
8760 <primary>AUTH</primary>
8761 <secondary>configuration</secondary>
8762 </indexterm>
8763 The authenticators section of the configuration, introduced by
8764 </para>
8765 <literallayout class="monospaced">
8766 begin authenticators
8767 </literallayout>
8768 <para>
8769 defines mechanisms for the use of the SMTP AUTH command. The default
8770 configuration file contains two commented-out example authenticators
8771 which support plaintext username/password authentication using the
8772 standard PLAIN mechanism and the traditional but non-standard LOGIN
8773 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8774 to support most MUA software.
8775 </para>
8776 <para>
8777 The example PLAIN authenticator looks like this:
8778 </para>
8779 <literallayout class="monospaced">
8780 #PLAIN:
8781 #  driver                  = plaintext
8782 #  server_set_id           = $auth2
8783 #  server_prompts          = :
8784 #  server_condition        = Authentication is not yet configured
8785 #  server_advertise_condition = ${if def:tls_cipher }
8786 </literallayout>
8787 <para>
8788 And the example LOGIN authenticator looks like this:
8789 </para>
8790 <literallayout class="monospaced">
8791 #LOGIN:
8792 #  driver                  = plaintext
8793 #  server_set_id           = $auth1
8794 #  server_prompts          = &lt;| Username: | Password:
8795 #  server_condition        = Authentication is not yet configured
8796 #  server_advertise_condition = ${if def:tls_cipher }
8797 </literallayout>
8798 <para>
8799 The <option>server_set_id</option> option makes Exim remember the authenticated username
8800 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8801 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8802 that it implements the details of the specific authentication mechanism,
8803 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8804 when Exim offers authentication to clients; in the examples, this is only
8805 when TLS or SSL has been started, so to enable the authenticators you also
8806 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8807 </para>
8808 <para>
8809 The <option>server_condition</option> setting defines how to verify that the username and
8810 password are correct. In the examples it just produces an error message.
8811 To make the authenticators work, you can use a string expansion
8812 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8813 </para>
8814 <para>
8815 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8816 </para>
8817 </section>
8818 </chapter>
8819
8820 <chapter id="CHAPregexp">
8821 <title>Regular expressions</title>
8822 <para>
8823 <indexterm role="concept">
8824 <primary>regular expressions</primary>
8825 <secondary>library</secondary>
8826 </indexterm>
8827 <indexterm role="concept">
8828 <primary>PCRE</primary>
8829 </indexterm>
8830 Exim supports the use of regular expressions in many of its options. It
8831 uses the PCRE regular expression library; this provides regular expression
8832 matching that is compatible with Perl 5. The syntax and semantics of
8833 regular expressions is discussed in many Perl reference books, and also in
8834 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8835 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8836 </para>
8837 <para>
8838 The documentation for the syntax and semantics of the regular expressions that
8839 are supported by PCRE is included in plain text in the file
8840 <filename>doc/pcrepattern.txt</filename> in the Exim distribution, and also in the HTML
8841 tarbundle of Exim documentation. It describes in detail the features of the
8842 regular expressions that PCRE supports, so no further description is included
8843 here. The PCRE functions are called from Exim using the default option settings
8844 (that is, with no PCRE options set), except that the PCRE_CASELESS option is
8845 set when the matching is required to be case-insensitive.
8846 </para>
8847 <para>
8848 In most cases, when a regular expression is required in an Exim configuration,
8849 it has to start with a circumflex, in order to distinguish it from plain text
8850 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8851 second item in the colon-separated list is a regular expression.
8852 </para>
8853 <literallayout class="monospaced">
8854 domains = a.b.c : ^\\d{3} : *.y.z : ...
8855 </literallayout>
8856 <para>
8857 The doubling of the backslash is required because of string expansion that
8858 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
8859 of this issue, and a way of avoiding the need for doubling backslashes. The
8860 regular expression that is eventually used in this example contains just one
8861 backslash. The circumflex is included in the regular expression, and has the
8862 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8863 matched.
8864 </para>
8865 <para>
8866 There are, however, two cases where a circumflex is not required for the
8867 recognition of a regular expression: these are the <option>match</option> condition in a
8868 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8869 these cases, the relevant string is always treated as a regular expression; if
8870 it does not start with a circumflex, the expression is not anchored, and can
8871 match anywhere in the subject string.
8872 </para>
8873 <para>
8874 In all cases, if you want a regular expression to match at the end of a string,
8875 you must code the $ metacharacter to indicate this. For example:
8876 </para>
8877 <literallayout class="monospaced">
8878 domains = ^\\d{3}\\.example
8879 </literallayout>
8880 <para>
8881 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8882 You need to use:
8883 </para>
8884 <literallayout class="monospaced">
8885 domains = ^\\d{3}\\.example\$
8886 </literallayout>
8887 <para>
8888 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8889 $ is needed because string expansion also interprets dollar characters.
8890 </para>
8891 <section id="SECID59">
8892 <title>Testing regular expressions</title>
8893 <para>
8894 <indexterm role="concept">
8895 <primary>testing</primary>
8896 <secondary>regular expressions</secondary>
8897 </indexterm>
8898 <indexterm role="concept">
8899 <primary>regular expressions</primary>
8900 <secondary>testing</secondary>
8901 </indexterm>
8902 <indexterm role="concept">
8903 <primary><emphasis>pcretest</emphasis></primary>
8904 </indexterm>
8905 A program called <emphasis>pcretest</emphasis> forms part of the PCRE distribution and is built
8906 with PCRE during the process of building Exim. It is primarily intended for
8907 testing PCRE itself, but it can also be used for experimenting with regular
8908 expressions. After building Exim, the binary can be found in the build
8909 directory (it is not installed anywhere automatically). There is documentation
8910 of various options in <filename>doc/pcretest.txt</filename>, but for simple testing, none are
8911 needed. This is the output of a sample run of <emphasis>pcretest</emphasis>:
8912 </para>
8913 <literallayout>
8914 <literal>  re&gt; </literal><emphasis role="bold"><literal>/^([@]+)@.+\.(ac|edu)\.(?!kr)[a-z]{2}$/</literal></emphasis>
8915 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.ac.uk</literal></emphasis>
8916 <literal> 0: x@y.ac.uk</literal>
8917 <literal> 1: x</literal>
8918 <literal> 2: ac</literal>
8919 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.ac.kr</literal></emphasis>
8920 <literal>No match</literal>
8921 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.edu.com</literal></emphasis>
8922 <literal>No match</literal>
8923 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.edu.co</literal></emphasis>
8924 <literal> 0: x@y.edu.co</literal>
8925 <literal> 1: x</literal>
8926 <literal> 2: edu</literal>
8927 </literallayout>
8928 <para>
8929 Input typed by the user is shown in bold face. After the <quote>re&gt;</quote> prompt, a
8930 regular expression enclosed in delimiters is expected. If this compiles without
8931 error, <quote>data&gt;</quote> prompts are given for strings against which the expression is
8932 matched. An empty data line causes a new regular expression to be read. If the
8933 match is successful, the captured substring values (that is, what would be in
8934 the variables <varname>$0</varname>, <varname>$1</varname>, <varname>$2</varname>, etc.) are shown. The above example tests for
8935 an email address whose domain ends with either <quote>ac</quote> or <quote>edu</quote> followed by a
8936 two-character top-level domain that is not <quote>kr</quote>. The local part is captured
8937 in <varname>$1</varname> and the <quote>ac</quote> or <quote>edu</quote> in <varname>$2</varname>.
8938 </para>
8939 </section>
8940 </chapter>
8941
8942 <chapter id="CHAPfdlookup">
8943 <title>File and database lookups</title>
8944 <para>
8945 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8946 <primary>file</primary>
8947 <secondary>lookups</secondary>
8948 </indexterm>
8949 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8950 <primary>database</primary>
8951 <secondary>lookups</secondary>
8952 </indexterm>
8953 <indexterm role="concept">
8954 <primary>lookup</primary>
8955 <secondary>description of</secondary>
8956 </indexterm>
8957 Exim can be configured to look up data in files or databases as it processes
8958 messages. Two different kinds of syntax are used:
8959 </para>
8960 <orderedlist numeration="arabic">
8961 <listitem>
8962 <para>
8963 A string that is to be expanded may contain explicit lookup requests. These
8964 cause parts of the string to be replaced by data that is obtained from the
8965 lookup. Lookups of this type are conditional expansion items. Different results
8966 can be defined for the cases of lookup success and failure. See chapter
8967 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8968 </para>
8969 </listitem>
8970 <listitem>
8971 <para>
8972 Lists of domains, hosts, and email addresses can contain lookup requests as a
8973 way of avoiding excessively long linear lists. In this case, the data that is
8974 returned by the lookup is often (but not always) discarded; whether the lookup
8975 succeeds or fails is what really counts. These kinds of list are described in
8976 chapter <xref linkend="CHAPdomhosaddlists"/>.
8977 </para>
8978 </listitem>
8979 </orderedlist>
8980 <para>
8981 String expansions, lists, and lookups interact with each other in such a way
8982 that there is no order in which to describe any one of them that does not
8983 involve references to the others. Each of these three chapters makes more sense
8984 if you have read the other two first. If you are reading this for the first
8985 time, be aware that some of it will make a lot more sense after you have read
8986 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
8987 </para>
8988 <section id="SECID60">
8989 <title>Examples of different lookup syntax</title>
8990 <para>
8991 It is easy to confuse the two different kinds of lookup, especially as the
8992 lists that may contain the second kind are always expanded before being
8993 processed as lists. Therefore, they may also contain lookups of the first kind.
8994 Be careful to distinguish between the following two examples:
8995 </para>
8996 <literallayout class="monospaced">
8997 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
8998 domains = lsearch;/some/file
8999 </literallayout>
9000 <para>
9001 The first uses a string expansion, the result of which must be a domain list.
9002 No strings have been specified for a successful or a failing lookup; the
9003 defaults in this case are the looked-up data and an empty string, respectively.
9004 The expansion takes place before the string is processed as a list, and the
9005 file that is searched could contain lines like this:
9006 </para>
9007 <literallayout class="monospaced">
9008 192.168.3.4: domain1:domain2:...
9009 192.168.1.9: domain3:domain4:...
9010 </literallayout>
9011 <para>
9012 When the lookup succeeds, the result of the expansion is a list of domains (and
9013 possibly other types of item that are allowed in domain lists).
9014 </para>
9015 <para>
9016 In the second example, the lookup is a single item in a domain list. It causes
9017 Exim to use a lookup to see if the domain that is being processed can be found
9018 in the file. The file could contains lines like this:
9019 </para>
9020 <literallayout class="monospaced">
9021 domain1:
9022 domain2:
9023 </literallayout>
9024 <para>
9025 Any data that follows the keys is not relevant when checking that the domain
9026 matches the list item.
9027 </para>
9028 <para>
9029 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9030 Consider a file containing lines like this:
9031 </para>
9032 <literallayout class="monospaced">
9033 192.168.5.6: lsearch;/another/file
9034 </literallayout>
9035 <para>
9036 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9037 first <option>domains</option> setting above generates the second setting, which therefore
9038 causes a second lookup to occur.
9039 </para>
9040 <para>
9041 The rest of this chapter describes the different lookup types that are
9042 available. Any of them can be used in any part of the configuration where a
9043 lookup is permitted.
9044 </para>
9045 </section>
9046 <section id="SECID61">
9047 <title>Lookup types</title>
9048 <para>
9049 <indexterm role="concept">
9050 <primary>lookup</primary>
9051 <secondary>types of</secondary>
9052 </indexterm>
9053 <indexterm role="concept">
9054 <primary>single-key lookup</primary>
9055 <secondary>definition of</secondary>
9056 </indexterm>
9057 Two different types of data lookup are implemented:
9058 </para>
9059 <itemizedlist>
9060 <listitem>
9061 <para>
9062 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9063 and a single key to search for. The key must be a non-empty string for the
9064 lookup to succeed. The lookup type determines how the file is searched.
9065 </para>
9066 </listitem>
9067 <listitem>
9068 <para>
9069 <indexterm role="concept">
9070 <primary>query-style lookup</primary>
9071 <secondary>definition of</secondary>
9072 </indexterm>
9073 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9074 key value is assumed by Exim for query-style lookups. You can use whichever
9075 Exim variables you need to construct the database query.
9076 </para>
9077 </listitem>
9078 </itemizedlist>
9079 <para>
9080 The code for each lookup type is in a separate source file that is included in
9081 the binary of Exim only if the corresponding compile-time option is set. The
9082 default settings in <filename>src/EDITME</filename> are:
9083 </para>
9084 <literallayout class="monospaced">
9085 LOOKUP_DBM=yes
9086 LOOKUP_LSEARCH=yes
9087 </literallayout>
9088 <para>
9089 which means that only linear searching and DBM lookups are included by default.
9090 For some types of lookup (e.g. SQL databases), you need to install appropriate
9091 libraries and header files before building Exim.
9092 </para>
9093 </section>
9094 <section id="SECTsinglekeylookups">
9095 <title>Single-key lookup types</title>
9096 <para>
9097 <indexterm role="concept">
9098 <primary>lookup</primary>
9099 <secondary>single-key types</secondary>
9100 </indexterm>
9101 <indexterm role="concept">
9102 <primary>single-key lookup</primary>
9103 <secondary>list of types</secondary>
9104 </indexterm>
9105 The following single-key lookup types are implemented:
9106 </para>
9107 <itemizedlist>
9108 <listitem>
9109 <para>
9110 <indexterm role="concept">
9111 <primary>cdb</primary>
9112 <secondary>description of</secondary>
9113 </indexterm>
9114 <indexterm role="concept">
9115 <primary>lookup</primary>
9116 <secondary>cdb</secondary>
9117 </indexterm>
9118 <indexterm role="concept">
9119 <primary>binary zero</primary>
9120 <secondary>in lookup key</secondary>
9121 </indexterm>
9122 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9123 string without a terminating binary zero. The cdb format is designed for
9124 indexed files that are read frequently and never updated, except by total
9125 re-creation. As such, it is particularly suitable for large files containing
9126 aliases or other indexed data referenced by an MTA. Information about cdb can
9127 be found in several places:
9128 </para>
9129 <literallayout>
9130 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9131 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9132 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9133 </literallayout>
9134 <para>
9135 A cdb distribution is not needed in order to build Exim with cdb support,
9136 because the code for reading cdb files is included directly in Exim itself.
9137 However, no means of building or testing cdb files is provided with Exim, so
9138 you need to obtain a cdb distribution in order to do this.
9139 </para>
9140 </listitem>
9141 <listitem>
9142 <para>
9143 <indexterm role="concept">
9144 <primary>DBM</primary>
9145 <secondary>lookup type</secondary>
9146 </indexterm>
9147 <indexterm role="concept">
9148 <primary>lookup</primary>
9149 <secondary>dbm</secondary>
9150 </indexterm>
9151 <indexterm role="concept">
9152 <primary>binary zero</primary>
9153 <secondary>in lookup key</secondary>
9154 </indexterm>
9155 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9156 DBM file by looking up the record with the given key. A terminating binary
9157 zero is included in the key that is passed to the DBM library. See section
9158 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9159 </para>
9160 <para>
9161 <indexterm role="concept">
9162 <primary>Berkeley DB library</primary>
9163 <secondary>file format</secondary>
9164 </indexterm>
9165 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9166 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9167 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9168 the DB_UNKNOWN option. This enables it to handle any of the types of database
9169 that the library supports, and can be useful for accessing DBM files created by
9170 other applications. (For earlier DB versions, DB_HASH is always used.)
9171 </para>
9172 </listitem>
9173 <listitem>
9174 <para>
9175 <indexterm role="concept">
9176 <primary>lookup</primary>
9177 <secondary>dbmnz</secondary>
9178 </indexterm>
9179 <indexterm role="concept">
9180 <primary>lookup</primary>
9181 <secondary>dbm &ndash; terminating zero</secondary>
9182 </indexterm>
9183 <indexterm role="concept">
9184 <primary>binary zero</primary>
9185 <secondary>in lookup key</secondary>
9186 </indexterm>
9187 <indexterm role="concept">
9188 <primary>Courier</primary>
9189 </indexterm>
9190 <indexterm role="concept">
9191 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9192 </indexterm>
9193 <indexterm role="concept">
9194 <primary>dmbnz lookup type</primary>
9195 </indexterm>
9196 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9197 is not included in the key that is passed to the DBM library. You may need this
9198 if you want to look up data in files that are created by or shared with some
9199 other application that does not use terminating zeros. For example, you need to
9200 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9201 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9202 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9203 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9204 </para>
9205 </listitem>
9206 <listitem>
9207 <para>
9208 <indexterm role="concept">
9209 <primary>lookup</primary>
9210 <secondary>dsearch</secondary>
9211 </indexterm>
9212 <indexterm role="concept">
9213 <primary>dsearch lookup type</primary>
9214 </indexterm>
9215 <command>dsearch</command>: The given file must be a directory; this is searched for a file
9216 whose name is the key. The key may not contain any forward slash characters.
9217 The result of a successful lookup is the name of the file. An example of how
9218 this lookup can be used to support virtual domains is given in section
9219 <xref linkend="SECTvirtualdomains"/>.
9220 </para>
9221 </listitem>
9222 <listitem>
9223 <para>
9224 <indexterm role="concept">
9225 <primary>lookup</primary>
9226 <secondary>iplsearch</secondary>
9227 </indexterm>
9228 <indexterm role="concept">
9229 <primary>iplsearch lookup type</primary>
9230 </indexterm>
9231 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9232 terminated by a colon or white space or the end of the line. The keys in the
9233 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9234 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9235 being interpreted as a key terminator. For example:
9236 </para>
9237 <literallayout class="monospaced">
9238 1.2.3.4:           data for 1.2.3.4
9239 192.168.0.0/16     data for 192.168.0.0/16
9240 "abcd::cdab":      data for abcd::cdab
9241 "abcd:abcd::/32"   data for abcd:abcd::/32
9242 </literallayout>
9243 <para>
9244 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9245 file is searched linearly, using the CIDR masks where present, until a matching
9246 key is found. The first key that matches is used; there is no attempt to find a
9247 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9248 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9249 </para>
9250 <para>
9251 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9252 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9253 lookup types support only literal keys.
9254 </para>
9255 <para>
9256 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9257 the implicit key is the host&#x2019;s IP address rather than its name (see section
9258 <xref linkend="SECThoslispatsikey"/>).
9259 </para>
9260 </listitem>
9261 <listitem>
9262 <para>
9263 <indexterm role="concept">
9264 <primary>linear search</primary>
9265 </indexterm>
9266 <indexterm role="concept">
9267 <primary>lookup</primary>
9268 <secondary>lsearch</secondary>
9269 </indexterm>
9270 <indexterm role="concept">
9271 <primary>lsearch lookup type</primary>
9272 </indexterm>
9273 <indexterm role="concept">
9274 <primary>case sensitivity</primary>
9275 <secondary>in lsearch lookup</secondary>
9276 </indexterm>
9277 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9278 line beginning with the search key, terminated by a colon or white space or the
9279 end of the line. The search is case-insensitive; that is, upper and lower case
9280 letters are treated as the same. The first occurrence of the key that is found
9281 in the file is used.
9282 </para>
9283 <para>
9284 White space between the key and the colon is permitted. The remainder of the
9285 line, with leading and trailing white space removed, is the data. This can be
9286 continued onto subsequent lines by starting them with any amount of white
9287 space, but only a single space character is included in the data at such a
9288 junction. If the data begins with a colon, the key must be terminated by a
9289 colon, for example:
9290 </para>
9291 <literallayout class="monospaced">
9292 baduser:  :fail:
9293 </literallayout>
9294 <para>
9295 Empty lines and lines beginning with # are ignored, even if they occur in the
9296 middle of an item. This is the traditional textual format of alias files. Note
9297 that the keys in an <command>lsearch</command> file are literal strings. There is no
9298 wildcarding of any kind.
9299 </para>
9300 <para>
9301 <indexterm role="concept">
9302 <primary>lookup</primary>
9303 <secondary>lsearch &ndash; colons in keys</secondary>
9304 </indexterm>
9305 <indexterm role="concept">
9306 <primary>white space</primary>
9307 <secondary>in lsearch key</secondary>
9308 </indexterm>
9309 In most <command>lsearch</command> files, keys are not required to contain colons or #
9310 characters, or white space. However, if you need this feature, it is available.
9311 If a key begins with a doublequote character, it is terminated only by a
9312 matching quote (or end of line), and the normal escaping rules apply to its
9313 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9314 quoted keys (exactly as for unquoted keys). There is no special handling of
9315 quotes for the data part of an <command>lsearch</command> line.
9316 </para>
9317 </listitem>
9318 <listitem>
9319 <para>
9320 <indexterm role="concept">
9321 <primary>NIS lookup type</primary>
9322 </indexterm>
9323 <indexterm role="concept">
9324 <primary>lookup</primary>
9325 <secondary>NIS</secondary>
9326 </indexterm>
9327 <indexterm role="concept">
9328 <primary>binary zero</primary>
9329 <secondary>in lookup key</secondary>
9330 </indexterm>
9331 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9332 the given key, without a terminating binary zero. There is a variant called
9333 <command>nis0</command> which does include the terminating binary zero in the key. This is
9334 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9335 aliases; the full map names must be used.
9336 </para>
9337 </listitem>
9338 <listitem>
9339 <para>
9340 <indexterm role="concept">
9341 <primary>wildlsearch lookup type</primary>
9342 </indexterm>
9343 <indexterm role="concept">
9344 <primary>lookup</primary>
9345 <secondary>wildlsearch</secondary>
9346 </indexterm>
9347 <indexterm role="concept">
9348 <primary>nwildlsearch lookup type</primary>
9349 </indexterm>
9350 <indexterm role="concept">
9351 <primary>lookup</primary>
9352 <secondary>nwildlsearch</secondary>
9353 </indexterm>
9354 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9355 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9356 the file may be wildcarded. The difference between these two lookup types is
9357 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9358 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9359 </para>
9360 <para>
9361 <indexterm role="concept">
9362 <primary>case sensitivity</primary>
9363 <secondary>in (n)wildlsearch lookup</secondary>
9364 </indexterm>
9365 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9366 file that are regular expressions can be made case-sensitive by the use of
9367 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9368 </para>
9369 <orderedlist numeration="arabic">
9370 <listitem>
9371 <para>
9372 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9373 </para>
9374 <literallayout class="monospaced">
9375     *.a.b.c       data for anything.a.b.c
9376     *fish         data for anythingfish
9377 </literallayout>
9378 </listitem>
9379 <listitem>
9380 <para>
9381 The string may begin with a circumflex to indicate a regular expression. For
9382 example, for <command>wildlsearch</command>:
9383 </para>
9384 <literallayout class="monospaced">
9385     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9386 </literallayout>
9387 <para>
9388 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9389 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9390 string-expanded, the equivalent entry is:
9391 </para>
9392 <literallayout class="monospaced">
9393     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9394 </literallayout>
9395 <para>
9396 The case-insensitive flag is set at the start of compiling the regular
9397 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9398 For example, to make the entire pattern case-sensitive:
9399 </para>
9400 <literallayout class="monospaced">
9401     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9402 </literallayout>
9403 <para>
9404 If the regular expression contains white space or colon characters, you must
9405 either quote it (see <command>lsearch</command> above), or represent these characters in other
9406 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9407 colon. This may be easier than quoting, because if you quote, you have to
9408 escape all the backslashes inside the quotes.
9409 </para>
9410 <para>
9411 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9412 match for later use, because the results of all lookups are cached. If a lookup
9413 is repeated, the result is taken from the cache, and no actual pattern matching
9414 takes place. The values of all the numeric variables are unset after a
9415 <command>(n)wildlsearch</command> match.
9416 </para>
9417 </listitem>
9418 <listitem>
9419 <para>
9420 Although I cannot see it being of much use, the general matching function that
9421 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9422 lookup name terminated by a semicolon, and followed by lookup data. For
9423 example:
9424 </para>
9425 <literallayout class="monospaced">
9426     cdb;/some/file  data for keys that match the file
9427 </literallayout>
9428 <para>
9429 The data that is obtained from the nested lookup is discarded.
9430 </para>
9431 </listitem>
9432 </orderedlist>
9433 <para>
9434 Keys that do not match any of these patterns are interpreted literally. The
9435 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9436 be followed by optional colons.
9437 </para>
9438 <para>
9439 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9440 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9441 lookup types support only literal keys.
9442 </para>
9443 </listitem>
9444 </itemizedlist>
9445 </section>
9446 <section id="SECID62">
9447 <title>Query-style lookup types</title>
9448 <para>
9449 <indexterm role="concept">
9450 <primary>lookup</primary>
9451 <secondary>query-style types</secondary>
9452 </indexterm>
9453 <indexterm role="concept">
9454 <primary>query-style lookup</primary>
9455 <secondary>list of types</secondary>
9456 </indexterm>
9457 The supported query-style lookup types are listed below. Further details about
9458 many of them are given in later sections.
9459 </para>
9460 <itemizedlist>
9461 <listitem>
9462 <para>
9463 <indexterm role="concept">
9464 <primary>DNS</primary>
9465 <secondary>as a lookup type</secondary>
9466 </indexterm>
9467 <indexterm role="concept">
9468 <primary>lookup</primary>
9469 <secondary>DNS</secondary>
9470 </indexterm>
9471 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9472 are given in the supplied query. The resulting data is the contents of the
9473 records. See section <xref linkend="SECTdnsdb"/>.
9474 </para>
9475 </listitem>
9476 <listitem>
9477 <para>
9478 <indexterm role="concept">
9479 <primary>InterBase lookup type</primary>
9480 </indexterm>
9481 <indexterm role="concept">
9482 <primary>lookup</primary>
9483 <secondary>InterBase</secondary>
9484 </indexterm>
9485 <command>ibase</command>: This does a lookup in an InterBase database.
9486 </para>
9487 </listitem>
9488 <listitem>
9489 <para>
9490 <indexterm role="concept">
9491 <primary>LDAP</primary>
9492 <secondary>lookup type</secondary>
9493 </indexterm>
9494 <indexterm role="concept">
9495 <primary>lookup</primary>
9496 <secondary>LDAP</secondary>
9497 </indexterm>
9498 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9499 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9500 that permits values from multiple entries to be returned. A third variant
9501 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9502 any attribute values. See section <xref linkend="SECTldap"/>.
9503 </para>
9504 </listitem>
9505 <listitem>
9506 <para>
9507 <indexterm role="concept">
9508 <primary>MySQL</primary>
9509 <secondary>lookup type</secondary>
9510 </indexterm>
9511 <indexterm role="concept">
9512 <primary>lookup</primary>
9513 <secondary>MySQL</secondary>
9514 </indexterm>
9515 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9516 MySQL database. See section <xref linkend="SECTsql"/>.
9517 </para>
9518 </listitem>
9519 <listitem>
9520 <para>
9521 <indexterm role="concept">
9522 <primary>NIS+ lookup type</primary>
9523 </indexterm>
9524 <indexterm role="concept">
9525 <primary>lookup</primary>
9526 <secondary>NIS+</secondary>
9527 </indexterm>
9528 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9529 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9530 </para>
9531 </listitem>
9532 <listitem>
9533 <para>
9534 <indexterm role="concept">
9535 <primary>Oracle</primary>
9536 <secondary>lookup type</secondary>
9537 </indexterm>
9538 <indexterm role="concept">
9539 <primary>lookup</primary>
9540 <secondary>Oracle</secondary>
9541 </indexterm>
9542 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9543 Oracle database. See section <xref linkend="SECTsql"/>.
9544 </para>
9545 </listitem>
9546 <listitem>
9547 <para>
9548 <indexterm role="concept">
9549 <primary>lookup</primary>
9550 <secondary>passwd</secondary>
9551 </indexterm>
9552 <indexterm role="concept">
9553 <primary>passwd lookup type</primary>
9554 </indexterm>
9555 <indexterm role="concept">
9556 <primary><filename>/etc/passwd</filename></primary>
9557 </indexterm>
9558 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9559 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9560 success, the result string is the same as you would get from an <command>lsearch</command>
9561 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9562 password value. For example:
9563 </para>
9564 <literallayout class="monospaced">
9565 *:42:42:King Rat:/home/kr:/bin/bash
9566 </literallayout>
9567 </listitem>
9568 <listitem>
9569 <para>
9570 <indexterm role="concept">
9571 <primary>PostgreSQL lookup type</primary>
9572 </indexterm>
9573 <indexterm role="concept">
9574 <primary>lookup</primary>
9575 <secondary>PostgreSQL</secondary>
9576 </indexterm>
9577 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9578 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9579 </para>
9580 </listitem>
9581 <listitem>
9582 <para>
9583 <indexterm role="concept">
9584 <primary>sqlite lookup type</primary>
9585 </indexterm>
9586 <indexterm role="concept">
9587 <primary>lookup</primary>
9588 <secondary>sqlite</secondary>
9589 </indexterm>
9590 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9591 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9592 </para>
9593 </listitem>
9594 <listitem>
9595 <para>
9596 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9597 not likely to be useful in normal operation.
9598 </para>
9599 </listitem>
9600 <listitem>
9601 <para>
9602 <indexterm role="concept">
9603 <primary>whoson lookup type</primary>
9604 </indexterm>
9605 <indexterm role="concept">
9606 <primary>lookup</primary>
9607 <secondary>whoson</secondary>
9608 </indexterm>
9609 </para>
9610 <para revisionflag="changed">
9611 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a protocol that
9612 allows a server to check whether a particular (dynamically allocated) IP
9613 address is currently allocated to a known (trusted) user and, optionally, to
9614 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9615 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9616 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9617 <quote>POP before SMTP</quote> checking using ACL statements such as
9618 </para>
9619 <literallayout class="monospaced" revisionflag="changed">
9620 require condition = \
9621   ${lookup whoson {$sender_host_address}{yes}{no}}
9622 </literallayout>
9623 <para revisionflag="changed">
9624 The query consists of a single IP address. The value returned is the name of
9625 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9626 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9627 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9628 </para>
9629 </listitem>
9630 </itemizedlist>
9631 </section>
9632 <section id="SECID63">
9633 <title>Temporary errors in lookups</title>
9634 <para>
9635 <indexterm role="concept">
9636 <primary>lookup</primary>
9637 <secondary>temporary error in</secondary>
9638 </indexterm>
9639 Lookup functions can return temporary error codes if the lookup cannot be
9640 completed. For example, an SQL or LDAP database might be unavailable. For this
9641 reason, it is not advisable to use a lookup that might do this for critical
9642 options such as a list of local domains.
9643 </para>
9644 <para>
9645 When a lookup cannot be completed in a router or transport, delivery
9646 of the message (to the relevant address) is deferred, as for any other
9647 temporary error. In other circumstances Exim may assume the lookup has failed,
9648 or may give up altogether.
9649 </para>
9650 </section>
9651 <section id="SECTdefaultvaluelookups">
9652 <title>Default values in single-key lookups</title>
9653 <para>
9654 <indexterm role="concept">
9655 <primary>wildcard lookups</primary>
9656 </indexterm>
9657 <indexterm role="concept">
9658 <primary>lookup</primary>
9659 <secondary>default values</secondary>
9660 </indexterm>
9661 <indexterm role="concept">
9662 <primary>lookup</primary>
9663 <secondary>wildcard</secondary>
9664 </indexterm>
9665 <indexterm role="concept">
9666 <primary>lookup</primary>
9667 <secondary>* added to type</secondary>
9668 </indexterm>
9669 <indexterm role="concept">
9670 <primary>default</primary>
9671 <secondary>in single-key lookups</secondary>
9672 </indexterm>
9673 In this context, a <quote>default value</quote> is a value specified by the administrator
9674 that is to be used if a lookup fails.
9675 </para>
9676 <para>
9677 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9678 lookups, the facilities of the query language must be used. An attempt to
9679 specify a default for a query-style lookup provokes an error.
9680 </para>
9681 <para>
9682 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9683 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9684 provide a default value. See also the section on partial matching below.
9685 </para>
9686 <para>
9687 <indexterm role="concept">
9688 <primary>*@ with single-key lookup</primary>
9689 </indexterm>
9690 <indexterm role="concept">
9691 <primary>lookup</primary>
9692 <secondary>*@ added to type</secondary>
9693 </indexterm>
9694 <indexterm role="concept">
9695 <primary>alias file</primary>
9696 <secondary>per-domain default</secondary>
9697 </indexterm>
9698 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9699 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9700 character, a second lookup is done with everything before the last @ replaced
9701 by *. This makes it possible to provide per-domain defaults in alias files
9702 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
9703 take place because there is no @ in the key), <quote>*</quote> is looked up.
9704 For example, a <command>redirect</command> router might contain:
9705 </para>
9706 <literallayout class="monospaced">
9707 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9708 </literallayout>
9709 <para>
9710 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9711 looks up these keys, in this order:
9712 </para>
9713 <literallayout class="monospaced">
9714 jane@eyre.example
9715 *@eyre.example
9716 *
9717 </literallayout>
9718 <para>
9719 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9720 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9721 complete scan is done for each key, and only if it is not found at all does
9722 Exim move on to try the next key.
9723 </para>
9724 </section>
9725 <section id="SECTpartiallookup">
9726 <title>Partial matching in single-key lookups</title>
9727 <para>
9728 <indexterm role="concept">
9729 <primary>partial matching</primary>
9730 </indexterm>
9731 <indexterm role="concept">
9732 <primary>wildcard lookups</primary>
9733 </indexterm>
9734 <indexterm role="concept">
9735 <primary>lookup</primary>
9736 <secondary>partial matching</secondary>
9737 </indexterm>
9738 <indexterm role="concept">
9739 <primary>lookup</primary>
9740 <secondary>wildcard</secondary>
9741 </indexterm>
9742 <indexterm role="concept">
9743 <primary>asterisk</primary>
9744 <secondary>in search type</secondary>
9745 </indexterm>
9746 The normal operation of a single-key lookup is to search the file for an exact
9747 match with the given key. However, in a number of situations where domains are
9748 being looked up, it is useful to be able to do partial matching. In this case,
9749 information in the file that has a key starting with <quote>*.</quote> is matched by any
9750 domain that ends with the components that follow the full stop. For example, if
9751 a key in a DBM file is
9752 </para>
9753 <literallayout class="monospaced">
9754 *.dates.fict.example
9755 </literallayout>
9756 <para>
9757 then when partial matching is enabled this is matched by (amongst others)
9758 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9759 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9760 file.
9761 </para>
9762 <para>
9763 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9764 also not available for any lookup items in address lists (see section
9765 <xref linkend="SECTaddresslist"/>).
9766 </para>
9767 <para>
9768 Partial matching is implemented by doing a series of separate lookups using
9769 keys constructed by modifying the original subject key. This means that it can
9770 be used with any of the single-key lookup types, provided that
9771 partial matching keys
9772 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9773 Keys in the file that do not begin with the prefix are matched only by
9774 unmodified subject keys when partial matching is in use.
9775 </para>
9776 <para>
9777 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9778 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9779 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9780 is added at the start of the subject key, and it is looked up again. If that
9781 fails, further lookups are tried with dot-separated components removed from the
9782 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9783 remains.
9784 </para>
9785 <para>
9786 A minimum number of two non-* components are required. This can be adjusted
9787 by including a number before the hyphen in the search type. For example,
9788 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9789 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9790 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9791 up when the minimum number of non-* components is two:
9792 </para>
9793 <literallayout class="monospaced">
9794 2250.dates.fict.example
9795 *.2250.dates.fict.example
9796 *.dates.fict.example
9797 *.fict.example
9798 </literallayout>
9799 <para>
9800 As soon as one key in the sequence is successfully looked up, the lookup
9801 finishes.
9802 </para>
9803 <para>
9804 <indexterm role="concept">
9805 <primary>lookup</primary>
9806 <secondary>partial matching &ndash; changing prefix</secondary>
9807 </indexterm>
9808 <indexterm role="concept">
9809 <primary>prefix</primary>
9810 <secondary>for partial matching</secondary>
9811 </indexterm>
9812 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9813 changed. The motivation for this feature is to allow Exim to operate with file
9814 formats that are used by other MTAs. A different prefix can be supplied in
9815 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9816 </para>
9817 <literallayout class="monospaced">
9818 domains = partial(.)lsearch;/some/file
9819 </literallayout>
9820 <para>
9821 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9822 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9823 components is unchanged). The prefix may consist of any punctuation characters
9824 other than a closing parenthesis. It may be empty, for example:
9825 </para>
9826 <literallayout class="monospaced">
9827 domains = partial1()cdb;/some/file
9828 </literallayout>
9829 <para>
9830 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9831 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9832 </para>
9833 <para>
9834 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9835 just one non-wild component has failed, and the original key is shortened right
9836 down to the null string) depends on the prefix:
9837 </para>
9838 <itemizedlist>
9839 <listitem>
9840 <para>
9841 If the prefix has zero length, the whole lookup fails.
9842 </para>
9843 </listitem>
9844 <listitem>
9845 <para>
9846 If the prefix has length 1, a lookup for just the prefix is done. For
9847 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9848 </para>
9849 </listitem>
9850 <listitem>
9851 <para>
9852 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9853 remainder is looked up. With the default prefix, therefore, the final lookup is
9854 for <quote>*</quote> on its own.
9855 </para>
9856 </listitem>
9857 <listitem>
9858 <para>
9859 Otherwise, the whole prefix is looked up.
9860 </para>
9861 </listitem>
9862 </itemizedlist>
9863 <para>
9864 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9865 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9866 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9867 specified, adding <quote>*</quote> to the search type has no effect with the default
9868 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9869 lookups. However, there might be a use for lookup types such as
9870 <quote>partial0(.)lsearch*</quote>.
9871 </para>
9872 <para>
9873 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9874 in domain lists and the like. Partial matching works only in terms of
9875 dot-separated components; a key such as <literal>*fict.example</literal>
9876 in a database file is useless, because the asterisk in a partial matching
9877 subject key is always followed by a dot.
9878 </para>
9879 </section>
9880 <section id="SECID64">
9881 <title>Lookup caching</title>
9882 <para>
9883 <indexterm role="concept">
9884 <primary>lookup</primary>
9885 <secondary>caching</secondary>
9886 </indexterm>
9887 <indexterm role="concept">
9888 <primary>caching</primary>
9889 <secondary>lookup data</secondary>
9890 </indexterm>
9891 Exim caches all lookup results in order to avoid needless repetition of
9892 lookups. However, because (apart from the daemon) Exim operates as a collection
9893 of independent, short-lived processes, this caching applies only within a
9894 single Exim process. There is no inter-process lookup caching facility.
9895 </para>
9896 <para>
9897 For single-key lookups, Exim keeps the relevant files open in case there is
9898 another lookup that needs them. In some types of configuration this can lead to
9899 many files being kept open for messages with many recipients. To avoid hitting
9900 the operating system limit on the number of simultaneously open files, Exim
9901 closes the least recently used file when it needs to open more files than its
9902 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9903 </para>
9904 <para>
9905 The single-key lookup files are closed and the lookup caches are flushed at
9906 strategic points during delivery &ndash; for example, after all routing is
9907 complete.
9908 </para>
9909 </section>
9910 <section id="SECID65">
9911 <title>Quoting lookup data</title>
9912 <para>
9913 <indexterm role="concept">
9914 <primary>lookup</primary>
9915 <secondary>quoting</secondary>
9916 </indexterm>
9917 <indexterm role="concept">
9918 <primary>quoting</primary>
9919 <secondary>in lookups</secondary>
9920 </indexterm>
9921 When data from an incoming message is included in a query-style lookup, there
9922 is the possibility of special characters in the data messing up the syntax of
9923 the query. For example, a NIS+ query that contains
9924 </para>
9925 <literallayout class="monospaced">
9926 [name=$local_part]
9927 </literallayout>
9928 <para>
9929 will be broken if the local part happens to contain a closing square bracket.
9930 For NIS+, data can be enclosed in double quotes like this:
9931 </para>
9932 <literallayout class="monospaced">
9933 [name="$local_part"]
9934 </literallayout>
9935 <para>
9936 but this still leaves the problem of a double quote in the data. The rule for
9937 NIS+ is that double quotes must be doubled. Other lookup types have different
9938 rules, and to cope with the differing requirements, an expansion operator
9939 of the following form is provided:
9940 </para>
9941 <literallayout class="monospaced">
9942 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
9943 </literallayout>
9944 <para>
9945 For example, the safest way to write the NIS+ query is
9946 </para>
9947 <literallayout class="monospaced">
9948 [name="${quote_nisplus:$local_part}"]
9949 </literallayout>
9950 <para>
9951 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9952 operator can be used for all lookup types, but has no effect for single-key
9953 lookups, since no quoting is ever needed in their key strings.
9954 </para>
9955 </section>
9956 <section id="SECTdnsdb">
9957 <title>More about dnsdb</title>
9958 <para>
9959 <indexterm role="concept">
9960 <primary>dnsdb lookup</primary>
9961 </indexterm>
9962 <indexterm role="concept">
9963 <primary>lookup</primary>
9964 <secondary>dnsdb</secondary>
9965 </indexterm>
9966 <indexterm role="concept">
9967 <primary>DNS</primary>
9968 <secondary>as a lookup type</secondary>
9969 </indexterm>
9970 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9971 of a record type and a domain name, separated by an equals sign. For example,
9972 an expansion string could contain:
9973 </para>
9974 <literallayout class="monospaced">
9975 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9976 </literallayout>
9977 <para>
9978 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9979 is used on its own as the result. If the lookup does not succeed, the
9980 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
9981 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
9982 </para>
9983 <para>
9984 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
9985 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
9986 configured). If no type is given, TXT is assumed. When the type is PTR,
9987 the data can be an IP address, written as normal; inversion and the addition of
9988 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
9989 </para>
9990 <literallayout class="monospaced">
9991 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
9992 </literallayout>
9993 <para>
9994 If the data for a PTR record is not a syntactically valid IP address, it is not
9995 altered and nothing is added.
9996 </para>
9997 <para>
9998 <indexterm role="concept">
9999 <primary>MX record</primary>
10000 <secondary>in <command>dnsdb</command> lookup</secondary>
10001 </indexterm>
10002 <indexterm role="concept">
10003 <primary>SRV record</primary>
10004 <secondary>in <command>dnsdb</command> lookup</secondary>
10005 </indexterm>
10006 For an MX lookup, both the preference value and the host name are returned for
10007 each record, separated by a space. For an SRV lookup, the priority, weight,
10008 port, and host name are returned for each record, separated by spaces.
10009 </para>
10010 <para>
10011 For any record type, if multiple records are found (or, for A6 lookups, if a
10012 single record leads to multiple addresses), the data is returned as a
10013 concatenation, with newline as the default separator. The order, of course,
10014 depends on the DNS resolver. You can specify a different separator character
10015 between multiple records by putting a right angle-bracket followed immediately
10016 by the new separator at the start of the query. For example:
10017 </para>
10018 <literallayout class="monospaced">
10019 ${lookup dnsdb{&gt;: a=host1.example}}
10020 </literallayout>
10021 <para>
10022 It is permitted to specify a space as the separator character. Further
10023 white space is ignored.
10024 </para>
10025 </section>
10026 <section id="SECID66">
10027 <title>Pseudo dnsdb record types</title>
10028 <para>
10029 <indexterm role="concept">
10030 <primary>MX record</primary>
10031 <secondary>in <command>dnsdb</command> lookup</secondary>
10032 </indexterm>
10033 By default, both the preference value and the host name are returned for
10034 each MX record, separated by a space. If you want only host names, you can use
10035 the pseudo-type MXH:
10036 </para>
10037 <literallayout class="monospaced">
10038 ${lookup dnsdb{mxh=a.b.example}}
10039 </literallayout>
10040 <para>
10041 In this case, the preference values are omitted, and just the host names are
10042 returned.
10043 </para>
10044 <para>
10045 <indexterm role="concept">
10046 <primary>name server for enclosing domain</primary>
10047 </indexterm>
10048 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10049 records on the given domain, but if none are found, it removes the first
10050 component of the domain name, and tries again. This process continues until NS
10051 records are found or there are no more components left (or there is a DNS
10052 error). In other words, it may return the name servers for a top-level domain,
10053 but it never returns the root name servers. If there are no NS records for the
10054 top-level domain, the lookup fails. Consider these examples:
10055 </para>
10056 <literallayout class="monospaced">
10057 ${lookup dnsdb{zns=xxx.quercite.com}}
10058 ${lookup dnsdb{zns=xxx.edu}}
10059 </literallayout>
10060 <para>
10061 Assuming that in each case there are no NS records for the full domain name,
10062 the first returns the name servers for <option>quercite.com</option>, and the second returns
10063 the name servers for <option>edu</option>.
10064 </para>
10065 <para>
10066 You should be careful about how you use this lookup because, unless the
10067 top-level domain does not exist, the lookup always returns some host names. The
10068 sort of use to which this might be put is for seeing if the name servers for a
10069 given domain are on a blacklist. You can probably assume that the name servers
10070 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10071 such a list.
10072 </para>
10073 <para>
10074 <indexterm role="concept">
10075 <primary>CSA</primary>
10076 <secondary>in <command>dnsdb</command> lookup</secondary>
10077 </indexterm>
10078 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10079 records according to the CSA rules, which are described in section
10080 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10081 not sufficient because of the extra parent domain search behaviour of CSA. The
10082 result of a successful lookup such as:
10083 </para>
10084 <literallayout class="monospaced">
10085 ${lookup dnsdb {csa=$sender_helo_name}}
10086 </literallayout>
10087 <para>
10088 has two space-separated fields: an authorization code and a target host name.
10089 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10090 authorization required but absent, or <quote>?</quote> for unknown.
10091 </para>
10092 </section>
10093 <section id="SECID67">
10094 <title>Multiple dnsdb lookups</title>
10095 <para>
10096 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10097 However, you can specify a list of domains or IP addresses in a single
10098 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10099 the default separator, but with the ability to change this. For example:
10100 </para>
10101 <literallayout class="monospaced">
10102 ${lookup dnsdb{one.domain.com:two.domain.com}}
10103 ${lookup dnsdb{a=one.host.com:two.host.com}}
10104 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10105 </literallayout>
10106 <para>
10107 In order to retain backwards compatibility, there is one special case: if
10108 the lookup type is PTR and no change of separator is specified, Exim looks
10109 to see if the rest of the string is precisely one IPv6 address. In this
10110 case, it does not treat it as a list.
10111 </para>
10112 <para>
10113 The data from each lookup is concatenated, with newline separators by default,
10114 in the same way that multiple DNS records for a single item are handled. A
10115 different separator can be specified, as described above.
10116 </para>
10117 <para>
10118 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10119 temporary DNS error for any of them, the behaviour is controlled by
10120 an optional keyword followed by a comma that may appear before the record
10121 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10122 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10123 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10124 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10125 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10126 error causes the whole lookup to defer only if none of the other lookups
10127 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10128 </para>
10129 <literallayout class="monospaced">
10130 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10131 ${lookup dnsdb{a=one.host.com:two.host.com}}
10132 </literallayout>
10133 <para>
10134 Thus, in the default case, as long as at least one of the DNS lookups
10135 yields some data, the lookup succeeds.
10136 </para>
10137 </section>
10138 <section id="SECTldap">
10139 <title>More about LDAP</title>
10140 <para>
10141 <indexterm role="concept">
10142 <primary>LDAP</primary>
10143 <secondary>lookup, more about</secondary>
10144 </indexterm>
10145 <indexterm role="concept">
10146 <primary>lookup</primary>
10147 <secondary>LDAP</secondary>
10148 </indexterm>
10149 <indexterm role="concept">
10150 <primary>Solaris</primary>
10151 <secondary>LDAP</secondary>
10152 </indexterm>
10153 The original LDAP implementation came from the University of Michigan; this has
10154 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10155 implementation comes from Netscape, and Solaris 7 and subsequent releases
10156 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10157 the lookup function level, their error handling is different. For this reason
10158 it is necessary to set a compile-time variable when building Exim with LDAP, to
10159 indicate which LDAP library is in use. One of the following should appear in
10160 your <filename>Local/Makefile</filename>:
10161 </para>
10162 <literallayout class="monospaced">
10163 LDAP_LIB_TYPE=UMICHIGAN
10164 LDAP_LIB_TYPE=OPENLDAP1
10165 LDAP_LIB_TYPE=OPENLDAP2
10166 LDAP_LIB_TYPE=NETSCAPE
10167 LDAP_LIB_TYPE=SOLARIS
10168 </literallayout>
10169 <para>
10170 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10171 same interface as the University of Michigan version.
10172 </para>
10173 <para>
10174 There are three LDAP lookup types in Exim. These behave slightly differently in
10175 the way they handle the results of a query:
10176 </para>
10177 <itemizedlist>
10178 <listitem>
10179 <para>
10180 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10181 gives an error.
10182 </para>
10183 </listitem>
10184 <listitem>
10185 <para>
10186 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10187 Distinguished Name that is returned rather than any attribute values.
10188 </para>
10189 </listitem>
10190 <listitem>
10191 <para>
10192 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10193 from all of them are returned.
10194 </para>
10195 </listitem>
10196 </itemizedlist>
10197 <para>
10198 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10199 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10200 the data returned by a successful lookup is described in the next section.
10201 First we explain how LDAP queries are coded.
10202 </para>
10203 </section>
10204 <section id="SECTforldaque">
10205 <title>Format of LDAP queries</title>
10206 <para>
10207 <indexterm role="concept">
10208 <primary>LDAP</primary>
10209 <secondary>query format</secondary>
10210 </indexterm>
10211 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10212 the configuration of a <command>redirect</command> router one might have this setting:
10213 </para>
10214 <literallayout class="monospaced">
10215 data = ${lookup ldap \
10216   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10217   c=UK?mailbox?base?}}
10218 </literallayout>
10219 <para>
10220 <indexterm role="concept">
10221 <primary>LDAP</primary>
10222 <secondary>with TLS</secondary>
10223 </indexterm>
10224 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10225 secure (encrypted) LDAP connections. The second of these ensures that an
10226 encrypted TLS connection is used.
10227 </para>
10228 </section>
10229 <section id="SECID68">
10230 <title>LDAP quoting</title>
10231 <para>
10232 <indexterm role="concept">
10233 <primary>LDAP</primary>
10234 <secondary>quoting</secondary>
10235 </indexterm>
10236 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10237 and the second because the LDAP query is represented as a URL. Furthermore,
10238 within an LDAP query, two different kinds of quoting are required. For this
10239 reason, there are two different LDAP-specific quoting operators.
10240 </para>
10241 <para>
10242 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10243 filter specifications. Conceptually, it first does the following conversions on
10244 the string:
10245 </para>
10246 <literallayout class="monospaced">
10247 *   =&gt;   \2A
10248 (   =&gt;   \28
10249 )   =&gt;   \29
10250 \   =&gt;   \5C
10251 </literallayout>
10252 <para>
10253 in accordance with RFC 2254. The resulting string is then quoted according
10254 to the rules for URLs, that is, all non-alphanumeric characters except
10255 </para>
10256 <literallayout class="monospaced">
10257 ! $ ' - . _ ( ) * +
10258 </literallayout>
10259 <para>
10260 are converted to their hex values, preceded by a percent sign. For example:
10261 </para>
10262 <literallayout class="monospaced">
10263 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10264 </literallayout>
10265 <para>
10266 yields
10267 </para>
10268 <literallayout class="monospaced">
10269 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10270 </literallayout>
10271 <para>
10272 Removing the URL quoting, this is (with a leading and a trailing space):
10273 </para>
10274 <literallayout class="monospaced">
10275 a\28bc\29\2A, a&lt;yz&gt;;
10276 </literallayout>
10277 <para>
10278 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10279 base DN specifications in queries. Conceptually, it first converts the string
10280 by inserting a backslash in front of any of the following characters:
10281 </para>
10282 <literallayout class="monospaced">
10283 , + " \ &lt; &gt; ;
10284 </literallayout>
10285 <para>
10286 It also inserts a backslash before any leading spaces or # characters, and
10287 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10288 is then quoted according to the rules for URLs. For example:
10289 </para>
10290 <literallayout class="monospaced">
10291 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10292 </literallayout>
10293 <para>
10294 yields
10295 </para>
10296 <literallayout class="monospaced">
10297 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10298 </literallayout>
10299 <para>
10300 Removing the URL quoting, this is (with a trailing space):
10301 </para>
10302 <literallayout class="monospaced">
10303 \ a(bc)*\, a\&lt;yz\&gt;\;\
10304 </literallayout>
10305 <para>
10306 There are some further comments about quoting in the section on LDAP
10307 authentication below.
10308 </para>
10309 </section>
10310 <section id="SECID69">
10311 <title>LDAP connections</title>
10312 <para>
10313 <indexterm role="concept">
10314 <primary>LDAP</primary>
10315 <secondary>connections</secondary>
10316 </indexterm>
10317 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10318 is in use, via a Unix domain socket. The example given above does not specify
10319 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10320 by starting it with
10321 </para>
10322 <literallayout class="monospaced">
10323 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10324 </literallayout>
10325 <para>
10326 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10327 used. When no server is specified in a query, a list of default servers is
10328 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10329 colon-separated list of servers which are tried in turn until one successfully
10330 handles a query, or there is a serious error. Successful handling either
10331 returns the requested data, or indicates that it does not exist. Serious errors
10332 are syntactical, or multiple values when only a single value is expected.
10333 Errors which cause the next server to be tried are connection failures, bind
10334 failures, and timeouts.
10335 </para>
10336 <para>
10337 For each server name in the list, a port number can be given. The standard way
10338 of specifying a host and port is to use a colon separator (RFC 1738). Because
10339 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10340 doubled. For example
10341 </para>
10342 <literallayout class="monospaced">
10343 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10344 </literallayout>
10345 <para>
10346 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10347 to the LDAP library with no server name, and the library&#x2019;s default (normally
10348 the local host) is used.
10349 </para>
10350 <para>
10351 If you are using the OpenLDAP library, you can connect to an LDAP server using
10352 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10353 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10354 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10355 not available.
10356 </para>
10357 <para>
10358 For this type of connection, instead of a host name for the server, a pathname
10359 for the socket is required, and the port number is not relevant. The pathname
10360 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10361 the query. In the former case, you can have settings such as
10362 </para>
10363 <literallayout class="monospaced">
10364 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10365 </literallayout>
10366 <para>
10367 When the pathname is given in the query, you have to escape the slashes as
10368 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10369 </para>
10370 <literallayout class="monospaced">
10371 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10372 </literallayout>
10373 <para>
10374 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10375 a pathname, it uses the Unix domain socket code, even if the query actually
10376 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10377 socket connection. This behaviour means that you can use a setting of
10378 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10379 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10380 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10381 backup host.
10382 </para>
10383 <para>
10384 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10385 specified, an error is diagnosed. However, if there are more items in
10386 <option>ldap_default_servers</option>, they are tried. In other words:
10387 </para>
10388 <itemizedlist>
10389 <listitem>
10390 <para>
10391 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10392 interface.
10393 </para>
10394 </listitem>
10395 <listitem>
10396 <para>
10397 Using <literal>ldapi</literal> with a host name causes an error.
10398 </para>
10399 </listitem>
10400 </itemizedlist>
10401 <para>
10402 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10403 <option>ldap_default_servers</option>, does whatever the library does by default.
10404 </para>
10405 </section>
10406 <section id="SECID70">
10407 <title>LDAP authentication and control information</title>
10408 <para>
10409 <indexterm role="concept">
10410 <primary>LDAP</primary>
10411 <secondary>authentication</secondary>
10412 </indexterm>
10413 The LDAP URL syntax provides no way of passing authentication and other control
10414 information to the server. To make this possible, the URL in an LDAP query may
10415 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10416 spaces. If a value contains spaces it must be enclosed in double quotes, and
10417 when double quotes are used, backslash is interpreted in the usual way inside
10418 them. The following names are recognized:
10419 </para>
10420 <literallayout>
10421 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10422 <literal>NETTIME    </literal>  set a timeout for a network operation
10423 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10424 <literal>PASS       </literal>  set the password, likewise
10425 <literal>REFERRALS  </literal>  set the referrals parameter
10426 <literal>SIZE       </literal>  set the limit for the number of entries returned
10427 <literal>TIME       </literal>  set the maximum waiting time for a query
10428 </literallayout>
10429 <para>
10430 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10431 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10432 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10433 library from trying to follow referrals issued by the LDAP server.
10434 </para>
10435 <para>
10436 The name CONNECT is an obsolete name for NETTIME, retained for
10437 backwards compatibility. This timeout (specified as a number of seconds) is
10438 enforced from the client end for operations that can be carried out over a
10439 network. Specifically, it applies to network connections and calls to the
10440 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10441 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10442 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10443 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10444 Netscape SDK; for OpenLDAP no action is taken.
10445 </para>
10446 <para>
10447 The TIME parameter (also a number of seconds) is passed to the server to
10448 set a server-side limit on the time taken to complete a search.
10449 </para>
10450 <para>
10451 Here is an example of an LDAP query in an Exim lookup that uses some of these
10452 values. This is a single line, folded to fit on the page:
10453 </para>
10454 <literallayout class="monospaced">
10455 ${lookup ldap
10456   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10457   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10458   {$value}fail}
10459 </literallayout>
10460 <para>
10461 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10462 any of the auxiliary data. Exim configuration settings that include lookups
10463 which contain password information should be preceded by <quote>hide</quote> to prevent
10464 non-admin users from using the <option>-bP</option> option to see their values.
10465 </para>
10466 <para>
10467 The auxiliary data items may be given in any order. The default is no
10468 connection timeout (the system timeout is used), no user or password, no limit
10469 on the number of entries returned, and no time limit on queries.
10470 </para>
10471 <para>
10472 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10473 removes any URL quoting that it may contain before passing it LDAP. Apparently
10474 some libraries do this for themselves, but some do not. Removing the URL
10475 quoting has two advantages:
10476 </para>
10477 <itemizedlist>
10478 <listitem>
10479 <para>
10480 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10481 DNs as with DNs inside actual queries.
10482 </para>
10483 </listitem>
10484 <listitem>
10485 <para>
10486 It permits spaces inside USER= DNs.
10487 </para>
10488 </listitem>
10489 </itemizedlist>
10490 <para>
10491 For example, a setting such as
10492 </para>
10493 <literallayout class="monospaced">
10494 USER=cn=${quote_ldap_dn:$1}
10495 </literallayout>
10496 <para>
10497 should work even if <varname>$1</varname> contains spaces.
10498 </para>
10499 <para>
10500 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10501 expansion operator, rather than the LDAP quote operators. The only reason this
10502 field needs quoting is to ensure that it conforms to the Exim syntax, which
10503 does not allow unquoted spaces. For example:
10504 </para>
10505 <literallayout class="monospaced">
10506 PASS=${quote:$3}
10507 </literallayout>
10508 <para>
10509 The LDAP authentication mechanism can be used to check passwords as part of
10510 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10511 <xref linkend="CHAPexpand"/>.
10512 </para>
10513 </section>
10514 <section id="SECID71">
10515 <title>Format of data returned by LDAP</title>
10516 <para>
10517 <indexterm role="concept">
10518 <primary>LDAP</primary>
10519 <secondary>returned data formats</secondary>
10520 </indexterm>
10521 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10522 as a sequence of values, for example
10523 </para>
10524 <literallayout class="monospaced">
10525 cn=manager, o=University of Cambridge, c=UK
10526 </literallayout>
10527 <para>
10528 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10529 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10530 the result between the data from different entries. It is possible for multiple
10531 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10532 you know that whatever values are returned all came from a single entry in the
10533 directory.
10534 </para>
10535 <para>
10536 In the common case where you specify a single attribute in your LDAP query, the
10537 result is not quoted, and does not contain the attribute name. If the attribute
10538 has multiple values, they are separated by commas.
10539 </para>
10540 <para>
10541 If you specify multiple attributes, the result contains space-separated, quoted
10542 strings, each preceded by the attribute name and an equals sign. Within the
10543 quotes, the quote character, backslash, and newline are escaped with
10544 backslashes, and commas are used to separate multiple values for the attribute.
10545 Apart from the escaping, the string within quotes takes the same form as the
10546 output when a single attribute is requested. Specifying no attributes is the
10547 same as specifying all of an entry&#x2019;s attributes.
10548 </para>
10549 <para>
10550 Here are some examples of the output format. The first line of each pair is an
10551 LDAP query, and the second is the data that is returned. The attribute called
10552 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10553 </para>
10554 <literallayout class="monospaced">
10555 ldap:///o=base?attr1?sub?(uid=fred)
10556 value1.1, value1.2
10557
10558 ldap:///o=base?attr2?sub?(uid=fred)
10559 value two
10560
10561 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10562 attr1="value1.1, value1.2" attr2="value two"
10563
10564 ldap:///o=base??sub?(uid=fred)
10565 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10566 </literallayout>
10567 <para>
10568 The <option>extract</option> operator in string expansions can be used to pick out
10569 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10570 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
10571 results of LDAP lookups.
10572 </para>
10573 </section>
10574 <section id="SECTnisplus">
10575 <title>More about NIS+</title>
10576 <para>
10577 <indexterm role="concept">
10578 <primary>NIS+ lookup type</primary>
10579 </indexterm>
10580 <indexterm role="concept">
10581 <primary>lookup</primary>
10582 <secondary>NIS+</secondary>
10583 </indexterm>
10584 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10585 and field name. If this is given, the result of a successful query is the
10586 contents of the named field; otherwise the result consists of a concatenation
10587 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10588 values containing spaces are quoted. For example, the query
10589 </para>
10590 <literallayout class="monospaced">
10591 [name=mg1456],passwd.org_dir
10592 </literallayout>
10593 <para>
10594 might return the string
10595 </para>
10596 <literallayout class="monospaced">
10597 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10598 home=/home/mg1456 shell=/bin/bash shadow=""
10599 </literallayout>
10600 <para>
10601 (split over two lines here to fit on the page), whereas
10602 </para>
10603 <literallayout class="monospaced">
10604 [name=mg1456],passwd.org_dir:gcos
10605 </literallayout>
10606 <para>
10607 would just return
10608 </para>
10609 <literallayout class="monospaced">
10610 Martin Guerre
10611 </literallayout>
10612 <para>
10613 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10614 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10615 operator is to double any quote characters within the text.
10616 </para>
10617 </section>
10618 <section id="SECTsql">
10619 <title>SQL lookups</title>
10620 <para>
10621 <indexterm role="concept">
10622 <primary>SQL lookup types</primary>
10623 </indexterm>
10624 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10625 databases. Queries for these databases contain SQL statements, so an example
10626 might be
10627 </para>
10628 <literallayout class="monospaced">
10629 ${lookup mysql{select mailbox from users where id='userx'}\
10630   {$value}fail}
10631 </literallayout>
10632 <para>
10633 If the result of the query contains more than one field, the data for each
10634 field in the row is returned, preceded by its name, so the result of
10635 </para>
10636 <literallayout class="monospaced">
10637 ${lookup pgsql{select home,name from users where id='userx'}\
10638   {$value}}
10639 </literallayout>
10640 <para>
10641 might be
10642 </para>
10643 <literallayout class="monospaced">
10644 home=/home/userx name="Mister X"
10645 </literallayout>
10646 <para>
10647 Empty values and values containing spaces are double quoted, with embedded
10648 quotes escaped by a backslash. If the result of the query contains just one
10649 field, the value is passed back verbatim, without a field name, for example:
10650 </para>
10651 <literallayout class="monospaced">
10652 Mister X
10653 </literallayout>
10654 <para>
10655 If the result of the query yields more than one row, it is all concatenated,
10656 with a newline between the data for each row.
10657 </para>
10658 </section>
10659 <section id="SECID72">
10660 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10661 <para>
10662 <indexterm role="concept">
10663 <primary>MySQL</primary>
10664 <secondary>lookup type</secondary>
10665 </indexterm>
10666 <indexterm role="concept">
10667 <primary>PostgreSQL lookup type</primary>
10668 </indexterm>
10669 <indexterm role="concept">
10670 <primary>lookup</primary>
10671 <secondary>MySQL</secondary>
10672 </indexterm>
10673 <indexterm role="concept">
10674 <primary>lookup</primary>
10675 <secondary>PostgreSQL</secondary>
10676 </indexterm>
10677 <indexterm role="concept">
10678 <primary>Oracle</primary>
10679 <secondary>lookup type</secondary>
10680 </indexterm>
10681 <indexterm role="concept">
10682 <primary>lookup</primary>
10683 <secondary>Oracle</secondary>
10684 </indexterm>
10685 <indexterm role="concept">
10686 <primary>InterBase lookup type</primary>
10687 </indexterm>
10688 <indexterm role="concept">
10689 <primary>lookup</primary>
10690 <secondary>InterBase</secondary>
10691 </indexterm>
10692 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10693 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10694 option (as appropriate) must be set to a colon-separated list of server
10695 information. Each item in the list is a slash-separated list of four items:
10696 host name, database name, user name, and password. In the case of Oracle, the
10697 host name field is used for the <quote>service name</quote>, and the database name field
10698 is not used and should be empty. For example:
10699 </para>
10700 <literallayout class="monospaced">
10701 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10702 </literallayout>
10703 <para>
10704 Because password data is sensitive, you should always precede the setting with
10705 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10706 option. Here is an example where two MySQL servers are listed:
10707 </para>
10708 <literallayout class="monospaced">
10709 hide mysql_servers = localhost/users/root/secret:\
10710                      otherhost/users/root/othersecret
10711 </literallayout>
10712 <para>
10713 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
10714 because this is a colon-separated list, the colon has to be doubled. For each
10715 query, these parameter groups are tried in order until a connection and a query
10716 succeeds.
10717 </para>
10718 <para>
10719 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10720 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10721 respectively, and the characters single-quote, double-quote, and backslash
10722 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10723 addition, escapes the percent and underscore characters. This cannot be done
10724 for MySQL because these escapes are not recognized in contexts where these
10725 characters are not special.
10726 </para>
10727 </section>
10728 <section id="SECID73">
10729 <title>Special MySQL features</title>
10730 <para>
10731 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10732 causes a connection to the server on the local host by means of a Unix domain
10733 socket. An alternate socket can be specified in parentheses. The full syntax of
10734 each item in <option>mysql_servers</option> is:
10735 </para>
10736 <literallayout>
10737 &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;
10738 </literallayout>
10739 <para>
10740 Any of the three sub-parts of the first field can be omitted. For normal use on
10741 the local host it can be left blank or set to just <quote>localhost</quote>.
10742 </para>
10743 <para>
10744 No database need be supplied &ndash; but if it is absent here, it must be given in
10745 the queries.
10746 </para>
10747 <para>
10748 If a MySQL query is issued that does not request any data (an insert, update,
10749 or delete command), the result of the lookup is the number of rows affected.
10750 </para>
10751 <para>
10752 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10753 anything (for example, setting a field to the value it already has), the result
10754 is zero because no rows are affected.
10755 </para>
10756 </section>
10757 <section id="SECID74">
10758 <title>Special PostgreSQL features</title>
10759 <para>
10760 PostgreSQL lookups can also use Unix domain socket connections to the database.
10761 This is usually faster and costs less CPU time than a TCP/IP connection.
10762 However it can be used only if the mail server runs on the same machine as the
10763 database server. A configuration line for PostgreSQL via Unix domain sockets
10764 looks like this:
10765 </para>
10766 <literallayout class="monospaced">
10767 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10768 </literallayout>
10769 <para>
10770 In other words, instead of supplying a host name, a path to the socket is
10771 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
10772 visually confused with the delimiters for the other server parameters.
10773 </para>
10774 <para>
10775 If a PostgreSQL query is issued that does not request any data (an insert,
10776 update, or delete command), the result of the lookup is the number of rows
10777 affected.
10778 </para>
10779 </section>
10780 <section id="SECTsqlite">
10781 <title>More about SQLite</title>
10782 <para>
10783 <indexterm role="concept">
10784 <primary>lookup</primary>
10785 <secondary>SQLite</secondary>
10786 </indexterm>
10787 <indexterm role="concept">
10788 <primary>sqlite lookup type</primary>
10789 </indexterm>
10790 SQLite is different to the other SQL lookups because a file name is required in
10791 addition to the SQL query. An SQLite database is a single file, and there is no
10792 daemon as in the other SQL databases. The interface to Exim requires the name
10793 of the file, as an absolute path, to be given at the start of the query. It is
10794 separated from the query by white space. This means that the path name cannot
10795 contain white space. Here is a lookup expansion example:
10796 </para>
10797 <literallayout class="monospaced">
10798 ${lookup sqlite {/some/thing/sqlitedb \
10799   select name from aliases where id='userx';}}
10800 </literallayout>
10801 <para>
10802 In a list, the syntax is similar. For example:
10803 </para>
10804 <literallayout class="monospaced">
10805 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10806    select * from relays where ip='$sender_host_address';
10807 </literallayout>
10808 <para>
10809 The only character affected by the <option>quote_sqlite</option> operator is a single
10810 quote, which it doubles.
10811 </para>
10812 <para>
10813 The SQLite library handles multiple simultaneous accesses to the database
10814 internally. Multiple readers are permitted, but only one process can
10815 update at once. Attempts to access the database while it is being updated
10816 are rejected after a timeout period, during which the SQLite library
10817 waits for the lock to be released. In Exim, the default timeout is set
10818 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10819 option.
10820 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10821 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10822 </para>
10823 </section>
10824 </chapter>
10825
10826 <chapter id="CHAPdomhosaddlists">
10827 <title>Domain, host, address, and local part lists</title>
10828 <titleabbrev>Domain, host, and address lists</titleabbrev>
10829 <para>
10830 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10831 <primary>lists of domains; hosts; etc.</primary>
10832 </indexterm>
10833 A number of Exim configuration options contain lists of domains, hosts,
10834 email addresses, or local parts. For example, the <option>hold_domains</option> option
10835 contains a list of domains whose delivery is currently suspended. These lists
10836 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10837 arguments to expansion conditions such as <option>match_domain</option>.
10838 </para>
10839 <para>
10840 Each item in one of these lists is a pattern to be matched against a domain,
10841 host, email address, or local part, respectively. In the sections below, the
10842 different types of pattern for each case are described, but first we cover some
10843 general facilities that apply to all four kinds of list.
10844 </para>
10845 <section id="SECID75">
10846 <title>Expansion of lists</title>
10847 <para>
10848 <indexterm role="concept">
10849 <primary>expansion</primary>
10850 <secondary>of lists</secondary>
10851 </indexterm>
10852 Each list is expanded as a single string before it is used. The result of
10853 expansion must be a list, possibly containing empty items, which is split up
10854 into separate items for matching. By default, colon is the separator character,
10855 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10856 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10857 discusses the way to specify empty list items.
10858 </para>
10859 <para>
10860 If the string expansion is forced to fail, Exim behaves as if the item it is
10861 testing (domain, host, address, or local part) is not in the list. Other
10862 expansion failures cause temporary errors.
10863 </para>
10864 <para>
10865 If an item in a list is a regular expression, backslashes, dollars and possibly
10866 other special characters in the expression must be protected against
10867 misinterpretation by the string expander. The easiest way to do this is to use
10868 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10869 expression should not be expanded. For example, in an ACL you might have:
10870 </para>
10871 <literallayout class="monospaced">
10872 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
10873                ${lookup{$domain}lsearch{/badsenders/bydomain}}
10874 </literallayout>
10875 <para>
10876 The first item is a regular expression that is protected from expansion by
10877 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
10878 senders based on the receiving domain.
10879 </para>
10880 </section>
10881 <section id="SECID76">
10882 <title>Negated items in lists</title>
10883 <para>
10884 <indexterm role="concept">
10885 <primary>list</primary>
10886 <secondary>negation</secondary>
10887 </indexterm>
10888 <indexterm role="concept">
10889 <primary>negation</primary>
10890 <secondary>in lists</secondary>
10891 </indexterm>
10892 Items in a list may be positive or negative. Negative items are indicated by a
10893 leading exclamation mark, which may be followed by optional white space. A list
10894 defines a set of items (domains, etc). When Exim processes one of these lists,
10895 it is trying to find out whether a domain, host, address, or local part
10896 (respectively) is in the set that is defined by the list. It works like this:
10897 </para>
10898 <para>
10899 The list is scanned from left to right. If a positive item is matched, the
10900 subject that is being checked is in the set; if a negative item is matched, the
10901 subject is not in the set. If the end of the list is reached without the
10902 subject having matched any of the patterns, it is in the set if the last item
10903 was a negative one, but not if it was a positive one. For example, the list in
10904 </para>
10905 <literallayout class="monospaced">
10906 domainlist relay_domains = !a.b.c : *.b.c
10907 </literallayout>
10908 <para>
10909 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
10910 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
10911 list is positive. However, if the setting were
10912 </para>
10913 <literallayout class="monospaced">
10914 domainlist relay_domains = !a.b.c
10915 </literallayout>
10916 <para>
10917 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
10918 list is negative. In other words, a list that ends with a negative item behaves
10919 as if it had an extra item <literal>:*</literal> on the end.
10920 </para>
10921 <para>
10922 Another way of thinking about positive and negative items in lists is to read
10923 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
10924 item.
10925 </para>
10926 </section>
10927 <section id="SECTfilnamlis">
10928 <title>File names in lists</title>
10929 <para>
10930 <indexterm role="concept">
10931 <primary>list</primary>
10932 <secondary>file name in</secondary>
10933 </indexterm>
10934 If an item in a domain, host, address, or local part list is an absolute file
10935 name (beginning with a slash character), each line of the file is read and
10936 processed as if it were an independent item in the list, except that further
10937 file names are not allowed,
10938 and no expansion of the data from the file takes place.
10939 Empty lines in the file are ignored, and the file may also contain comment
10940 lines:
10941 </para>
10942 <itemizedlist>
10943 <listitem>
10944 <para>
10945 For domain and host lists, if a # character appears anywhere in a line of the
10946 file, it and all following characters are ignored.
10947 </para>
10948 </listitem>
10949 <listitem>
10950 <para>
10951 Because local parts may legitimately contain # characters, a comment in an
10952 address list or local part list file is recognized only if # is preceded by
10953 white space or the start of the line. For example:
10954 </para>
10955 <literallayout class="monospaced">
10956 not#comment@x.y.z   # but this is a comment
10957 </literallayout>
10958 </listitem>
10959 </itemizedlist>
10960 <para>
10961 Putting a file name in a list has the same effect as inserting each line of the
10962 file as an item in the list (blank lines and comments excepted). However, there
10963 is one important difference: the file is read each time the list is processed,
10964 so if its contents vary over time, Exim&#x2019;s behaviour changes.
10965 </para>
10966 <para>
10967 If a file name is preceded by an exclamation mark, the sense of any match
10968 within the file is inverted. For example, if
10969 </para>
10970 <literallayout class="monospaced">
10971 hold_domains = !/etc/nohold-domains
10972 </literallayout>
10973 <para>
10974 and the file contains the lines
10975 </para>
10976 <literallayout class="monospaced">
10977 !a.b.c
10978 *.b.c
10979 </literallayout>
10980 <para>
10981 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
10982 any domain matching <literal>*.b.c</literal> is not.
10983 </para>
10984 </section>
10985 <section id="SECID77">
10986 <title>An lsearch file is not an out-of-line list</title>
10987 <para>
10988 As will be described in the sections that follow, lookups can be used in lists
10989 to provide indexed methods of checking list membership. There has been some
10990 confusion about the way <command>lsearch</command> lookups work in lists. Because
10991 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
10992 sometimes thought that it is allowed to contain wild cards and other kinds of
10993 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
10994 always fixed strings, just as for any other single-key lookup type.
10995 </para>
10996 <para>
10997 If you want to use a file to contain wild-card patterns that form part of a
10998 list, just give the file name on its own, without a search type, as described
10999 in the previous section. You could also use the <command>wildlsearch</command> or
11000 <command>nwildlsearch</command>, but there is no advantage in doing this.
11001 </para>
11002 </section>
11003 <section id="SECTnamedlists">
11004 <title>Named lists</title>
11005 <para>
11006 <indexterm role="concept">
11007 <primary>named lists</primary>
11008 </indexterm>
11009 <indexterm role="concept">
11010 <primary>list</primary>
11011 <secondary>named</secondary>
11012 </indexterm>
11013 A list of domains, hosts, email addresses, or local parts can be given a name
11014 which is then used to refer to the list elsewhere in the configuration. This is
11015 particularly convenient if the same list is required in several different
11016 places. It also allows lists to be given meaningful names, which can improve
11017 the readability of the configuration. For example, it is conventional to define
11018 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11019 locally on a host, using a configuration line such as
11020 </para>
11021 <literallayout class="monospaced">
11022 domainlist local_domains = localhost:my.dom.example
11023 </literallayout>
11024 <para>
11025 Named lists are referenced by giving their name preceded by a plus sign, so,
11026 for example, a router that is intended to handle local domains would be
11027 configured with the line
11028 </para>
11029 <literallayout class="monospaced">
11030 domains = +local_domains
11031 </literallayout>
11032 <para>
11033 The first router in a configuration is often one that handles all domains
11034 except the local ones, using a configuration with a negated item like this:
11035 </para>
11036 <literallayout class="monospaced">
11037 dnslookup:
11038   driver = dnslookup
11039   domains = ! +local_domains
11040   transport = remote_smtp
11041   no_more
11042 </literallayout>
11043 <para>
11044 The four kinds of named list are created by configuration lines starting with
11045 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11046 respectively. Then there follows the name that you are defining, followed by an
11047 equals sign and the list itself. For example:
11048 </para>
11049 <literallayout class="monospaced">
11050 hostlist    relay_hosts = 192.168.23.0/24 : my.friend.example
11051 addresslist bad_senders = cdb;/etc/badsenders
11052 </literallayout>
11053 <para>
11054 A named list may refer to other named lists:
11055 </para>
11056 <literallayout class="monospaced">
11057 domainlist  dom1 = first.example : second.example
11058 domainlist  dom2 = +dom1 : third.example
11059 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11060 </literallayout>
11061 <para>
11062 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11063 effect may not be what you intended, because the negation does not propagate
11064 out to the higher level. For example, consider:
11065 </para>
11066 <literallayout class="monospaced">
11067 domainlist  dom1 = !a.b
11068 domainlist  dom2 = +dom1 : *.b
11069 </literallayout>
11070 <para>
11071 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11072 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11073 means it matches the second list as well. The effect is not the same as
11074 </para>
11075 <literallayout class="monospaced">
11076 domainlist  dom2 = !a.b : *.b
11077 </literallayout>
11078 <para>
11079 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11080 referenced lists if you can.
11081 </para>
11082 <para>
11083 Named lists may have a performance advantage. When Exim is routing an
11084 address or checking an incoming message, it caches the result of tests on named
11085 lists. So, if you have a setting such as
11086 </para>
11087 <literallayout class="monospaced">
11088 domains = +local_domains
11089 </literallayout>
11090 <para>
11091 on several of your routers
11092 or in several ACL statements,
11093 the actual test is done only for the first one. However, the caching works only
11094 if there are no expansions within the list itself or any sublists that it
11095 references. In other words, caching happens only for lists that are known to be
11096 the same each time they are referenced.
11097 </para>
11098 <para>
11099 By default, there may be up to 16 named lists of each type. This limit can be
11100 extended by changing a compile-time variable. The use of domain and host lists
11101 is recommended for concepts such as local domains, relay domains, and relay
11102 hosts. The default configuration is set up like this.
11103 </para>
11104 </section>
11105 <section id="SECID78">
11106 <title>Named lists compared with macros</title>
11107 <para>
11108 <indexterm role="concept">
11109 <primary>list</primary>
11110 <secondary>named compared with macro</secondary>
11111 </indexterm>
11112 <indexterm role="concept">
11113 <primary>macro</primary>
11114 <secondary>compared with named list</secondary>
11115 </indexterm>
11116 At first sight, named lists might seem to be no different from macros in the
11117 configuration file. However, macros are just textual substitutions. If you
11118 write
11119 </para>
11120 <literallayout class="monospaced">
11121 ALIST = host1 : host2
11122 auth_advertise_hosts = !ALIST
11123 </literallayout>
11124 <para>
11125 it probably won&#x2019;t do what you want, because that is exactly the same as
11126 </para>
11127 <literallayout class="monospaced">
11128 auth_advertise_hosts = !host1 : host2
11129 </literallayout>
11130 <para>
11131 Notice that the second host name is not negated. However, if you use a host
11132 list, and write
11133 </para>
11134 <literallayout class="monospaced">
11135 hostlist alist = host1 : host2
11136 auth_advertise_hosts = ! +alist
11137 </literallayout>
11138 <para>
11139 the negation applies to the whole list, and so that is equivalent to
11140 </para>
11141 <literallayout class="monospaced">
11142 auth_advertise_hosts = !host1 : !host2
11143 </literallayout>
11144 </section>
11145 <section id="SECID79">
11146 <title>Named list caching</title>
11147 <para>
11148 <indexterm role="concept">
11149 <primary>list</primary>
11150 <secondary>caching of named</secondary>
11151 </indexterm>
11152 <indexterm role="concept">
11153 <primary>caching</primary>
11154 <secondary>named lists</secondary>
11155 </indexterm>
11156 While processing a message, Exim caches the result of checking a named list if
11157 it is sure that the list is the same each time. In practice, this means that
11158 the cache operates only if the list contains no $ characters, which guarantees
11159 that it will not change when it is expanded. Sometimes, however, you may have
11160 an expanded list that you know will be the same each time within a given
11161 message. For example:
11162 </para>
11163 <literallayout class="monospaced">
11164 domainlist special_domains = \
11165            ${lookup{$sender_host_address}cdb{/some/file}}
11166 </literallayout>
11167 <para>
11168 This provides a list of domains that depends only on the sending host&#x2019;s IP
11169 address. If this domain list is referenced a number of times (for example,
11170 in several ACL lines, or in several routers) the result of the check is not
11171 cached by default, because Exim does not know that it is going to be the
11172 same list each time.
11173 </para>
11174 <para>
11175 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11176 cache the result anyway. For example:
11177 </para>
11178 <literallayout class="monospaced">
11179 domainlist_cache special_domains = ${lookup{...
11180 </literallayout>
11181 <para>
11182 If you do this, you should be absolutely sure that caching is going to do
11183 the right thing in all cases. When in doubt, leave it out.
11184 </para>
11185 </section>
11186 <section id="SECTdomainlist">
11187 <title>Domain lists</title>
11188 <para>
11189 <indexterm role="concept">
11190 <primary>domain list</primary>
11191 <secondary>patterns for</secondary>
11192 </indexterm>
11193 <indexterm role="concept">
11194 <primary>list</primary>
11195 <secondary>domain list</secondary>
11196 </indexterm>
11197 Domain lists contain patterns that are to be matched against a mail domain.
11198 The following types of item may appear in domain lists:
11199 </para>
11200 <itemizedlist>
11201 <listitem>
11202 <para>
11203 <indexterm role="concept">
11204 <primary>primary host name</primary>
11205 </indexterm>
11206 <indexterm role="concept">
11207 <primary>host name</primary>
11208 <secondary>matched in domain list</secondary>
11209 </indexterm>
11210 <indexterm role="option">
11211 <primary><option>primary_hostname</option></primary>
11212 </indexterm>
11213 <indexterm role="concept">
11214 <primary>domain list</primary>
11215 <secondary>matching primary host name</secondary>
11216 </indexterm>
11217 <indexterm role="concept">
11218 <primary>@ in a domain list</primary>
11219 </indexterm>
11220 If a pattern consists of a single @ character, it matches the local host name,
11221 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11222 possible to use the same configuration file on several different hosts that
11223 differ only in their names.
11224 </para>
11225 </listitem>
11226 <listitem>
11227 <para>
11228 <indexterm role="concept">
11229 <primary>@[] in a domain list</primary>
11230 </indexterm>
11231 <indexterm role="concept">
11232 <primary>domain list</primary>
11233 <secondary>matching local IP interfaces</secondary>
11234 </indexterm>
11235 <indexterm role="concept">
11236 <primary>domain literal</primary>
11237 </indexterm>
11238 If a pattern consists of the string <literal>@[]</literal> it matches any local IP interface
11239 address, enclosed in square brackets, as in an email address that contains a
11240 domain literal.
11241 In today&#x2019;s Internet, the use of domain literals is controversial.
11242 </para>
11243 </listitem>
11244 <listitem>
11245 <para>
11246 <indexterm role="concept">
11247 <primary>@mx_any</primary>
11248 </indexterm>
11249 <indexterm role="concept">
11250 <primary>@mx_primary</primary>
11251 </indexterm>
11252 <indexterm role="concept">
11253 <primary>@mx_secondary</primary>
11254 </indexterm>
11255 <indexterm role="concept">
11256 <primary>domain list</primary>
11257 <secondary>matching MX pointers to local host</secondary>
11258 </indexterm>
11259 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11260 has an MX record pointing to the local host or to any host that is listed in
11261 <indexterm role="option">
11262 <primary><option>hosts_treat_as_local</option></primary>
11263 </indexterm>
11264 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11265 are similar, except that the first matches only when a primary MX target is the
11266 local host, and the second only when no primary MX target is the local host,
11267 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11268 preference value &ndash; there may of course be more than one of them.
11269 </para>
11270 <para>
11271 The MX lookup that takes place when matching a pattern of this type is
11272 performed with the resolver options for widening names turned off. Thus, for
11273 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11274 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11275 options of the <command>dnslookup</command> router for a discussion of domain widening.
11276 </para>
11277 <para>
11278 Sometimes you may want to ignore certain IP addresses when using one of these
11279 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11280 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11281 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11282 on a router). For example:
11283 </para>
11284 <literallayout class="monospaced">
11285 domains = @mx_any/ignore=127.0.0.1
11286 </literallayout>
11287 <para>
11288 This example matches any domain that has an MX record pointing to one of
11289 the local host&#x2019;s IP addresses other than 127.0.0.1.
11290 </para>
11291 <para>
11292 The list of IP addresses is in fact processed by the same code that processes
11293 host lists, so it may contain CIDR-coded network specifications and it may also
11294 contain negative items.
11295 </para>
11296 <para>
11297 Because the list of IP addresses is a sublist within a domain list, you have to
11298 be careful about delimiters if there is more than one address. Like any other
11299 list, the default delimiter can be changed. Thus, you might have:
11300 </para>
11301 <literallayout class="monospaced">
11302 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11303           an.other.domain : ...
11304 </literallayout>
11305 <para>
11306 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11307 involved, it is easiest to change the delimiter for the main list as well:
11308 </para>
11309 <literallayout class="monospaced">
11310 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11311           an.other.domain ? ...
11312 </literallayout>
11313 </listitem>
11314 <listitem>
11315 <para>
11316 <indexterm role="concept">
11317 <primary>asterisk</primary>
11318 <secondary>in domain list</secondary>
11319 </indexterm>
11320 <indexterm role="concept">
11321 <primary>domain list</primary>
11322 <secondary>asterisk in</secondary>
11323 </indexterm>
11324 <indexterm role="concept">
11325 <primary>domain list</primary>
11326 <secondary>matching <quote>ends with</quote></secondary>
11327 </indexterm>
11328 If a pattern starts with an asterisk, the remaining characters of the pattern
11329 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11330 domain lists differs from its use in partial matching lookups. In a domain
11331 list, the character following the asterisk need not be a dot, whereas partial
11332 matching works only in terms of dot-separated components. For example, a domain
11333 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11334 <emphasis>cipher.key.ex</emphasis>.
11335 </para>
11336 </listitem>
11337 <listitem>
11338 <para>
11339 <indexterm role="concept">
11340 <primary>regular expressions</primary>
11341 <secondary>in domain list</secondary>
11342 </indexterm>
11343 <indexterm role="concept">
11344 <primary>domain list</primary>
11345 <secondary>matching regular expression</secondary>
11346 </indexterm>
11347 If a pattern starts with a circumflex character, it is treated as a regular
11348 expression, and matched against the domain using a regular expression matching
11349 function. The circumflex is treated as part of the regular expression.
11350 References to descriptions of the syntax of regular expressions are given in
11351 chapter <xref linkend="CHAPregexp"/>.
11352 </para>
11353 <para>
11354 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11355 must escape any backslash and dollar characters in the regular expression, or
11356 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11357 it is not to be expanded (unless you really do want to build a regular
11358 expression by expansion, of course).
11359 </para>
11360 </listitem>
11361 <listitem>
11362 <para>
11363 <indexterm role="concept">
11364 <primary>lookup</primary>
11365 <secondary>in domain list</secondary>
11366 </indexterm>
11367 <indexterm role="concept">
11368 <primary>domain list</primary>
11369 <secondary>matching by lookup</secondary>
11370 </indexterm>
11371 If a pattern starts with the name of a single-key lookup type followed by a
11372 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11373 must be a file name in a suitable format for the lookup type. For example, for
11374 <quote>cdb;</quote> it must be an absolute path:
11375 </para>
11376 <literallayout class="monospaced">
11377 domains = cdb;/etc/mail/local_domains.cdb
11378 </literallayout>
11379 <para>
11380 The appropriate type of lookup is done on the file using the domain name as the
11381 key. In most cases, the data that is looked up is not used; Exim is interested
11382 only in whether or not the key is present in the file. However, when a lookup
11383 is used for the <option>domains</option> option on a router
11384 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11385 <varname>$domain_data</varname> variable and can be referred to in other router options or
11386 other statements in the same ACL.
11387 </para>
11388 </listitem>
11389 <listitem>
11390 <para>
11391 Any of the single-key lookup type names may be preceded by
11392 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11393 </para>
11394 <literallayout class="monospaced">
11395 domains = partial-dbm;/partial/domains
11396 </literallayout>
11397 <para>
11398 This causes partial matching logic to be invoked; a description of how this
11399 works is given in section <xref linkend="SECTpartiallookup"/>.
11400 </para>
11401 </listitem>
11402 <listitem>
11403 <para>
11404 <indexterm role="concept">
11405 <primary>asterisk</primary>
11406 <secondary>in lookup type</secondary>
11407 </indexterm>
11408 Any of the single-key lookup types may be followed by an asterisk. This causes
11409 a default lookup for a key consisting of a single asterisk to be done if the
11410 original lookup fails. This is not a useful feature when using a domain list to
11411 select particular domains (because any domain would match), but it might have
11412 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11413 expansion variable.
11414 </para>
11415 </listitem>
11416 <listitem>
11417 <para>
11418 If the pattern starts with the name of a query-style lookup type followed by a
11419 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11420 pattern must be an appropriate query for the lookup type, as described in
11421 chapter <xref linkend="CHAPfdlookup"/>. For example:
11422 </para>
11423 <literallayout class="monospaced">
11424 hold_domains = mysql;select domain from holdlist \
11425   where domain = '$domain';
11426 </literallayout>
11427 <para>
11428 In most cases, the data that is looked up is not used (so for an SQL query, for
11429 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11430 whether or not the query succeeds. However, when a lookup is used for the
11431 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11432 variable and can be referred to in other options.
11433 </para>
11434 </listitem>
11435 <listitem>
11436 <para>
11437 <indexterm role="concept">
11438 <primary>domain list</primary>
11439 <secondary>matching literal domain name</secondary>
11440 </indexterm>
11441 If none of the above cases apply, a caseless textual comparison is made
11442 between the pattern and the domain.
11443 </para>
11444 </listitem>
11445 </itemizedlist>
11446 <para>
11447 Here is an example that uses several different kinds of pattern:
11448 </para>
11449 <literallayout class="monospaced">
11450 domainlist funny_domains = \
11451   @ : \
11452   lib.unseen.edu : \
11453   *.foundation.fict.example : \
11454   \N^[1-2]\d{3}\.fict\.example$\N : \
11455   partial-dbm;/opt/data/penguin/book : \
11456   nis;domains.byname : \
11457   nisplus;[name=$domain,status=local],domains.org_dir
11458 </literallayout>
11459 <para>
11460 There are obvious processing trade-offs among the various matching modes. Using
11461 an asterisk is faster than a regular expression, and listing a few names
11462 explicitly probably is too. The use of a file or database lookup is expensive,
11463 but may be the only option if hundreds of names are required. Because the
11464 patterns are tested in order, it makes sense to put the most commonly matched
11465 patterns earlier.
11466 </para>
11467 </section>
11468 <section id="SECThostlist">
11469 <title>Host lists</title>
11470 <para>
11471 <indexterm role="concept">
11472 <primary>host list</primary>
11473 <secondary>patterns in</secondary>
11474 </indexterm>
11475 <indexterm role="concept">
11476 <primary>list</primary>
11477 <secondary>host list</secondary>
11478 </indexterm>
11479 Host lists are used to control what remote hosts are allowed to do. For
11480 example, some hosts may be allowed to use the local host as a relay, and some
11481 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11482 two different ways, by name or by IP address. In a host list, some types of
11483 pattern are matched to a host name, and some are matched to an IP address.
11484 You need to be particularly careful with this when single-key lookups are
11485 involved, to ensure that the right value is being used as the key.
11486 </para>
11487 </section>
11488 <section id="SECID80">
11489 <title>Special host list patterns</title>
11490 <para>
11491 <indexterm role="concept">
11492 <primary>empty item in hosts list</primary>
11493 </indexterm>
11494 <indexterm role="concept">
11495 <primary>host list</primary>
11496 <secondary>empty string in</secondary>
11497 </indexterm>
11498 If a host list item is the empty string, it matches only when no remote host is
11499 involved. This is the case when a message is being received from a local
11500 process using SMTP on the standard input, that is, when a TCP/IP connection is
11501 not used.
11502 </para>
11503 <para>
11504 <indexterm role="concept">
11505 <primary>asterisk</primary>
11506 <secondary>in host list</secondary>
11507 </indexterm>
11508 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11509 the IP address nor the name is actually inspected.
11510 </para>
11511 </section>
11512 <section id="SECThoslispatip">
11513 <title>Host list patterns that match by IP address</title>
11514 <para>
11515 <indexterm role="concept">
11516 <primary>host list</primary>
11517 <secondary>matching IP addresses</secondary>
11518 </indexterm>
11519 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11520 the incoming address actually appears in the IPv6 host as
11521 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
11522 list, it is converted into a traditional IPv4 address first. (Not all operating
11523 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11524 concerns.)
11525 </para>
11526 <para>
11527 The following types of pattern in a host list check the remote host by
11528 inspecting its IP address:
11529 </para>
11530 <itemizedlist>
11531 <listitem>
11532 <para>
11533 If the pattern is a plain domain name (not a regular expression, not starting
11534 with *, not a lookup of any kind), Exim calls the operating system function
11535 to find the associated IP address(es). Exim uses the newer
11536 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11537 This typically causes a forward DNS lookup of the name. The result is compared
11538 with the IP address of the subject host.
11539 </para>
11540 <para>
11541 If there is a temporary problem (such as a DNS timeout) with the host name
11542 lookup, a temporary error occurs. For example, if the list is being used in an
11543 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11544 temporary SMTP error code. If no IP address can be found for the host name,
11545 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11546 </para>
11547 </listitem>
11548 <listitem>
11549 <para>
11550 <indexterm role="concept">
11551 <primary>@ in a host list</primary>
11552 </indexterm>
11553 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11554 domain name, as just described.
11555 </para>
11556 </listitem>
11557 <listitem>
11558 <para>
11559 If the pattern is an IP address, it is matched against the IP address of the
11560 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11561 IPv6 addresses can be given in colon-separated format, but the colons have to
11562 be doubled so as not to be taken as item separators when the default list
11563 separator is used. IPv6 addresses are recognized even when Exim is compiled
11564 without IPv6 support. This means that if they appear in a host list on an
11565 IPv4-only host, Exim will not treat them as host names. They are just addresses
11566 that can never match a client host.
11567 </para>
11568 </listitem>
11569 <listitem>
11570 <para>
11571 <indexterm role="concept">
11572 <primary>@[] in a host list</primary>
11573 </indexterm>
11574 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11575 the local host. For example, if the local host is an IPv4 host with one
11576 interface address 10.45.23.56, these two ACL statements have the same effect:
11577 </para>
11578 <literallayout class="monospaced">
11579 accept hosts = 127.0.0.1 : 10.45.23.56
11580 accept hosts = @[]
11581 </literallayout>
11582 </listitem>
11583 <listitem>
11584 <para>
11585 <indexterm role="concept">
11586 <primary>CIDR notation</primary>
11587 </indexterm>
11588 If the pattern is an IP address followed by a slash and a mask length (for
11589 example 10.11.42.0/24), it is matched against the IP address of the subject
11590 host under the given mask. This allows, an entire network of hosts to be
11591 included (or excluded) by a single item. The mask uses CIDR notation; it
11592 specifies the number of address bits that must match, starting from the most
11593 significant end of the address.
11594 </para>
11595 <para>
11596 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11597 of a range of addresses. It is the number of bits in the network portion of the
11598 address. The above example specifies a 24-bit netmask, so it matches all 256
11599 addresses in the 10.11.42.0 network. An item such as
11600 </para>
11601 <literallayout class="monospaced">
11602 192.168.23.236/31
11603 </literallayout>
11604 <para>
11605 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11606 32 for an IPv4 address is the same as no mask at all; just a single address
11607 matches.
11608 </para>
11609 <para>
11610 Here is another example which shows an IPv4 and an IPv6 network:
11611 </para>
11612 <literallayout class="monospaced">
11613 recipient_unqualified_hosts = 192.168.0.0/16: \
11614                               3ffe::ffff::836f::::/48
11615 </literallayout>
11616 <para>
11617 The doubling of list separator characters applies only when these items
11618 appear inline in a host list. It is not required when indirecting via a file.
11619 For example:
11620 </para>
11621 <literallayout class="monospaced">
11622 recipient_unqualified_hosts = /opt/exim/unqualnets
11623 </literallayout>
11624 <para>
11625 could make use of a file containing
11626 </para>
11627 <literallayout class="monospaced">
11628 172.16.0.0/12
11629 3ffe:ffff:836f::/48
11630 </literallayout>
11631 <para>
11632 to have exactly the same effect as the previous example. When listing IPv6
11633 addresses inline, it is usually more convenient to use the facility for
11634 changing separator characters. This list contains the same two networks:
11635 </para>
11636 <literallayout class="monospaced">
11637 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
11638                                  3ffe:ffff:836f::/48
11639 </literallayout>
11640 <para>
11641 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
11642 list.
11643 </para>
11644 </listitem>
11645 </itemizedlist>
11646 </section>
11647 <section id="SECThoslispatsikey">
11648 <title>Host list patterns for single-key lookups by host address</title>
11649 <para>
11650 <indexterm role="concept">
11651 <primary>host list</primary>
11652 <secondary>lookup of IP address</secondary>
11653 </indexterm>
11654 When a host is to be identified by a single-key lookup of its complete IP
11655 address, the pattern takes this form:
11656 </para>
11657 <literallayout>
11658 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
11659 </literallayout>
11660 <para>
11661 For example:
11662 </para>
11663 <literallayout class="monospaced">
11664 hosts_lookup = net-cdb;/hosts-by-ip.db
11665 </literallayout>
11666 <para>
11667 The text form of the IP address of the subject host is used as the lookup key.
11668 IPv6 addresses are converted to an unabbreviated form, using lower case
11669 letters, with dots as separators because colon is the key terminator in
11670 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11671 quoting the keys, but this is a facility that was added later.] The data
11672 returned by the lookup is not used.
11673 </para>
11674 <para>
11675 <indexterm role="concept">
11676 <primary>IP address</primary>
11677 <secondary>masking</secondary>
11678 </indexterm>
11679 <indexterm role="concept">
11680 <primary>host list</primary>
11681 <secondary>masked IP address</secondary>
11682 </indexterm>
11683 Single-key lookups can also be performed using masked IP addresses, using
11684 patterns of this form:
11685 </para>
11686 <literallayout>
11687 <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>
11688 </literallayout>
11689 <para>
11690 For example:
11691 </para>
11692 <literallayout class="monospaced">
11693 net24-dbm;/networks.db
11694 </literallayout>
11695 <para>
11696 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
11697 length. A textual string is constructed from the masked value, followed by the
11698 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
11699 is 192.168.34.6, the key that is looked up for the above example is
11700 <quote>192.168.34.0/24</quote>. IPv6 addresses are converted to a text value using lower
11701 case letters and dots as separators instead of the more usual colon, because
11702 colon is the key terminator in <command>lsearch</command> files. Full, unabbreviated IPv6
11703 addresses are always used.
11704 </para>
11705 <para>
11706 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11707 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
11708 the former case the key strings include the mask value, whereas in the latter
11709 case the IP address is used on its own.
11710 </para>
11711 </section>
11712 <section id="SECThoslispatnam">
11713 <title>Host list patterns that match by host name</title>
11714 <para>
11715 <indexterm role="concept">
11716 <primary>host</primary>
11717 <secondary>lookup failures</secondary>
11718 </indexterm>
11719 <indexterm role="concept">
11720 <primary>unknown host name</primary>
11721 </indexterm>
11722 <indexterm role="concept">
11723 <primary>host list</primary>
11724 <secondary>matching host name</secondary>
11725 </indexterm>
11726 There are several types of pattern that require Exim to know the name of the
11727 remote host. These are either wildcard patterns or lookups by name. (If a
11728 complete hostname is given without any wildcarding, it is used to find an IP
11729 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11730 above.)
11731 </para>
11732 <para>
11733 If the remote host name is not already known when Exim encounters one of these
11734 patterns, it has to be found from the IP address.
11735 Although many sites on the Internet are conscientious about maintaining reverse
11736 DNS data for their hosts, there are also many that do not do this.
11737 Consequently, a name cannot always be found, and this may lead to unwanted
11738 effects. Take care when configuring host lists with wildcarded name patterns.
11739 Consider what will happen if a name cannot be found.
11740 </para>
11741 <para>
11742 Because of the problems of determining host names from IP addresses, matching
11743 against host names is not as common as matching against IP addresses.
11744 </para>
11745 <para>
11746 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11747 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11748 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11749 are done can be changed by setting the <option>host_lookup_order</option> option. For
11750 security, once Exim has found one or more names, it looks up the IP addresses
11751 for these names and compares them with the IP address that it started with.
11752 Only those names whose IP addresses match are accepted. Any other names are
11753 discarded. If no names are left, Exim behaves as if the host name cannot be
11754 found. In the most common case there is only one name and one IP address.
11755 </para>
11756 <para>
11757 There are some options that control what happens if a host name cannot be
11758 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11759 </para>
11760 <para>
11761 <indexterm role="concept">
11762 <primary>host</primary>
11763 <secondary>alias for</secondary>
11764 </indexterm>
11765 <indexterm role="concept">
11766 <primary>alias for host</primary>
11767 </indexterm>
11768 As a result of aliasing, hosts may have more than one name. When processing any
11769 of the following types of pattern, all the host&#x2019;s names are checked:
11770 </para>
11771 <itemizedlist>
11772 <listitem>
11773 <para>
11774 <indexterm role="concept">
11775 <primary>asterisk</primary>
11776 <secondary>in host list</secondary>
11777 </indexterm>
11778 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11779 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11780 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11781 requirement. Other kinds of wildcarding require the use of a regular
11782 expression.
11783 </para>
11784 </listitem>
11785 <listitem>
11786 <para>
11787 <indexterm role="concept">
11788 <primary>regular expressions</primary>
11789 <secondary>in host list</secondary>
11790 </indexterm>
11791 <indexterm role="concept">
11792 <primary>host list</primary>
11793 <secondary>regular expression in</secondary>
11794 </indexterm>
11795 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11796 matched against the host name. For example,
11797 </para>
11798 <literallayout class="monospaced">
11799 ^(a|b)\.c\.d$
11800 </literallayout>
11801 <para>
11802 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11803 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11804 that backslash and dollar characters are not misinterpreted as part of the
11805 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11806 part of the string as non-expandable. For example:
11807 </para>
11808 <literallayout class="monospaced">
11809 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11810 </literallayout>
11811 <para>
11812 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11813 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11814 example. Without it, a match at the start of the host name is all that is
11815 required.
11816 </para>
11817 </listitem>
11818 </itemizedlist>
11819 </section>
11820 <section id="SECTbehipnot">
11821 <title>Behaviour when an IP address or name cannot be found</title>
11822 <para>
11823 <indexterm role="concept">
11824 <primary>host</primary>
11825 <secondary>lookup failures</secondary>
11826 </indexterm>
11827 While processing a host list, Exim may need to look up an IP address from a
11828 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11829 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11830 behaviour when it fails to find the information it is seeking is the same.
11831 </para>
11832 <para>
11833 <indexterm role="concept">
11834 <primary><literal>+include_unknown</literal></primary>
11835 </indexterm>
11836 <indexterm role="concept">
11837 <primary><literal>+ignore_unknown</literal></primary>
11838 </indexterm>
11839 By default, Exim behaves as if the host does not match the list. This may not
11840 always be what you want to happen. To change Exim&#x2019;s behaviour, the special
11841 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11842 top level &ndash; they are not recognized in an indirected file).
11843 </para>
11844 <itemizedlist>
11845 <listitem>
11846 <para>
11847 If any item that follows <literal>+include_unknown</literal> requires information that
11848 cannot found, Exim behaves as if the host does match the list. For example,
11849 </para>
11850 <literallayout class="monospaced">
11851 host_reject_connection = +include_unknown:*.enemy.ex
11852 </literallayout>
11853 <para>
11854 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
11855 any hosts whose name it cannot find.
11856 </para>
11857 </listitem>
11858 <listitem>
11859 <para>
11860 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
11861 be found, Exim ignores that item and proceeds to the rest of the list. For
11862 example:
11863 </para>
11864 <literallayout class="monospaced">
11865 accept hosts = +ignore_unknown : friend.example : \
11866                192.168.4.5
11867 </literallayout>
11868 <para>
11869 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
11870 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
11871 name can be found for 192.168.4.5, it is rejected.
11872 </para>
11873 </listitem>
11874 </itemizedlist>
11875 <para>
11876 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
11877 list. The effect of each one lasts until the next, or until the end of the
11878 list.
11879 </para>
11880 <para>
11881 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11882 apply to temporary DNS errors. They always cause a defer action (except when
11883 <option>dns_again_means_nonexist</option> converts them into permanent errors).
11884 </para>
11885 </section>
11886 <section id="SECThoslispatnamsk">
11887 <title>Host list patterns for single-key lookups by host name</title>
11888 <para>
11889 <indexterm role="concept">
11890 <primary>host</primary>
11891 <secondary>lookup failures</secondary>
11892 </indexterm>
11893 <indexterm role="concept">
11894 <primary>unknown host name</primary>
11895 </indexterm>
11896 <indexterm role="concept">
11897 <primary>host list</primary>
11898 <secondary>matching host name</secondary>
11899 </indexterm>
11900 If a pattern is of the form
11901 </para>
11902 <literallayout>
11903 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
11904 </literallayout>
11905 <para>
11906 for example
11907 </para>
11908 <literallayout class="monospaced">
11909 dbm;/host/accept/list
11910 </literallayout>
11911 <para>
11912 a single-key lookup is performed, using the host name as its key. If the
11913 lookup succeeds, the host matches the item. The actual data that is looked up
11914 is not used.
11915 </para>
11916 <para>
11917 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
11918 keys in the file, not IP addresses. If you want to do lookups based on IP
11919 addresses, you must precede the search type with <quote>net-</quote> (see section
11920 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
11921 two items in the same list, one doing an address lookup and one doing a name
11922 lookup, both using the same file.
11923 </para>
11924 </section>
11925 <section id="SECID81">
11926 <title>Host list patterns for query-style lookups</title>
11927 <para>
11928 If a pattern is of the form
11929 </para>
11930 <literallayout>
11931 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
11932 </literallayout>
11933 <para>
11934 the query is obeyed, and if it succeeds, the host matches the item. The actual
11935 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
11936 <varname>$sender_host_name</varname> can be used in the query. For example:
11937 </para>
11938 <literallayout class="monospaced">
11939 hosts_lookup = pgsql;\
11940   select ip from hostlist where ip='$sender_host_address'
11941 </literallayout>
11942 <para>
11943 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
11944 can use the <option>sg</option> expansion item to change this if you need to. If you want to
11945 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
11946 operator.
11947 </para>
11948 <para>
11949 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
11950 looks up the host name if has not already done so. (See section
11951 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
11952 </para>
11953 <para>
11954 Historical note: prior to release 4.30, Exim would always attempt to find a
11955 host name before running the query, unless the search type was preceded by
11956 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
11957 still recognized for query-style lookups, but its presence or absence has no
11958 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
11959 See section <xref linkend="SECThoslispatsikey"/>.)
11960 </para>
11961 </section>
11962 <section id="SECTmixwilhos">
11963 <title>Mixing wildcarded host names and addresses in host lists</title>
11964 <para>
11965 <indexterm role="concept">
11966 <primary>host list</primary>
11967 <secondary>mixing names and addresses in</secondary>
11968 </indexterm>
11969 If you have name lookups or wildcarded host names and IP addresses in the same
11970 host list, you should normally put the IP addresses first. For example, in an
11971 ACL you could have:
11972 </para>
11973 <literallayout class="monospaced">
11974 accept hosts = 10.9.8.7 : *.friend.example
11975 </literallayout>
11976 <para>
11977 The reason for this lies in the left-to-right way that Exim processes lists.
11978 It can test IP addresses without doing any DNS lookups, but when it reaches an
11979 item that requires a host name, it fails if it cannot find a host name to
11980 compare with the pattern. If the above list is given in the opposite order, the
11981 <option>accept</option> statement fails for a host whose name cannot be found, even if its
11982 IP address is 10.9.8.7.
11983 </para>
11984 <para>
11985 If you really do want to do the name check first, and still recognize the IP
11986 address, you can rewrite the ACL like this:
11987 </para>
11988 <literallayout class="monospaced">
11989 accept hosts = *.friend.example
11990 accept hosts = 10.9.8.7
11991 </literallayout>
11992 <para>
11993 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
11994 <xref linkend="CHAPACL"/> for details of ACLs.
11995 </para>
11996 </section>
11997 <section id="SECTaddresslist">
11998 <title>Address lists</title>
11999 <para>
12000 <indexterm role="concept">
12001 <primary>list</primary>
12002 <secondary>address list</secondary>
12003 </indexterm>
12004 <indexterm role="concept">
12005 <primary>address list</primary>
12006 <secondary>empty item</secondary>
12007 </indexterm>
12008 <indexterm role="concept">
12009 <primary>address list</primary>
12010 <secondary>patterns</secondary>
12011 </indexterm>
12012 Address lists contain patterns that are matched against mail addresses. There
12013 is one special case to be considered: the sender address of a bounce message is
12014 always empty. You can test for this by providing an empty item in an address
12015 list. For example, you can set up a router to process bounce messages by
12016 using this option setting:
12017 </para>
12018 <literallayout class="monospaced">
12019 senders = :
12020 </literallayout>
12021 <para>
12022 The presence of the colon creates an empty item. If you do not provide any
12023 data, the list is empty and matches nothing. The empty sender can also be
12024 detected by a regular expression that matches an empty string,
12025 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12026 </para>
12027 <para>
12028 Non-empty items in an address list can be straightforward email addresses. For
12029 example:
12030 </para>
12031 <literallayout class="monospaced">
12032 senders = jbc@askone.example : hs@anacreon.example
12033 </literallayout>
12034 <para>
12035 A certain amount of wildcarding is permitted. If a pattern contains an @
12036 character, but is not a regular expression and does not begin with a
12037 semicolon-terminated lookup type (described below), the local part of the
12038 subject address is compared with the local part of the pattern, which may start
12039 with an asterisk. If the local parts match, the domain is checked in exactly
12040 the same way as for a pattern in a domain list. For example, the domain can be
12041 wildcarded, refer to a named list, or be a lookup:
12042 </para>
12043 <literallayout class="monospaced">
12044 deny senders = *@*.spamming.site:\
12045                *@+hostile_domains:\
12046                bozo@partial-lsearch;/list/of/dodgy/sites:\
12047                *@dbm;/bad/domains.db
12048 </literallayout>
12049 <para>
12050 <indexterm role="concept">
12051 <primary>local part</primary>
12052 <secondary>starting with !</secondary>
12053 </indexterm>
12054 <indexterm role="concept">
12055 <primary>address list</primary>
12056 <secondary>local part starting with !</secondary>
12057 </indexterm>
12058 If a local part that begins with an exclamation mark is required, it has to be
12059 specified using a regular expression, because otherwise the exclamation mark is
12060 treated as a sign of negation, as is standard in lists.
12061 </para>
12062 <para>
12063 If a non-empty pattern that is not a regular expression or a lookup does not
12064 contain an @ character, it is matched against the domain part of the subject
12065 address. The only two formats that are recognized this way are a literal
12066 domain, or a domain pattern that starts with *. In both these cases, the effect
12067 is the same as if <literal>*@</literal> preceded the pattern. For example:
12068 </para>
12069 <literallayout class="monospaced">
12070 deny senders = enemy.domain : *.enemy.domain
12071 </literallayout>
12072 <para>
12073 The following kinds of more complicated address list pattern can match any
12074 address, including the empty address that is characteristic of bounce message
12075 senders:
12076 </para>
12077 <itemizedlist>
12078 <listitem>
12079 <para>
12080 <indexterm role="concept">
12081 <primary>regular expressions</primary>
12082 <secondary>in address list</secondary>
12083 </indexterm>
12084 <indexterm role="concept">
12085 <primary>address list</primary>
12086 <secondary>regular expression in</secondary>
12087 </indexterm>
12088 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12089 done against the complete address, with the pattern as the regular expression.
12090 You must take care that backslash and dollar characters are not misinterpreted
12091 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12092 to mark that part of the string as non-expandable. For example:
12093 </para>
12094 <literallayout class="monospaced">
12095 deny senders = \N^.*this.*@example\.com$\N : \
12096                \N^\d{8}.+@spamhaus.example$\N : ...
12097 </literallayout>
12098 <para>
12099 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12100 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12101 </para>
12102 </listitem>
12103 <listitem>
12104 <para>
12105 <indexterm role="concept">
12106 <primary>address list</primary>
12107 <secondary>lookup for complete address</secondary>
12108 </indexterm>
12109 Complete addresses can be looked up by using a pattern that starts with a
12110 lookup type terminated by a semicolon, followed by the data for the lookup. For
12111 example:
12112 </para>
12113 <literallayout class="monospaced">
12114 deny senders = cdb;/etc/blocked.senders : \
12115   mysql;select address from blocked where \
12116   address='${quote_mysql:$sender_address}'
12117 </literallayout>
12118 <para>
12119 Both query-style and single-key lookup types can be used. For a single-key
12120 lookup type, Exim uses the complete address as the key. However, empty keys are
12121 not supported for single-key lookups, so a match against the empty address
12122 always fails. This restriction does not apply to query-style lookups.
12123 </para>
12124 <para>
12125 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12126 cannot be used, and is ignored if specified, with an entry being written to the
12127 panic log.
12128 <indexterm role="concept">
12129 <primary>*@ with single-key lookup</primary>
12130 </indexterm>
12131 However, you can configure lookup defaults, as described in section
12132 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12133 default. For example, with this lookup:
12134 </para>
12135 <literallayout class="monospaced">
12136 accept senders = lsearch*@;/some/file
12137 </literallayout>
12138 <para>
12139 the file could contains lines like this:
12140 </para>
12141 <literallayout class="monospaced">
12142 user1@domain1.example
12143 *@domain2.example
12144 </literallayout>
12145 <para>
12146 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12147 that are tried is:
12148 </para>
12149 <literallayout class="monospaced">
12150 nimrod@jaeger.example
12151 *@jaeger.example
12152 *
12153 </literallayout>
12154 <para>
12155 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12156 would mean that every address matches, thus rendering the test useless.
12157 </para>
12158 <para>
12159 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12160 </para>
12161 <literallayout class="monospaced">
12162 deny recipients = dbm*@;/some/file
12163 deny recipients = *@dbm;/some/file
12164 </literallayout>
12165 <para>
12166 The first does a whole address lookup, with defaulting, as just described,
12167 because it starts with a lookup type. The second matches the local part and
12168 domain independently, as described in a bullet point below.
12169 </para>
12170 </listitem>
12171 </itemizedlist>
12172 <para>
12173 The following kinds of address list pattern can match only non-empty addresses.
12174 If the subject address is empty, a match against any of these pattern types
12175 always fails.
12176 </para>
12177 <itemizedlist>
12178 <listitem>
12179 <para>
12180 <indexterm role="concept">
12181 <primary>@@ with single-key lookup</primary>
12182 </indexterm>
12183 <indexterm role="concept">
12184 <primary>address list</primary>
12185 <secondary>@@ lookup type</secondary>
12186 </indexterm>
12187 <indexterm role="concept">
12188 <primary>address list</primary>
12189 <secondary>split local part and domain</secondary>
12190 </indexterm>
12191 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12192 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12193 split into a local part and a domain. The domain is looked up in the file. If
12194 it is not found, there is no match. If it is found, the data that is looked up
12195 from the file is treated as a colon-separated list of local part patterns, each
12196 of which is matched against the subject local part in turn.
12197 </para>
12198 <para>
12199 <indexterm role="concept">
12200 <primary>asterisk</primary>
12201 <secondary>in address list</secondary>
12202 </indexterm>
12203 The lookup may be a partial one, and/or one involving a search for a default
12204 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12205 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12206 even be further lookups. They may also be independently negated. For example,
12207 with
12208 </para>
12209 <literallayout class="monospaced">
12210 deny senders = @@dbm;/etc/reject-by-domain
12211 </literallayout>
12212 <para>
12213 the data from which the DBM file is built could contain lines like
12214 </para>
12215 <literallayout class="monospaced">
12216 baddomain.com:  !postmaster : *
12217 </literallayout>
12218 <para>
12219 to reject all senders except <option>postmaster</option> from that domain.
12220 </para>
12221 <para>
12222 <indexterm role="concept">
12223 <primary>local part</primary>
12224 <secondary>starting with !</secondary>
12225 </indexterm>
12226 If a local part that actually begins with an exclamation mark is required, it
12227 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12228 may be split over several lines by indenting the second and subsequent lines,
12229 but the separating colon must still be included at line breaks. White space
12230 surrounding the colons is ignored. For example:
12231 </para>
12232 <literallayout class="monospaced">
12233 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12234 spammer3 : spammer4
12235 </literallayout>
12236 <para>
12237 As in all colon-separated lists in Exim, a colon can be included in an item by
12238 doubling.
12239 </para>
12240 <para>
12241 If the last item in the list starts with a right angle-bracket, the remainder
12242 of the item is taken as a new key to look up in order to obtain a continuation
12243 list of local parts. The new key can be any sequence of characters. Thus one
12244 might have entries like
12245 </para>
12246 <literallayout class="monospaced">
12247 aol.com: spammer1 : spammer 2 : &gt;*
12248 xyz.com: spammer3 : &gt;*
12249 *:       ^\d{8}$
12250 </literallayout>
12251 <para>
12252 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12253 local parts for all domains, in addition to the specific local parts listed for
12254 each domain. Of course, using this feature costs another lookup each time a
12255 chain is followed, but the effort needed to maintain the data is reduced.
12256 </para>
12257 <para>
12258 <indexterm role="concept">
12259 <primary>loop</primary>
12260 <secondary>in lookups</secondary>
12261 </indexterm>
12262 It is possible to construct loops using this facility, and in order to catch
12263 them, the chains may be no more than fifty items long.
12264 </para>
12265 </listitem>
12266 <listitem>
12267 <para>
12268 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12269 lookup, but in this case, the chaining facility is not available. The lookup
12270 can only return a single list of local parts.
12271 </para>
12272 </listitem>
12273 </itemizedlist>
12274 <para>
12275 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12276 in these two examples:
12277 </para>
12278 <literallayout class="monospaced">
12279 senders = +my_list
12280 senders = *@+my_list
12281 </literallayout>
12282 <para>
12283 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12284 example it is a named domain list.
12285 </para>
12286 </section>
12287 <section id="SECTcasletadd">
12288 <title>Case of letters in address lists</title>
12289 <para>
12290 <indexterm role="concept">
12291 <primary>case of local parts</primary>
12292 </indexterm>
12293 <indexterm role="concept">
12294 <primary>address list</primary>
12295 <secondary>case forcing</secondary>
12296 </indexterm>
12297 <indexterm role="concept">
12298 <primary>case forcing in address lists</primary>
12299 </indexterm>
12300 Domains in email addresses are always handled caselessly, but for local parts
12301 case may be significant on some systems (see <option>caseful_local_part</option> for how
12302 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12303 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12304 blocking lists should be done in a case-independent manner. Since most address
12305 lists in Exim are used for this kind of control, Exim attempts to do this by
12306 default.
12307 </para>
12308 <para>
12309 The domain portion of an address is always lowercased before matching it to an
12310 address list. The local part is lowercased by default, and any string
12311 comparisons that take place are done caselessly. This means that the data in
12312 the address list itself, in files included as plain file names, and in any file
12313 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12314 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12315 works caselessly) must be in lower case, because these lookups are not
12316 case-independent.
12317 </para>
12318 <para>
12319 <indexterm role="concept">
12320 <primary><literal>+caseful</literal></primary>
12321 </indexterm>
12322 To allow for the possibility of caseful address list matching, if an item in
12323 an address list is the string <quote>+caseful</quote>, the original case of the local
12324 part is restored for any comparisons that follow, and string comparisons are no
12325 longer case-independent. This does not affect the domain, which remains in
12326 lower case. However, although independent matches on the domain alone are still
12327 performed caselessly, regular expressions that match against an entire address
12328 become case-sensitive after <quote>+caseful</quote> has been seen.
12329 </para>
12330 </section>
12331 <section id="SECTlocparlis">
12332 <title>Local part lists</title>
12333 <para>
12334 <indexterm role="concept">
12335 <primary>list</primary>
12336 <secondary>local part list</secondary>
12337 </indexterm>
12338 <indexterm role="concept">
12339 <primary>local part</primary>
12340 <secondary>list</secondary>
12341 </indexterm>
12342 Case-sensitivity in local part lists is handled in the same way as for address
12343 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12344 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12345 set false, the subject is lowercased and the matching is initially
12346 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12347 matching in the local part list, but not elsewhere in the router. If
12348 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12349 option is case-sensitive from the start.
12350 </para>
12351 <para>
12352 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12353 comments are handled in the same way as address lists &ndash; they are recognized
12354 only if the # is preceded by white space or the start of the line.
12355 Otherwise, local part lists are matched in the same way as domain lists, except
12356 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12357 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12358 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12359 types.
12360 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12361 </para>
12362 </section>
12363 </chapter>
12364
12365 <chapter id="CHAPexpand">
12366 <title>String expansions</title>
12367 <para>
12368 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12369 <primary>expansion</primary>
12370 <secondary>of strings</secondary>
12371 </indexterm>
12372 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12373 them are expanded every time they are used; others are expanded only once.
12374 </para>
12375 <para>
12376 When a string is being expanded it is copied verbatim from left to right except
12377 when a dollar or backslash character is encountered. A dollar specifies the
12378 start of a portion of the string that is interpreted and replaced as described
12379 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12380 escape character, as described in the following section.
12381 </para>
12382 <section id="SECTlittext">
12383 <title>Literal text in expanded strings</title>
12384 <para>
12385 <indexterm role="concept">
12386 <primary>expansion</primary>
12387 <secondary>including literal text</secondary>
12388 </indexterm>
12389 An uninterpreted dollar can be included in an expanded string by putting a
12390 backslash in front of it. A backslash can be used to prevent any special
12391 character being treated specially in an expansion, including backslash itself.
12392 If the string appears in quotes in the configuration file, two backslashes are
12393 required because the quotes themselves cause interpretation of backslashes when
12394 the string is read in (see section <xref linkend="SECTstrings"/>).
12395 </para>
12396 <para>
12397 <indexterm role="concept">
12398 <primary>expansion</primary>
12399 <secondary>non-expandable substrings</secondary>
12400 </indexterm>
12401 A portion of the string can specified as non-expandable by placing it between
12402 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12403 expressions, which often contain backslashes and dollar signs. For example:
12404 </para>
12405 <literallayout class="monospaced">
12406 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12407 </literallayout>
12408 <para>
12409 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12410 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12411 string.
12412 </para>
12413 </section>
12414 <section id="SECID82">
12415 <title>Character escape sequences in expanded strings</title>
12416 <para>
12417 <indexterm role="concept">
12418 <primary>expansion</primary>
12419 <secondary>escape sequences</secondary>
12420 </indexterm>
12421 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12422 expanded string is recognized as an escape sequence for the character newline,
12423 carriage return, or tab, respectively. A backslash followed by up to three
12424 octal digits is recognized as an octal encoding for a single character, and a
12425 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12426 encoding.
12427 </para>
12428 <para>
12429 These escape sequences are also recognized in quoted strings when they are read
12430 in. Their interpretation in expansions as well is useful for unquoted strings,
12431 and for other cases such as looked-up strings that are then expanded.
12432 </para>
12433 </section>
12434 <section id="SECID83">
12435 <title>Testing string expansions</title>
12436 <para>
12437 <indexterm role="concept">
12438 <primary>expansion</primary>
12439 <secondary>testing</secondary>
12440 </indexterm>
12441 <indexterm role="concept">
12442 <primary>testing</primary>
12443 <secondary>string expansion</secondary>
12444 </indexterm>
12445 <indexterm role="option">
12446 <primary><option>-be</option></primary>
12447 </indexterm>
12448 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12449 takes the command arguments, or lines from the standard input if there are no
12450 arguments, runs them through the string expansion code, and writes the results
12451 to the standard output. Variables based on configuration values are set up, but
12452 since no message is being processed, variables such as <varname>$local_part</varname> have no
12453 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12454 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12455 and <option>nhash</option>.
12456 </para>
12457 <para>
12458 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12459 instead runs under the uid and gid it was called with, to prevent users from
12460 using <option>-be</option> for reading files to which they do not have access.
12461 </para>
12462 <para>
12463 <indexterm role="option">
12464 <primary><option>-bem</option></primary>
12465 </indexterm>
12466 If you want to test expansions that include variables whose values are taken
12467 from a message, there are two other options that can be used. The <option>-bem</option>
12468 option is like <option>-be</option> except that it is followed by a file name. The file is
12469 read as a message before doing the test expansions. For example:
12470 </para>
12471 <literallayout class="monospaced">
12472 exim -bem /tmp/test.message '$h_subject:'
12473 </literallayout>
12474 <para>
12475 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12476 Exim message identifier. For example:
12477 </para>
12478 <literallayout class="monospaced">
12479 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12480 </literallayout>
12481 <para>
12482 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
12483 is therefore restricted to admin users.
12484 </para>
12485 </section>
12486 <section id="SECTforexpfai">
12487 <title>Forced expansion failure</title>
12488 <para>
12489 <indexterm role="concept">
12490 <primary>expansion</primary>
12491 <secondary>forced failure</secondary>
12492 </indexterm>
12493 A number of expansions that are described in the following section have
12494 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12495 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12496 used depends on some condition that is evaluated as part of the expansion. If,
12497 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12498 the entire string expansion fails in a way that can be detected by the code
12499 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12500 its consequences depend on the circumstances. In some cases it is no different
12501 from any other expansion failure, but in others a different action may be
12502 taken. Such variations are mentioned in the documentation of the option that is
12503 being expanded.
12504 </para>
12505 </section>
12506 <section id="SECTexpansionitems">
12507 <title>Expansion items</title>
12508 <para>
12509 The following items are recognized in expanded strings. White space may be used
12510 between sub-items that are keywords or substrings enclosed in braces inside an
12511 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12512 white space is significant.
12513 </para>
12514 <variablelist>
12515 <varlistentry>
12516 <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>
12517 <listitem>
12518 <para>
12519 <indexterm role="concept">
12520 <primary>expansion</primary>
12521 <secondary>variables</secondary>
12522 </indexterm>
12523 Substitute the contents of the named variable, for example:
12524 </para>
12525 <literallayout class="monospaced">
12526 $local_part
12527 ${domain}
12528 </literallayout>
12529 <para>
12530 The second form can be used to separate the name from subsequent alphanumeric
12531 characters. This form (using braces) is available only for variables; it does
12532 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12533 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12534 given, the expansion fails.
12535 </para>
12536 </listitem></varlistentry>
12537 <varlistentry>
12538 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12539 <listitem>
12540 <para>
12541 <indexterm role="concept">
12542 <primary>expansion</primary>
12543 <secondary>operators</secondary>
12544 </indexterm>
12545 The string is first itself expanded, and then the operation specified by
12546 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
12547 </para>
12548 <literallayout class="monospaced">
12549 ${lc:$local_part}
12550 </literallayout>
12551 <para>
12552 The string starts with the first character after the colon, which may be
12553 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12554 below. The operator notation is used for simple expansion items that have just
12555 one argument, because it reduces the number of braces and therefore makes the
12556 string easier to understand.
12557 </para>
12558 </listitem></varlistentry>
12559 <varlistentry>
12560 <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>
12561 <listitem>
12562 <para>
12563 <indexterm role="concept">
12564 <primary><option>dlfunc</option></primary>
12565 </indexterm>
12566 This expansion dynamically loads and then calls a locally-written C function.
12567 This functionality is available only if Exim is compiled with
12568 </para>
12569 <literallayout class="monospaced">
12570 EXPAND_DLFUNC=yes
12571 </literallayout>
12572 <para>
12573 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12574 object so that it doesn&#x2019;t reload the same object file in the same Exim process
12575 (but of course Exim does start new processes frequently).
12576 </para>
12577 <para>
12578 There may be from zero to eight arguments to the function. When compiling
12579 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12580 included. The Exim variables and functions that are defined by that API
12581 are also available for dynamically loaded functions. The function itself
12582 must have the following type:
12583 </para>
12584 <literallayout class="monospaced">
12585 int dlfunction(uschar **yield, int argc, uschar *argv[])
12586 </literallayout>
12587 <para>
12588 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12589 function should return one of the following values:
12590 </para>
12591 <para>
12592 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12593 into the expanded string that is being built.
12594 </para>
12595 <para>
12596 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12597 from <emphasis>yield</emphasis>, if it is set.
12598 </para>
12599 <para>
12600 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12601 taken from <emphasis>yield</emphasis> if it is set.
12602 </para>
12603 <para>
12604 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12605 </para>
12606 <para>
12607 When compiling a function that is to be used in this way with gcc,
12608 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12609 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12610 </para>
12611 </listitem></varlistentry>
12612 <varlistentry>
12613 <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>
12614 <listitem>
12615 <para>
12616 <indexterm role="concept">
12617 <primary>expansion</primary>
12618 <secondary>extracting substrings by key</secondary>
12619 </indexterm>
12620 <indexterm role="concept">
12621 <primary><option>extract</option></primary>
12622 <secondary>substrings by key</secondary>
12623 </indexterm>
12624 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
12625 white space is removed from the key (but not from any of the strings). The key
12626 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
12627 form:
12628 </para>
12629 <literallayout>
12630 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
12631 </literallayout>
12632 <para>
12633 <indexterm role="variable">
12634 <primary><varname>$value</varname></primary>
12635 </indexterm>
12636 where the equals signs and spaces (but not both) are optional. If any of the
12637 values contain white space, they must be enclosed in double quotes, and any
12638 values that are enclosed in double quotes are subject to escape processing as
12639 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
12640 for the value that corresponds to the key. The search is case-insensitive. If
12641 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
12642 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
12643 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12644 is restored to any previous value it might have had.
12645 </para>
12646 <para>
12647 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
12648 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
12649 extracted is used. Thus, for example, these two expansions are identical, and
12650 yield <quote>2001</quote>:
12651 </para>
12652 <literallayout class="monospaced">
12653 ${extract{gid}{uid=1984 gid=2001}}
12654 ${extract{gid}{uid=1984 gid=2001}{$value}}
12655 </literallayout>
12656 <para>
12657 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
12658 appear, for example:
12659 </para>
12660 <literallayout class="monospaced">
12661 ${extract{Z}{A=... B=...}{$value} fail }
12662 </literallayout>
12663 <para>
12664 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12665 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
12666 </para>
12667 </listitem></varlistentry>
12668 <varlistentry>
12669 <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>
12670 <listitem>
12671 <para>
12672 <indexterm role="concept">
12673 <primary>expansion</primary>
12674 <secondary>extracting substrings by number</secondary>
12675 </indexterm>
12676 <indexterm role="concept">
12677 <primary><option>extract</option></primary>
12678 <secondary>substrings by number</secondary>
12679 </indexterm>
12680 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
12681 apart from leading and trailing white space, which is ignored.
12682 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12683 behaves in the same way, except that, instead of extracting a named field, it
12684 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
12685 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
12686 &lt;<emphasis>string3</emphasis>&gt; as before.
12687 </para>
12688 <para>
12689 The fields in the string are separated by any one of the characters in the
12690 separator string. These may include space or tab characters.
12691 The first field is numbered one. If the number is negative, the fields are
12692 counted from the end of the string, with the rightmost one numbered -1. If the
12693 number given is zero, the entire string is returned. If the modulus of the
12694 number is greater than the number of fields in the string, the result is the
12695 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
12696 provided. For example:
12697 </para>
12698 <literallayout class="monospaced">
12699 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12700 </literallayout>
12701 <para>
12702 yields <quote>42</quote>, and
12703 </para>
12704 <literallayout class="monospaced">
12705 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12706 </literallayout>
12707 <para>
12708 yields <quote>99</quote>. Two successive separators mean that the field between them is
12709 empty (for example, the fifth field above).
12710 </para>
12711 </listitem></varlistentry>
12712 <varlistentry revisionflag="changed">
12713 <term><emphasis role="bold">${filter{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>condition</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
12714 <listitem>
12715 <para revisionflag="changed">
12716 <indexterm role="concept">
12717 <primary>list</primary>
12718 <secondary>selecting by condition</secondary>
12719 </indexterm>
12720 <indexterm role="concept">
12721 <primary>expansion</primary>
12722 <secondary>selecting from list by condition</secondary>
12723 </indexterm>
12724 <indexterm role="variable">
12725 <primary><varname>$item</varname></primary>
12726 </indexterm>
12727 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
12728 default, but the separator can be changed in the usual way. For each item
12729 in this list, its value is place in <varname>$item</varname>, and then the condition is
12730 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
12731 item in a new list; if the condition is false, the item is discarded. The
12732 separator used for the output list is the same as the one used for the
12733 input, but a separator setting is not included in the output. For example:
12734 </para>
12735 <literallayout class="monospaced" revisionflag="changed">
12736 ${filter{a:b:c}{!eq{$item}{b}}
12737 </literallayout>
12738 <para revisionflag="changed">
12739 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
12740 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
12741 </para>
12742 </listitem></varlistentry>
12743 <varlistentry>
12744 <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>
12745 <listitem>
12746 <para>
12747 <indexterm role="concept">
12748 <primary>hash function</primary>
12749 <secondary>textual</secondary>
12750 </indexterm>
12751 <indexterm role="concept">
12752 <primary>expansion</primary>
12753 <secondary>textual hash</secondary>
12754 </indexterm>
12755 This is a textual hashing function, and was the first to be implemented in
12756 early versions of Exim. In current releases, there are other hashing functions
12757 (numeric, MD5, and SHA-1), which are described below.
12758 </para>
12759 <para>
12760 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
12761 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
12762 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
12763 use the simpler operator notation that avoids some of the braces:
12764 </para>
12765 <literallayout class="monospaced">
12766 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
12767 </literallayout>
12768 <para>
12769 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
12770 or equal to the length of the string, the expansion item returns the string.
12771 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
12772 function to the string. The new string consists of characters taken from the
12773 first &lt;<emphasis>m</emphasis>&gt; characters of the string
12774 </para>
12775 <literallayout class="monospaced">
12776 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12777 </literallayout>
12778 <para>
12779 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
12780 letters appear. For example:
12781 </para>
12782 <literallayout>
12783 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
12784 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
12785 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
12786 </literallayout>
12787 </listitem></varlistentry>
12788 <varlistentry>
12789 <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>
12790 <listitem>
12791 <para>
12792 See <emphasis role="bold">$rheader</emphasis> below.
12793 </para>
12794 </listitem></varlistentry>
12795 <varlistentry>
12796 <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>
12797 <listitem>
12798 <para>
12799 See <emphasis role="bold">$rheader</emphasis> below.
12800 </para>
12801 </listitem></varlistentry>
12802 <varlistentry>
12803 <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>
12804 <listitem>
12805 <para>
12806 <indexterm role="concept">
12807 <primary>expansion</primary>
12808 <secondary>header insertion</secondary>
12809 </indexterm>
12810 <indexterm role="variable">
12811 <primary><varname>$header_</varname></primary>
12812 </indexterm>
12813 <indexterm role="variable">
12814 <primary><varname>$bheader_</varname></primary>
12815 </indexterm>
12816 <indexterm role="variable">
12817 <primary><varname>$rheader_</varname></primary>
12818 </indexterm>
12819 <indexterm role="concept">
12820 <primary>header lines</primary>
12821 <secondary>in expansion strings</secondary>
12822 </indexterm>
12823 <indexterm role="concept">
12824 <primary>header lines</primary>
12825 <secondary>character sets</secondary>
12826 </indexterm>
12827 <indexterm role="concept">
12828 <primary>header lines</primary>
12829 <secondary>decoding</secondary>
12830 </indexterm>
12831 Substitute the contents of the named message header line, for example
12832 </para>
12833 <literallayout class="monospaced">
12834 $header_reply-to:
12835 </literallayout>
12836 <para>
12837 The newline that terminates a header line is not included in the expansion, but
12838 internal newlines (caused by splitting the header line over several physical
12839 lines) may be present.
12840 </para>
12841 <para>
12842 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
12843 the data in the header line is interpreted.
12844 </para>
12845 <itemizedlist>
12846 <listitem>
12847 <para>
12848 <indexterm role="concept">
12849 <primary>white space</primary>
12850 <secondary>in header lines</secondary>
12851 </indexterm>
12852 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
12853 processing at all, and without the removal of leading and trailing white space.
12854 </para>
12855 </listitem>
12856 <listitem>
12857 <para>
12858 <indexterm role="concept">
12859 <primary>base64 encoding</primary>
12860 <secondary>in header lines</secondary>
12861 </indexterm>
12862 <option>bheader</option> removes leading and trailing white space, and then decodes base64
12863 or quoted-printable MIME <quote>words</quote> within the header text, but does no
12864 character set translation. If decoding of what looks superficially like a MIME
12865 <quote>word</quote> fails, the raw string is returned. If decoding
12866 <indexterm role="concept">
12867 <primary>binary zero</primary>
12868 <secondary>in header line</secondary>
12869 </indexterm>
12870 produces a binary zero character, it is replaced by a question mark &ndash; this is
12871 what Exim does for binary zeros that are actually received in header lines.
12872 </para>
12873 </listitem>
12874 <listitem>
12875 <para>
12876 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
12877 standard character set. This is an attempt to produce the same string as would
12878 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
12879 returned. Translation is attempted only on operating systems that support the
12880 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
12881 a system Makefile or in <filename>Local/Makefile</filename>.
12882 </para>
12883 </listitem>
12884 </itemizedlist>
12885 <para>
12886 In a filter file, the target character set for <option>header</option> can be specified by a
12887 command of the following form:
12888 </para>
12889 <literallayout class="monospaced">
12890 headers charset "UTF-8"
12891 </literallayout>
12892 <para>
12893 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
12894 subsequently obeyed filter commands. In the absence of this command, the target
12895 character set in a filter is taken from the setting of the <option>headers_charset</option>
12896 option in the runtime configuration. The value of this option defaults to the
12897 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
12898 ISO-8859-1.
12899 </para>
12900 <para>
12901 Header names follow the syntax of RFC 2822, which states that they may contain
12902 any printing characters except space and colon. Consequently, curly brackets
12903 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
12904 if they were variables. Attempting to do so causes a syntax error.
12905 </para>
12906 <para>
12907 Only header lines that are common to all copies of a message are visible to
12908 this mechanism. These are the original header lines that are received with the
12909 message, and any that are added by an ACL statement or by a system
12910 filter. Header lines that are added to a particular copy of a message by a
12911 router or transport are not accessible.
12912 </para>
12913 <para>
12914 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
12915 before the DATA ACL, because the header structure is not set up until the
12916 message is received. Header lines that are added in a RCPT ACL (for example)
12917 are saved until the message&#x2019;s incoming header lines are available, at which
12918 point they are added. When a DATA ACL is running, however, header lines added
12919 by earlier ACLs are visible.
12920 </para>
12921 <para>
12922 Upper case and lower case letters are synonymous in header names. If the
12923 following character is white space, the terminating colon may be omitted, but
12924 this is not recommended, because you may then forget it when it is needed. When
12925 white space terminates the header name, it is included in the expanded string.
12926 If the message does not contain the given header, the expansion item is
12927 replaced by an empty string. (See the <option>def</option> condition in section
12928 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
12929 </para>
12930 <para>
12931 If there is more than one header with the same name, they are all concatenated
12932 to form the substitution string, up to a maximum length of 64K. Unless
12933 <option>rheader</option> is being used, leading and trailing white space is removed from
12934 each header before concatenation, and a completely empty header is ignored. A
12935 newline character is then inserted between non-empty headers, but there is no
12936 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
12937 those headers that contain lists of addresses, a comma is also inserted at the
12938 junctions between headers. This does not happen for the <option>rheader</option> expansion.
12939 </para>
12940 </listitem></varlistentry>
12941 <varlistentry>
12942 <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>
12943 <listitem>
12944 <para>
12945 <indexterm role="concept">
12946 <primary>expansion</primary>
12947 <secondary>hmac hashing</secondary>
12948 </indexterm>
12949 <indexterm role="concept">
12950 <primary><option>hmac</option></primary>
12951 </indexterm>
12952 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
12953 shared secret and some text into a message authentication code, as specified in
12954 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
12955 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
12956 cryptographic hash, allowing for authentication that is not possible with MD5
12957 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
12958 present. For example:
12959 </para>
12960 <literallayout class="monospaced">
12961 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
12962 </literallayout>
12963 <para>
12964 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
12965 produces:
12966 </para>
12967 <literallayout class="monospaced">
12968 dd97e3ba5d1a61b5006108f8c8252953
12969 </literallayout>
12970 <para>
12971 As an example of how this might be used, you might put in the main part of
12972 an Exim configuration:
12973 </para>
12974 <literallayout class="monospaced">
12975 SPAMSCAN_SECRET=cohgheeLei2thahw
12976 </literallayout>
12977 <para>
12978 In a router or a transport you could then have:
12979 </para>
12980 <literallayout class="monospaced">
12981 headers_add = \
12982   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
12983   ${hmac{md5}{SPAMSCAN_SECRET}\
12984   {${primary_hostname},${message_exim_id},$h_message-id:}}
12985 </literallayout>
12986 <para>
12987 Then given a message, you can check where it was scanned by looking at the
12988 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
12989 this header line is authentic by recomputing the authentication code from the
12990 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
12991 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
12992 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
12993 </para>
12994 </listitem></varlistentry>
12995 <varlistentry>
12996 <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>
12997 <listitem>
12998 <para>
12999 <indexterm role="concept">
13000 <primary>expansion</primary>
13001 <secondary>conditional</secondary>
13002 </indexterm>
13003 <indexterm role="concept">
13004 <primary><option>if</option>, expansion item</primary>
13005 </indexterm>
13006 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13007 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13008 in section <xref linkend="SECTexpcond"/> below. For example:
13009 </para>
13010 <literallayout class="monospaced">
13011 ${if eq {$local_part}{postmaster} {yes}{no} }
13012 </literallayout>
13013 <para>
13014 The second string need not be present; if it is not and the condition is not
13015 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13016 be present instead of the second string (without any curly brackets). In this
13017 case, the expansion is forced to fail if the condition is not true (see section
13018 <xref linkend="SECTforexpfai"/>).
13019 </para>
13020 <para>
13021 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13022 is true, and the empty string if the condition is false. This makes it less
13023 cumbersome to write custom ACL and router conditions. For example, instead of
13024 </para>
13025 <literallayout class="monospaced">
13026 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13027 </literallayout>
13028 <para>
13029 you can use
13030 </para>
13031 <literallayout class="monospaced">
13032 condition = ${if &gt;{$acl_m4}{3}}
13033 </literallayout>
13034 </listitem></varlistentry>
13035 <varlistentry>
13036 <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>
13037 <listitem>
13038 <para>
13039 <indexterm role="concept">
13040 <primary>expansion</primary>
13041 <secondary>string truncation</secondary>
13042 </indexterm>
13043 <indexterm role="concept">
13044 <primary><option>length</option> expansion item</primary>
13045 </indexterm>
13046 The <option>length</option> item is used to extract the initial portion of a string. Both
13047 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13048 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13049 change when expanded, you can use the simpler operator notation that avoids
13050 some of the braces:
13051 </para>
13052 <literallayout class="monospaced">
13053 ${length_&lt;n&gt;:&lt;string&gt;}
13054 </literallayout>
13055 <para>
13056 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13057 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13058 <option>strlen</option>, which gives the length of a string.
13059 </para>
13060 </listitem></varlistentry>
13061 <varlistentry>
13062 <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>
13063 <listitem>
13064 <para>
13065 This is the first of one of two different types of lookup item, which are both
13066 described in the next item.
13067 </para>
13068 </listitem></varlistentry>
13069 <varlistentry>
13070 <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>
13071 <listitem>
13072 <para>
13073 <indexterm role="concept">
13074 <primary>expansion</primary>
13075 <secondary>lookup in</secondary>
13076 </indexterm>
13077 <indexterm role="concept">
13078 <primary>file</primary>
13079 <secondary>lookups</secondary>
13080 </indexterm>
13081 <indexterm role="concept">
13082 <primary>lookup</primary>
13083 <secondary>in expanded string</secondary>
13084 </indexterm>
13085 The two forms of lookup item specify data lookups in files and databases, as
13086 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13087 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13088 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13089 </para>
13090 <para>
13091 If there is any white space in a lookup item which is part of a filter command,
13092 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13093 other place where white space is significant, the lookup item must be enclosed
13094 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13095 out by the system administrator.
13096 </para>
13097 <para>
13098 <indexterm role="variable">
13099 <primary><varname>$value</varname></primary>
13100 </indexterm>
13101 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13102 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13103 lookup. Afterwards it reverts to the value it had previously (at the outer
13104 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13105 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13106 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13107 lookup, thus providing a mechanism for looking up a default value when the
13108 original lookup fails.
13109 </para>
13110 <para>
13111 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13112 data for the outer lookup while the parameters of the second lookup are
13113 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13114 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13115 appear, and in this case, if the lookup fails, the entire expansion is forced
13116 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13117 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13118 successful lookup, and nothing in the case of failure.
13119 </para>
13120 <para>
13121 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13122 search type in order to do partial matching, and * or *@ may follow a search
13123 type to request default lookups if the key does not match (see sections
13124 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13125 </para>
13126 <para>
13127 <indexterm role="concept">
13128 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13129 <secondary>in lookup expansion</secondary>
13130 </indexterm>
13131 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13132 and non-wild parts of the key during the expansion of the replacement text.
13133 They return to their previous values at the end of the lookup item.
13134 </para>
13135 <para>
13136 This example looks up the postmaster alias in the conventional alias file:
13137 </para>
13138 <literallayout class="monospaced">
13139 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13140 </literallayout>
13141 <para>
13142 This example uses NIS+ to look up the full name of the user corresponding to
13143 the local part of an address, forcing the expansion to fail if it is not found:
13144 </para>
13145 <literallayout class="monospaced">
13146 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13147   {$value}fail}
13148 </literallayout>
13149 </listitem></varlistentry>
13150 <varlistentry revisionflag="changed">
13151 <term><emphasis role="bold">${map{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13152 <listitem>
13153 <para revisionflag="changed">
13154 <indexterm role="concept">
13155 <primary>expansion</primary>
13156 <secondary>list creation</secondary>
13157 </indexterm>
13158 <indexterm role="variable">
13159 <primary><varname>$item</varname></primary>
13160 </indexterm>
13161 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13162 default, but the separator can be changed in the usual way. For each item
13163 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
13164 expanded and added to the output as an item in a new list. The separator used
13165 for the output list is the same as the one used for the input, but a separator
13166 setting is not included in the output. For example:
13167 </para>
13168 <literallayout class="monospaced" revisionflag="changed">
13169 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
13170 </literallayout>
13171 <para revisionflag="changed">
13172 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13173 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13174 and <emphasis role="bold">reduce</emphasis> expansion items.
13175 </para>
13176 </listitem></varlistentry>
13177 <varlistentry>
13178 <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>
13179 <listitem>
13180 <para>
13181 <indexterm role="concept">
13182 <primary>expansion</primary>
13183 <secondary>numeric hash</secondary>
13184 </indexterm>
13185 <indexterm role="concept">
13186 <primary>hash function</primary>
13187 <secondary>numeric</secondary>
13188 </indexterm>
13189 The three strings are expanded; the first two must yield numbers. Call them
13190 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13191 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13192 can use the simpler operator notation that avoids some of the braces:
13193 </para>
13194 <literallayout class="monospaced">
13195 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13196 </literallayout>
13197 <para>
13198 The second number is optional (in both notations). If there is only one number,
13199 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13200 processed by a div/mod hash function that returns two numbers, separated by a
13201 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13202 example,
13203 </para>
13204 <literallayout class="monospaced">
13205 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13206 </literallayout>
13207 <para>
13208 returns the string <quote>6/33</quote>.
13209 </para>
13210 </listitem></varlistentry>
13211 <varlistentry>
13212 <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>
13213 <listitem>
13214 <para>
13215 <indexterm role="concept">
13216 <primary>Perl</primary>
13217 <secondary>use in expanded string</secondary>
13218 </indexterm>
13219 <indexterm role="concept">
13220 <primary>expansion</primary>
13221 <secondary>calling Perl from</secondary>
13222 </indexterm>
13223 This item is available only if Exim has been built to include an embedded Perl
13224 interpreter. The subroutine name and the arguments are first separately
13225 expanded, and then the Perl subroutine is called with those arguments. No
13226 additional arguments need be given; the maximum number permitted, including the
13227 name of the subroutine, is nine.
13228 </para>
13229 <para>
13230 The return value of the subroutine is inserted into the expanded string, unless
13231 the return value is <option>undef</option>. In that case, the expansion fails in the same
13232 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13233 Whatever you return is evaluated in a scalar context. For example, if you
13234 return the name of a Perl vector, the return value is the size of the vector,
13235 not its contents.
13236 </para>
13237 <para>
13238 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13239 with the error message that was passed to <option>die</option>. More details of the embedded
13240 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13241 </para>
13242 <para>
13243 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13244 out the use of this expansion item in filter files.
13245 </para>
13246 </listitem></varlistentry>
13247 <varlistentry>
13248 <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>
13249 <listitem>
13250 <para>
13251 <indexterm role="concept">
13252 <primary><option>prvs</option> expansion item</primary>
13253 </indexterm>
13254 The first argument is a complete email address and the second is secret
13255 keystring. The third argument, specifying a key number, is optional. If absent,
13256 it defaults to 0. The result of the expansion is a prvs-signed email address,
13257 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13258 as part of a bounce address tag validation (BATV) scheme. For more discussion
13259 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13260 </para>
13261 </listitem></varlistentry>
13262 <varlistentry>
13263 <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>
13264 <listitem>
13265 <para>
13266 <indexterm role="concept">
13267 <primary><option>prvscheck</option> expansion item</primary>
13268 </indexterm>
13269 This expansion item is the complement of the <option>prvs</option> item. It is used for
13270 checking prvs-signed addresses. If the expansion of the first argument does not
13271 yield a syntactically valid prvs-signed address, the whole item expands to the
13272 empty string. When the first argument does expand to a syntactically valid
13273 prvs-signed address, the second argument is expanded, with the prvs-decoded
13274 version of the address and the key number extracted from the address in the
13275 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13276 </para>
13277 <para>
13278 These two variables can be used in the expansion of the second argument to
13279 retrieve the secret. The validity of the prvs-signed address is then checked
13280 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13281 which is empty for failure or <quote>1</quote> for success.
13282 </para>
13283 <para>
13284 The third argument is optional; if it is missing, it defaults to an empty
13285 string. This argument is now expanded. If the result is an empty string, the
13286 result of the expansion is the decoded version of the address. This is the case
13287 whether or not the signature was valid. Otherwise, the result of the expansion
13288 is the expansion of the third argument.
13289 </para>
13290 <para>
13291 All three variables can be used in the expansion of the third argument.
13292 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13293 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13294 </para>
13295 </listitem></varlistentry>
13296 <varlistentry>
13297 <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>
13298 <listitem>
13299 <para>
13300 <indexterm role="concept">
13301 <primary>expansion</primary>
13302 <secondary>inserting an entire file</secondary>
13303 </indexterm>
13304 <indexterm role="concept">
13305 <primary>file</primary>
13306 <secondary>inserting into expansion</secondary>
13307 </indexterm>
13308 <indexterm role="concept">
13309 <primary><option>readfile</option> expansion item</primary>
13310 </indexterm>
13311 The file name and end-of-line string are first expanded separately. The file is
13312 then read, and its contents replace the entire item. All newline characters in
13313 the file are replaced by the end-of-line string if it is present. Otherwise,
13314 newlines are left in the string.
13315 String expansion is not applied to the contents of the file. If you want this,
13316 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13317 the string expansion fails.
13318 </para>
13319 <para>
13320 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13321 locks out the use of this expansion item in filter files.
13322 </para>
13323 </listitem></varlistentry>
13324 <varlistentry>
13325 <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>
13326 <listitem>
13327 <para>
13328 <indexterm role="concept">
13329 <primary>expansion</primary>
13330 <secondary>inserting from a socket</secondary>
13331 </indexterm>
13332 <indexterm role="concept">
13333 <primary>socket, use of in expansion</primary>
13334 </indexterm>
13335 <indexterm role="concept">
13336 <primary><option>readsocket</option> expansion item</primary>
13337 </indexterm>
13338 This item inserts data from a Unix domain or Internet socket into the expanded
13339 string. The minimal way of using it uses just two arguments, as in these
13340 examples:
13341 </para>
13342 <literallayout class="monospaced">
13343 ${readsocket{/socket/name}{request string}}
13344 ${readsocket{inet:some.host:1234}{request string}}
13345 </literallayout>
13346 <para>
13347 For a Unix domain socket, the first substring must be the path to the socket.
13348 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13349 a host name or IP address, followed by a colon and a port, which can be a
13350 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13351 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13352 example:
13353 </para>
13354 <literallayout class="monospaced">
13355 ${readsocket{inet:[::1]:1234}{request string}}
13356 </literallayout>
13357 <para>
13358 Only a single host name may be given, but if looking it up yields more than
13359 one IP address, they are each tried in turn until a connection is made. For
13360 both kinds of socket, Exim makes a connection, writes the request string
13361 (unless it is an empty string) and reads from the socket until an end-of-file
13362 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13363 extend what can be done. Firstly, you can vary the timeout. For example:
13364 </para>
13365 <literallayout class="monospaced">
13366 ${readsocket{/socket/name}{request string}{3s}}
13367 </literallayout>
13368 <para>
13369 A fourth argument allows you to change any newlines that are in the data
13370 that is read, in the same way as for <option>readfile</option> (see above). This example
13371 turns them into spaces:
13372 </para>
13373 <literallayout class="monospaced">
13374 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13375 </literallayout>
13376 <para>
13377 As with all expansions, the substrings are expanded before the processing
13378 happens. Errors in these sub-expansions cause the expansion to fail. In
13379 addition, the following errors can occur:
13380 </para>
13381 <itemizedlist>
13382 <listitem>
13383 <para>
13384 Failure to create a socket file descriptor;
13385 </para>
13386 </listitem>
13387 <listitem>
13388 <para>
13389 Failure to connect the socket;
13390 </para>
13391 </listitem>
13392 <listitem>
13393 <para>
13394 Failure to write the request string;
13395 </para>
13396 </listitem>
13397 <listitem>
13398 <para>
13399 Timeout on reading from the socket.
13400 </para>
13401 </listitem>
13402 </itemizedlist>
13403 <para>
13404 By default, any of these errors causes the expansion to fail. However, if
13405 you supply a fifth substring, it is expanded and used when any of the above
13406 errors occurs. For example:
13407 </para>
13408 <literallayout class="monospaced">
13409 ${readsocket{/socket/name}{request string}{3s}{\n}\
13410   {socket failure}}
13411 </literallayout>
13412 <para>
13413 You can test for the existence of a Unix domain socket by wrapping this
13414 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13415 and the actual opening of the socket, so it is safer to use the fifth argument
13416 if you want to be absolutely sure of avoiding an expansion error for a
13417 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13418 </para>
13419 <para>
13420 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13421 locks out the use of this expansion item in filter files.
13422 </para>
13423 </listitem></varlistentry>
13424 <varlistentry revisionflag="changed">
13425 <term><emphasis role="bold">${reduce{</emphasis>&lt;<emphasis>string1</emphasis>&gt;}{&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13426 <listitem>
13427 <para revisionflag="changed">
13428 <indexterm role="concept">
13429 <primary>expansion</primary>
13430 <secondary>reducing a list to a scalar</secondary>
13431 </indexterm>
13432 <indexterm role="concept">
13433 <primary>list</primary>
13434 <secondary>reducing to a scalar</secondary>
13435 </indexterm>
13436 <indexterm role="variable">
13437 <primary><varname>$value</varname></primary>
13438 </indexterm>
13439 <indexterm role="variable">
13440 <primary><varname>$item</varname></primary>
13441 </indexterm>
13442 This operation reduces a list to a single, scalar string. After expansion,
13443 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
13444 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
13445 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
13446 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
13447 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13448 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13449 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13450 number of ways. For example, to add up a list of numbers:
13451 </para>
13452 <literallayout class="monospaced" revisionflag="changed">
13453 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
13454 </literallayout>
13455 <para revisionflag="changed">
13456 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13457 can be found:
13458 </para>
13459 <literallayout class="monospaced" revisionflag="changed">
13460 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
13461 </literallayout>
13462 <para revisionflag="changed">
13463 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13464 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13465 expansion items.
13466 </para>
13467 </listitem></varlistentry>
13468 <varlistentry>
13469 <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>
13470 <listitem>
13471 <para>
13472 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13473 expansion item above.
13474 </para>
13475 </listitem></varlistentry>
13476 <varlistentry>
13477 <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>
13478 <listitem>
13479 <para>
13480 <indexterm role="concept">
13481 <primary>expansion</primary>
13482 <secondary>running a command</secondary>
13483 </indexterm>
13484 <indexterm role="concept">
13485 <primary><option>run</option> expansion item</primary>
13486 </indexterm>
13487 The command and its arguments are first expanded separately, and then the
13488 command is run in a separate process, but under the same uid and gid. As in
13489 other command executions from Exim, a shell is not used by default. If you want
13490 a shell, you must explicitly code it.
13491 </para>
13492 <para>
13493 The standard input for the command exists, but is empty. The standard output
13494 and standard error are set to the same file descriptor.
13495 <indexterm role="concept">
13496 <primary>return code</primary>
13497 <secondary>from <option>run</option> expansion</secondary>
13498 </indexterm>
13499 <indexterm role="variable">
13500 <primary><varname>$value</varname></primary>
13501 </indexterm>
13502 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
13503 and replaces the entire item; during this expansion, the standard output/error
13504 from the command is in the variable <varname>$value</varname>. If the command fails,
13505 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
13506 expansion, the standard output/error from the command is in the variable
13507 <varname>$value</varname>.
13508 </para>
13509 <para>
13510 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
13511 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13512 command does not succeed. If both strings are omitted, the result is contents
13513 of the standard output/error on success, and nothing on failure.
13514 </para>
13515 <para>
13516 <indexterm role="variable">
13517 <primary><varname>$runrc</varname></primary>
13518 </indexterm>
13519 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13520 remains set afterwards, so in a filter file you can do things like this:
13521 </para>
13522 <literallayout class="monospaced">
13523 if "${run{x y z}{}}$runrc" is 1 then ...
13524   elif $runrc is 2 then ...
13525   ...
13526 endif
13527 </literallayout>
13528 <para>
13529 If execution of the command fails (for example, the command does not exist),
13530 the return code is 127 &ndash; the same code that shells use for non-existent
13531 commands.
13532 </para>
13533 <para>
13534 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13535 option values are expanded, except for those preconditions whose order of
13536 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13537 by the expansion of one option, and use it in another.
13538 </para>
13539 <para>
13540 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13541 out the use of this expansion item in filter files.
13542 </para>
13543 </listitem></varlistentry>
13544 <varlistentry>
13545 <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>
13546 <listitem>
13547 <para>
13548 <indexterm role="concept">
13549 <primary>expansion</primary>
13550 <secondary>string substitution</secondary>
13551 </indexterm>
13552 <indexterm role="concept">
13553 <primary><option>sg</option> expansion item</primary>
13554 </indexterm>
13555 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
13556 option; hence its name. However, unlike the Perl equivalent, Exim does not
13557 modify the subject string; instead it returns the modified string for insertion
13558 into the overall expansion. The item takes three arguments: the subject string,
13559 a regular expression, and a substitution string. For example:
13560 </para>
13561 <literallayout class="monospaced">
13562 ${sg{abcdefabcdef}{abc}{xyz}}
13563 </literallayout>
13564 <para>
13565 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13566 if any $ or \ characters are required in the regular expression or in the
13567 substitution string, they have to be escaped. For example:
13568 </para>
13569 <literallayout class="monospaced">
13570 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13571 </literallayout>
13572 <para>
13573 yields <quote>defabc</quote>, and
13574 </para>
13575 <literallayout class="monospaced">
13576 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13577 </literallayout>
13578 <para>
13579 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13580 the regular expression from string expansion.
13581 </para>
13582 </listitem></varlistentry>
13583 <varlistentry>
13584 <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>
13585 <listitem>
13586 <para>
13587 <indexterm role="concept">
13588 <primary><option>substr</option> expansion item</primary>
13589 </indexterm>
13590 <indexterm role="concept">
13591 <primary>substring extraction</primary>
13592 </indexterm>
13593 <indexterm role="concept">
13594 <primary>expansion</primary>
13595 <secondary>substring extraction</secondary>
13596 </indexterm>
13597 The three strings are expanded; the first two must yield numbers. Call them
13598 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13599 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13600 can use the simpler operator notation that avoids some of the braces:
13601 </para>
13602 <literallayout class="monospaced">
13603 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13604 </literallayout>
13605 <para>
13606 The second number is optional (in both notations).
13607 If it is absent in the simpler format, the preceding underscore must also be
13608 omitted.
13609 </para>
13610 <para>
13611 The <option>substr</option> item can be used to extract more general substrings than
13612 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
13613 length required. For example
13614 </para>
13615 <literallayout class="monospaced">
13616 ${substr{3}{2}{$local_part}}
13617 </literallayout>
13618 <para>
13619 If the starting offset is greater than the string length the result is the
13620 null string; if the length plus starting offset is greater than the string
13621 length, the result is the right-hand part of the string, starting from the
13622 given offset. The first character in the string has offset zero.
13623 </para>
13624 <para>
13625 The <option>substr</option> expansion item can take negative offset values to count
13626 from the right-hand end of its operand. The last character is offset -1, the
13627 second-last is offset -2, and so on. Thus, for example,
13628 </para>
13629 <literallayout class="monospaced">
13630 ${substr{-5}{2}{1234567}}
13631 </literallayout>
13632 <para>
13633 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13634 length of the string, the substring starts at the beginning of the string, and
13635 the length is reduced by the amount of overshoot. Thus, for example,
13636 </para>
13637 <literallayout class="monospaced">
13638 ${substr{-5}{2}{12}}
13639 </literallayout>
13640 <para>
13641 yields an empty string, but
13642 </para>
13643 <literallayout class="monospaced">
13644 ${substr{-3}{2}{12}}
13645 </literallayout>
13646 <para>
13647 yields <quote>1</quote>.
13648 </para>
13649 <para>
13650 When the second number is omitted from <option>substr</option>, the remainder of the string
13651 is taken if the offset is positive. If it is negative, all characters in the
13652 string preceding the offset point are taken. For example, an offset of -1 and
13653 no length, as in these semantically identical examples:
13654 </para>
13655 <literallayout class="monospaced">
13656 ${substr_-1:abcde}
13657 ${substr{-1}{abcde}}
13658 </literallayout>
13659 <para>
13660 yields all but the last character of the string, that is, <quote>abcd</quote>.
13661 </para>
13662 </listitem></varlistentry>
13663 <varlistentry>
13664 <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>
13665 <listitem>
13666 <para>
13667 <indexterm role="concept">
13668 <primary>expansion</primary>
13669 <secondary>character translation</secondary>
13670 </indexterm>
13671 <indexterm role="concept">
13672 <primary><option>tr</option> expansion item</primary>
13673 </indexterm>
13674 This item does single-character translation on its subject string. The second
13675 argument is a list of characters to be translated in the subject string. Each
13676 matching character is replaced by the corresponding character from the
13677 replacement list. For example
13678 </para>
13679 <literallayout class="monospaced">
13680 ${tr{abcdea}{ac}{13}}
13681 </literallayout>
13682 <para>
13683 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13684 last occurrence is used. If the third string is shorter than the second, its
13685 last character is replicated. However, if it is empty, no translation takes
13686 place.
13687 </para>
13688 </listitem></varlistentry>
13689 </variablelist>
13690 </section>
13691 <section id="SECTexpop">
13692 <title>Expansion operators</title>
13693 <para>
13694 <indexterm role="concept">
13695 <primary>expansion</primary>
13696 <secondary>operators</secondary>
13697 </indexterm>
13698 For expansion items that perform transformations on a single argument string,
13699 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13700 The substring is first expanded before the operation is applied to it. The
13701 following operations can be performed:
13702 </para>
13703 <variablelist>
13704 <varlistentry>
13705 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13706 <listitem>
13707 <para>
13708 <indexterm role="concept">
13709 <primary>expansion</primary>
13710 <secondary>RFC 2822 address handling</secondary>
13711 </indexterm>
13712 <indexterm role="concept">
13713 <primary><option>address</option> expansion item</primary>
13714 </indexterm>
13715 The string is interpreted as an RFC 2822 address, as it might appear in a
13716 header line, and the effective address is extracted from it. If the string does
13717 not parse successfully, the result is empty.
13718 </para>
13719 </listitem></varlistentry>
13720 <varlistentry revisionflag="changed">
13721 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13722 <listitem>
13723 <para revisionflag="changed">
13724 <indexterm role="concept">
13725 <primary>expansion</primary>
13726 <secondary>RFC 2822 address handling</secondary>
13727 </indexterm>
13728 <indexterm role="concept">
13729 <primary><option>addresses</option> expansion item</primary>
13730 </indexterm>
13731 The string (after expansion) is interpreted as a list of addresses in RFC
13732 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
13733 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
13734 result of the expansion is a colon-separated list, with appropriate
13735 doubling of colons should any happen to be present in the email addresses.
13736 Syntactically invalid RFC2822 address items are omitted from the output.
13737 </para>
13738 <para revisionflag="changed">
13739 It is possible to specify a character other than colon for the output
13740 separator by starting the string with &gt; followed by the new separator
13741 character. For example:
13742 </para>
13743 <literallayout class="monospaced" revisionflag="changed">
13744 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
13745 </literallayout>
13746 <para revisionflag="changed">
13747 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
13748 expansion item, which extracts the working address from a single RFC2822
13749 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
13750 processing lists.
13751 </para>
13752 </listitem></varlistentry>
13753 <varlistentry>
13754 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13755 <listitem>
13756 <para>
13757 <indexterm role="concept">
13758 <primary><option>base62</option> expansion item</primary>
13759 </indexterm>
13760 <indexterm role="concept">
13761 <primary>expansion</primary>
13762 <secondary>conversion to base 62</secondary>
13763 </indexterm>
13764 The string must consist entirely of decimal digits. The number is converted to
13765 base 62 and output as a string of six characters, including leading zeros. In
13766 the few operating environments where Exim uses base 36 instead of base 62 for
13767 its message identifiers (because those systems do not have case-sensitive file
13768 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13769 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13770 </para>
13771 </listitem></varlistentry>
13772 <varlistentry>
13773 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13774 <listitem>
13775 <para>
13776 <indexterm role="concept">
13777 <primary><option>base62d</option> expansion item</primary>
13778 </indexterm>
13779 <indexterm role="concept">
13780 <primary>expansion</primary>
13781 <secondary>conversion to base 62</secondary>
13782 </indexterm>
13783 The string must consist entirely of base-62 digits, or, in operating
13784 environments where Exim uses base 36 instead of base 62 for its message
13785 identifiers, base-36 digits. The number is converted to decimal and output as a
13786 string.
13787 </para>
13788 </listitem></varlistentry>
13789 <varlistentry>
13790 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13791 <listitem>
13792 <para>
13793 <indexterm role="concept">
13794 <primary>domain</primary>
13795 <secondary>extraction</secondary>
13796 </indexterm>
13797 <indexterm role="concept">
13798 <primary>expansion</primary>
13799 <secondary>domain extraction</secondary>
13800 </indexterm>
13801 The string is interpreted as an RFC 2822 address and the domain is extracted
13802 from it. If the string does not parse successfully, the result is empty.
13803 </para>
13804 </listitem></varlistentry>
13805 <varlistentry>
13806 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13807 <listitem>
13808 <para>
13809 <indexterm role="concept">
13810 <primary>expansion</primary>
13811 <secondary>escaping non-printing characters</secondary>
13812 </indexterm>
13813 <indexterm role="concept">
13814 <primary><option>escape</option> expansion item</primary>
13815 </indexterm>
13816 If the string contains any non-printing characters, they are converted to
13817 escape sequences starting with a backslash. Whether characters with the most
13818 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13819 is controlled by the <option>print_topbitchars</option> option.
13820 </para>
13821 </listitem></varlistentry>
13822 <varlistentry>
13823 <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>
13824 <listitem>
13825 <para>
13826 <indexterm role="concept">
13827 <primary>expansion</primary>
13828 <secondary>expression evaluation</secondary>
13829 </indexterm>
13830 <indexterm role="concept">
13831 <primary>expansion</primary>
13832 <secondary>arithmetic expression</secondary>
13833 </indexterm>
13834 <indexterm role="concept">
13835 <primary><option>eval</option> expansion item</primary>
13836 </indexterm>
13837 These items supports simple arithmetic and bitwise logical operations in
13838 expansion strings. The string (after expansion) must be a conventional
13839 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
13840 logical operators, and parentheses. All operations are carried out using
13841 integer arithmetic. The operator priorities are as follows (the same as in the
13842 C programming language):
13843 </para>
13844 <informaltable frame="none">
13845 <tgroup cols="2" colsep="0" rowsep="0">
13846 <colspec colwidth="70pt" align="left"/>
13847 <colspec colwidth="300pt" align="left"/>
13848 <tbody>
13849 <row>
13850 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
13851 <entry>not (~), negate (-)</entry>
13852 </row>
13853 <row>
13854 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
13855 <entry>multiply (*), divide (/), remainder (%)</entry>
13856 </row>
13857 <row>
13858 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
13859 <entry>plus (+), minus (-)</entry>
13860 </row>
13861 <row>
13862 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
13863 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
13864 </row>
13865 <row>
13866 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
13867 <entry>and (&amp;)</entry>
13868 </row>
13869 <row>
13870 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
13871 <entry>xor (^)</entry>
13872 </row>
13873 <row>
13874 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
13875 <entry>or (|)</entry>
13876 </row>
13877 </tbody>
13878 </tgroup>
13879 </informaltable>
13880 <para>
13881 Binary operators with the same priority are evaluated from left to right. White
13882 space is permitted before or after operators.
13883 </para>
13884 <para>
13885 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
13886 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
13887 decimal, even if they start with a leading zero; hexadecimal numbers are not
13888 permitted. This can be useful when processing numbers extracted from dates or
13889 times, which often do have leading zeros.
13890 </para>
13891 <para>
13892 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
13893 respectively. Negative numbers are supported. The result of the computation is
13894 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
13895 </para>
13896 <literallayout>
13897 <literal>${eval:1+1}            </literal>  yields 2
13898 <literal>${eval:1+2*3}          </literal>  yields 7
13899 <literal>${eval:(1+2)*3}        </literal>  yields 9
13900 <literal>${eval:2+42%5}         </literal>  yields 4
13901 <literal>${eval:0xc&amp;5}          </literal>  yields 4
13902 <literal>${eval:0xc|5}          </literal>  yields 13
13903 <literal>${eval:0xc^5}          </literal>  yields 9
13904 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
13905 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
13906 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
13907 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
13908 </literallayout>
13909 <para>
13910 As a more realistic example, in an ACL you might have
13911 </para>
13912 <literallayout class="monospaced">
13913 deny   message = Too many bad recipients
13914        condition =                    \
13915          ${if and {                   \
13916            {&gt;{$rcpt_count}{10}}       \
13917            {                          \
13918            &lt;                          \
13919              {$recipients_count}      \
13920              {${eval:$rcpt_count/2}}  \
13921            }                          \
13922          }{yes}{no}}
13923 </literallayout>
13924 <para>
13925 The condition is true if there have been more than 10 RCPT commands and
13926 fewer than half of them have resulted in a valid recipient.
13927 </para>
13928 </listitem></varlistentry>
13929 <varlistentry>
13930 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13931 <listitem>
13932 <para>
13933 <indexterm role="concept">
13934 <primary>expansion</primary>
13935 <secondary>re-expansion of substring</secondary>
13936 </indexterm>
13937 The <option>expand</option> operator causes a string to be expanded for a second time. For
13938 example,
13939 </para>
13940 <literallayout class="monospaced">
13941 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
13942 </literallayout>
13943 <para>
13944 first looks up a string in a file while expanding the operand for <option>expand</option>,
13945 and then re-expands what it has found.
13946 </para>
13947 </listitem></varlistentry>
13948 <varlistentry>
13949 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13950 <listitem>
13951 <para>
13952 <indexterm role="concept">
13953 <primary>Unicode</primary>
13954 </indexterm>
13955 <indexterm role="concept">
13956 <primary>UTF-8</primary>
13957 <secondary>conversion from</secondary>
13958 </indexterm>
13959 <indexterm role="concept">
13960 <primary>expansion</primary>
13961 <secondary>UTF-8 conversion</secondary>
13962 </indexterm>
13963 <indexterm role="concept">
13964 <primary><option>from_utf8</option> expansion item</primary>
13965 </indexterm>
13966 The world is slowly moving towards Unicode, although there are no standards for
13967 email yet. However, other applications (including some databases) are starting
13968 to store data in Unicode, using UTF-8 encoding. This operator converts from a
13969 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
13970 converted to underscores. The input must be a valid UTF-8 string. If it is not,
13971 the result is an undefined sequence of bytes.
13972 </para>
13973 <para>
13974 Unicode code points with values less than 256 are compatible with ASCII and
13975 ISO-8859-1 (also known as Latin-1).
13976 For example, character 169 is the copyright symbol in both cases, though the
13977 way it is encoded is different. In UTF-8, more than one byte is needed for
13978 characters with code values greater than 127, whereas ISO-8859-1 is a
13979 single-byte encoding (but thereby limited to 256 characters). This makes
13980 translation from UTF-8 to ISO-8859-1 straightforward.
13981 </para>
13982 </listitem></varlistentry>
13983 <varlistentry>
13984 <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>
13985 <listitem>
13986 <para>
13987 <indexterm role="concept">
13988 <primary>hash function</primary>
13989 <secondary>textual</secondary>
13990 </indexterm>
13991 <indexterm role="concept">
13992 <primary>expansion</primary>
13993 <secondary>textual hash</secondary>
13994 </indexterm>
13995 The <option>hash</option> operator is a simpler interface to the hashing function that can
13996 be used when the two parameters are fixed numbers (as opposed to strings that
13997 change when expanded). The effect is the same as
13998 </para>
13999 <literallayout class="monospaced">
14000 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14001 </literallayout>
14002 <para>
14003 See the description of the general <option>hash</option> item above for details. The
14004 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14005 </para>
14006 </listitem></varlistentry>
14007 <varlistentry>
14008 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14009 <listitem>
14010 <para>
14011 <indexterm role="concept">
14012 <primary>base64 encoding</primary>
14013 <secondary>conversion from hex</secondary>
14014 </indexterm>
14015 <indexterm role="concept">
14016 <primary>expansion</primary>
14017 <secondary>hex to base64</secondary>
14018 </indexterm>
14019 <indexterm role="concept">
14020 <primary><option>hex2b64</option> expansion item</primary>
14021 </indexterm>
14022 This operator converts a hex string into one that is base64 encoded. This can
14023 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14024 </para>
14025 </listitem></varlistentry>
14026 <varlistentry>
14027 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14028 <listitem>
14029 <para>
14030 <indexterm role="concept">
14031 <primary>case forcing in strings</primary>
14032 </indexterm>
14033 <indexterm role="concept">
14034 <primary>string</primary>
14035 <secondary>case forcing</secondary>
14036 </indexterm>
14037 <indexterm role="concept">
14038 <primary>lower casing</primary>
14039 </indexterm>
14040 <indexterm role="concept">
14041 <primary>expansion</primary>
14042 <secondary>case forcing</secondary>
14043 </indexterm>
14044 <indexterm role="concept">
14045 <primary><option>lc</option> expansion item</primary>
14046 </indexterm>
14047 This forces the letters in the string into lower-case, for example:
14048 </para>
14049 <literallayout class="monospaced">
14050 ${lc:$local_part}
14051 </literallayout>
14052 </listitem></varlistentry>
14053 <varlistentry>
14054 <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>
14055 <listitem>
14056 <para>
14057 <indexterm role="concept">
14058 <primary>expansion</primary>
14059 <secondary>string truncation</secondary>
14060 </indexterm>
14061 <indexterm role="concept">
14062 <primary><option>length</option> expansion item</primary>
14063 </indexterm>
14064 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14065 can be used when the parameter is a fixed number (as opposed to a string that
14066 changes when expanded). The effect is the same as
14067 </para>
14068 <literallayout class="monospaced">
14069 ${length{&lt;number&gt;}{&lt;string&gt;}}
14070 </literallayout>
14071 <para>
14072 See the description of the general <option>length</option> item above for details. Note that
14073 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14074 when <option>length</option> is used as an operator.
14075 </para>
14076 </listitem></varlistentry>
14077 <varlistentry>
14078 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14079 <listitem>
14080 <para>
14081 <indexterm role="concept">
14082 <primary>expansion</primary>
14083 <secondary>local part extraction</secondary>
14084 </indexterm>
14085 <indexterm role="concept">
14086 <primary><option>local_part</option> expansion item</primary>
14087 </indexterm>
14088 The string is interpreted as an RFC 2822 address and the local part is
14089 extracted from it. If the string does not parse successfully, the result is
14090 empty.
14091 </para>
14092 </listitem></varlistentry>
14093 <varlistentry>
14094 <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>
14095 <listitem>
14096 <para>
14097 <indexterm role="concept">
14098 <primary>masked IP address</primary>
14099 </indexterm>
14100 <indexterm role="concept">
14101 <primary>IP address</primary>
14102 <secondary>masking</secondary>
14103 </indexterm>
14104 <indexterm role="concept">
14105 <primary>CIDR notation</primary>
14106 </indexterm>
14107 <indexterm role="concept">
14108 <primary>expansion</primary>
14109 <secondary>IP address masking</secondary>
14110 </indexterm>
14111 <indexterm role="concept">
14112 <primary><option>mask</option> expansion item</primary>
14113 </indexterm>
14114 If the form of the string to be operated on is not an IP address followed by a
14115 slash and an integer (that is, a network address in CIDR notation), the
14116 expansion fails. Otherwise, this operator converts the IP address to binary,
14117 masks off the least significant bits according to the bit count, and converts
14118 the result back to text, with mask appended. For example,
14119 </para>
14120 <literallayout class="monospaced">
14121 ${mask:10.111.131.206/28}
14122 </literallayout>
14123 <para>
14124 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14125 be mostly used for looking up masked addresses in files, the result for an IPv6
14126 address uses dots to separate components instead of colons, because colon
14127 terminates a key string in lsearch files. So, for example,
14128 </para>
14129 <literallayout class="monospaced">
14130 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14131 </literallayout>
14132 <para>
14133 returns the string
14134 </para>
14135 <literallayout class="monospaced">
14136 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14137 </literallayout>
14138 <para>
14139 Letters in IPv6 addresses are always output in lower case.
14140 </para>
14141 </listitem></varlistentry>
14142 <varlistentry>
14143 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14144 <listitem>
14145 <para>
14146 <indexterm role="concept">
14147 <primary>MD5 hash</primary>
14148 </indexterm>
14149 <indexterm role="concept">
14150 <primary>expansion</primary>
14151 <secondary>MD5 hash</secondary>
14152 </indexterm>
14153 <indexterm role="concept">
14154 <primary><option>md5</option> expansion item</primary>
14155 </indexterm>
14156 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14157 as a 32-digit hexadecimal number, in which any letters are in lower case.
14158 </para>
14159 </listitem></varlistentry>
14160 <varlistentry>
14161 <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>
14162 <listitem>
14163 <para>
14164 <indexterm role="concept">
14165 <primary>expansion</primary>
14166 <secondary>numeric hash</secondary>
14167 </indexterm>
14168 <indexterm role="concept">
14169 <primary>hash function</primary>
14170 <secondary>numeric</secondary>
14171 </indexterm>
14172 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14173 that can be used when the two parameters are fixed numbers (as opposed to
14174 strings that change when expanded). The effect is the same as
14175 </para>
14176 <literallayout class="monospaced">
14177 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14178 </literallayout>
14179 <para>
14180 See the description of the general <option>nhash</option> item above for details.
14181 </para>
14182 </listitem></varlistentry>
14183 <varlistentry>
14184 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14185 <listitem>
14186 <para>
14187 <indexterm role="concept">
14188 <primary>quoting</primary>
14189 <secondary>in string expansions</secondary>
14190 </indexterm>
14191 <indexterm role="concept">
14192 <primary>expansion</primary>
14193 <secondary>quoting</secondary>
14194 </indexterm>
14195 <indexterm role="concept">
14196 <primary><option>quote</option> expansion item</primary>
14197 </indexterm>
14198 The <option>quote</option> operator puts its argument into double quotes if it
14199 is an empty string or
14200 contains anything other than letters, digits, underscores, dots, and hyphens.
14201 Any occurrences of double quotes and backslashes are escaped with a backslash.
14202 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14203 respectively For example,
14204 </para>
14205 <literallayout class="monospaced">
14206 ${quote:ab"*"cd}
14207 </literallayout>
14208 <para>
14209 becomes
14210 </para>
14211 <literallayout class="monospaced">
14212 "ab\"*\"cd"
14213 </literallayout>
14214 <para>
14215 The place where this is useful is when the argument is a substitution from a
14216 variable or a message header.
14217 </para>
14218 </listitem></varlistentry>
14219 <varlistentry>
14220 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14221 <listitem>
14222 <para>
14223 <indexterm role="concept">
14224 <primary><option>quote_local_part</option> expansion item</primary>
14225 </indexterm>
14226 This operator is like <option>quote</option>, except that it quotes the string only if
14227 required to do so by the rules of RFC 2822 for quoting local parts. For
14228 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14229 If you are creating a new email address from the contents of <varname>$local_part</varname>
14230 (or any other unknown data), you should always use this operator.
14231 </para>
14232 </listitem></varlistentry>
14233 <varlistentry>
14234 <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>
14235 <listitem>
14236 <para>
14237 <indexterm role="concept">
14238 <primary>quoting</primary>
14239 <secondary>lookup-specific</secondary>
14240 </indexterm>
14241 This operator applies lookup-specific quoting rules to the string. Each
14242 query-style lookup type has its own quoting rules which are described with
14243 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14244 </para>
14245 <literallayout class="monospaced">
14246 ${quote_ldap:two * two}
14247 </literallayout>
14248 <para>
14249 returns
14250 </para>
14251 <literallayout class="monospaced">
14252 two%20%5C2A%20two
14253 </literallayout>
14254 <para>
14255 For single-key lookup types, no quoting is ever necessary and this operator
14256 yields an unchanged string.
14257 </para>
14258 </listitem></varlistentry>
14259 <varlistentry>
14260 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14261 <listitem>
14262 <para>
14263 <indexterm role="concept">
14264 <primary>expansion</primary>
14265 <secondary>RFC 2047</secondary>
14266 </indexterm>
14267 <indexterm role="concept">
14268 <primary>RFC 2047</primary>
14269 <secondary>expansion operator</secondary>
14270 </indexterm>
14271 <indexterm role="concept">
14272 <primary><option>rfc2047</option> expansion item</primary>
14273 </indexterm>
14274 This operator encodes text according to the rules of RFC 2047. This is an
14275 encoding that is used in header lines to encode non-ASCII characters. It is
14276 assumed that the input string is in the encoding specified by the
14277 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14278 contains only characters in the range 33&ndash;126, and no instances of the
14279 characters
14280 </para>
14281 <literallayout class="monospaced">
14282 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
14283 </literallayout>
14284 <para>
14285 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14286 string, using as many <quote>encoded words</quote> as necessary to encode all the
14287 characters.
14288 </para>
14289 </listitem></varlistentry>
14290 <varlistentry revisionflag="changed">
14291 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14292 <listitem>
14293 <para revisionflag="changed">
14294 <indexterm role="concept">
14295 <primary>expansion</primary>
14296 <secondary>RFC 2047</secondary>
14297 </indexterm>
14298 <indexterm role="concept">
14299 <primary>RFC 2047</primary>
14300 <secondary>decoding</secondary>
14301 </indexterm>
14302 <indexterm role="concept">
14303 <primary><option>rfc2047d</option> expansion item</primary>
14304 </indexterm>
14305 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14306 bytes are replaced by question marks. Characters are converted into the
14307 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14308 not recognized unless <option>check_rfc2047_length</option> is set false.
14309 </para>
14310 </listitem></varlistentry>
14311 <varlistentry>
14312 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14313 <listitem>
14314 <para>
14315 <indexterm role="concept">
14316 <primary>quoting</primary>
14317 <secondary>in regular expressions</secondary>
14318 </indexterm>
14319 <indexterm role="concept">
14320 <primary>regular expressions</primary>
14321 <secondary>quoting</secondary>
14322 </indexterm>
14323 <indexterm role="concept">
14324 <primary><option>rxquote</option> expansion item</primary>
14325 </indexterm>
14326 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14327 characters in its argument. This is useful when substituting the values of
14328 variables or headers inside regular expressions.
14329 </para>
14330 </listitem></varlistentry>
14331 <varlistentry>
14332 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14333 <listitem>
14334 <para>
14335 <indexterm role="concept">
14336 <primary>SHA-1 hash</primary>
14337 </indexterm>
14338 <indexterm role="concept">
14339 <primary>expansion</primary>
14340 <secondary>SHA-1 hashing</secondary>
14341 </indexterm>
14342 <indexterm role="concept">
14343 <primary><option>sha2</option> expansion item</primary>
14344 </indexterm>
14345 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14346 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14347 </para>
14348 </listitem></varlistentry>
14349 <varlistentry>
14350 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14351 <listitem>
14352 <para>
14353 <indexterm role="concept">
14354 <primary>expansion</primary>
14355 <secondary>statting a file</secondary>
14356 </indexterm>
14357 <indexterm role="concept">
14358 <primary>file</primary>
14359 <secondary>extracting characteristics</secondary>
14360 </indexterm>
14361 <indexterm role="concept">
14362 <primary><option>stat</option> expansion item</primary>
14363 </indexterm>
14364 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14365 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14366 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14367 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
14368 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14369 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14370 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14371 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14372 can extract individual fields using the <option>extract</option> expansion item.
14373 </para>
14374 <para>
14375 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
14376 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14377 systems for files larger than 2GB.
14378 </para>
14379 </listitem></varlistentry>
14380 <varlistentry>
14381 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14382 <listitem>
14383 <para>
14384 <indexterm role="concept">
14385 <primary>expansion</primary>
14386 <secondary>base64 encoding</secondary>
14387 </indexterm>
14388 <indexterm role="concept">
14389 <primary>base64 encoding</primary>
14390 <secondary>in string expansion</secondary>
14391 </indexterm>
14392 <indexterm role="concept">
14393 <primary><option>str2b64</option> expansion item</primary>
14394 </indexterm>
14395 This operator converts a string into one that is base64 encoded.
14396 </para>
14397 </listitem></varlistentry>
14398 <varlistentry>
14399 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14400 <listitem>
14401 <para>
14402 <indexterm role="concept">
14403 <primary>expansion</primary>
14404 <secondary>string length</secondary>
14405 </indexterm>
14406 <indexterm role="concept">
14407 <primary>string</primary>
14408 <secondary>length in expansion</secondary>
14409 </indexterm>
14410 <indexterm role="concept">
14411 <primary><option>strlen</option> expansion item</primary>
14412 </indexterm>
14413 The item is replace by the length of the expanded string, expressed as a
14414 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14415 </para>
14416 </listitem></varlistentry>
14417 <varlistentry>
14418 <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>
14419 <listitem>
14420 <para>
14421 <indexterm role="concept">
14422 <primary><option>substr</option> expansion item</primary>
14423 </indexterm>
14424 <indexterm role="concept">
14425 <primary>substring extraction</primary>
14426 </indexterm>
14427 <indexterm role="concept">
14428 <primary>expansion</primary>
14429 <secondary>substring expansion</secondary>
14430 </indexterm>
14431 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14432 can be used when the two parameters are fixed numbers (as opposed to strings
14433 that change when expanded). The effect is the same as
14434 </para>
14435 <literallayout class="monospaced">
14436 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
14437 </literallayout>
14438 <para>
14439 See the description of the general <option>substr</option> item above for details. The
14440 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14441 </para>
14442 </listitem></varlistentry>
14443 <varlistentry>
14444 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14445 <listitem>
14446 <para>
14447 <indexterm role="concept">
14448 <primary><option>time_eval</option> expansion item</primary>
14449 </indexterm>
14450 <indexterm role="concept">
14451 <primary>time interval</primary>
14452 <secondary>decoding</secondary>
14453 </indexterm>
14454 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14455 seconds.
14456 </para>
14457 </listitem></varlistentry>
14458 <varlistentry>
14459 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14460 <listitem>
14461 <para>
14462 <indexterm role="concept">
14463 <primary><option>time_interval</option> expansion item</primary>
14464 </indexterm>
14465 <indexterm role="concept">
14466 <primary>time interval</primary>
14467 <secondary>formatting</secondary>
14468 </indexterm>
14469 The argument (after sub-expansion) must be a sequence of decimal digits that
14470 represents an interval of time as a number of seconds. It is converted into a
14471 number of larger units and output in Exim&#x2019;s normal time format, for example,
14472 <literal>1w3d4h2m6s</literal>.
14473 </para>
14474 </listitem></varlistentry>
14475 <varlistentry>
14476 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14477 <listitem>
14478 <para>
14479 <indexterm role="concept">
14480 <primary>case forcing in strings</primary>
14481 </indexterm>
14482 <indexterm role="concept">
14483 <primary>string</primary>
14484 <secondary>case forcing</secondary>
14485 </indexterm>
14486 <indexterm role="concept">
14487 <primary>upper casing</primary>
14488 </indexterm>
14489 <indexterm role="concept">
14490 <primary>expansion</primary>
14491 <secondary>case forcing</secondary>
14492 </indexterm>
14493 <indexterm role="concept">
14494 <primary><option>uc</option> expansion item</primary>
14495 </indexterm>
14496 This forces the letters in the string into upper-case.
14497 </para>
14498 </listitem></varlistentry>
14499 </variablelist>
14500 </section>
14501 <section id="SECTexpcond">
14502 <title>Expansion conditions</title>
14503 <para>
14504 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14505 <primary>expansion</primary>
14506 <secondary>conditions</secondary>
14507 </indexterm>
14508 The following conditions are available for testing by the <option>${if</option> construct
14509 while expanding strings:
14510 </para>
14511 <variablelist>
14512 <varlistentry>
14513 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
14514 <listitem>
14515 <para>
14516 <indexterm role="concept">
14517 <primary>expansion</primary>
14518 <secondary>negating a condition</secondary>
14519 </indexterm>
14520 <indexterm role="concept">
14521 <primary>negation</primary>
14522 <secondary>in expansion condition</secondary>
14523 </indexterm>
14524 Preceding any condition with an exclamation mark negates the result of the
14525 condition.
14526 </para>
14527 </listitem></varlistentry>
14528 <varlistentry>
14529 <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>
14530 <listitem>
14531 <para>
14532 <indexterm role="concept">
14533 <primary>numeric comparison</primary>
14534 </indexterm>
14535 <indexterm role="concept">
14536 <primary>expansion</primary>
14537 <secondary>numeric comparison</secondary>
14538 </indexterm>
14539 There are a number of symbolic operators for doing numeric comparisons. They
14540 are:
14541 </para>
14542 <literallayout>
14543 <literal>=   </literal>   equal
14544 <literal>==  </literal>   equal
14545 <literal>&gt;   </literal>   greater
14546 <literal>&gt;=  </literal>   greater or equal
14547 <literal>&lt;   </literal>   less
14548 <literal>&lt;=  </literal>   less or equal
14549 </literallayout>
14550 <para>
14551 For example:
14552 </para>
14553 <literallayout class="monospaced">
14554 ${if &gt;{$message_size}{10M} ...
14555 </literallayout>
14556 <para>
14557 Note that the general negation operator provides for inequality testing. The
14558 two strings must take the form of optionally signed decimal integers,
14559 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14560 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14561 As a special case, the numerical value of an empty string is taken as
14562 zero.
14563 </para>
14564 </listitem></varlistentry>
14565 <varlistentry>
14566 <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>
14567 <listitem>
14568 <para>
14569 <indexterm role="concept">
14570 <primary>expansion</primary>
14571 <secondary>encrypted comparison</secondary>
14572 </indexterm>
14573 <indexterm role="concept">
14574 <primary>encrypted strings, comparing</primary>
14575 </indexterm>
14576 <indexterm role="concept">
14577 <primary><option>crypteq</option> expansion condition</primary>
14578 </indexterm>
14579 This condition is included in the Exim binary if it is built to support any
14580 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14581 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14582 included in the binary.
14583 </para>
14584 <para>
14585 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14586 compared against the second, which is already encrypted. The second string may
14587 be in the LDAP form for storing encrypted strings, which starts with the
14588 encryption type in curly brackets, followed by the data. If the second string
14589 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14590 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14591 Typically this will be a field from a password file. An example of an encrypted
14592 string in LDAP form is:
14593 </para>
14594 <literallayout class="monospaced">
14595 {md5}CY9rzUYh03PK3k6DJie09g==
14596 </literallayout>
14597 <para>
14598 If such a string appears directly in an expansion, the curly brackets have to
14599 be quoted, because they are part of the expansion syntax. For example:
14600 </para>
14601 <literallayout class="monospaced">
14602 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14603 </literallayout>
14604 <para>
14605 The following encryption types (whose names are matched case-independently) are
14606 supported:
14607 </para>
14608 <itemizedlist>
14609 <listitem>
14610 <para>
14611 <indexterm role="concept">
14612 <primary>MD5 hash</primary>
14613 </indexterm>
14614 <indexterm role="concept">
14615 <primary>base64 encoding</primary>
14616 <secondary>in encrypted password</secondary>
14617 </indexterm>
14618 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14619 printable characters to compare with the remainder of the second string. If the
14620 length of the comparison string is 24, Exim assumes that it is base64 encoded
14621 (as in the above example). If the length is 32, Exim assumes that it is a
14622 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14623 comparison fails.
14624 </para>
14625 </listitem>
14626 <listitem>
14627 <para>
14628 <indexterm role="concept">
14629 <primary>SHA-1 hash</primary>
14630 </indexterm>
14631 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14632 printable characters to compare with the remainder of the second string. If the
14633 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14634 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14635 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14636 </para>
14637 </listitem>
14638 <listitem>
14639 <para>
14640 <indexterm role="concept">
14641 <primary><function>crypt()</function></primary>
14642 </indexterm>
14643 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14644 only the first eight characters of the password. However, in modern operating
14645 systems this is no longer true, and in many cases the entire password is used,
14646 whatever its length.
14647 </para>
14648 </listitem>
14649 <listitem>
14650 <para>
14651 <indexterm role="concept">
14652 <primary><function>crypt16()</function></primary>
14653 </indexterm>
14654 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
14655 use up to 16 characters of the password in some operating systems. Again, in
14656 modern operating systems, more characters may be used.
14657 </para>
14658 </listitem>
14659 </itemizedlist>
14660 <para>
14661 Exim has its own version of <function>crypt16()</function>, which is just a double call to
14662 <function>crypt()</function>. For operating systems that have their own version, setting
14663 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14664 operating system version instead of its own. This option is set by default in
14665 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14666 support <function>crypt16()</function>.
14667 </para>
14668 <para>
14669 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
14670 it was not using the same algorithm as some operating systems&#x2019; versions. It
14671 turns out that as well as <function>crypt16()</function> there is a function called
14672 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
14673 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
14674 </para>
14675 <para>
14676 However, since there is now a move away from the traditional <function>crypt()</function>
14677 functions towards using SHA1 and other algorithms, tidying up this area of
14678 Exim is seen as very low priority.
14679 </para>
14680 <para>
14681 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
14682 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
14683 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
14684 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
14685 function by specifying it explicitly in curly brackets.
14686 </para>
14687 </listitem></varlistentry>
14688 <varlistentry>
14689 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
14690 <listitem>
14691 <para>
14692 <indexterm role="concept">
14693 <primary>expansion</primary>
14694 <secondary>checking for empty variable</secondary>
14695 </indexterm>
14696 <indexterm role="concept">
14697 <primary><option>def</option> expansion condition</primary>
14698 </indexterm>
14699 The <option>def</option> condition must be followed by the name of one of the expansion
14700 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14701 variable does not contain the empty string. For example:
14702 </para>
14703 <literallayout class="monospaced">
14704 ${if def:sender_ident {from $sender_ident}}
14705 </literallayout>
14706 <para>
14707 Note that the variable name is given without a leading <option>$</option> character. If the
14708 variable does not exist, the expansion fails.
14709 </para>
14710 </listitem></varlistentry>
14711 <varlistentry>
14712 <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>
14713 <listitem>
14714 <para>
14715 <indexterm role="concept">
14716 <primary>expansion</primary>
14717 <secondary>checking header line existence</secondary>
14718 </indexterm>
14719 This condition is true if a message is being processed and the named header
14720 exists in the message. For example,
14721 </para>
14722 <literallayout class="monospaced">
14723 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14724 </literallayout>
14725 <para>
14726 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14727 the header name must be terminated by a colon if white space does not follow.
14728 </para>
14729 </listitem></varlistentry>
14730 <varlistentry>
14731 <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>
14732 <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>
14733 <listitem>
14734 <para>
14735 <indexterm role="concept">
14736 <primary>string</primary>
14737 <secondary>comparison</secondary>
14738 </indexterm>
14739 <indexterm role="concept">
14740 <primary>expansion</primary>
14741 <secondary>string comparison</secondary>
14742 </indexterm>
14743 <indexterm role="concept">
14744 <primary><option>eq</option> expansion condition</primary>
14745 </indexterm>
14746 <indexterm role="concept">
14747 <primary><option>eqi</option> expansion condition</primary>
14748 </indexterm>
14749 The two substrings are first expanded. The condition is true if the two
14750 resulting strings are identical. For <option>eq</option> the comparison includes the case of
14751 letters, whereas for <option>eqi</option> the comparison is case-independent.
14752 </para>
14753 </listitem></varlistentry>
14754 <varlistentry>
14755 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14756 <listitem>
14757 <para>
14758 <indexterm role="concept">
14759 <primary>expansion</primary>
14760 <secondary>file existence test</secondary>
14761 </indexterm>
14762 <indexterm role="concept">
14763 <primary>file</primary>
14764 <secondary>existence test</secondary>
14765 </indexterm>
14766 <indexterm role="concept">
14767 <primary><option>exists</option>, expansion condition</primary>
14768 </indexterm>
14769 The substring is first expanded and then interpreted as an absolute path. The
14770 condition is true if the named file (or directory) exists. The existence test
14771 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14772 users&#x2019; filter files may be locked out by the system administrator.
14773 </para>
14774 </listitem></varlistentry>
14775 <varlistentry>
14776 <term><emphasis role="bold">first_delivery</emphasis></term>
14777 <listitem>
14778 <para>
14779 <indexterm role="concept">
14780 <primary>delivery</primary>
14781 <secondary>first</secondary>
14782 </indexterm>
14783 <indexterm role="concept">
14784 <primary>first delivery</primary>
14785 </indexterm>
14786 <indexterm role="concept">
14787 <primary>expansion</primary>
14788 <secondary>first delivery test</secondary>
14789 </indexterm>
14790 <indexterm role="concept">
14791 <primary><option>first_delivery</option> expansion condition</primary>
14792 </indexterm>
14793 This condition, which has no data, is true during a message&#x2019;s first delivery
14794 attempt. It is false during any subsequent delivery attempts.
14795 </para>
14796 </listitem></varlistentry>
14797 <varlistentry revisionflag="changed">
14798 <term><emphasis role="bold">forall{</emphasis>&lt;<emphasis>a list</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>a condition</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14799 <term><emphasis role="bold">forany{</emphasis>&lt;<emphasis>a list</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>a condition</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14800 <listitem>
14801 <para revisionflag="changed">
14802 <indexterm role="concept">
14803 <primary>list</primary>
14804 <secondary>iterative conditions</secondary>
14805 </indexterm>
14806 <indexterm role="concept">
14807 <primary>expansion</primary>
14808 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
14809 </indexterm>
14810 <indexterm role="concept">
14811 <primary>expansion</primary>
14812 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
14813 </indexterm>
14814 <indexterm role="variable">
14815 <primary><varname>$item</varname></primary>
14816 </indexterm>
14817 These conditions iterate over a list. The first argument is expanded to form
14818 the list. By default, the list separator is a colon, but it can be changed by
14819 the normal method. The second argument is interpreted as a condition that is to
14820 be applied to each item in the list in turn. During the interpretation of the
14821 condition, the current list item is placed in a variable called <varname>$item</varname>.
14822 </para>
14823 <itemizedlist revisionflag="changed">
14824 <listitem>
14825 <para revisionflag="changed">
14826 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
14827 the result of the whole condition is true. If the condition is false for all
14828 items in the list, the overall condition is false.
14829 </para>
14830 </listitem>
14831 <listitem>
14832 <para revisionflag="changed">
14833 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
14834 and the result of the whole condition is false. If the condition is true for
14835 all items in the list, the overall condition is true.
14836 </para>
14837 </listitem>
14838 </itemizedlist>
14839 <para revisionflag="changed">
14840 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
14841 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
14842 that the condition must be false for at least one item. In this example, the
14843 list separator is changed to a comma:
14844 </para>
14845 <literallayout class="monospaced" revisionflag="changed">
14846 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
14847 </literallayout>
14848 <para revisionflag="changed">
14849 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
14850 being processed, to enable these expansion items to be nested.
14851 </para>
14852 </listitem></varlistentry>
14853 <varlistentry>
14854 <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>
14855 <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>
14856 <listitem>
14857 <para>
14858 <indexterm role="concept">
14859 <primary>string</primary>
14860 <secondary>comparison</secondary>
14861 </indexterm>
14862 <indexterm role="concept">
14863 <primary>expansion</primary>
14864 <secondary>string comparison</secondary>
14865 </indexterm>
14866 <indexterm role="concept">
14867 <primary><option>ge</option> expansion condition</primary>
14868 </indexterm>
14869 <indexterm role="concept">
14870 <primary><option>gei</option> expansion condition</primary>
14871 </indexterm>
14872 The two substrings are first expanded. The condition is true if the first
14873 string is lexically greater than or equal to the second string. For <option>ge</option> the
14874 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
14875 case-independent.
14876 </para>
14877 </listitem></varlistentry>
14878 <varlistentry>
14879 <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>
14880 <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>
14881 <listitem>
14882 <para>
14883 <indexterm role="concept">
14884 <primary>string</primary>
14885 <secondary>comparison</secondary>
14886 </indexterm>
14887 <indexterm role="concept">
14888 <primary>expansion</primary>
14889 <secondary>string comparison</secondary>
14890 </indexterm>
14891 <indexterm role="concept">
14892 <primary><option>gt</option> expansion condition</primary>
14893 </indexterm>
14894 <indexterm role="concept">
14895 <primary><option>gti</option> expansion condition</primary>
14896 </indexterm>
14897 The two substrings are first expanded. The condition is true if the first
14898 string is lexically greater than the second string. For <option>gt</option> the comparison
14899 includes the case of letters, whereas for <option>gti</option> the comparison is
14900 case-independent.
14901 </para>
14902 </listitem></varlistentry>
14903 <varlistentry>
14904 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14905 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14906 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14907 <listitem>
14908 <para>
14909 <indexterm role="concept">
14910 <primary>IP address</primary>
14911 <secondary>testing string format</secondary>
14912 </indexterm>
14913 <indexterm role="concept">
14914 <primary>string</primary>
14915 <secondary>testing for IP address</secondary>
14916 </indexterm>
14917 <indexterm role="concept">
14918 <primary><option>isip</option> expansion condition</primary>
14919 </indexterm>
14920 <indexterm role="concept">
14921 <primary><option>isip4</option> expansion condition</primary>
14922 </indexterm>
14923 <indexterm role="concept">
14924 <primary><option>isip6</option> expansion condition</primary>
14925 </indexterm>
14926 The substring is first expanded, and then tested to see if it has the form of
14927 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
14928 <option>isip4</option> and <option>isip6</option> test just for IPv4 or IPv6 addresses, respectively. For
14929 example, you could use
14930 </para>
14931 <literallayout class="monospaced">
14932 ${if isip4{$sender_host_address}...
14933 </literallayout>
14934 <para>
14935 to test which version of IP an incoming SMTP connection is using.
14936 </para>
14937 </listitem></varlistentry>
14938 <varlistentry>
14939 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14940 <listitem>
14941 <para>
14942 <indexterm role="concept">
14943 <primary>LDAP</primary>
14944 <secondary>use for authentication</secondary>
14945 </indexterm>
14946 <indexterm role="concept">
14947 <primary>expansion</primary>
14948 <secondary>LDAP authentication test</secondary>
14949 </indexterm>
14950 <indexterm role="concept">
14951 <primary><option>ldapauth</option> expansion condition</primary>
14952 </indexterm>
14953 This condition supports user authentication using LDAP. See section
14954 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
14955 queries. For this use, the query must contain a user name and password. The
14956 query itself is not used, and can be empty. The condition is true if the
14957 password is not empty, and the user name and password are accepted by the LDAP
14958 server. An empty password is rejected without calling LDAP because LDAP binds
14959 with an empty password are considered anonymous regardless of the username, and
14960 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
14961 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
14962 this can be used.
14963 </para>
14964 </listitem></varlistentry>
14965 <varlistentry>
14966 <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>
14967 <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>
14968 <listitem>
14969 <para>
14970 <indexterm role="concept">
14971 <primary>string</primary>
14972 <secondary>comparison</secondary>
14973 </indexterm>
14974 <indexterm role="concept">
14975 <primary>expansion</primary>
14976 <secondary>string comparison</secondary>
14977 </indexterm>
14978 <indexterm role="concept">
14979 <primary><option>le</option> expansion condition</primary>
14980 </indexterm>
14981 <indexterm role="concept">
14982 <primary><option>lei</option> expansion condition</primary>
14983 </indexterm>
14984 The two substrings are first expanded. The condition is true if the first
14985 string is lexically less than or equal to the second string. For <option>le</option> the
14986 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
14987 case-independent.
14988 </para>
14989 </listitem></varlistentry>
14990 <varlistentry>
14991 <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>
14992 <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>
14993 <listitem>
14994 <para>
14995 <indexterm role="concept">
14996 <primary>string</primary>
14997 <secondary>comparison</secondary>
14998 </indexterm>
14999 <indexterm role="concept">
15000 <primary>expansion</primary>
15001 <secondary>string comparison</secondary>
15002 </indexterm>
15003 <indexterm role="concept">
15004 <primary><option>lt</option> expansion condition</primary>
15005 </indexterm>
15006 <indexterm role="concept">
15007 <primary><option>lti</option> expansion condition</primary>
15008 </indexterm>
15009 The two substrings are first expanded. The condition is true if the first
15010 string is lexically less than the second string. For <option>lt</option> the comparison
15011 includes the case of letters, whereas for <option>lti</option> the comparison is
15012 case-independent.
15013 </para>
15014 </listitem></varlistentry>
15015 <varlistentry>
15016 <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>
15017 <listitem>
15018 <para>
15019 <indexterm role="concept">
15020 <primary>expansion</primary>
15021 <secondary>regular expression comparison</secondary>
15022 </indexterm>
15023 <indexterm role="concept">
15024 <primary>regular expressions</primary>
15025 <secondary>match in expanded string</secondary>
15026 </indexterm>
15027 <indexterm role="concept">
15028 <primary><option>match</option> expansion condition</primary>
15029 </indexterm>
15030 The two substrings are first expanded. The second is then treated as a regular
15031 expression and applied to the first. Because of the pre-expansion, if the
15032 regular expression contains dollar, or backslash characters, they must be
15033 escaped. Care must also be taken if the regular expression contains braces
15034 (curly brackets). A closing brace must be escaped so that it is not taken as a
15035 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
15036 <literal>\N</literal> feature to disable expansion of the regular expression.
15037 For example,
15038 </para>
15039 <literallayout class="monospaced">
15040 ${if match {$local_part}{\N^\d{3}\N} ...
15041 </literallayout>
15042 <para>
15043 If the whole expansion string is in double quotes, further escaping of
15044 backslashes is also required.
15045 </para>
15046 <para>
15047 The condition is true if the regular expression match succeeds.
15048 The regular expression is not required to begin with a circumflex
15049 metacharacter, but if there is no circumflex, the expression is not anchored,
15050 and it may match anywhere in the subject, not just at the start. If you want
15051 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15052 metacharacter at an appropriate point.
15053 </para>
15054 <para>
15055 <indexterm role="concept">
15056 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15057 <secondary>in <option>if</option> expansion</secondary>
15058 </indexterm>
15059 At the start of an <option>if</option> expansion the values of the numeric variable
15060 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15061 succeeds causes them to be reset to the substrings of that condition and they
15062 will have these values during the expansion of the success string. At the end
15063 of the <option>if</option> expansion, the previous values are restored. After testing a
15064 combination of conditions using <option>or</option>, the subsequent values of the numeric
15065 variables are those of the condition that succeeded.
15066 </para>
15067 </listitem></varlistentry>
15068 <varlistentry>
15069 <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>
15070 <listitem>
15071 <para>
15072 <indexterm role="concept">
15073 <primary><option>match_address</option> expansion condition</primary>
15074 </indexterm>
15075 See <emphasis role="bold">match_local_part</emphasis>.
15076 </para>
15077 </listitem></varlistentry>
15078 <varlistentry>
15079 <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>
15080 <listitem>
15081 <para>
15082 <indexterm role="concept">
15083 <primary><option>match_domain</option> expansion condition</primary>
15084 </indexterm>
15085 See <emphasis role="bold">match_local_part</emphasis>.
15086 </para>
15087 </listitem></varlistentry>
15088 <varlistentry>
15089 <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>
15090 <listitem>
15091 <para>
15092 <indexterm role="concept">
15093 <primary><option>match_ip</option> expansion condition</primary>
15094 </indexterm>
15095 This condition matches an IP address to a list of IP address patterns. It must
15096 be followed by two argument strings. The first (after expansion) must be an IP
15097 address or an empty string. The second (after expansion) is a restricted host
15098 list that can match only an IP address, not a host name. For example:
15099 </para>
15100 <literallayout class="monospaced">
15101 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15102 </literallayout>
15103 <para>
15104 The specific types of host list item that are permitted in the list are:
15105 </para>
15106 <itemizedlist>
15107 <listitem>
15108 <para>
15109 An IP address, optionally with a CIDR mask.
15110 </para>
15111 </listitem>
15112 <listitem>
15113 <para>
15114 A single asterisk, which matches any IP address.
15115 </para>
15116 </listitem>
15117 <listitem>
15118 <para>
15119 An empty item, which matches only if the IP address is empty. This could be
15120 useful for testing for a locally submitted message or one from specific hosts
15121 in a single test such as
15122 </para>
15123 <literallayout class="monospaced">
15124   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15125 </literallayout>
15126 <para>
15127 where the first item in the list is the empty string.
15128 </para>
15129 </listitem>
15130 <listitem>
15131 <para>
15132 The item @[] matches any of the local host&#x2019;s interface addresses.
15133 </para>
15134 </listitem>
15135 <listitem>
15136 <para revisionflag="changed">
15137 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15138 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15139 address into a host name. The most common type of linear search for
15140 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15141 masks. For example:
15142 </para>
15143 <literallayout class="monospaced" revisionflag="changed">
15144   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15145 </literallayout>
15146 <para revisionflag="changed">
15147 It is of course possible to use other kinds of lookup, and in such a case, you
15148 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15149 address mask, for example:
15150 </para>
15151 <literallayout class="monospaced" revisionflag="changed">
15152   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15153 </literallayout>
15154 <para revisionflag="changed">
15155 However, unless you are combining a <option>match_ip</option> condition with others, it is
15156 just as easy to use the fact that a lookup is itself a condition, and write:
15157 </para>
15158 <literallayout class="monospaced" revisionflag="changed">
15159   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15160 </literallayout>
15161 </listitem>
15162 </itemizedlist>
15163 <para>
15164 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15165 </para>
15166 </listitem></varlistentry>
15167 <varlistentry>
15168 <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>
15169 <listitem>
15170 <para>
15171 <indexterm role="concept">
15172 <primary>domain list</primary>
15173 <secondary>in expansion condition</secondary>
15174 </indexterm>
15175 <indexterm role="concept">
15176 <primary>address list</primary>
15177 <secondary>in expansion condition</secondary>
15178 </indexterm>
15179 <indexterm role="concept">
15180 <primary>local part</primary>
15181 <secondary>list, in expansion condition</secondary>
15182 </indexterm>
15183 <indexterm role="concept">
15184 <primary><option>match_local_part</option> expansion condition</primary>
15185 </indexterm>
15186 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15187 possible to test domain, address, and local part lists within expansions. Each
15188 condition requires two arguments: an item and a list to match. A trivial
15189 example is:
15190 </para>
15191 <literallayout class="monospaced">
15192 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15193 </literallayout>
15194 <para>
15195 In each case, the second argument may contain any of the allowable items for a
15196 list of the appropriate type. Also, because the second argument (after
15197 expansion) is a standard form of list, it is possible to refer to a named list.
15198 Thus, you can use conditions like this:
15199 </para>
15200 <literallayout class="monospaced">
15201 ${if match_domain{$domain}{+local_domains}{...
15202 </literallayout>
15203 <para>
15204 <indexterm role="concept">
15205 <primary><literal>+caseful</literal></primary>
15206 </indexterm>
15207 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15208 item can be used, as in all address lists, to cause subsequent items to
15209 have their local parts matched casefully. Domains are always matched
15210 caselessly.
15211 </para>
15212 <para>
15213 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15214 hosts have two identities: a name and an IP address, and it is not clear
15215 how to specify cleanly how such a test would work. However, IP addresses can be
15216 matched using <option>match_ip</option>.
15217 </para>
15218 </listitem></varlistentry>
15219 <varlistentry>
15220 <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>
15221 <listitem>
15222 <para>
15223 <indexterm role="concept">
15224 <primary>PAM authentication</primary>
15225 </indexterm>
15226 <indexterm role="concept">
15227 <primary>AUTH</primary>
15228 <secondary>with PAM</secondary>
15229 </indexterm>
15230 <indexterm role="concept">
15231 <primary>Solaris</primary>
15232 <secondary>PAM support</secondary>
15233 </indexterm>
15234 <indexterm role="concept">
15235 <primary>expansion</primary>
15236 <secondary>PAM authentication test</secondary>
15237 </indexterm>
15238 <indexterm role="concept">
15239 <primary><option>pam</option> expansion condition</primary>
15240 </indexterm>
15241 <emphasis>Pluggable Authentication Modules</emphasis>
15242 (<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
15243 available in the latest releases of Solaris and in some GNU/Linux
15244 distributions. The Exim support, which is intended for use in conjunction with
15245 the SMTP AUTH command, is available only if Exim is compiled with
15246 </para>
15247 <literallayout class="monospaced">
15248 SUPPORT_PAM=yes
15249 </literallayout>
15250 <para>
15251 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15252 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15253 </para>
15254 <para>
15255 The argument string is first expanded, and the result must be a
15256 colon-separated list of strings. Leading and trailing white space is ignored.
15257 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15258 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
15259 The remaining items in the data string are passed over in response to requests
15260 from the authentication function. In the simple case there will only be one
15261 request, for a password, so the data consists of just two strings.
15262 </para>
15263 <para>
15264 There can be problems if any of the strings are permitted to contain colon
15265 characters. In the usual way, these have to be doubled to avoid being taken as
15266 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15267 item can be used to double any existing colons. For example, the configuration
15268 of a LOGIN authenticator might contain this setting:
15269 </para>
15270 <literallayout class="monospaced">
15271 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15272 </literallayout>
15273 <para>
15274 For a PLAIN authenticator you could use:
15275 </para>
15276 <literallayout class="monospaced">
15277 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15278 </literallayout>
15279 <para>
15280 In some operating systems, PAM authentication can be done only from a process
15281 running as root. Since Exim is running as the Exim user when receiving
15282 messages, this means that PAM cannot be used directly in those systems.
15283 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15284 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>.
15285 The patched module allows one special uid/gid combination, in addition to root,
15286 to authenticate. If you build the patched module to allow the Exim user and
15287 group, PAM can then be used from an Exim authenticator.
15288 </para>
15289 </listitem></varlistentry>
15290 <varlistentry>
15291 <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>
15292 <listitem>
15293 <para>
15294 <indexterm role="concept">
15295 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15296 </indexterm>
15297 <indexterm role="concept">
15298 <primary>Cyrus</primary>
15299 </indexterm>
15300 <indexterm role="concept">
15301 <primary>expansion</primary>
15302 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15303 </indexterm>
15304 <indexterm role="concept">
15305 <primary><option>pwcheck</option> expansion condition</primary>
15306 </indexterm>
15307 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15308 This is one way of making it possible for passwords to be checked by a process
15309 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15310 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15311 </para>
15312 <para>
15313 The pwcheck support is not included in Exim by default. You need to specify
15314 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15315 building Exim. For example:
15316 </para>
15317 <literallayout class="monospaced">
15318 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15319 </literallayout>
15320 <para>
15321 You do not need to install the full Cyrus software suite in order to use
15322 the pwcheck daemon. You can compile and install just the daemon alone
15323 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15324 access to the <filename>/var/pwcheck</filename> directory.
15325 </para>
15326 <para>
15327 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15328 password, separated by a colon. For example, in a LOGIN authenticator
15329 configuration, you might have this:
15330 </para>
15331 <literallayout class="monospaced">
15332 server_condition = ${if pwcheck{$auth1:$auth2}}
15333 </literallayout>
15334 </listitem></varlistentry>
15335 <varlistentry>
15336 <term><emphasis role="bold">queue_running</emphasis></term>
15337 <listitem>
15338 <para>
15339 <indexterm role="concept">
15340 <primary>queue runner</primary>
15341 <secondary>detecting when delivering from</secondary>
15342 </indexterm>
15343 <indexterm role="concept">
15344 <primary>expansion</primary>
15345 <secondary>queue runner test</secondary>
15346 </indexterm>
15347 <indexterm role="concept">
15348 <primary><option>queue_running</option> expansion condition</primary>
15349 </indexterm>
15350 This condition, which has no data, is true during delivery attempts that are
15351 initiated by queue runner processes, and false otherwise.
15352 </para>
15353 </listitem></varlistentry>
15354 <varlistentry>
15355 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15356 <listitem>
15357 <para>
15358 <indexterm role="concept">
15359 <primary>Radius</primary>
15360 </indexterm>
15361 <indexterm role="concept">
15362 <primary>expansion</primary>
15363 <secondary>Radius authentication</secondary>
15364 </indexterm>
15365 <indexterm role="concept">
15366 <primary><option>radius</option> expansion condition</primary>
15367 </indexterm>
15368 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15369 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15370 the Radius client configuration file in order to build Exim with Radius
15371 support.
15372 </para>
15373 <para>
15374 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15375 library, using the original API. If you are using release 0.4.0 or later of
15376 this library, you need to set
15377 </para>
15378 <literallayout class="monospaced">
15379 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15380 </literallayout>
15381 <para>
15382 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15383 <option>libradius</option> library that comes with FreeBSD. To do this, set
15384 </para>
15385 <literallayout class="monospaced">
15386 RADIUS_LIB_TYPE=RADLIB
15387 </literallayout>
15388 <para>
15389 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15390 You may also have to supply a suitable setting in EXTRALIBS so that the
15391 Radius library can be found when Exim is linked.
15392 </para>
15393 <para>
15394 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15395 Radius client library, which calls the Radius server. The condition is true if
15396 the authentication is successful. For example:
15397 </para>
15398 <literallayout class="monospaced">
15399 server_condition = ${if radius{&lt;arguments&gt;}}
15400 </literallayout>
15401 </listitem></varlistentry>
15402 <varlistentry>
15403 <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>
15404 <listitem>
15405 <para>
15406 <indexterm role="concept">
15407 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15408 </indexterm>
15409 <indexterm role="concept">
15410 <primary>Cyrus</primary>
15411 </indexterm>
15412 <indexterm role="concept">
15413 <primary>expansion</primary>
15414 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15415 </indexterm>
15416 <indexterm role="concept">
15417 <primary><option>saslauthd</option> expansion condition</primary>
15418 </indexterm>
15419 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15420 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15421 Using this daemon is one way of making it possible for passwords to be checked
15422 by a process that is not running as root.
15423 </para>
15424 <para>
15425 The saslauthd support is not included in Exim by default. You need to specify
15426 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15427 building Exim. For example:
15428 </para>
15429 <literallayout class="monospaced">
15430 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15431 </literallayout>
15432 <para>
15433 You do not need to install the full Cyrus software suite in order to use
15434 the saslauthd daemon. You can compile and install just the daemon alone
15435 from the Cyrus SASL library.
15436 </para>
15437 <para>
15438 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15439 two are mandatory. For example:
15440 </para>
15441 <literallayout class="monospaced">
15442 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15443 </literallayout>
15444 <para>
15445 The service and the realm are optional (which is why the arguments are enclosed
15446 in their own set of braces). For details of the meaning of the service and
15447 realm, and how to run the daemon, consult the Cyrus documentation.
15448 </para>
15449 </listitem></varlistentry>
15450 </variablelist>
15451 </section>
15452 <section id="SECID84">
15453 <title>Combining expansion conditions</title>
15454 <para>
15455 <indexterm role="concept">
15456 <primary>expansion</primary>
15457 <secondary>combining conditions</secondary>
15458 </indexterm>
15459 Several conditions can be tested at once by combining them using the <option>and</option>
15460 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15461 conditions on their own, and precede their lists of sub-conditions. Each
15462 sub-condition must be enclosed in braces within the overall braces that contain
15463 the list. No repetition of <option>if</option> is used.
15464 </para>
15465 <variablelist>
15466 <varlistentry>
15467 <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>
15468 <listitem>
15469 <para>
15470 <indexterm role="concept">
15471 <primary><quote>or</quote> expansion condition</primary>
15472 </indexterm>
15473 <indexterm role="concept">
15474 <primary>expansion</primary>
15475 <secondary><quote>or</quote> of conditions</secondary>
15476 </indexterm>
15477 The sub-conditions are evaluated from left to right. The condition is true if
15478 any one of the sub-conditions is true.
15479 For example,
15480 </para>
15481 <literallayout class="monospaced">
15482 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15483 </literallayout>
15484 <para>
15485 When a true sub-condition is found, the following ones are parsed but not
15486 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15487 numeric variables afterwards are taken from the first one that succeeds.
15488 </para>
15489 </listitem></varlistentry>
15490 <varlistentry>
15491 <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>
15492 <listitem>
15493 <para>
15494 <indexterm role="concept">
15495 <primary><quote>and</quote> expansion condition</primary>
15496 </indexterm>
15497 <indexterm role="concept">
15498 <primary>expansion</primary>
15499 <secondary><quote>and</quote> of conditions</secondary>
15500 </indexterm>
15501 The sub-conditions are evaluated from left to right. The condition is true if
15502 all of the sub-conditions are true. If there are several <quote>match</quote>
15503 sub-conditions, the values of the numeric variables afterwards are taken from
15504 the last one. When a false sub-condition is found, the following ones are
15505 parsed but not evaluated.
15506 </para>
15507 </listitem></varlistentry>
15508 </variablelist>
15509 <para>
15510 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15511 </para>
15512 </section>
15513 <section id="SECTexpvar">
15514 <title>Expansion variables</title>
15515 <para>
15516 <indexterm role="concept">
15517 <primary>expansion</primary>
15518 <secondary>variables, list of</secondary>
15519 </indexterm>
15520 This section contains an alphabetical list of all the expansion variables. Some
15521 of them are available only when Exim is compiled with specific options such as
15522 support for TLS or the content scanning extension.
15523 </para>
15524 <variablelist>
15525 <varlistentry>
15526 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15527 <listitem>
15528 <para>
15529 <indexterm role="concept">
15530 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15531 </indexterm>
15532 </para>
15533 <para revisionflag="changed">
15534 When a <option>match</option> expansion condition succeeds, these variables contain the
15535 captured substrings identified by the regular expression during subsequent
15536 processing of the success string of the containing <option>if</option> expansion item.
15537 However, they do not retain their values afterwards; in fact, their previous
15538 values are restored at the end of processing an <option>if</option> item. The numerical
15539 variables may also be set externally by some other matching process which
15540 precedes the expansion of the string. For example, the commands available in
15541 Exim filter files include an <option>if</option> command with its own regular expression
15542 matching condition.
15543 </para>
15544 </listitem></varlistentry>
15545 <varlistentry revisionflag="changed">
15546 <term><varname>$acl_c...</varname></term>
15547 <listitem>
15548 <para revisionflag="changed">
15549 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15550 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15551 long, but the sixth character must be either a digit or an underscore. For
15552 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15553 variables persist throughout the lifetime of an SMTP connection. They can be
15554 used to pass information between ACLs and between different invocations of the
15555 same ACL. When a message is received, the values of these variables are saved
15556 with the message, and can be accessed by filters, routers, and transports
15557 during subsequent delivery.
15558 </para>
15559 </listitem></varlistentry>
15560 <varlistentry revisionflag="changed">
15561 <term><varname>$acl_m...</varname></term>
15562 <listitem>
15563 <para revisionflag="changed">
15564 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15565 are reset after a message has been received. Thus, if several messages are
15566 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15567 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15568 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15569 message is received, the values of these variables are saved with the message,
15570 and can be accessed by filters, routers, and transports during subsequent
15571 delivery.
15572 </para>
15573 </listitem></varlistentry>
15574 <varlistentry>
15575 <term><varname>$acl_verify_message</varname></term>
15576 <listitem>
15577 <para>
15578 <indexterm role="variable">
15579 <primary><varname>$acl_verify_message</varname></primary>
15580 </indexterm>
15581 After an address verification has failed, this variable contains the failure
15582 message. It retains its value for use in subsequent modifiers. The message can
15583 be preserved by coding like this:
15584 </para>
15585 <literallayout class="monospaced">
15586 warn !verify = sender
15587      set acl_m0 = $acl_verify_message
15588 </literallayout>
15589 <para>
15590 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15591 <option>log_message</option> modifiers, to include information about the verification
15592 failure.
15593 </para>
15594 </listitem></varlistentry>
15595 <varlistentry>
15596 <term><varname>$address_data</varname></term>
15597 <listitem>
15598 <para>
15599 <indexterm role="variable">
15600 <primary><varname>$address_data</varname></primary>
15601 </indexterm>
15602 This variable is set by means of the <option>address_data</option> option in routers. The
15603 value then remains with the address while it is processed by subsequent routers
15604 and eventually a transport. If the transport is handling multiple addresses,
15605 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15606 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15607 user filter files.
15608 </para>
15609 <para>
15610 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15611 a recipient address, the final value is still in the variable for subsequent
15612 conditions and modifiers of the ACL statement. If routing the address caused it
15613 to be redirected to just one address, the child address is also routed as part
15614 of the verification, and in this case the final value of <varname>$address_data</varname> is
15615 from the child&#x2019;s routing.
15616 </para>
15617 <para>
15618 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15619 sender address, the final value is also preserved, but this time in
15620 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15621 address.
15622 </para>
15623 <para>
15624 In both cases (recipient and sender verification), the value does not persist
15625 after the end of the current ACL statement. If you want to preserve
15626 these values for longer, you can save them in ACL variables.
15627 </para>
15628 </listitem></varlistentry>
15629 <varlistentry>
15630 <term><varname>$address_file</varname></term>
15631 <listitem>
15632 <para>
15633 <indexterm role="variable">
15634 <primary><varname>$address_file</varname></primary>
15635 </indexterm>
15636 When, as a result of aliasing, forwarding, or filtering, a message is directed
15637 to a specific file, this variable holds the name of the file when the transport
15638 is running. At other times, the variable is empty. For example, using the
15639 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15640 </para>
15641 <literallayout class="monospaced">
15642 /home/r2d2/savemail
15643 </literallayout>
15644 <para>
15645 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15646 contains the text string <literal>/home/r2d2/savemail</literal>.
15647 <indexterm role="concept">
15648 <primary>Sieve filter</primary>
15649 <secondary>value of <varname>$address_file</varname></secondary>
15650 </indexterm>
15651 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15652 then up to the transport configuration to generate an appropriate absolute path
15653 to the relevant file.
15654 </para>
15655 </listitem></varlistentry>
15656 <varlistentry>
15657 <term><varname>$address_pipe</varname></term>
15658 <listitem>
15659 <para>
15660 <indexterm role="variable">
15661 <primary><varname>$address_pipe</varname></primary>
15662 </indexterm>
15663 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15664 this variable holds the pipe command when the transport is running.
15665 </para>
15666 </listitem></varlistentry>
15667 <varlistentry>
15668 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
15669 <listitem>
15670 <para>
15671 <indexterm role="variable">
15672 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15673 </indexterm>
15674 These variables are used in SMTP authenticators (see chapters
15675 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15676 </para>
15677 </listitem></varlistentry>
15678 <varlistentry>
15679 <term><varname>$authenticated_id</varname></term>
15680 <listitem>
15681 <para>
15682 <indexterm role="concept">
15683 <primary>authentication</primary>
15684 <secondary>id</secondary>
15685 </indexterm>
15686 <indexterm role="variable">
15687 <primary><varname>$authenticated_id</varname></primary>
15688 </indexterm>
15689 When a server successfully authenticates a client it may be configured to
15690 preserve some of the authentication information in the variable
15691 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15692 user/password authenticator configuration might preserve the user name for use
15693 in the routers. Note that this is not the same information that is saved in
15694 <varname>$sender_host_authenticated</varname>.
15695 When a message is submitted locally (that is, not over a TCP connection)
15696 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15697 process. However, a trusted user can override this by means of the <option>-oMai</option>
15698 command line option.
15699 </para>
15700 </listitem></varlistentry>
15701 <varlistentry>
15702 <term><varname>$authenticated_sender</varname></term>
15703 <listitem>
15704 <para>
15705 <indexterm role="concept">
15706 <primary>sender</primary>
15707 <secondary>authenticated</secondary>
15708 </indexterm>
15709 <indexterm role="concept">
15710 <primary>authentication</primary>
15711 <secondary>sender</secondary>
15712 </indexterm>
15713 <indexterm role="concept">
15714 <primary>AUTH</primary>
15715 <secondary>on MAIL command</secondary>
15716 </indexterm>
15717 <indexterm role="variable">
15718 <primary><varname>$authenticated_sender</varname></primary>
15719 </indexterm>
15720 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15721 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15722 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15723 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
15724 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15725 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15726 </para>
15727 <para>
15728 <indexterm role="variable">
15729 <primary><varname>$qualify_domain</varname></primary>
15730 </indexterm>
15731 When a message is submitted locally (that is, not over a TCP connection), the
15732 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15733 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15734 can override this by means of the <option>-oMas</option> command line option.
15735 </para>
15736 </listitem></varlistentry>
15737 <varlistentry>
15738 <term><varname>$authentication_failed</varname></term>
15739 <listitem>
15740 <para>
15741 <indexterm role="concept">
15742 <primary>authentication</primary>
15743 <secondary>failure</secondary>
15744 </indexterm>
15745 <indexterm role="variable">
15746 <primary><varname>$authentication_failed</varname></primary>
15747 </indexterm>
15748 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15749 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15750 possible to distinguish between <quote>did not try to authenticate</quote>
15751 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15752 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15753 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15754 negative response to an AUTH command, including (for example) an attempt to use
15755 an undefined mechanism.
15756 </para>
15757 </listitem></varlistentry>
15758 <varlistentry>
15759 <term><varname>$body_linecount</varname></term>
15760 <listitem>
15761 <para>
15762 <indexterm role="concept">
15763 <primary>message body</primary>
15764 <secondary>line count</secondary>
15765 </indexterm>
15766 <indexterm role="concept">
15767 <primary>body of message</primary>
15768 <secondary>line count</secondary>
15769 </indexterm>
15770 <indexterm role="variable">
15771 <primary><varname>$body_linecount</varname></primary>
15772 </indexterm>
15773 When a message is being received or delivered, this variable contains the
15774 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
15775 </para>
15776 </listitem></varlistentry>
15777 <varlistentry>
15778 <term><varname>$body_zerocount</varname></term>
15779 <listitem>
15780 <para>
15781 <indexterm role="concept">
15782 <primary>message body</primary>
15783 <secondary>binary zero count</secondary>
15784 </indexterm>
15785 <indexterm role="concept">
15786 <primary>body of message</primary>
15787 <secondary>binary zero count</secondary>
15788 </indexterm>
15789 <indexterm role="concept">
15790 <primary>binary zero</primary>
15791 <secondary>in message body</secondary>
15792 </indexterm>
15793 <indexterm role="variable">
15794 <primary><varname>$body_zerocount</varname></primary>
15795 </indexterm>
15796 When a message is being received or delivered, this variable contains the
15797 number of binary zero bytes in the message&#x2019;s body.
15798 </para>
15799 </listitem></varlistentry>
15800 <varlistentry>
15801 <term><varname>$bounce_recipient</varname></term>
15802 <listitem>
15803 <para>
15804 <indexterm role="variable">
15805 <primary><varname>$bounce_recipient</varname></primary>
15806 </indexterm>
15807 This is set to the recipient address of a bounce message while Exim is creating
15808 it. It is useful if a customized bounce message text file is in use (see
15809 chapter <xref linkend="CHAPemsgcust"/>).
15810 </para>
15811 </listitem></varlistentry>
15812 <varlistentry>
15813 <term><varname>$bounce_return_size_limit</varname></term>
15814 <listitem>
15815 <para>
15816 <indexterm role="variable">
15817 <primary><varname>$bounce_return_size_limit</varname></primary>
15818 </indexterm>
15819 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
15820 up to a multiple of 1000. It is useful when a customized error message text
15821 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
15822 </para>
15823 </listitem></varlistentry>
15824 <varlistentry>
15825 <term><varname>$caller_gid</varname></term>
15826 <listitem>
15827 <para>
15828 <indexterm role="concept">
15829 <primary>gid (group id)</primary>
15830 <secondary>caller</secondary>
15831 </indexterm>
15832 <indexterm role="variable">
15833 <primary><varname>$caller_gid</varname></primary>
15834 </indexterm>
15835 The real group id under which the process that called Exim was running. This is
15836 not the same as the group id of the originator of a message (see
15837 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
15838 incarnation normally contains the Exim gid.
15839 </para>
15840 </listitem></varlistentry>
15841 <varlistentry>
15842 <term><varname>$caller_uid</varname></term>
15843 <listitem>
15844 <para>
15845 <indexterm role="concept">
15846 <primary>uid (user id)</primary>
15847 <secondary>caller</secondary>
15848 </indexterm>
15849 <indexterm role="variable">
15850 <primary><varname>$caller_uid</varname></primary>
15851 </indexterm>
15852 The real user id under which the process that called Exim was running. This is
15853 not the same as the user id of the originator of a message (see
15854 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
15855 incarnation normally contains the Exim uid.
15856 </para>
15857 </listitem></varlistentry>
15858 <varlistentry>
15859 <term><varname>$compile_date</varname></term>
15860 <listitem>
15861 <para>
15862 <indexterm role="variable">
15863 <primary><varname>$compile_date</varname></primary>
15864 </indexterm>
15865 The date on which the Exim binary was compiled.
15866 </para>
15867 </listitem></varlistentry>
15868 <varlistentry>
15869 <term><varname>$compile_number</varname></term>
15870 <listitem>
15871 <para>
15872 <indexterm role="variable">
15873 <primary><varname>$compile_number</varname></primary>
15874 </indexterm>
15875 The building process for Exim keeps a count of the number
15876 of times it has been compiled. This serves to distinguish different
15877 compilations of the same version of the program.
15878 </para>
15879 </listitem></varlistentry>
15880 <varlistentry>
15881 <term><varname>$demime_errorlevel</varname></term>
15882 <listitem>
15883 <para>
15884 <indexterm role="variable">
15885 <primary><varname>$demime_errorlevel</varname></primary>
15886 </indexterm>
15887 This variable is available when Exim is compiled with
15888 the content-scanning extension and the obsolete <option>demime</option> condition. For
15889 details, see section <xref linkend="SECTdemimecond"/>.
15890 </para>
15891 </listitem></varlistentry>
15892 <varlistentry>
15893 <term><varname>$demime_reason</varname></term>
15894 <listitem>
15895 <para>
15896 <indexterm role="variable">
15897 <primary><varname>$demime_reason</varname></primary>
15898 </indexterm>
15899 This variable is available when Exim is compiled with the
15900 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15901 see section <xref linkend="SECTdemimecond"/>.
15902 </para>
15903 </listitem></varlistentry>
15904 <varlistentry>
15905 <term><varname>$dnslist_domain</varname></term>
15906 <listitem>
15907 <para>
15908 <indexterm role="concept">
15909 <primary>black list (DNS)</primary>
15910 </indexterm>
15911 <indexterm role="variable">
15912 <primary><varname>$dnslist_domain</varname></primary>
15913 </indexterm>
15914 When a client host is found to be on a DNS (black) list,
15915 the list&#x2019;s domain name is put into this variable so that it can be included in
15916 the rejection message.
15917 </para>
15918 </listitem></varlistentry>
15919 <varlistentry>
15920 <term><varname>$dnslist_text</varname></term>
15921 <listitem>
15922 <para>
15923 <indexterm role="variable">
15924 <primary><varname>$dnslist_text</varname></primary>
15925 </indexterm>
15926 When a client host is found to be on a DNS (black) list, the
15927 contents of any associated TXT record are placed in this variable.
15928 </para>
15929 </listitem></varlistentry>
15930 <varlistentry>
15931 <term><varname>$dnslist_value</varname></term>
15932 <listitem>
15933 <para>
15934 <indexterm role="variable">
15935 <primary><varname>$dnslist_value</varname></primary>
15936 </indexterm>
15937 When a client host is found to be on a DNS (black) list,
15938 the IP address from the resource record is placed in this variable.
15939 If there are multiple records, all the addresses are included, comma-space
15940 separated.
15941 </para>
15942 </listitem></varlistentry>
15943 <varlistentry>
15944 <term><varname>$domain</varname></term>
15945 <listitem>
15946 <para>
15947 <indexterm role="variable">
15948 <primary><varname>$domain</varname></primary>
15949 </indexterm>
15950 When an address is being routed, or delivered on its own, this variable
15951 contains the domain. Uppercase letters in the domain are converted into lower
15952 case for <varname>$domain</varname>.
15953 </para>
15954 <para>
15955 Global address rewriting happens when a message is received, so the value of
15956 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
15957 is set during user filtering, but not during system filtering, because a
15958 message may have many recipients and the system filter is called just once.
15959 </para>
15960 <para>
15961 When more than one address is being delivered at once (for example, several
15962 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
15963 have the same domain. Transports can be restricted to handling only one domain
15964 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
15965 the default for local transports. For further details of the environment in
15966 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
15967 </para>
15968 <para>
15969 <indexterm role="option">
15970 <primary><option>delay_warning_condition</option></primary>
15971 </indexterm>
15972 At the end of a delivery, if all deferred addresses have the same domain, it is
15973 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
15974 </para>
15975 <para>
15976 The <varname>$domain</varname> variable is also used in some other circumstances:
15977 </para>
15978 <itemizedlist>
15979 <listitem>
15980 <para>
15981 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
15982 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
15983 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
15984 normally set during the running of the MAIL ACL. However, if the sender address
15985 is verified with a callout during the MAIL ACL, the sender domain is placed in
15986 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
15987 the <command>smtp</command> transport.
15988 </para>
15989 </listitem>
15990 <listitem>
15991 <para>
15992 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15993 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
15994 it can be used in the expansion of the replacement address, for example, to
15995 rewrite domains by file lookup.
15996 </para>
15997 </listitem>
15998 <listitem>
15999 <para>
16000 With one important exception, whenever a domain list is being scanned,
16001 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16002 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16003 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16004 that, in a RCPT ACL, the sender domain list can be dependent on the
16005 recipient domain (which is what is in <varname>$domain</varname> at this time).
16006 </para>
16007 </listitem>
16008 <listitem>
16009 <para>
16010 <indexterm role="concept">
16011 <primary>ETRN</primary>
16012 <secondary>value of <varname>$domain</varname></secondary>
16013 </indexterm>
16014 <indexterm role="option">
16015 <primary><option>smtp_etrn_command</option></primary>
16016 </indexterm>
16017 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16018 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16019 </para>
16020 </listitem>
16021 </itemizedlist>
16022 </listitem></varlistentry>
16023 <varlistentry>
16024 <term><varname>$domain_data</varname></term>
16025 <listitem>
16026 <para>
16027 <indexterm role="variable">
16028 <primary><varname>$domain_data</varname></primary>
16029 </indexterm>
16030 When the <option>domains</option> option on a router matches a domain by
16031 means of a lookup, the data read by the lookup is available during the running
16032 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16033 address to a transport, the value is available in that transport. If the
16034 transport is handling multiple addresses, the value from the first address is
16035 used.
16036 </para>
16037 <para>
16038 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16039 domain by means of a lookup. The data read by the lookup is available during
16040 the rest of the ACL statement. In all other situations, this variable expands
16041 to nothing.
16042 </para>
16043 </listitem></varlistentry>
16044 <varlistentry>
16045 <term><varname>$exim_gid</varname></term>
16046 <listitem>
16047 <para>
16048 <indexterm role="variable">
16049 <primary><varname>$exim_gid</varname></primary>
16050 </indexterm>
16051 This variable contains the numerical value of the Exim group id.
16052 </para>
16053 </listitem></varlistentry>
16054 <varlistentry>
16055 <term><varname>$exim_path</varname></term>
16056 <listitem>
16057 <para>
16058 <indexterm role="variable">
16059 <primary><varname>$exim_path</varname></primary>
16060 </indexterm>
16061 This variable contains the path to the Exim binary.
16062 </para>
16063 </listitem></varlistentry>
16064 <varlistentry>
16065 <term><varname>$exim_uid</varname></term>
16066 <listitem>
16067 <para>
16068 <indexterm role="variable">
16069 <primary><varname>$exim_uid</varname></primary>
16070 </indexterm>
16071 This variable contains the numerical value of the Exim user id.
16072 </para>
16073 </listitem></varlistentry>
16074 <varlistentry>
16075 <term><varname>$found_extension</varname></term>
16076 <listitem>
16077 <para>
16078 <indexterm role="variable">
16079 <primary><varname>$found_extension</varname></primary>
16080 </indexterm>
16081 This variable is available when Exim is compiled with the
16082 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16083 see section <xref linkend="SECTdemimecond"/>.
16084 </para>
16085 </listitem></varlistentry>
16086 <varlistentry>
16087 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
16088 <listitem>
16089 <para>
16090 This is not strictly an expansion variable. It is expansion syntax for
16091 inserting the message header line with the given name. Note that the name must
16092 be terminated by colon or white space, because it may contain a wide variety of
16093 characters. Note also that braces must <emphasis>not</emphasis> be used.
16094 </para>
16095 </listitem></varlistentry>
16096 <varlistentry>
16097 <term><varname>$home</varname></term>
16098 <listitem>
16099 <para>
16100 <indexterm role="variable">
16101 <primary><varname>$home</varname></primary>
16102 </indexterm>
16103 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
16104 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16105 means it is set during the running of users&#x2019; filter files. A router may also
16106 explicitly set a home directory for use by a transport; this can be overridden
16107 by a setting on the transport itself.
16108 </para>
16109 <para>
16110 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16111 of the environment variable HOME.
16112 </para>
16113 </listitem></varlistentry>
16114 <varlistentry>
16115 <term><varname>$host</varname></term>
16116 <listitem>
16117 <para>
16118 <indexterm role="variable">
16119 <primary><varname>$host</varname></primary>
16120 </indexterm>
16121 If a router assigns an address to a transport (any transport), and passes a
16122 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16123 to run is the name of the first host on the list. Note that this applies both
16124 to local and remote transports.
16125 </para>
16126 <para>
16127 <indexterm role="concept">
16128 <primary>transport</primary>
16129 <secondary>filter</secondary>
16130 </indexterm>
16131 <indexterm role="concept">
16132 <primary>filter</primary>
16133 <secondary>transport filter</secondary>
16134 </indexterm>
16135 For the <command>smtp</command> transport, if there is more than one host, the value of
16136 <varname>$host</varname> changes as the transport works its way through the list. In
16137 particular, when the <command>smtp</command> transport is expanding its options for encryption
16138 using TLS, or for specifying a transport filter (see chapter
16139 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16140 is connected.
16141 </para>
16142 <para>
16143 When used in the client part of an authenticator configuration (see chapter
16144 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16145 client is connected.
16146 </para>
16147 </listitem></varlistentry>
16148 <varlistentry>
16149 <term><varname>$host_address</varname></term>
16150 <listitem>
16151 <para>
16152 <indexterm role="variable">
16153 <primary><varname>$host_address</varname></primary>
16154 </indexterm>
16155 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
16156 for a remote connection. It is also set to the IP address that is being checked
16157 when the <option>ignore_target_hosts</option> option is being processed.
16158 </para>
16159 </listitem></varlistentry>
16160 <varlistentry>
16161 <term><varname>$host_data</varname></term>
16162 <listitem>
16163 <para>
16164 <indexterm role="variable">
16165 <primary><varname>$host_data</varname></primary>
16166 </indexterm>
16167 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16168 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16169 allows you, for example, to do things like this:
16170 </para>
16171 <literallayout class="monospaced">
16172 deny  hosts = net-lsearch;/some/file
16173 message = $host_data
16174 </literallayout>
16175 </listitem></varlistentry>
16176 <varlistentry>
16177 <term><varname>$host_lookup_deferred</varname></term>
16178 <listitem>
16179 <para>
16180 <indexterm role="concept">
16181 <primary>host name</primary>
16182 <secondary>lookup, failure of</secondary>
16183 </indexterm>
16184 <indexterm role="variable">
16185 <primary><varname>$host_lookup_deferred</varname></primary>
16186 </indexterm>
16187 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16188 message comes from a remote host and there is an attempt to look up the host&#x2019;s
16189 name from its IP address, and the attempt is not successful, one of these
16190 variables is set to <quote>1</quote>.
16191 </para>
16192 <itemizedlist>
16193 <listitem>
16194 <para>
16195 If the lookup receives a definite negative response (for example, a DNS lookup
16196 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16197 </para>
16198 </listitem>
16199 <listitem>
16200 <para>
16201 If there is any kind of problem during the lookup, such that Exim cannot
16202 tell whether or not the host name is defined (for example, a timeout for a DNS
16203 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16204 </para>
16205 </listitem>
16206 </itemizedlist>
16207 <para>
16208 Looking up a host&#x2019;s name from its IP address consists of more than just a
16209 single reverse lookup. Exim checks that a forward lookup of at least one of the
16210 names it receives from a reverse lookup yields the original IP address. If this
16211 is not the case, Exim does not accept the looked up name(s), and
16212 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16213 IP address (for example, the existence of a PTR record in the DNS) is not
16214 sufficient on its own for the success of a host name lookup. If the reverse
16215 lookup succeeds, but there is a lookup problem such as a timeout when checking
16216 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16217 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16218 </para>
16219 </listitem></varlistentry>
16220 <varlistentry>
16221 <term><varname>$host_lookup_failed</varname></term>
16222 <listitem>
16223 <para>
16224 <indexterm role="variable">
16225 <primary><varname>$host_lookup_failed</varname></primary>
16226 </indexterm>
16227 See <varname>$host_lookup_deferred</varname>.
16228 </para>
16229 </listitem></varlistentry>
16230 <varlistentry>
16231 <term><varname>$inode</varname></term>
16232 <listitem>
16233 <para>
16234 <indexterm role="variable">
16235 <primary><varname>$inode</varname></primary>
16236 </indexterm>
16237 The only time this variable is set is while expanding the <option>directory_file</option>
16238 option in the <command>appendfile</command> transport. The variable contains the inode number
16239 of the temporary file which is about to be renamed. It can be used to construct
16240 a unique name for the file.
16241 </para>
16242 </listitem></varlistentry>
16243 <varlistentry>
16244 <term><varname>$interface_address</varname></term>
16245 <listitem>
16246 <para>
16247 <indexterm role="variable">
16248 <primary><varname>$interface_address</varname></primary>
16249 </indexterm>
16250 This is an obsolete name for <varname>$received_ip_address</varname>.
16251 </para>
16252 </listitem></varlistentry>
16253 <varlistentry>
16254 <term><varname>$interface_port</varname></term>
16255 <listitem>
16256 <para>
16257 <indexterm role="variable">
16258 <primary><varname>$interface_port</varname></primary>
16259 </indexterm>
16260 This is an obsolete name for <varname>$received_port</varname>.
16261 </para>
16262 </listitem></varlistentry>
16263 <varlistentry revisionflag="changed">
16264 <term><varname>$item</varname></term>
16265 <listitem>
16266 <para revisionflag="changed">
16267 <indexterm role="variable">
16268 <primary><varname>$item</varname></primary>
16269 </indexterm>
16270 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16271 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">man</emphasis>, and
16272 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16273 empty.
16274 </para>
16275 </listitem></varlistentry>
16276 <varlistentry>
16277 <term><varname>$ldap_dn</varname></term>
16278 <listitem>
16279 <para>
16280 <indexterm role="variable">
16281 <primary><varname>$ldap_dn</varname></primary>
16282 </indexterm>
16283 This variable, which is available only when Exim is compiled with LDAP support,
16284 contains the DN from the last entry in the most recently successful LDAP
16285 lookup.
16286 </para>
16287 </listitem></varlistentry>
16288 <varlistentry>
16289 <term><varname>$load_average</varname></term>
16290 <listitem>
16291 <para>
16292 <indexterm role="variable">
16293 <primary><varname>$load_average</varname></primary>
16294 </indexterm>
16295 This variable contains the system load average, multiplied by 1000 to that it
16296 is an integer. For example, if the load average is 0.21, the value of the
16297 variable is 210. The value is recomputed every time the variable is referenced.
16298 </para>
16299 </listitem></varlistentry>
16300 <varlistentry>
16301 <term><varname>$local_part</varname></term>
16302 <listitem>
16303 <para>
16304 <indexterm role="variable">
16305 <primary><varname>$local_part</varname></primary>
16306 </indexterm>
16307 When an address is being routed, or delivered on its own, this
16308 variable contains the local part. When a number of addresses are being
16309 delivered together (for example, multiple RCPT commands in an SMTP
16310 session), <varname>$local_part</varname> is not set.
16311 </para>
16312 <para>
16313 Global address rewriting happens when a message is received, so the value of
16314 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16315 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16316 because a message may have many recipients and the system filter is called just
16317 once.
16318 </para>
16319 <para>
16320 <indexterm role="variable">
16321 <primary><varname>$local_part_prefix</varname></primary>
16322 </indexterm>
16323 <indexterm role="variable">
16324 <primary><varname>$local_part_suffix</varname></primary>
16325 </indexterm>
16326 If a local part prefix or suffix has been recognized, it is not included in the
16327 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16328 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16329 <varname>$local_part_suffix</varname>, respectively.
16330 </para>
16331 <para>
16332 When a message is being delivered to a file, pipe, or autoreply transport as a
16333 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16334 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16335 <varname>$address_pipe</varname>).
16336 </para>
16337 <para>
16338 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16339 local part of the recipient address.
16340 </para>
16341 <para>
16342 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16343 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16344 it can be used in the expansion of the replacement address, for example.
16345 </para>
16346 <para>
16347 In all cases, all quoting is removed from the local part. For example, for both
16348 the addresses
16349 </para>
16350 <literallayout class="monospaced">
16351 "abc:xyz"@test.example
16352 abc\:xyz@test.example
16353 </literallayout>
16354 <para>
16355 the value of <varname>$local_part</varname> is
16356 </para>
16357 <literallayout class="monospaced">
16358 abc:xyz
16359 </literallayout>
16360 <para>
16361 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16362 inside a quoting operator. For example, in a <command>redirect</command> router you could
16363 have:
16364 </para>
16365 <literallayout class="monospaced">
16366 data = ${quote_local_part:$local_part}@new.domain.example
16367 </literallayout>
16368 <para>
16369 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16370 to process local parts in a case-dependent manner in a router, you can set the
16371 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16372 </para>
16373 </listitem></varlistentry>
16374 <varlistentry>
16375 <term><varname>$local_part_data</varname></term>
16376 <listitem>
16377 <para>
16378 <indexterm role="variable">
16379 <primary><varname>$local_part_data</varname></primary>
16380 </indexterm>
16381 When the <option>local_parts</option> option on a router matches a local part by means of a
16382 lookup, the data read by the lookup is available during the running of the
16383 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16384 to a transport, the value is available in that transport. If the transport is
16385 handling multiple addresses, the value from the first address is used.
16386 </para>
16387 <para>
16388 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16389 matches a local part by means of a lookup. The data read by the lookup is
16390 available during the rest of the ACL statement. In all other situations, this
16391 variable expands to nothing.
16392 </para>
16393 </listitem></varlistentry>
16394 <varlistentry>
16395 <term><varname>$local_part_prefix</varname></term>
16396 <listitem>
16397 <para>
16398 <indexterm role="variable">
16399 <primary><varname>$local_part_prefix</varname></primary>
16400 </indexterm>
16401 When an address is being routed or delivered, and a
16402 specific prefix for the local part was recognized, it is available in this
16403 variable, having been removed from <varname>$local_part</varname>.
16404 </para>
16405 </listitem></varlistentry>
16406 <varlistentry>
16407 <term><varname>$local_part_suffix</varname></term>
16408 <listitem>
16409 <para>
16410 <indexterm role="variable">
16411 <primary><varname>$local_part_suffix</varname></primary>
16412 </indexterm>
16413 When an address is being routed or delivered, and a
16414 specific suffix for the local part was recognized, it is available in this
16415 variable, having been removed from <varname>$local_part</varname>.
16416 </para>
16417 </listitem></varlistentry>
16418 <varlistentry>
16419 <term><varname>$local_scan_data</varname></term>
16420 <listitem>
16421 <para>
16422 <indexterm role="variable">
16423 <primary><varname>$local_scan_data</varname></primary>
16424 </indexterm>
16425 This variable contains the text returned by the <function>local_scan()</function> function when
16426 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16427 </para>
16428 </listitem></varlistentry>
16429 <varlistentry>
16430 <term><varname>$local_user_gid</varname></term>
16431 <listitem>
16432 <para>
16433 <indexterm role="variable">
16434 <primary><varname>$local_user_gid</varname></primary>
16435 </indexterm>
16436 See <varname>$local_user_uid</varname>.
16437 </para>
16438 </listitem></varlistentry>
16439 <varlistentry>
16440 <term><varname>$local_user_uid</varname></term>
16441 <listitem>
16442 <para>
16443 <indexterm role="variable">
16444 <primary><varname>$local_user_uid</varname></primary>
16445 </indexterm>
16446 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16447 <option>check_local_user</option> router precondition succeeds. This means that their values
16448 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16449 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16450 router-specific expansions. At all other times, the values in these variables
16451 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16452 </para>
16453 </listitem></varlistentry>
16454 <varlistentry>
16455 <term><varname>$localhost_number</varname></term>
16456 <listitem>
16457 <para>
16458 <indexterm role="variable">
16459 <primary><varname>$localhost_number</varname></primary>
16460 </indexterm>
16461 This contains the expanded value of the
16462 <option>localhost_number</option> option. The expansion happens after the main options have
16463 been read.
16464 </para>
16465 </listitem></varlistentry>
16466 <varlistentry>
16467 <term><varname>$log_inodes</varname></term>
16468 <listitem>
16469 <para>
16470 <indexterm role="variable">
16471 <primary><varname>$log_inodes</varname></primary>
16472 </indexterm>
16473 The number of free inodes in the disk partition where Exim&#x2019;s
16474 log files are being written. The value is recalculated whenever the variable is
16475 referenced. If the relevant file system does not have the concept of inodes,
16476 the value of is -1. See also the <option>check_log_inodes</option> option.
16477 </para>
16478 </listitem></varlistentry>
16479 <varlistentry>
16480 <term><varname>$log_space</varname></term>
16481 <listitem>
16482 <para>
16483 <indexterm role="variable">
16484 <primary><varname>$log_space</varname></primary>
16485 </indexterm>
16486 The amount of free space (as a number of kilobytes) in the disk
16487 partition where Exim&#x2019;s log files are being written. The value is recalculated
16488 whenever the variable is referenced. If the operating system does not have the
16489 ability to find the amount of free space (only true for experimental systems),
16490 the space value is -1. See also the <option>check_log_space</option> option.
16491 </para>
16492 </listitem></varlistentry>
16493 <varlistentry>
16494 <term><varname>$mailstore_basename</varname></term>
16495 <listitem>
16496 <para>
16497 <indexterm role="variable">
16498 <primary><varname>$mailstore_basename</varname></primary>
16499 </indexterm>
16500 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16501 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16502 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16503 contains the basename of the files that are being written, that is, the name
16504 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16505 variable is empty.
16506 </para>
16507 </listitem></varlistentry>
16508 <varlistentry>
16509 <term><varname>$malware_name</varname></term>
16510 <listitem>
16511 <para>
16512 <indexterm role="variable">
16513 <primary><varname>$malware_name</varname></primary>
16514 </indexterm>
16515 This variable is available when Exim is compiled with the
16516 content-scanning extension. It is set to the name of the virus that was found
16517 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16518 </para>
16519 </listitem></varlistentry>
16520 <varlistentry>
16521 <term><varname>$message_age</varname></term>
16522 <listitem>
16523 <para>
16524 <indexterm role="concept">
16525 <primary>message</primary>
16526 <secondary>age of</secondary>
16527 </indexterm>
16528 <indexterm role="variable">
16529 <primary><varname>$message_age</varname></primary>
16530 </indexterm>
16531 This variable is set at the start of a delivery attempt to contain the number
16532 of seconds since the message was received. It does not change during a single
16533 delivery attempt.
16534 </para>
16535 </listitem></varlistentry>
16536 <varlistentry>
16537 <term><varname>$message_body</varname></term>
16538 <listitem>
16539 <para>
16540 <indexterm role="concept">
16541 <primary>body of message</primary>
16542 <secondary>expansion variable</secondary>
16543 </indexterm>
16544 <indexterm role="concept">
16545 <primary>message body</primary>
16546 <secondary>in expansion</secondary>
16547 </indexterm>
16548 <indexterm role="concept">
16549 <primary>binary zero</primary>
16550 <secondary>in message body</secondary>
16551 </indexterm>
16552 <indexterm role="variable">
16553 <primary><varname>$message_body</varname></primary>
16554 </indexterm>
16555 This variable contains the initial portion of a message&#x2019;s
16556 body while it is being delivered, and is intended mainly for use in filter
16557 files. The maximum number of characters of the body that are put into the
16558 variable is set by the <option>message_body_visible</option> configuration option; the
16559 default is 500. Newlines are converted into spaces to make it easier to search
16560 for phrases that might be split over a line break.
16561 Binary zeros are also converted into spaces.
16562 </para>
16563 </listitem></varlistentry>
16564 <varlistentry>
16565 <term><varname>$message_body_end</varname></term>
16566 <listitem>
16567 <para>
16568 <indexterm role="concept">
16569 <primary>body of message</primary>
16570 <secondary>expansion variable</secondary>
16571 </indexterm>
16572 <indexterm role="concept">
16573 <primary>message body</primary>
16574 <secondary>in expansion</secondary>
16575 </indexterm>
16576 <indexterm role="variable">
16577 <primary><varname>$message_body_end</varname></primary>
16578 </indexterm>
16579 This variable contains the final portion of a message&#x2019;s
16580 body while it is being delivered. The format and maximum size are as for
16581 <varname>$message_body</varname>.
16582 </para>
16583 </listitem></varlistentry>
16584 <varlistentry>
16585 <term><varname>$message_body_size</varname></term>
16586 <listitem>
16587 <para>
16588 <indexterm role="concept">
16589 <primary>body of message</primary>
16590 <secondary>size</secondary>
16591 </indexterm>
16592 <indexterm role="concept">
16593 <primary>message body</primary>
16594 <secondary>size</secondary>
16595 </indexterm>
16596 <indexterm role="variable">
16597 <primary><varname>$message_body_size</varname></primary>
16598 </indexterm>
16599 When a message is being delivered, this variable contains the size of the body
16600 in bytes. The count starts from the character after the blank line that
16601 separates the body from the header. Newlines are included in the count. See
16602 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16603 </para>
16604 </listitem></varlistentry>
16605 <varlistentry>
16606 <term><varname>$message_exim_id</varname></term>
16607 <listitem>
16608 <para>
16609 <indexterm role="variable">
16610 <primary><varname>$message_exim_id</varname></primary>
16611 </indexterm>
16612 When a message is being received or delivered, this variable contains the
16613 unique message id that is generated and used by Exim to identify the message.
16614 An id is not created for a message until after its header has been successfully
16615 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16616 line; it is the local id that Exim assigns to the message, for example:
16617 <literal>1BXTIK-0001yO-VA</literal>.
16618 </para>
16619 </listitem></varlistentry>
16620 <varlistentry>
16621 <term><varname>$message_headers</varname></term>
16622 <listitem>
16623 <para>
16624 <indexterm role="variable">
16625 <primary><varname>$message_headers</varname></primary>
16626 </indexterm>
16627 This variable contains a concatenation of all the header lines when a message
16628 is being processed, except for lines added by routers or transports. The header
16629 lines are separated by newline characters. Their contents are decoded in the
16630 same way as a header line that is inserted by <option>bheader</option>.
16631 </para>
16632 </listitem></varlistentry>
16633 <varlistentry>
16634 <term><varname>$message_headers_raw</varname></term>
16635 <listitem>
16636 <para>
16637 <indexterm role="variable">
16638 <primary><varname>$message_headers_raw</varname></primary>
16639 </indexterm>
16640 This variable is like <varname>$message_headers</varname> except that no processing of the
16641 contents of header lines is done.
16642 </para>
16643 </listitem></varlistentry>
16644 <varlistentry>
16645 <term><varname>$message_id</varname></term>
16646 <listitem>
16647 <para>
16648 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16649 </para>
16650 </listitem></varlistentry>
16651 <varlistentry>
16652 <term><varname>$message_linecount</varname></term>
16653 <listitem>
16654 <para>
16655 <indexterm role="variable">
16656 <primary><varname>$message_linecount</varname></primary>
16657 </indexterm>
16658 This variable contains the total number of lines in the header and body of the
16659 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16660 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16661 number of lines received. Before delivery happens (that is, before filters,
16662 routers, and transports run) the count is increased to include the
16663 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16664 lines that are added by ACLs. The blank line that separates the message header
16665 from the body is not counted. Here is an example of the use of this variable in
16666 a DATA ACL:
16667 </para>
16668 <literallayout class="monospaced">
16669 deny message   = Too many lines in message header
16670      condition = \
16671       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
16672 </literallayout>
16673 <para>
16674 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16675 message has not yet been received.
16676 </para>
16677 </listitem></varlistentry>
16678 <varlistentry>
16679 <term><varname>$message_size</varname></term>
16680 <listitem>
16681 <para>
16682 <indexterm role="concept">
16683 <primary>size</primary>
16684 <secondary>of message</secondary>
16685 </indexterm>
16686 <indexterm role="concept">
16687 <primary>message</primary>
16688 <secondary>size</secondary>
16689 </indexterm>
16690 <indexterm role="variable">
16691 <primary><varname>$message_size</varname></primary>
16692 </indexterm>
16693 When a message is being processed, this variable contains its size in bytes. In
16694 most cases, the size includes those headers that were received with the
16695 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16696 deliveries as they are written. However, there is one special case: during the
16697 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16698 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16699 precise size of the file that has been written. See also
16700 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16701 </para>
16702 <para>
16703 <indexterm role="concept">
16704 <primary>RCPT</primary>
16705 <secondary>value of <varname>$message_size</varname></secondary>
16706 </indexterm>
16707 While running an ACL at the time of an SMTP RCPT command, <varname>$message_size</varname>
16708 contains the size supplied on the MAIL command, or -1 if no size was given. The
16709 value may not, of course, be truthful.
16710 </para>
16711 </listitem></varlistentry>
16712 <varlistentry>
16713 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16714 <listitem>
16715 <para>
16716 A number of variables whose names start with <varname>$mime</varname> are
16717 available when Exim is compiled with the content-scanning extension. For
16718 details, see section <xref linkend="SECTscanmimepart"/>.
16719 </para>
16720 </listitem></varlistentry>
16721 <varlistentry>
16722 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
16723 <listitem>
16724 <para>
16725 These variables are counters that can be incremented by means
16726 of the <option>add</option> command in filter files.
16727 </para>
16728 </listitem></varlistentry>
16729 <varlistentry>
16730 <term><varname>$original_domain</varname></term>
16731 <listitem>
16732 <para>
16733 <indexterm role="variable">
16734 <primary><varname>$domain</varname></primary>
16735 </indexterm>
16736 <indexterm role="variable">
16737 <primary><varname>$original_domain</varname></primary>
16738 </indexterm>
16739 When a top-level address is being processed for delivery, this contains the
16740 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16741 generated by an alias, forward, or filter file) is being processed, this
16742 variable contains the domain of the original address (lower cased). This
16743 differs from <varname>$parent_domain</varname> only when there is more than one level of
16744 aliasing or forwarding. When more than one address is being delivered in a
16745 single transport run, <varname>$original_domain</varname> is not set.
16746 </para>
16747 <para>
16748 If a new address is created by means of a <option>deliver</option> command in a system
16749 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16750 part <emphasis>system-filter</emphasis> and the default qualify domain.
16751 </para>
16752 </listitem></varlistentry>
16753 <varlistentry>
16754 <term><varname>$original_local_part</varname></term>
16755 <listitem>
16756 <para>
16757 <indexterm role="variable">
16758 <primary><varname>$local_part</varname></primary>
16759 </indexterm>
16760 <indexterm role="variable">
16761 <primary><varname>$original_local_part</varname></primary>
16762 </indexterm>
16763 When a top-level address is being processed for delivery, this contains the
16764 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16765 local part, because <varname>$original_local_part</varname> always contains the full local
16766 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16767 filter file) is being processed, this variable contains the full local part of
16768 the original address.
16769 </para>
16770 <para>
16771 If the router that did the redirection processed the local part
16772 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16773 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16774 one level of aliasing or forwarding. When more than one address is being
16775 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
16776 </para>
16777 <para>
16778 If a new address is created by means of a <option>deliver</option> command in a system
16779 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16780 part <emphasis>system-filter</emphasis> and the default qualify domain.
16781 </para>
16782 </listitem></varlistentry>
16783 <varlistentry>
16784 <term><varname>$originator_gid</varname></term>
16785 <listitem>
16786 <para>
16787 <indexterm role="concept">
16788 <primary>gid (group id)</primary>
16789 <secondary>of originating user</secondary>
16790 </indexterm>
16791 <indexterm role="concept">
16792 <primary>sender</primary>
16793 <secondary>gid</secondary>
16794 </indexterm>
16795 <indexterm role="variable">
16796 <primary><varname>$caller_gid</varname></primary>
16797 </indexterm>
16798 <indexterm role="variable">
16799 <primary><varname>$originator_gid</varname></primary>
16800 </indexterm>
16801 This variable contains the value of <varname>$caller_gid</varname> that was set when the
16802 message was received. For messages received via the command line, this is the
16803 gid of the sending user. For messages received by SMTP over TCP/IP, this is
16804 normally the gid of the Exim user.
16805 </para>
16806 </listitem></varlistentry>
16807 <varlistentry>
16808 <term><varname>$originator_uid</varname></term>
16809 <listitem>
16810 <para>
16811 <indexterm role="concept">
16812 <primary>uid (user id)</primary>
16813 <secondary>of originating user</secondary>
16814 </indexterm>
16815 <indexterm role="concept">
16816 <primary>sender</primary>
16817 <secondary>uid</secondary>
16818 </indexterm>
16819 <indexterm role="variable">
16820 <primary><varname>$caller_uid</varname></primary>
16821 </indexterm>
16822 <indexterm role="variable">
16823 <primary><varname>$originaltor_uid</varname></primary>
16824 </indexterm>
16825 The value of <varname>$caller_uid</varname> that was set when the message was received. For
16826 messages received via the command line, this is the uid of the sending user.
16827 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
16828 user.
16829 </para>
16830 </listitem></varlistentry>
16831 <varlistentry>
16832 <term><varname>$parent_domain</varname></term>
16833 <listitem>
16834 <para>
16835 <indexterm role="variable">
16836 <primary><varname>$parent_domain</varname></primary>
16837 </indexterm>
16838 This variable is similar to <varname>$original_domain</varname> (see
16839 above), except that it refers to the immediately preceding parent address.
16840 </para>
16841 </listitem></varlistentry>
16842 <varlistentry>
16843 <term><varname>$parent_local_part</varname></term>
16844 <listitem>
16845 <para>
16846 <indexterm role="variable">
16847 <primary><varname>$parent_local_part</varname></primary>
16848 </indexterm>
16849 This variable is similar to <varname>$original_local_part</varname>
16850 (see above), except that it refers to the immediately preceding parent address.
16851 </para>
16852 </listitem></varlistentry>
16853 <varlistentry>
16854 <term><varname>$pid</varname></term>
16855 <listitem>
16856 <para>
16857 <indexterm role="concept">
16858 <primary>pid (process id)</primary>
16859 <secondary>of current process</secondary>
16860 </indexterm>
16861 <indexterm role="variable">
16862 <primary><varname>$pid</varname></primary>
16863 </indexterm>
16864 This variable contains the current process id.
16865 </para>
16866 </listitem></varlistentry>
16867 <varlistentry>
16868 <term><varname>$pipe_addresses</varname></term>
16869 <listitem>
16870 <para>
16871 <indexterm role="concept">
16872 <primary>filter</primary>
16873 <secondary>transport filter</secondary>
16874 </indexterm>
16875 <indexterm role="concept">
16876 <primary>transport</primary>
16877 <secondary>filter</secondary>
16878 </indexterm>
16879 <indexterm role="variable">
16880 <primary><varname>$pipe_addresses</varname></primary>
16881 </indexterm>
16882 This is not an expansion variable, but is mentioned here because the string
16883 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
16884 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
16885 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
16886 It cannot be used in general expansion strings, and provokes an <quote>unknown
16887 variable</quote> error if encountered.
16888 </para>
16889 </listitem></varlistentry>
16890 <varlistentry>
16891 <term><varname>$primary_hostname</varname></term>
16892 <listitem>
16893 <para>
16894 <indexterm role="variable">
16895 <primary><varname>$primary_hostname</varname></primary>
16896 </indexterm>
16897 This variable contains the value set by <option>primary_hostname</option> in the
16898 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
16899 a single-component name, Exim calls <function>gethostbyname()</function> (or
16900 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
16901 qualified host name. See also <varname>$smtp_active_hostname</varname>.
16902 </para>
16903 </listitem></varlistentry>
16904 <varlistentry>
16905 <term><varname>$prvscheck_address</varname></term>
16906 <listitem>
16907 <para>
16908 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16909 which is described in sections <xref linkend="SECTexpansionitems"/> and
16910 <xref linkend="SECTverifyPRVS"/>.
16911 </para>
16912 </listitem></varlistentry>
16913 <varlistentry>
16914 <term><varname>$prvscheck_keynum</varname></term>
16915 <listitem>
16916 <para>
16917 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16918 which is described in sections <xref linkend="SECTexpansionitems"/> and
16919 <xref linkend="SECTverifyPRVS"/>.
16920 </para>
16921 </listitem></varlistentry>
16922 <varlistentry>
16923 <term><varname>$prvscheck_result</varname></term>
16924 <listitem>
16925 <para>
16926 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16927 which is described in sections <xref linkend="SECTexpansionitems"/> and
16928 <xref linkend="SECTverifyPRVS"/>.
16929 </para>
16930 </listitem></varlistentry>
16931 <varlistentry>
16932 <term><varname>$qualify_domain</varname></term>
16933 <listitem>
16934 <para>
16935 <indexterm role="variable">
16936 <primary><varname>$qualify_domain</varname></primary>
16937 </indexterm>
16938 The value set for the <option>qualify_domain</option> option in the configuration file.
16939 </para>
16940 </listitem></varlistentry>
16941 <varlistentry>
16942 <term><varname>$qualify_recipient</varname></term>
16943 <listitem>
16944 <para>
16945 <indexterm role="variable">
16946 <primary><varname>$qualify_recipient</varname></primary>
16947 </indexterm>
16948 The value set for the <option>qualify_recipient</option> option in the configuration file,
16949 or if not set, the value of <varname>$qualify_domain</varname>.
16950 </para>
16951 </listitem></varlistentry>
16952 <varlistentry>
16953 <term><varname>$rcpt_count</varname></term>
16954 <listitem>
16955 <para>
16956 <indexterm role="variable">
16957 <primary><varname>$rcpt_count</varname></primary>
16958 </indexterm>
16959 When a message is being received by SMTP, this variable contains the number of
16960 RCPT commands received for the current message. If this variable is used in a
16961 RCPT ACL, its value includes the current command.
16962 </para>
16963 </listitem></varlistentry>
16964 <varlistentry>
16965 <term><varname>$rcpt_defer_count</varname></term>
16966 <listitem>
16967 <para>
16968 <indexterm role="variable">
16969 <primary><varname>$rcpt_defer_count</varname></primary>
16970 </indexterm>
16971 <indexterm role="concept">
16972 <primary>4<emphasis>xx</emphasis> responses</primary>
16973 <secondary>count of</secondary>
16974 </indexterm>
16975 When a message is being received by SMTP, this variable contains the number of
16976 RCPT commands in the current message that have previously been rejected with a
16977 temporary (4<emphasis>xx</emphasis>) response.
16978 </para>
16979 </listitem></varlistentry>
16980 <varlistentry>
16981 <term><varname>$rcpt_fail_count</varname></term>
16982 <listitem>
16983 <para>
16984 <indexterm role="variable">
16985 <primary><varname>$rcpt_fail_count</varname></primary>
16986 </indexterm>
16987 When a message is being received by SMTP, this variable contains the number of
16988 RCPT commands in the current message that have previously been rejected with a
16989 permanent (5<emphasis>xx</emphasis>) response.
16990 </para>
16991 </listitem></varlistentry>
16992 <varlistentry>
16993 <term><varname>$received_count</varname></term>
16994 <listitem>
16995 <para>
16996 <indexterm role="variable">
16997 <primary><varname>$received_count</varname></primary>
16998 </indexterm>
16999 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17000 including the one added by Exim (so its value is always greater than zero). It
17001 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17002 delivering.
17003 </para>
17004 </listitem></varlistentry>
17005 <varlistentry>
17006 <term><varname>$received_for</varname></term>
17007 <listitem>
17008 <para>
17009 <indexterm role="variable">
17010 <primary><varname>$received_for</varname></primary>
17011 </indexterm>
17012 If there is only a single recipient address in an incoming message, this
17013 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17014 built. The value is copied after recipient rewriting has happened, but before
17015 the <function>local_scan()</function> function is run.
17016 </para>
17017 </listitem></varlistentry>
17018 <varlistentry>
17019 <term><varname>$received_ip_address</varname></term>
17020 <listitem>
17021 <para>
17022 <indexterm role="variable">
17023 <primary><varname>$received_ip_address</varname></primary>
17024 </indexterm>
17025 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17026 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17027 is set to the local port number. (The remote IP address and port are in
17028 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17029 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17030 option.
17031 </para>
17032 <para>
17033 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17034 could be used, for example, to make the file name for a TLS certificate depend
17035 on which interface and/or port is being used for the incoming connection. The
17036 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17037 messages that are received, thus making these variables available at delivery
17038 time.
17039 </para>
17040 <para>
17041 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17042 the values are unknown (unless they are explicitly set by options of the
17043 <command>smtp</command> transport).
17044 </para>
17045 </listitem></varlistentry>
17046 <varlistentry>
17047 <term><varname>$received_port</varname></term>
17048 <listitem>
17049 <para>
17050 <indexterm role="variable">
17051 <primary><varname>$received_port</varname></primary>
17052 </indexterm>
17053 See <varname>$received_ip_address</varname>.
17054 </para>
17055 </listitem></varlistentry>
17056 <varlistentry>
17057 <term><varname>$received_protocol</varname></term>
17058 <listitem>
17059 <para>
17060 <indexterm role="variable">
17061 <primary><varname>$received_protocol</varname></primary>
17062 </indexterm>
17063 When a message is being processed, this variable contains the name of the
17064 protocol by which it was received. Most of the names used by Exim are defined
17065 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17066 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17067 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17068 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17069 connection and the client was successfully authenticated.
17070 </para>
17071 <para>
17072 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17073 automatically set up on connection without the use of STARTTLS (see
17074 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17075 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17076 where the client initially uses EHLO, sets up an encrypted connection using
17077 STARTTLS, and then uses HELO afterwards.
17078 </para>
17079 <para>
17080 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17081 messages that are injected locally by trusted callers. This is commonly used to
17082 identify messages that are being re-injected after some kind of scanning.
17083 </para>
17084 </listitem></varlistentry>
17085 <varlistentry>
17086 <term><varname>$received_time</varname></term>
17087 <listitem>
17088 <para>
17089 <indexterm role="variable">
17090 <primary><varname>$received_time</varname></primary>
17091 </indexterm>
17092 This variable contains the date and time when the current message was received,
17093 as a number of seconds since the start of the Unix epoch.
17094 </para>
17095 </listitem></varlistentry>
17096 <varlistentry>
17097 <term><varname>$recipient_data</varname></term>
17098 <listitem>
17099 <para>
17100 <indexterm role="variable">
17101 <primary><varname>$recipient_data</varname></primary>
17102 </indexterm>
17103 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17104 condition. It contains the data from the lookup, and the value remains set
17105 until the next <option>recipients</option> test. Thus, you can do things like this:
17106 </para>
17107 <literallayout>
17108 <literal>require recipients  = cdb*@;/some/file</literal>
17109 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17110 </literallayout>
17111 <para>
17112 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17113 method in the address list, using the semicolon syntax as in the example above.
17114 The variable is not set for a lookup that is used as part of the string
17115 expansion that all such lists undergo before being interpreted.
17116 </para>
17117 </listitem></varlistentry>
17118 <varlistentry>
17119 <term><varname>$recipient_verify_failure</varname></term>
17120 <listitem>
17121 <para>
17122 <indexterm role="variable">
17123 <primary><varname>$recipient_verify_failure</varname></primary>
17124 </indexterm>
17125 In an ACL, when a recipient verification fails, this variable contains
17126 information about the failure. It is set to one of the following words:
17127 </para>
17128 <itemizedlist>
17129 <listitem>
17130 <para>
17131 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17132 was neither local nor came from an exempted host.
17133 </para>
17134 </listitem>
17135 <listitem>
17136 <para>
17137 <quote>route</quote>: Routing failed.
17138 </para>
17139 </listitem>
17140 <listitem>
17141 <para>
17142 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17143 or before the MAIL command (that is, on initial connection, HELO, or
17144 MAIL).
17145 </para>
17146 </listitem>
17147 <listitem>
17148 <para>
17149 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17150 </para>
17151 </listitem>
17152 <listitem>
17153 <para>
17154 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17155 </para>
17156 </listitem>
17157 </itemizedlist>
17158 <para>
17159 The main use of this variable is expected to be to distinguish between
17160 rejections of MAIL and rejections of RCPT.
17161 </para>
17162 </listitem></varlistentry>
17163 <varlistentry>
17164 <term><varname>$recipients</varname></term>
17165 <listitem>
17166 <para>
17167 <indexterm role="variable">
17168 <primary><varname>$recipients</varname></primary>
17169 </indexterm>
17170 This variable contains a list of envelope recipients for a message. A comma and
17171 a space separate the addresses in the replacement text. However, the variable
17172 is not generally available, to prevent exposure of Bcc recipients in
17173 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
17174 cases:
17175 </para>
17176 <orderedlist numeration="arabic">
17177 <listitem>
17178 <para>
17179 In a system filter file.
17180 </para>
17181 </listitem>
17182 <listitem>
17183 <para>
17184 In the ACLs associated with the DATA command and with non-SMTP messages, that
17185 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17186 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17187 <option>acl_not_smtp_mime</option>.
17188 </para>
17189 </listitem>
17190 <listitem>
17191 <para revisionflag="changed">
17192 From within a <function>local_scan()</function> function.
17193 </para>
17194 </listitem>
17195 </orderedlist>
17196 </listitem></varlistentry>
17197 <varlistentry>
17198 <term><varname>$recipients_count</varname></term>
17199 <listitem>
17200 <para>
17201 <indexterm role="variable">
17202 <primary><varname>$recipients_count</varname></primary>
17203 </indexterm>
17204 When a message is being processed, this variable contains the number of
17205 envelope recipients that came with the message. Duplicates are not excluded
17206 from the count. While a message is being received over SMTP, the number
17207 increases for each accepted recipient. It can be referenced in an ACL.
17208 </para>
17209 </listitem></varlistentry>
17210 <varlistentry>
17211 <term><varname>$regex_match_string</varname></term>
17212 <listitem>
17213 <para>
17214 <indexterm role="variable">
17215 <primary><varname>$regex_match_string</varname></primary>
17216 </indexterm>
17217 This variable is set to contain the matching regular expression after a
17218 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17219 </para>
17220 </listitem></varlistentry>
17221 <varlistentry>
17222 <term><varname>$reply_address</varname></term>
17223 <listitem>
17224 <para>
17225 <indexterm role="variable">
17226 <primary><varname>$reply_address</varname></primary>
17227 </indexterm>
17228 When a message is being processed, this variable contains the contents of the
17229 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17230 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17231 white space, the value is not processed in any way. In particular, no RFC 2047
17232 decoding or character code translation takes place.
17233 </para>
17234 </listitem></varlistentry>
17235 <varlistentry>
17236 <term><varname>$return_path</varname></term>
17237 <listitem>
17238 <para>
17239 <indexterm role="variable">
17240 <primary><varname>$return_path</varname></primary>
17241 </indexterm>
17242 When a message is being delivered, this variable contains the return path &ndash;
17243 the sender field that will be sent as part of the envelope. It is not enclosed
17244 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
17245 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17246 mailing list has been expanded by a router which specifies a different address
17247 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17248 address, whereas <varname>$sender_address</varname> always contains the original sender address
17249 that was received with the message. In other words, <varname>$sender_address</varname> contains
17250 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17251 envelope sender.
17252 </para>
17253 </listitem></varlistentry>
17254 <varlistentry>
17255 <term><varname>$return_size_limit</varname></term>
17256 <listitem>
17257 <para>
17258 <indexterm role="variable">
17259 <primary><varname>$return_size_limit</varname></primary>
17260 </indexterm>
17261 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17262 </para>
17263 </listitem></varlistentry>
17264 <varlistentry>
17265 <term><varname>$runrc</varname></term>
17266 <listitem>
17267 <para>
17268 <indexterm role="concept">
17269 <primary>return code</primary>
17270 <secondary>from <option>run</option> expansion</secondary>
17271 </indexterm>
17272 <indexterm role="variable">
17273 <primary><varname>$runrc</varname></primary>
17274 </indexterm>
17275 This variable contains the return code from a command that is run by the
17276 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17277 assume the order in which option values are expanded, except for those
17278 preconditions whose order of testing is documented. Therefore, you cannot
17279 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17280 another.
17281 </para>
17282 </listitem></varlistentry>
17283 <varlistentry>
17284 <term><varname>$self_hostname</varname></term>
17285 <listitem>
17286 <para>
17287 <indexterm role="option">
17288 <primary><option>self</option></primary>
17289 <secondary>value of host name</secondary>
17290 </indexterm>
17291 <indexterm role="variable">
17292 <primary><varname>$self_hostname</varname></primary>
17293 </indexterm>
17294 When an address is routed to a supposedly remote host that turns out to be the
17295 local host, what happens is controlled by the <option>self</option> generic router option.
17296 One of its values causes the address to be passed to another router. When this
17297 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17298 original router encountered. In other circumstances its contents are null.
17299 </para>
17300 </listitem></varlistentry>
17301 <varlistentry>
17302 <term><varname>$sender_address</varname></term>
17303 <listitem>
17304 <para>
17305 <indexterm role="variable">
17306 <primary><varname>$sender_address</varname></primary>
17307 </indexterm>
17308 When a message is being processed, this variable contains the sender&#x2019;s address
17309 that was received in the message&#x2019;s envelope. The case of letters in the address
17310 is retained, in both the local part and the domain. For bounce messages, the
17311 value of this variable is the empty string. See also <varname>$return_path</varname>.
17312 </para>
17313 </listitem></varlistentry>
17314 <varlistentry>
17315 <term><varname>$sender_address_data</varname></term>
17316 <listitem>
17317 <para>
17318 <indexterm role="variable">
17319 <primary><varname>$address_data</varname></primary>
17320 </indexterm>
17321 <indexterm role="variable">
17322 <primary><varname>$sender_address_data</varname></primary>
17323 </indexterm>
17324 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17325 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17326 distinguish it from data from a recipient address. The value does not persist
17327 after the end of the current ACL statement. If you want to preserve it for
17328 longer, you can save it in an ACL variable.
17329 </para>
17330 </listitem></varlistentry>
17331 <varlistentry>
17332 <term><varname>$sender_address_domain</varname></term>
17333 <listitem>
17334 <para>
17335 <indexterm role="variable">
17336 <primary><varname>$sender_address_domain</varname></primary>
17337 </indexterm>
17338 The domain portion of <varname>$sender_address</varname>.
17339 </para>
17340 </listitem></varlistentry>
17341 <varlistentry>
17342 <term><varname>$sender_address_local_part</varname></term>
17343 <listitem>
17344 <para>
17345 <indexterm role="variable">
17346 <primary><varname>$sender_address_local_part</varname></primary>
17347 </indexterm>
17348 The local part portion of <varname>$sender_address</varname>.
17349 </para>
17350 </listitem></varlistentry>
17351 <varlistentry>
17352 <term><varname>$sender_data</varname></term>
17353 <listitem>
17354 <para>
17355 <indexterm role="variable">
17356 <primary><varname>$sender_data</varname></primary>
17357 </indexterm>
17358 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17359 in a router <option>senders</option> option. It contains the data from the lookup, and the
17360 value remains set until the next <option>senders</option> test. Thus, you can do things like
17361 this:
17362 </para>
17363 <literallayout>
17364 <literal>require senders      = cdb*@;/some/file</literal>
17365 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17366 </literallayout>
17367 <para>
17368 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17369 method in the address list, using the semicolon syntax as in the example above.
17370 The variable is not set for a lookup that is used as part of the string
17371 expansion that all such lists undergo before being interpreted.
17372 </para>
17373 </listitem></varlistentry>
17374 <varlistentry>
17375 <term><varname>$sender_fullhost</varname></term>
17376 <listitem>
17377 <para>
17378 <indexterm role="variable">
17379 <primary><varname>$sender_fullhost</varname></primary>
17380 </indexterm>
17381 When a message is received from a remote host, this variable contains the host
17382 name and IP address in a single string. It ends with the IP address in square
17383 brackets, followed by a colon and a port number if the logging of ports is
17384 enabled. The format of the rest of the string depends on whether the host
17385 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17386 looking up its IP address. (Looking up the IP address can be forced by the
17387 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17388 start of the string is a verified host name; if this is not present,
17389 verification either failed or was not requested. A host name in parentheses is
17390 the argument of a HELO or EHLO command. This is omitted if it is identical to
17391 the verified host name or to the host&#x2019;s IP address in square brackets.
17392 </para>
17393 </listitem></varlistentry>
17394 <varlistentry>
17395 <term><varname>$sender_helo_name</varname></term>
17396 <listitem>
17397 <para>
17398 <indexterm role="variable">
17399 <primary><varname>$sender_helo_name</varname></primary>
17400 </indexterm>
17401 When a message is received from a remote host that has issued a HELO or EHLO
17402 command, the argument of that command is placed in this variable. It is also
17403 set if HELO or EHLO is used when a message is received using SMTP locally via
17404 the <option>-bs</option> or <option>-bS</option> options.
17405 </para>
17406 </listitem></varlistentry>
17407 <varlistentry>
17408 <term><varname>$sender_host_address</varname></term>
17409 <listitem>
17410 <para>
17411 <indexterm role="variable">
17412 <primary><varname>$sender_host_address</varname></primary>
17413 </indexterm>
17414 When a message is received from a remote host, this variable contains that
17415 host&#x2019;s IP address. For locally submitted messages, it is empty.
17416 </para>
17417 </listitem></varlistentry>
17418 <varlistentry>
17419 <term><varname>$sender_host_authenticated</varname></term>
17420 <listitem>
17421 <para>
17422 <indexterm role="variable">
17423 <primary><varname>$sender_host_authenticated</varname></primary>
17424 </indexterm>
17425 This variable contains the name (not the public name) of the authenticator
17426 driver that successfully authenticated the client from which the message was
17427 received. It is empty if there was no successful authentication. See also
17428 <varname>$authenticated_id</varname>.
17429 </para>
17430 </listitem></varlistentry>
17431 <varlistentry>
17432 <term><varname>$sender_host_name</varname></term>
17433 <listitem>
17434 <para>
17435 <indexterm role="variable">
17436 <primary><varname>$sender_host_name</varname></primary>
17437 </indexterm>
17438 When a message is received from a remote host, this variable contains the
17439 host&#x2019;s name as obtained by looking up its IP address. For messages received by
17440 other means, this variable is empty.
17441 </para>
17442 <para>
17443 <indexterm role="variable">
17444 <primary><varname>$host_lookup_failed</varname></primary>
17445 </indexterm>
17446 If the host name has not previously been looked up, a reference to
17447 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17448 A looked up name is accepted only if it leads back to the original IP address
17449 via a forward lookup. If either the reverse or the forward lookup fails to find
17450 any data, or if the forward lookup does not yield the original IP address,
17451 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17452 </para>
17453 <para>
17454 <indexterm role="variable">
17455 <primary><varname>$host_lookup_deferred</varname></primary>
17456 </indexterm>
17457 However, if either of the lookups cannot be completed (for example, there is a
17458 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17459 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17460 </para>
17461 <para>
17462 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17463 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17464 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17465 is set to <quote>1</quote>.
17466 </para>
17467 <para>
17468 Exim does not automatically look up every calling host&#x2019;s name. If you want
17469 maximum efficiency, you should arrange your configuration so that it avoids
17470 these lookups altogether. The lookup happens only if one or more of the
17471 following are true:
17472 </para>
17473 <itemizedlist>
17474 <listitem>
17475 <para>
17476 A string containing <varname>$sender_host_name</varname> is expanded.
17477 </para>
17478 </listitem>
17479 <listitem>
17480 <para>
17481 The calling host matches the list in <option>host_lookup</option>. In the default
17482 configuration, this option is set to *, so it must be changed if lookups are
17483 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17484 </para>
17485 </listitem>
17486 <listitem>
17487 <para>
17488 Exim needs the host name in order to test an item in a host list. The items
17489 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17490 <xref linkend="SECThoslispatnamsk"/>.
17491 </para>
17492 </listitem>
17493 <listitem>
17494 <para>
17495 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17496 In this case, the host name is required to compare with the name quoted in any
17497 EHLO or HELO commands that the client issues.
17498 </para>
17499 </listitem>
17500 <listitem>
17501 <para>
17502 The remote host issues a EHLO or HELO command that quotes one of the
17503 domains in <option>helo_lookup_domains</option>. The default value of this option is
17504 </para>
17505 <literallayout class="monospaced">
17506   helo_lookup_domains = @ : @[]
17507 </literallayout>
17508 <para>
17509 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
17510 IP address in an EHLO or HELO command.
17511 </para>
17512 </listitem>
17513 </itemizedlist>
17514 </listitem></varlistentry>
17515 <varlistentry>
17516 <term><varname>$sender_host_port</varname></term>
17517 <listitem>
17518 <para>
17519 <indexterm role="variable">
17520 <primary><varname>$sender_host_port</varname></primary>
17521 </indexterm>
17522 When a message is received from a remote host, this variable contains the port
17523 number that was used on the remote host.
17524 </para>
17525 </listitem></varlistentry>
17526 <varlistentry>
17527 <term><varname>$sender_ident</varname></term>
17528 <listitem>
17529 <para>
17530 <indexterm role="variable">
17531 <primary><varname>$sender_ident</varname></primary>
17532 </indexterm>
17533 When a message is received from a remote host, this variable contains the
17534 identification received in response to an RFC 1413 request. When a message has
17535 been received locally, this variable contains the login name of the user that
17536 called Exim.
17537 </para>
17538 </listitem></varlistentry>
17539 <varlistentry>
17540 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17541 <listitem>
17542 <para>
17543 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17544 <option>ratelimit</option> ACL condition. Details are given in section
17545 <xref linkend="SECTratelimiting"/>.
17546 </para>
17547 </listitem></varlistentry>
17548 <varlistentry>
17549 <term><varname>$sender_rcvhost</varname></term>
17550 <listitem>
17551 <para>
17552 <indexterm role="concept">
17553 <primary>DNS</primary>
17554 <secondary>reverse lookup</secondary>
17555 </indexterm>
17556 <indexterm role="concept">
17557 <primary>reverse DNS lookup</primary>
17558 </indexterm>
17559 <indexterm role="variable">
17560 <primary><varname>$sender_rcvhost</varname></primary>
17561 </indexterm>
17562 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17563 either the verified host name (as obtained from a reverse DNS lookup) or, if
17564 there is no verified host name, the IP address in square brackets. After that
17565 there may be text in parentheses. When the first item is a verified host name,
17566 the first thing in the parentheses is the IP address in square brackets,
17567 followed by a colon and a port number if port logging is enabled. When the
17568 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17569 the parentheses.
17570 </para>
17571 <para>
17572 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17573 was used and its argument was not identical to the real host name or IP
17574 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17575 all three items are present in the parentheses, a newline and tab are inserted
17576 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17577 </para>
17578 </listitem></varlistentry>
17579 <varlistentry>
17580 <term><varname>$sender_verify_failure</varname></term>
17581 <listitem>
17582 <para>
17583 <indexterm role="variable">
17584 <primary><varname>$sender_verify_failure</varname></primary>
17585 </indexterm>
17586 In an ACL, when a sender verification fails, this variable contains information
17587 about the failure. The details are the same as for
17588 <varname>$recipient_verify_failure</varname>.
17589 </para>
17590 </listitem></varlistentry>
17591 <varlistentry revisionflag="changed">
17592 <term><varname>$sending_ip_address</varname></term>
17593 <listitem>
17594 <para revisionflag="changed">
17595 <indexterm role="variable">
17596 <primary><varname>$sending_ip_address</varname></primary>
17597 </indexterm>
17598 This variable is set whenever an outgoing SMTP connection to another host has
17599 been set up. It contains the IP address of the local interface that is being
17600 used. This is useful if a host that has more than one IP address wants to take
17601 on different personalities depending on which one is being used. For incoming
17602 connections, see <varname>$received_ip_address</varname>.
17603 </para>
17604 </listitem></varlistentry>
17605 <varlistentry revisionflag="changed">
17606 <term><varname>$sending_port</varname></term>
17607 <listitem>
17608 <para revisionflag="changed">
17609 <indexterm role="variable">
17610 <primary><varname>$sending_port</varname></primary>
17611 </indexterm>
17612 This variable is set whenever an outgoing SMTP connection to another host has
17613 been set up. It contains the local port that is being used. For incoming
17614 connections, see <varname>$received_port</varname>.
17615 </para>
17616 </listitem></varlistentry>
17617 <varlistentry>
17618 <term><varname>$smtp_active_hostname</varname></term>
17619 <listitem>
17620 <para>
17621 <indexterm role="variable">
17622 <primary><varname>$smtp_active_hostname</varname></primary>
17623 </indexterm>
17624 During an incoming SMTP session, this variable contains the value of the active
17625 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
17626 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17627 value can be consulted during routing and delivery.
17628 </para>
17629 </listitem></varlistentry>
17630 <varlistentry>
17631 <term><varname>$smtp_command</varname></term>
17632 <listitem>
17633 <para>
17634 <indexterm role="variable">
17635 <primary><varname>$smtp_command</varname></primary>
17636 </indexterm>
17637 During the processing of an incoming SMTP command, this variable contains the
17638 entire command. This makes it possible to distinguish between HELO and EHLO in
17639 the HELO ACL, and also to distinguish between commands such as these:
17640 </para>
17641 <literallayout class="monospaced">
17642 MAIL FROM:&lt;&gt;
17643 MAIL FROM: &lt;&gt;
17644 </literallayout>
17645 <para>
17646 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17647 command, the address in <varname>$smtp_command</varname> is the original address before any
17648 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17649 the address after SMTP-time rewriting.
17650 </para>
17651 </listitem></varlistentry>
17652 <varlistentry>
17653 <term><varname>$smtp_command_argument</varname></term>
17654 <listitem>
17655 <para>
17656 <indexterm role="concept">
17657 <primary>SMTP</primary>
17658 <secondary>command, argument for</secondary>
17659 </indexterm>
17660 <indexterm role="variable">
17661 <primary><varname>$smtp_command_argument</varname></primary>
17662 </indexterm>
17663 While an ACL is running to check an SMTP command, this variable contains the
17664 argument, that is, the text that follows the command name, with leading white
17665 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17666 somewhat redundant, but is retained for backwards compatibility.
17667 </para>
17668 </listitem></varlistentry>
17669 <varlistentry revisionflag="changed">
17670 <term><varname>$smtp_count_at_connection_start</varname></term>
17671 <listitem>
17672 <para revisionflag="changed">
17673 <indexterm role="variable">
17674 <primary><varname>$smtp_count_at_connection_start</varname></primary>
17675 </indexterm>
17676 This variable is set greater than zero only in processes spawned by the Exim
17677 daemon for handling incoming SMTP connections. The name is deliberately long,
17678 in order to emphasize what the contents are. When the daemon accepts a new
17679 connection, it increments this variable. A copy of the variable is passed to
17680 the child process that handles the connection, but its value is fixed, and
17681 never changes. It is only an approximation of how many incoming connections
17682 there actually are, because many other connections may come and go while a
17683 single connection is being processed. When a child process terminates, the
17684 daemon decrements its copy of the variable.
17685 </para>
17686 </listitem></varlistentry>
17687 <varlistentry>
17688 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
17689 <listitem>
17690 <para>
17691 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
17692 that were current at the end of the system filter file. This allows a system
17693 filter file to set values that can be tested in users&#x2019; filter files. For
17694 example, a system filter could set a value indicating how likely it is that a
17695 message is junk mail.
17696 </para>
17697 </listitem></varlistentry>
17698 <varlistentry>
17699 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17700 <listitem>
17701 <para>
17702 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17703 is compiled with the content-scanning extension. For details, see section
17704 <xref linkend="SECTscanspamass"/>.
17705 </para>
17706 </listitem></varlistentry>
17707 <varlistentry>
17708 <term><varname>$spool_directory</varname></term>
17709 <listitem>
17710 <para>
17711 <indexterm role="variable">
17712 <primary><varname>$spool_directory</varname></primary>
17713 </indexterm>
17714 The name of Exim&#x2019;s spool directory.
17715 </para>
17716 </listitem></varlistentry>
17717 <varlistentry>
17718 <term><varname>$spool_inodes</varname></term>
17719 <listitem>
17720 <para>
17721 <indexterm role="variable">
17722 <primary><varname>$spool_inodes</varname></primary>
17723 </indexterm>
17724 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
17725 being written. The value is recalculated whenever the variable is referenced.
17726 If the relevant file system does not have the concept of inodes, the value of
17727 is -1. See also the <option>check_spool_inodes</option> option.
17728 </para>
17729 </listitem></varlistentry>
17730 <varlistentry>
17731 <term><varname>$spool_space</varname></term>
17732 <listitem>
17733 <para>
17734 <indexterm role="variable">
17735 <primary><varname>$spool_space</varname></primary>
17736 </indexterm>
17737 The amount of free space (as a number of kilobytes) in the disk partition where
17738 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
17739 variable is referenced. If the operating system does not have the ability to
17740 find the amount of free space (only true for experimental systems), the space
17741 value is -1. For example, to check in an ACL that there is at least 50
17742 megabytes free on the spool, you could write:
17743 </para>
17744 <literallayout class="monospaced">
17745 condition = ${if &gt; {$spool_space}{50000}}
17746 </literallayout>
17747 <para>
17748 See also the <option>check_spool_space</option> option.
17749 </para>
17750 </listitem></varlistentry>
17751 <varlistentry>
17752 <term><varname>$thisaddress</varname></term>
17753 <listitem>
17754 <para>
17755 <indexterm role="variable">
17756 <primary><varname>$thisaddress</varname></primary>
17757 </indexterm>
17758 This variable is set only during the processing of the <option>foranyaddress</option>
17759 command in a filter file. Its use is explained in the description of that
17760 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
17761 interfaces to mail filtering</emphasis>.
17762 </para>
17763 </listitem></varlistentry>
17764 <varlistentry>
17765 <term><varname>$tls_certificate_verified</varname></term>
17766 <listitem>
17767 <para>
17768 <indexterm role="variable">
17769 <primary><varname>$tls_certificate_verified</varname></primary>
17770 </indexterm>
17771 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17772 message was received, and <quote>0</quote> otherwise.
17773 </para>
17774 </listitem></varlistentry>
17775 <varlistentry>
17776 <term><varname>$tls_cipher</varname></term>
17777 <listitem>
17778 <para>
17779 <indexterm role="variable">
17780 <primary><varname>$tls_cipher</varname></primary>
17781 </indexterm>
17782 When a message is received from a remote host over an encrypted SMTP
17783 connection, this variable is set to the cipher suite that was negotiated, for
17784 example DES-CBC3-SHA. In other circumstances, in particular, for message
17785 received over unencrypted connections, the variable is empty. See chapter
17786 <xref linkend="CHAPTLS"/> for details of TLS support.
17787 </para>
17788 </listitem></varlistentry>
17789 <varlistentry>
17790 <term><varname>$tls_peerdn</varname></term>
17791 <listitem>
17792 <para>
17793 <indexterm role="variable">
17794 <primary><varname>$tls_peerdn</varname></primary>
17795 </indexterm>
17796 When a message is received from a remote host over an encrypted SMTP
17797 connection, and Exim is configured to request a certificate from the client,
17798 the value of the Distinguished Name of the certificate is made available in the
17799 <varname>$tls_peerdn</varname> during subsequent processing.
17800 </para>
17801 </listitem></varlistentry>
17802 <varlistentry>
17803 <term><varname>$tod_bsdinbox</varname></term>
17804 <listitem>
17805 <para>
17806 <indexterm role="variable">
17807 <primary><varname>$tod_bsdinbox</varname></primary>
17808 </indexterm>
17809 The time of day and the date, in the format required for BSD-style mailbox
17810 files, for example: Thu Oct 17 17:14:09 1995.
17811 </para>
17812 </listitem></varlistentry>
17813 <varlistentry>
17814 <term><varname>$tod_epoch</varname></term>
17815 <listitem>
17816 <para>
17817 <indexterm role="variable">
17818 <primary><varname>$tod_epoch</varname></primary>
17819 </indexterm>
17820 The time and date as a number of seconds since the start of the Unix epoch.
17821 </para>
17822 </listitem></varlistentry>
17823 <varlistentry>
17824 <term><varname>$tod_full</varname></term>
17825 <listitem>
17826 <para>
17827 <indexterm role="variable">
17828 <primary><varname>$tod_full</varname></primary>
17829 </indexterm>
17830 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
17831 +0100. The timezone is always given as a numerical offset from UTC, with
17832 positive values used for timezones that are ahead (east) of UTC, and negative
17833 values for those that are behind (west).
17834 </para>
17835 </listitem></varlistentry>
17836 <varlistentry>
17837 <term><varname>$tod_log</varname></term>
17838 <listitem>
17839 <para>
17840 <indexterm role="variable">
17841 <primary><varname>$tod_log</varname></primary>
17842 </indexterm>
17843 The time and date in the format used for writing Exim&#x2019;s log files, for example:
17844 1995-10-12 15:32:29, but without a timezone.
17845 </para>
17846 </listitem></varlistentry>
17847 <varlistentry>
17848 <term><varname>$tod_logfile</varname></term>
17849 <listitem>
17850 <para>
17851 <indexterm role="variable">
17852 <primary><varname>$tod_logfile</varname></primary>
17853 </indexterm>
17854 This variable contains the date in the format yyyymmdd. This is the format that
17855 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
17856 flag.
17857 </para>
17858 </listitem></varlistentry>
17859 <varlistentry>
17860 <term><varname>$tod_zone</varname></term>
17861 <listitem>
17862 <para>
17863 <indexterm role="variable">
17864 <primary><varname>$tod_zone</varname></primary>
17865 </indexterm>
17866 This variable contains the numerical value of the local timezone, for example:
17867 -0500.
17868 </para>
17869 </listitem></varlistentry>
17870 <varlistentry>
17871 <term><varname>$tod_zulu</varname></term>
17872 <listitem>
17873 <para>
17874 <indexterm role="variable">
17875 <primary><varname>$tod_zulu</varname></primary>
17876 </indexterm>
17877 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
17878 by ISO 8601, for example: 20030221154023Z.
17879 </para>
17880 </listitem></varlistentry>
17881 <varlistentry>
17882 <term><varname>$value</varname></term>
17883 <listitem>
17884 <para>
17885 <indexterm role="variable">
17886 <primary><varname>$value</varname></primary>
17887 </indexterm>
17888 This variable contains the result of an expansion lookup, extraction operation,
17889 or external command, as described above. <phrase revisionflag="changed">It is also used during a
17890 <emphasis role="bold">reduce</emphasis> expansion.</phrase>
17891 </para>
17892 </listitem></varlistentry>
17893 <varlistentry>
17894 <term><varname>$version_number</varname></term>
17895 <listitem>
17896 <para>
17897 <indexterm role="variable">
17898 <primary><varname>$version_number</varname></primary>
17899 </indexterm>
17900 The version number of Exim.
17901 </para>
17902 </listitem></varlistentry>
17903 <varlistentry>
17904 <term><varname>$warn_message_delay</varname></term>
17905 <listitem>
17906 <para>
17907 <indexterm role="variable">
17908 <primary><varname>$warn_message_delay</varname></primary>
17909 </indexterm>
17910 This variable is set only during the creation of a message warning about a
17911 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17912 </para>
17913 </listitem></varlistentry>
17914 <varlistentry>
17915 <term><varname>$warn_message_recipients</varname></term>
17916 <listitem>
17917 <para>
17918 <indexterm role="variable">
17919 <primary><varname>$warn_message_recipients</varname></primary>
17920 </indexterm>
17921 This variable is set only during the creation of a message warning about a
17922 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17923 </para>
17924 </listitem></varlistentry>
17925 </variablelist>
17926 <para>
17927 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
17928 </para>
17929 </section>
17930 </chapter>
17931
17932 <chapter id="CHAPperl">
17933 <title>Embedded Perl</title>
17934 <para>
17935 <indexterm role="concept" id="IIDperl" class="startofrange">
17936 <primary>Perl</primary>
17937 <secondary>calling from Exim</secondary>
17938 </indexterm>
17939 Exim can be built to include an embedded Perl interpreter. When this is done,
17940 Perl subroutines can be called as part of the string expansion process. To make
17941 use of the Perl support, you need version 5.004 or later of Perl installed on
17942 your system. To include the embedded interpreter in the Exim binary, include
17943 the line
17944 </para>
17945 <literallayout class="monospaced">
17946 EXIM_PERL = perl.o
17947 </literallayout>
17948 <para>
17949 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
17950 </para>
17951 <section id="SECID85">
17952 <title>Setting up so Perl can be used</title>
17953 <para>
17954 <indexterm role="option">
17955 <primary><option>perl_startup</option></primary>
17956 </indexterm>
17957 Access to Perl subroutines is via a global configuration option called
17958 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
17959 no <option>perl_startup</option> option in the Exim configuration file then no Perl
17960 interpreter is started and there is almost no overhead for Exim (since none of
17961 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
17962 option then the associated value is taken to be Perl code which is executed in
17963 a newly created Perl interpreter.
17964 </para>
17965 <para>
17966 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
17967 need backslashes before any characters to escape special meanings. The option
17968 should usually be something like
17969 </para>
17970 <literallayout class="monospaced">
17971 perl_startup = do '/etc/exim.pl'
17972 </literallayout>
17973 <para>
17974 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
17975 use from Exim. Exim can be configured either to start up a Perl interpreter as
17976 soon as it is entered, or to wait until the first time it is needed. Starting
17977 the interpreter at the beginning ensures that it is done while Exim still has
17978 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
17979 fact used in a particular run. Also, note that this does not mean that Exim is
17980 necessarily running as root when Perl is called at a later time. By default,
17981 the interpreter is started only when it is needed, but this can be changed in
17982 two ways:
17983 </para>
17984 <itemizedlist>
17985 <listitem>
17986 <para>
17987 <indexterm role="option">
17988 <primary><option>perl_at_start</option></primary>
17989 </indexterm>
17990 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
17991 a startup when Exim is entered.
17992 </para>
17993 </listitem>
17994 <listitem>
17995 <para>
17996 The command line option <option>-ps</option> also requests a startup when Exim is entered,
17997 overriding the setting of <option>perl_at_start</option>.
17998 </para>
17999 </listitem>
18000 </itemizedlist>
18001 <para>
18002 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18003 initial startup, even if <option>perl_at_start</option> is set.
18004 </para>
18005 </section>
18006 <section id="SECID86">
18007 <title>Calling Perl subroutines</title>
18008 <para>
18009 When the configuration file includes a <option>perl_startup</option> option you can make use
18010 of the string expansion item to call the Perl subroutines that are defined
18011 by the <option>perl_startup</option> code. The operator is used in any of the following
18012 forms:
18013 </para>
18014 <literallayout class="monospaced">
18015 ${perl{foo}}
18016 ${perl{foo}{argument}}
18017 ${perl{foo}{argument1}{argument2} ... }
18018 </literallayout>
18019 <para>
18020 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18021 arguments may be passed. Passing more than this results in an expansion failure
18022 with an error message of the form
18023 </para>
18024 <literallayout class="monospaced">
18025 Too many arguments passed to Perl subroutine "foo" (max is 8)
18026 </literallayout>
18027 <para>
18028 The return value of the Perl subroutine is evaluated in a scalar context before
18029 it is passed back to Exim to be inserted into the expanded string. If the
18030 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18031 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18032 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
18033 that was passed to <option>die</option>.
18034 </para>
18035 </section>
18036 <section id="SECID87">
18037 <title>Calling Exim functions from Perl</title>
18038 <para>
18039 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18040 is available to call back into Exim&#x2019;s string expansion function. For example,
18041 the Perl code
18042 </para>
18043 <literallayout class="monospaced">
18044 my $lp = Exim::expand_string('$local_part');
18045 </literallayout>
18046 <para>
18047 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18048 Note those are single quotes and not double quotes to protect against
18049 <varname>$local_part</varname> being interpolated as a Perl variable.
18050 </para>
18051 <para>
18052 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18053 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18054 expansion string, the Perl call from the original expansion string fails with
18055 an appropriate error message, in the same way as if <option>die</option> were used.
18056 </para>
18057 <para>
18058 <indexterm role="concept">
18059 <primary>debugging</primary>
18060 <secondary>from embedded Perl</secondary>
18061 </indexterm>
18062 <indexterm role="concept">
18063 <primary>log</primary>
18064 <secondary>writing from embedded Perl</secondary>
18065 </indexterm>
18066 Two other Exim functions are available for use from within Perl code.
18067 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
18068 debugging is enabled. If you want a newline at the end, you must supply it.
18069 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
18070 timestamp. In this case, you should not supply a terminating newline.
18071 </para>
18072 </section>
18073 <section id="SECID88">
18074 <title>Use of standard output and error by Perl</title>
18075 <para>
18076 <indexterm role="concept">
18077 <primary>Perl</primary>
18078 <secondary>standard output and error</secondary>
18079 </indexterm>
18080 You should not write to the standard error or output streams from within your
18081 Perl code, as it is not defined how these are set up. In versions of Exim
18082 before 4.50, it is possible for the standard output or error to refer to the
18083 SMTP connection during message reception via the daemon. Writing to this stream
18084 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18085 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18086 avoided, but the output is lost.
18087 </para>
18088 <para>
18089 <indexterm role="concept">
18090 <primary>Perl</primary>
18091 <secondary>use of <option>warn</option></secondary>
18092 </indexterm>
18093 The Perl <option>warn</option> statement writes to the standard error stream by default.
18094 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18095 you have no control. When Exim starts up the Perl interpreter, it arranges for
18096 output from the <option>warn</option> statement to be written to the Exim main log. You can
18097 change this by including appropriate Perl magic somewhere in your Perl code.
18098 For example, to discard <option>warn</option> output completely, you need this:
18099 </para>
18100 <literallayout class="monospaced">
18101 $SIG{__WARN__} = sub { };
18102 </literallayout>
18103 <para>
18104 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18105 example, the code for the subroutine is empty, so it does nothing, but you can
18106 include any Perl code that you like. The text of the <option>warn</option> message is passed
18107 as the first subroutine argument.
18108 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18109 </para>
18110 </section>
18111 </chapter>
18112
18113 <chapter id="CHAPinterfaces">
18114 <title>Starting the daemon and the use of network interfaces</title>
18115 <titleabbrev>Starting the daemon</titleabbrev>
18116 <para>
18117 <indexterm role="concept">
18118 <primary>daemon</primary>
18119 <secondary>starting</secondary>
18120 </indexterm>
18121 <indexterm role="concept">
18122 <primary>interface</primary>
18123 <secondary>listening</secondary>
18124 </indexterm>
18125 <indexterm role="concept">
18126 <primary>network interface</primary>
18127 </indexterm>
18128 <indexterm role="concept">
18129 <primary>interface</primary>
18130 <secondary>network</secondary>
18131 </indexterm>
18132 <indexterm role="concept">
18133 <primary>IP address</primary>
18134 <secondary>for listening</secondary>
18135 </indexterm>
18136 <indexterm role="concept">
18137 <primary>daemon</primary>
18138 <secondary>listening IP addresses</secondary>
18139 </indexterm>
18140 <indexterm role="concept">
18141 <primary>TCP/IP</primary>
18142 <secondary>setting listening interfaces</secondary>
18143 </indexterm>
18144 <indexterm role="concept">
18145 <primary>TCP/IP</primary>
18146 <secondary>setting listening ports</secondary>
18147 </indexterm>
18148 A host that is connected to a TCP/IP network may have one or more physical
18149 hardware network interfaces. Each of these interfaces may be configured as one
18150 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18151 works with. Each of these logical interfaces is associated with an IP address.
18152 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18153 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18154 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
18155 </para>
18156 <orderedlist numeration="arabic">
18157 <listitem>
18158 <para>
18159 When a listening daemon is started, Exim needs to know which interfaces
18160 and ports to listen on.
18161 </para>
18162 </listitem>
18163 <listitem>
18164 <para>
18165 When Exim is routing an address, it needs to know which IP addresses
18166 are associated with local interfaces. This is required for the correct
18167 processing of MX lists by removing the local host and others with the
18168 same or higher priority values. Also, Exim needs to detect cases
18169 when an address is routed to an IP address that in fact belongs to the
18170 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18171 option of the smtp transport is set (as appropriate), this is treated
18172 as an error situation.
18173 </para>
18174 </listitem>
18175 <listitem>
18176 <para>
18177 When Exim connects to a remote host, it may need to know which interface to use
18178 for the outgoing connection.
18179 </para>
18180 </listitem>
18181 </orderedlist>
18182 <para>
18183 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
18184 of cases. If your host has only one interface, and you want all its IP
18185 addresses to be treated in the same way, and you are using only the
18186 standard SMTP port, you should not need to take any special action. The
18187 rest of this chapter does not apply to you.
18188 </para>
18189 <para>
18190 In a more complicated situation you may want to listen only on certain
18191 interfaces, or on different ports, and for this reason there are a number of
18192 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
18193 chapter describes how they operate.
18194 </para>
18195 <para>
18196 When a message is received over TCP/IP, the interface and port that were
18197 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18198 </para>
18199 <section id="SECID89">
18200 <title>Starting a listening daemon</title>
18201 <para>
18202 When a listening daemon is started (by means of the <option>-bd</option> command line
18203 option), the interfaces and ports on which it listens are controlled by the
18204 following options:
18205 </para>
18206 <itemizedlist>
18207 <listitem>
18208 <para>
18209 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18210 compatibility, this option can also be specified in the singular.)
18211 </para>
18212 </listitem>
18213 <listitem>
18214 <para>
18215 <option>local_interfaces</option> contains list of interface IP addresses on which to
18216 listen. Each item may optionally also specify a port.
18217 </para>
18218 </listitem>
18219 </itemizedlist>
18220 <para>
18221 The default list separator in both cases is a colon, but this can be changed as
18222 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18223 it is usually best to change the separator to avoid having to double all the
18224 colons. For example:
18225 </para>
18226 <literallayout class="monospaced">
18227 local_interfaces = &lt;; 127.0.0.1 ; \
18228                       192.168.23.65 ; \
18229                       ::1 ; \
18230                       3ffe:ffff:836f::fe86:a061
18231 </literallayout>
18232 <para>
18233 There are two different formats for specifying a port along with an IP address
18234 in <option>local_interfaces</option>:
18235 </para>
18236 <orderedlist numeration="arabic">
18237 <listitem>
18238 <para>
18239 The port is added onto the address with a dot separator. For example, to listen
18240 on port 1234 on two different IP addresses:
18241 </para>
18242 <literallayout class="monospaced">
18243 local_interfaces = &lt;; 192.168.23.65.1234 ; \
18244                       3ffe:ffff:836f::fe86:a061.1234
18245 </literallayout>
18246 </listitem>
18247 <listitem>
18248 <para>
18249 The IP address is enclosed in square brackets, and the port is added
18250 with a colon separator, for example:
18251 </para>
18252 <literallayout class="monospaced">
18253 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
18254                       [3ffe:ffff:836f::fe86:a061]:1234
18255 </literallayout>
18256 </listitem>
18257 </orderedlist>
18258 <para>
18259 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18260 default setting contains just one port:
18261 </para>
18262 <literallayout class="monospaced">
18263 daemon_smtp_ports = smtp
18264 </literallayout>
18265 <para>
18266 If more than one port is listed, each interface that does not have its own port
18267 specified listens on all of them. Ports that are listed in
18268 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18269 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18270 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18271 </para>
18272 </section>
18273 <section id="SECID90">
18274 <title>Special IP listening addresses</title>
18275 <para>
18276 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18277 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18278 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18279 instead of setting up separate listening sockets for each interface. The
18280 default value of <option>local_interfaces</option> is
18281 </para>
18282 <literallayout class="monospaced">
18283 local_interfaces = 0.0.0.0
18284 </literallayout>
18285 <para>
18286 when Exim is built without IPv6 support; otherwise it is:
18287 </para>
18288 <literallayout class="monospaced">
18289 local_interfaces = &lt;; ::0 ; 0.0.0.0
18290 </literallayout>
18291 <para>
18292 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18293 </para>
18294 </section>
18295 <section id="SECID91">
18296 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18297 <para>
18298 The <option>-oX</option> command line option can be used to override the values of
18299 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18300 instance. Another way of doing this would be to use macros and the <option>-D</option>
18301 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18302 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18303 exim.
18304 </para>
18305 <para>
18306 The value of <option>-oX</option> is a list of items. The default colon separator can be
18307 changed in the usual way if required. If there are any items that do not
18308 contain dots or colons (that is, are not IP addresses), the value of
18309 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18310 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18311 replaced by those items. Thus, for example,
18312 </para>
18313 <literallayout class="monospaced">
18314 -oX 1225
18315 </literallayout>
18316 <para>
18317 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18318 whereas
18319 </para>
18320 <literallayout class="monospaced">
18321 -oX 192.168.34.5.1125
18322 </literallayout>
18323 <para>
18324 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18325 (However, since <option>local_interfaces</option> now contains no items without ports, the
18326 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18327 </para>
18328 </section>
18329 <section id="SECTsupobssmt">
18330 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18331 <para>
18332 <indexterm role="concept">
18333 <primary>ssmtp protocol</primary>
18334 </indexterm>
18335 <indexterm role="concept">
18336 <primary>smtps protocol</primary>
18337 </indexterm>
18338 <indexterm role="concept">
18339 <primary>SMTP</primary>
18340 <secondary>ssmtp protocol</secondary>
18341 </indexterm>
18342 <indexterm role="concept">
18343 <primary>SMTP</primary>
18344 <secondary>smtps protocol</secondary>
18345 </indexterm>
18346 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18347 before the STARTTLS command was standardized for SMTP. Some legacy clients
18348 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18349 list of port numbers, connections to those ports must use SSMTP. The most
18350 common use of this option is expected to be
18351 </para>
18352 <literallayout class="monospaced">
18353 tls_on_connect_ports = 465
18354 </literallayout>
18355 <para>
18356 because 465 is the usual port number used by the legacy clients. There is also
18357 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18358 this way when a daemon is started.
18359 </para>
18360 <para>
18361 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18362 daemon to listen on those ports. You must still specify them in
18363 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18364 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18365 connections via the daemon.)
18366 </para>
18367 </section>
18368 <section id="SECID92">
18369 <title>IPv6 address scopes</title>
18370 <para>
18371 <indexterm role="concept">
18372 <primary>IPv6</primary>
18373 <secondary>address scopes</secondary>
18374 </indexterm>
18375 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18376 can, in principle, have the same link-local IPv6 address on different
18377 interfaces. Thus, additional information is needed, over and above the IP
18378 address, to distinguish individual interfaces. A convention of using a
18379 percent sign followed by something (often the interface name) has been
18380 adopted in some cases, leading to addresses like this:
18381 </para>
18382 <literallayout class="monospaced">
18383 fe80::202:b3ff:fe03:45c1%eth0
18384 </literallayout>
18385 <para>
18386 To accommodate this usage, a percent sign followed by an arbitrary string is
18387 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18388 to convert a textual IPv6 address for actual use. This function recognizes the
18389 percent convention in operating systems that support it, and it processes the
18390 address appropriately. Unfortunately, some older libraries have problems with
18391 <function>getaddrinfo()</function>. If
18392 </para>
18393 <literallayout class="monospaced">
18394 IPV6_USE_INET_PTON=yes
18395 </literallayout>
18396 <para>
18397 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18398 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18399 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18400 function.) Of course, this means that the additional functionality of
18401 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
18402 </para>
18403 </section>
18404 <section id="SECID93">
18405 <title>Disabling IPv6</title>
18406 <para>
18407 <indexterm role="concept">
18408 <primary>IPv6</primary>
18409 <secondary>disabling</secondary>
18410 </indexterm>
18411 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18412 run on a host whose kernel does not support IPv6. The binary will fall back to
18413 using IPv4, but it may waste resources looking up AAAA records, and trying to
18414 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18415 <indexterm role="option">
18416 <primary><option>disable_ipv6</option></primary>
18417 </indexterm>
18418 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18419 activities take place. AAAA records are never looked up, and any IPv6 addresses
18420 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18421 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18422 to handle IPv6 literal addresses.
18423 </para>
18424 <para>
18425 On the other hand, when IPv6 is in use, there may be times when you want to
18426 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18427 option to globally suppress the lookup of AAAA records for specified domains,
18428 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18429 IPv6 addresses in an individual router.
18430 </para>
18431 </section>
18432 <section id="SECID94">
18433 <title>Examples of starting a listening daemon</title>
18434 <para>
18435 The default case in an IPv6 environment is
18436 </para>
18437 <literallayout class="monospaced">
18438 daemon_smtp_ports = smtp
18439 local_interfaces = &lt;; ::0 ; 0.0.0.0
18440 </literallayout>
18441 <para>
18442 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18443 Either one or two sockets may be used, depending on the characteristics of
18444 the TCP/IP stack. (This is complicated and messy; for more information,
18445 read the comments in the <filename>daemon.c</filename> source file.)
18446 </para>
18447 <para>
18448 To specify listening on ports 25 and 26 on all interfaces:
18449 </para>
18450 <literallayout class="monospaced">
18451 daemon_smtp_ports = 25 : 26
18452 </literallayout>
18453 <para>
18454 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18455 </para>
18456 <literallayout class="monospaced">
18457 local_interfaces = &lt;; ::0.25     ; ::0.26 \
18458                       0.0.0.0.25 ; 0.0.0.0.26
18459 </literallayout>
18460 <para>
18461 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18462 IPv4 loopback address only:
18463 </para>
18464 <literallayout class="monospaced">
18465 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18466 </literallayout>
18467 <para>
18468 To specify listening on the default port on specific interfaces only:
18469 </para>
18470 <literallayout class="monospaced">
18471 local_interfaces = 192.168.34.67 : 192.168.34.67
18472 </literallayout>
18473 <para>
18474 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18475 </para>
18476 </section>
18477 <section id="SECTreclocipadd">
18478 <title>Recognizing the local host</title>
18479 <para>
18480 The <option>local_interfaces</option> option is also used when Exim needs to determine
18481 whether or not an IP address refers to the local host. That is, the IP
18482 addresses of all the interfaces on which a daemon is listening are always
18483 treated as local.
18484 </para>
18485 <para>
18486 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18487 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18488 available interfaces from the operating system, and extracts the relevant
18489 (that is, IPv4 or IPv6) addresses to use for checking.
18490 </para>
18491 <para>
18492 Some systems set up large numbers of virtual interfaces in order to provide
18493 many virtual web servers. In this situation, you may want to listen for
18494 email on only a few of the available interfaces, but nevertheless treat all
18495 interfaces as local when routing. You can do this by setting
18496 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18497 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18498 used for listening. Consider this example:
18499 </para>
18500 <literallayout class="monospaced">
18501 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
18502                       192.168.53.235 ; \
18503                       3ffe:2101:12:1:a00:20ff:fe86:a061
18504
18505 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
18506 </literallayout>
18507 <para>
18508 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18509 address, but all available interface addresses are treated as local when
18510 Exim is routing.
18511 </para>
18512 <para>
18513 In some environments the local host name may be in an MX list, but with an IP
18514 address that is not assigned to any local interface. In other cases it may be
18515 desirable to treat other host names as if they referred to the local host. Both
18516 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18517 This contains host names rather than IP addresses. When a host is referenced
18518 during routing, either via an MX record or directly, it is treated as the local
18519 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18520 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18521 </para>
18522 </section>
18523 <section id="SECID95">
18524 <title>Delivering to a remote host</title>
18525 <para>
18526 Delivery to a remote host is handled by the smtp transport. By default, it
18527 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
18528 there is more than one) when connecting to a remote host. However, the
18529 <option>interface</option> option can be set to specify which interface is used. See the
18530 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18531 details.
18532 </para>
18533 </section>
18534 </chapter>
18535
18536 <chapter id="CHAPmainconfig">
18537 <title>Main configuration</title>
18538 <para>
18539 <indexterm role="concept" id="IIDconfima" class="startofrange">
18540 <primary>configuration file</primary>
18541 <secondary>main section</secondary>
18542 </indexterm>
18543 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18544 <primary>main configuration</primary>
18545 </indexterm>
18546 The first part of the run time configuration file contains three types of item:
18547 </para>
18548 <itemizedlist>
18549 <listitem>
18550 <para>
18551 Macro definitions: These lines start with an upper case letter. See section
18552 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18553 </para>
18554 </listitem>
18555 <listitem>
18556 <para>
18557 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18558 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18559 section <xref linkend="SECTnamedlists"/>.
18560 </para>
18561 </listitem>
18562 <listitem>
18563 <para>
18564 Main configuration settings: Each setting occupies one line of the file
18565 (with possible continuations). If any setting is preceded by the word
18566 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18567 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18568 settings.
18569 </para>
18570 </listitem>
18571 </itemizedlist>
18572 <para>
18573 This chapter specifies all the main configuration options, along with their
18574 types and default values. For ease of finding a particular option, they appear
18575 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18576 are now so many options, they are first listed briefly in functional groups, as
18577 an aid to finding the name of the option you are looking for. Some options are
18578 listed in more than one group.
18579 </para>
18580 <section id="SECID96">
18581 <title>Miscellaneous</title>
18582 <informaltable frame="none">
18583 <tgroup cols="2" colsep="0" rowsep="0">
18584 <colspec colwidth="196pt" align="left"/>
18585 <colspec colwidth="254pt" align="left"/>
18586 <tbody>
18587 <row>
18588 <entry><option>bi_command</option></entry>
18589 <entry>to run for <option>-bi</option> command line option</entry>
18590 </row>
18591 <row>
18592 <entry><option>disable_ipv6</option></entry>
18593 <entry>do no IPv6 processing</entry>
18594 </row>
18595 <row>
18596 <entry><option>keep_malformed</option></entry>
18597 <entry>for broken files &ndash; should not happen</entry>
18598 </row>
18599 <row>
18600 <entry><option>localhost_number</option></entry>
18601 <entry>for unique message ids in clusters</entry>
18602 </row>
18603 <row>
18604 <entry><option>message_body_visible</option></entry>
18605 <entry>how much to show in <varname>$message_body</varname></entry>
18606 </row>
18607 <row>
18608 <entry><option>mua_wrapper</option></entry>
18609 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18610 </row>
18611 <row>
18612 <entry><option>print_topbitchars</option></entry>
18613 <entry>top-bit characters are printing</entry>
18614 </row>
18615 <row>
18616 <entry><option>timezone</option></entry>
18617 <entry>force time zone</entry>
18618 </row>
18619 </tbody>
18620 </tgroup>
18621 </informaltable>
18622 </section>
18623 <section id="SECID97">
18624 <title>Exim parameters</title>
18625 <informaltable frame="none">
18626 <tgroup cols="2" colsep="0" rowsep="0">
18627 <colspec colwidth="196pt" align="left"/>
18628 <colspec colwidth="254pt" align="left"/>
18629 <tbody>
18630 <row>
18631 <entry><option>exim_group</option></entry>
18632 <entry>override compiled-in value</entry>
18633 </row>
18634 <row>
18635 <entry><option>exim_path</option></entry>
18636 <entry>override compiled-in value</entry>
18637 </row>
18638 <row>
18639 <entry><option>exim_user</option></entry>
18640 <entry>override compiled-in value</entry>
18641 </row>
18642 <row>
18643 <entry><option>primary_hostname</option></entry>
18644 <entry>default from <function>uname()</function></entry>
18645 </row>
18646 <row>
18647 <entry><option>split_spool_directory</option></entry>
18648 <entry>use multiple directories</entry>
18649 </row>
18650 <row>
18651 <entry><option>spool_directory</option></entry>
18652 <entry>override compiled-in value</entry>
18653 </row>
18654 </tbody>
18655 </tgroup>
18656 </informaltable>
18657 </section>
18658 <section id="SECID98">
18659 <title>Privilege controls</title>
18660 <informaltable frame="none">
18661 <tgroup cols="2" colsep="0" rowsep="0">
18662 <colspec colwidth="196pt" align="left"/>
18663 <colspec colwidth="254pt" align="left"/>
18664 <tbody>
18665 <row>
18666 <entry><option>admin_groups</option></entry>
18667 <entry>groups that are Exim admin users</entry>
18668 </row>
18669 <row>
18670 <entry><option>deliver_drop_privilege</option></entry>
18671 <entry>drop root for delivery processes</entry>
18672 </row>
18673 <row>
18674 <entry><option>local_from_check</option></entry>
18675 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18676 </row>
18677 <row>
18678 <entry><option>local_from_prefix</option></entry>
18679 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18680 </row>
18681 <row>
18682 <entry><option>local_from_suffix</option></entry>
18683 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18684 </row>
18685 <row>
18686 <entry><option>local_sender_retain</option></entry>
18687 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18688 </row>
18689 <row>
18690 <entry><option>never_users</option></entry>
18691 <entry>do not run deliveries as these</entry>
18692 </row>
18693 <row>
18694 <entry><option>prod_requires_admin</option></entry>
18695 <entry>forced delivery requires admin user</entry>
18696 </row>
18697 <row>
18698 <entry><option>queue_list_requires_admin</option></entry>
18699 <entry>queue listing requires admin user</entry>
18700 </row>
18701 <row>
18702 <entry><option>trusted_groups</option></entry>
18703 <entry>groups that are trusted</entry>
18704 </row>
18705 <row>
18706 <entry><option>trusted_users</option></entry>
18707 <entry>users that are trusted</entry>
18708 </row>
18709 </tbody>
18710 </tgroup>
18711 </informaltable>
18712 </section>
18713 <section id="SECID99">
18714 <title>Logging</title>
18715 <informaltable frame="none">
18716 <tgroup cols="2" colsep="0" rowsep="0">
18717 <colspec colwidth="196pt" align="left"/>
18718 <colspec colwidth="254pt" align="left"/>
18719 <tbody>
18720 <row>
18721 <entry><option>hosts_connection_nolog</option></entry>
18722 <entry>exemption from connect logging</entry>
18723 </row>
18724 <row>
18725 <entry><option>log_file_path</option></entry>
18726 <entry>override compiled-in value</entry>
18727 </row>
18728 <row>
18729 <entry><option>log_selector</option></entry>
18730 <entry>set/unset optional logging</entry>
18731 </row>
18732 <row>
18733 <entry><option>log_timezone</option></entry>
18734 <entry>add timezone to log lines</entry>
18735 </row>
18736 <row>
18737 <entry><option>message_logs</option></entry>
18738 <entry>create per-message logs</entry>
18739 </row>
18740 <row>
18741 <entry><option>preserve_message_logs</option></entry>
18742 <entry>after message completion</entry>
18743 </row>
18744 <row>
18745 <entry><option>process_log_path</option></entry>
18746 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18747 </row>
18748 <row>
18749 <entry><option>syslog_duplication</option></entry>
18750 <entry>controls duplicate log lines on syslog</entry>
18751 </row>
18752 <row>
18753 <entry><option>syslog_facility</option></entry>
18754 <entry>set syslog <quote>facility</quote> field</entry>
18755 </row>
18756 <row>
18757 <entry><option>syslog_processname</option></entry>
18758 <entry>set syslog <quote>ident</quote> field</entry>
18759 </row>
18760 <row>
18761 <entry><option>syslog_timestamp</option></entry>
18762 <entry>timestamp syslog lines</entry>
18763 </row>
18764 <row>
18765 <entry><option>write_rejectlog</option></entry>
18766 <entry>control use of message log</entry>
18767 </row>
18768 </tbody>
18769 </tgroup>
18770 </informaltable>
18771 </section>
18772 <section id="SECID100">
18773 <title>Frozen messages</title>
18774 <informaltable frame="none">
18775 <tgroup cols="2" colsep="0" rowsep="0">
18776 <colspec colwidth="196pt" align="left"/>
18777 <colspec colwidth="254pt" align="left"/>
18778 <tbody>
18779 <row>
18780 <entry><option>auto_thaw</option></entry>
18781 <entry>sets time for retrying frozen messages</entry>
18782 </row>
18783 <row>
18784 <entry><option>freeze_tell</option></entry>
18785 <entry>send message when freezing</entry>
18786 </row>
18787 <row>
18788 <entry><option>move_frozen_messages</option></entry>
18789 <entry>to another directory</entry>
18790 </row>
18791 <row>
18792 <entry><option>timeout_frozen_after</option></entry>
18793 <entry>keep frozen messages only so long</entry>
18794 </row>
18795 </tbody>
18796 </tgroup>
18797 </informaltable>
18798 </section>
18799 <section id="SECID101">
18800 <title>Data lookups</title>
18801 <informaltable frame="none">
18802 <tgroup cols="2" colsep="0" rowsep="0">
18803 <colspec colwidth="196pt" align="left"/>
18804 <colspec colwidth="254pt" align="left"/>
18805 <tbody>
18806 <row>
18807 <entry><option>ldap_default_servers</option></entry>
18808 <entry>used if no server in query</entry>
18809 </row>
18810 <row>
18811 <entry><option>ldap_version</option></entry>
18812 <entry>set protocol version</entry>
18813 </row>
18814 <row>
18815 <entry><option>lookup_open_max</option></entry>
18816 <entry>lookup files held open</entry>
18817 </row>
18818 <row>
18819 <entry><option>mysql_servers</option></entry>
18820 <entry>as it says</entry>
18821 </row>
18822 <row>
18823 <entry><option>oracle_servers</option></entry>
18824 <entry>as it says</entry>
18825 </row>
18826 <row>
18827 <entry><option>pgsql_servers</option></entry>
18828 <entry>as it says</entry>
18829 </row>
18830 <row>
18831 <entry><option>sqlite_lock_timeout</option></entry>
18832 <entry>as it says</entry>
18833 </row>
18834 </tbody>
18835 </tgroup>
18836 </informaltable>
18837 </section>
18838 <section id="SECID102">
18839 <title>Message ids</title>
18840 <informaltable frame="none">
18841 <tgroup cols="2" colsep="0" rowsep="0">
18842 <colspec colwidth="196pt" align="left"/>
18843 <colspec colwidth="254pt" align="left"/>
18844 <tbody>
18845 <row>
18846 <entry><option>message_id_header_domain</option></entry>
18847 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
18848 </row>
18849 <row>
18850 <entry><option>message_id_header_text</option></entry>
18851 <entry>ditto</entry>
18852 </row>
18853 </tbody>
18854 </tgroup>
18855 </informaltable>
18856 </section>
18857 <section id="SECID103">
18858 <title>Embedded Perl Startup</title>
18859 <informaltable frame="none">
18860 <tgroup cols="2" colsep="0" rowsep="0">
18861 <colspec colwidth="196pt" align="left"/>
18862 <colspec colwidth="254pt" align="left"/>
18863 <tbody>
18864 <row>
18865 <entry><option>perl_at_start</option></entry>
18866 <entry>always start the interpreter</entry>
18867 </row>
18868 <row>
18869 <entry><option>perl_startup</option></entry>
18870 <entry>code to obey when starting Perl</entry>
18871 </row>
18872 </tbody>
18873 </tgroup>
18874 </informaltable>
18875 </section>
18876 <section id="SECID104">
18877 <title>Daemon</title>
18878 <informaltable frame="none">
18879 <tgroup cols="2" colsep="0" rowsep="0">
18880 <colspec colwidth="196pt" align="left"/>
18881 <colspec colwidth="254pt" align="left"/>
18882 <tbody>
18883 <row>
18884 <entry><option>daemon_smtp_ports</option></entry>
18885 <entry>default ports</entry>
18886 </row>
18887 <row>
18888 <entry><option>daemon_startup_retries</option></entry>
18889 <entry>number of times to retry</entry>
18890 </row>
18891 <row>
18892 <entry><option>daemon_startup_sleep</option></entry>
18893 <entry>time to sleep between tries</entry>
18894 </row>
18895 <row>
18896 <entry><option>extra_local_interfaces</option></entry>
18897 <entry>not necessarily listened on</entry>
18898 </row>
18899 <row>
18900 <entry><option>local_interfaces</option></entry>
18901 <entry>on which to listen, with optional ports</entry>
18902 </row>
18903 <row>
18904 <entry><option>pid_file_path</option></entry>
18905 <entry>override compiled-in value</entry>
18906 </row>
18907 <row>
18908 <entry><option>queue_run_max</option></entry>
18909 <entry>maximum simultaneous queue runners</entry>
18910 </row>
18911 </tbody>
18912 </tgroup>
18913 </informaltable>
18914 </section>
18915 <section id="SECID105">
18916 <title>Resource control</title>
18917 <informaltable frame="none">
18918 <tgroup cols="2" colsep="0" rowsep="0">
18919 <colspec colwidth="196pt" align="left"/>
18920 <colspec colwidth="254pt" align="left"/>
18921 <tbody>
18922 <row>
18923 <entry><option>check_log_inodes</option></entry>
18924 <entry>before accepting a message</entry>
18925 </row>
18926 <row>
18927 <entry><option>check_log_space</option></entry>
18928 <entry>before accepting a message</entry>
18929 </row>
18930 <row>
18931 <entry><option>check_spool_inodes</option></entry>
18932 <entry>before accepting a message</entry>
18933 </row>
18934 <row>
18935 <entry><option>check_spool_space</option></entry>
18936 <entry>before accepting a message</entry>
18937 </row>
18938 <row>
18939 <entry><option>deliver_queue_load_max</option></entry>
18940 <entry>no queue deliveries if load high</entry>
18941 </row>
18942 <row>
18943 <entry><option>queue_only_load</option></entry>
18944 <entry>queue incoming if load high</entry>
18945 </row>
18946 <row>
18947 <entry><option>queue_run_max</option></entry>
18948 <entry>maximum simultaneous queue runners</entry>
18949 </row>
18950 <row>
18951 <entry><option>remote_max_parallel</option></entry>
18952 <entry>parallel SMTP delivery per message</entry>
18953 </row>
18954 <row>
18955 <entry><option>smtp_accept_max</option></entry>
18956 <entry>simultaneous incoming connections</entry>
18957 </row>
18958 <row>
18959 <entry><option>smtp_accept_max_nonmail</option></entry>
18960 <entry>non-mail commands</entry>
18961 </row>
18962 <row>
18963 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18964 <entry>hosts to which the limit applies</entry>
18965 </row>
18966 <row>
18967 <entry><option>smtp_accept_max_per_connection</option></entry>
18968 <entry>messages per connection</entry>
18969 </row>
18970 <row>
18971 <entry><option>smtp_accept_max_per_host</option></entry>
18972 <entry>connections from one host</entry>
18973 </row>
18974 <row>
18975 <entry><option>smtp_accept_queue</option></entry>
18976 <entry>queue mail if more connections</entry>
18977 </row>
18978 <row>
18979 <entry><option>smtp_accept_queue_per_connection</option></entry>
18980 <entry>queue if more messages per connection</entry>
18981 </row>
18982 <row>
18983 <entry><option>smtp_accept_reserve</option></entry>
18984 <entry>only reserve hosts if more connections</entry>
18985 </row>
18986 <row>
18987 <entry><option>smtp_check_spool_space</option></entry>
18988 <entry>from SIZE on MAIL command</entry>
18989 </row>
18990 <row>
18991 <entry><option>smtp_connect_backlog</option></entry>
18992 <entry>passed to TCP/IP stack</entry>
18993 </row>
18994 <row>
18995 <entry><option>smtp_load_reserve</option></entry>
18996 <entry>SMTP from reserved hosts if load high</entry>
18997 </row>
18998 <row>
18999 <entry><option>smtp_reserve_hosts</option></entry>
19000 <entry>these are the reserve hosts</entry>
19001 </row>
19002 </tbody>
19003 </tgroup>
19004 </informaltable>
19005 </section>
19006 <section id="SECID106">
19007 <title>Policy controls</title>
19008 <informaltable frame="none">
19009 <tgroup cols="2" colsep="0" rowsep="0">
19010 <colspec colwidth="196pt" align="left"/>
19011 <colspec colwidth="254pt" align="left"/>
19012 <tbody>
19013 <row>
19014 <entry><option>acl_not_smtp</option></entry>
19015 <entry>ACL for non-SMTP messages</entry>
19016 </row>
19017 <row>
19018 <entry><option>acl_not_smtp_mime</option></entry>
19019 <entry>ACL for non-SMTP MIME parts</entry>
19020 </row>
19021 <row>
19022 <entry><option>acl_not_smtp_start</option></entry>
19023 <entry>ACL for start of non-SMTP message</entry>
19024 </row>
19025 <row>
19026 <entry><option>acl_smtp_auth</option></entry>
19027 <entry>ACL for AUTH</entry>
19028 </row>
19029 <row>
19030 <entry><option>acl_smtp_connect</option></entry>
19031 <entry>ACL for connection</entry>
19032 </row>
19033 <row>
19034 <entry><option>acl_smtp_data</option></entry>
19035 <entry>ACL for DATA</entry>
19036 </row>
19037 <row>
19038 <entry><option>acl_smtp_etrn</option></entry>
19039 <entry>ACL for ETRN</entry>
19040 </row>
19041 <row>
19042 <entry><option>acl_smtp_expn</option></entry>
19043 <entry>ACL for EXPN</entry>
19044 </row>
19045 <row>
19046 <entry><option>acl_smtp_helo</option></entry>
19047 <entry>ACL for EHLO or HELO</entry>
19048 </row>
19049 <row>
19050 <entry><option>acl_smtp_mail</option></entry>
19051 <entry>ACL for MAIL</entry>
19052 </row>
19053 <row>
19054 <entry><option>acl_smtp_mailauth</option></entry>
19055 <entry>ACL for AUTH on MAIL command</entry>
19056 </row>
19057 <row>
19058 <entry><option>acl_smtp_mime</option></entry>
19059 <entry>ACL for MIME parts</entry>
19060 </row>
19061 <row>
19062 <entry><option>acl_smtp_predata</option></entry>
19063 <entry>ACL for start of data</entry>
19064 </row>
19065 <row>
19066 <entry><option>acl_smtp_quit</option></entry>
19067 <entry>ACL for QUIT</entry>
19068 </row>
19069 <row>
19070 <entry><option>acl_smtp_rcpt</option></entry>
19071 <entry>ACL for RCPT</entry>
19072 </row>
19073 <row>
19074 <entry><option>acl_smtp_starttls</option></entry>
19075 <entry>ACL for STARTTLS</entry>
19076 </row>
19077 <row>
19078 <entry><option>acl_smtp_vrfy</option></entry>
19079 <entry>ACL for VRFY</entry>
19080 </row>
19081 <row>
19082 <entry><option>av_scanner</option></entry>
19083 <entry>specify virus scanner</entry>
19084 </row>
19085 <row>
19086 <entry><option>check_rfc2047_length</option></entry>
19087 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19088 </row>
19089 <row>
19090 <entry><option>dns_csa_search_limit</option></entry>
19091 <entry>control CSA parent search depth</entry>
19092 </row>
19093 <row>
19094 <entry><option>dns_csa_use_reverse</option></entry>
19095 <entry>en/disable CSA IP reverse search</entry>
19096 </row>
19097 <row>
19098 <entry><option>header_maxsize</option></entry>
19099 <entry>total size of message header</entry>
19100 </row>
19101 <row>
19102 <entry><option>header_line_maxsize</option></entry>
19103 <entry>individual header line limit</entry>
19104 </row>
19105 <row>
19106 <entry><option>helo_accept_junk_hosts</option></entry>
19107 <entry>allow syntactic junk from these hosts</entry>
19108 </row>
19109 <row>
19110 <entry><option>helo_allow_chars</option></entry>
19111 <entry>allow illegal chars in HELO names</entry>
19112 </row>
19113 <row>
19114 <entry><option>helo_lookup_domains</option></entry>
19115 <entry>lookup hostname for these HELO names</entry>
19116 </row>
19117 <row>
19118 <entry><option>helo_try_verify_hosts</option></entry>
19119 <entry>HELO soft-checked for these hosts</entry>
19120 </row>
19121 <row>
19122 <entry><option>helo_verify_hosts</option></entry>
19123 <entry>HELO hard-checked for these hosts</entry>
19124 </row>
19125 <row>
19126 <entry><option>host_lookup</option></entry>
19127 <entry>host name looked up for these hosts</entry>
19128 </row>
19129 <row>
19130 <entry><option>host_lookup_order</option></entry>
19131 <entry>order of DNS and local name lookups</entry>
19132 </row>
19133 <row>
19134 <entry><option>host_reject_connection</option></entry>
19135 <entry>reject connection from these hosts</entry>
19136 </row>
19137 <row>
19138 <entry><option>hosts_treat_as_local</option></entry>
19139 <entry>useful in some cluster configurations</entry>
19140 </row>
19141 <row>
19142 <entry><option>local_scan_timeout</option></entry>
19143 <entry>timeout for <function>local_scan()</function></entry>
19144 </row>
19145 <row>
19146 <entry><option>message_size_limit</option></entry>
19147 <entry>for all messages</entry>
19148 </row>
19149 <row>
19150 <entry><option>percent_hack_domains</option></entry>
19151 <entry>recognize %-hack for these domains</entry>
19152 </row>
19153 <row>
19154 <entry><option>spamd_address</option></entry>
19155 <entry>set interface to SpamAssassin</entry>
19156 </row>
19157 <row>
19158 <entry><option>strict_acl_vars</option></entry>
19159 <entry>object to unset ACL variables</entry>
19160 </row>
19161 </tbody>
19162 </tgroup>
19163 </informaltable>
19164 </section>
19165 <section id="SECID107">
19166 <title>Callout cache</title>
19167 <informaltable frame="none">
19168 <tgroup cols="2" colsep="0" rowsep="0">
19169 <colspec colwidth="196pt" align="left"/>
19170 <colspec colwidth="254pt" align="left"/>
19171 <tbody>
19172 <row>
19173 <entry><option>callout_domain_negative_expire</option></entry>
19174 <entry>timeout for negative domain cache item</entry>
19175 </row>
19176 <row>
19177 <entry><option>callout_domain_positive_expire</option></entry>
19178 <entry>timeout for positive domain cache item</entry>
19179 </row>
19180 <row>
19181 <entry><option>callout_negative_expire</option></entry>
19182 <entry>timeout for negative address cache item</entry>
19183 </row>
19184 <row>
19185 <entry><option>callout_positive_expire</option></entry>
19186 <entry>timeout for positive address cache item</entry>
19187 </row>
19188 <row>
19189 <entry><option>callout_random_local_part</option></entry>
19190 <entry>string to use for <quote>random</quote> testing</entry>
19191 </row>
19192 </tbody>
19193 </tgroup>
19194 </informaltable>
19195 </section>
19196 <section id="SECID108">
19197 <title>TLS</title>
19198 <informaltable frame="none">
19199 <tgroup cols="2" colsep="0" rowsep="0">
19200 <colspec colwidth="196pt" align="left"/>
19201 <colspec colwidth="254pt" align="left"/>
19202 <tbody>
19203 <row>
19204 <entry><phrase revisionflag="changed"><option>gnutls_require_kx</option></phrase></entry>
19205 <entry>control GnuTLS key exchanges</entry>
19206 </row>
19207 <row>
19208 <entry><phrase revisionflag="changed"><option>gnutls_require_mac</option></phrase></entry>
19209 <entry>control GnuTLS MAC algorithms</entry>
19210 </row>
19211 <row>
19212 <entry><phrase revisionflag="changed"><option>gnutls_require_protocols</option></phrase></entry>
19213 <entry>control GnuTLS protocols</entry>
19214 </row>
19215 <row>
19216 <entry><option>tls_advertise_hosts</option></entry>
19217 <entry>advertise TLS to these hosts</entry>
19218 </row>
19219 <row>
19220 <entry><option>tls_certificate</option></entry>
19221 <entry>location of server certificate</entry>
19222 </row>
19223 <row>
19224 <entry><option>tls_crl</option></entry>
19225 <entry>certificate revocation list</entry>
19226 </row>
19227 <row>
19228 <entry><option>tls_dhparam</option></entry>
19229 <entry>DH parameters for server</entry>
19230 </row>
19231 <row>
19232 <entry><option>tls_on_connect_ports</option></entry>
19233 <entry>specify SSMTP (SMTPS) ports</entry>
19234 </row>
19235 <row>
19236 <entry><option>tls_privatekey</option></entry>
19237 <entry>location of server private key</entry>
19238 </row>
19239 <row>
19240 <entry><option>tls_remember_esmtp</option></entry>
19241 <entry>don&#x2019;t reset after starting TLS</entry>
19242 </row>
19243 <row>
19244 <entry><option>tls_require_ciphers</option></entry>
19245 <entry>specify acceptable ciphers</entry>
19246 </row>
19247 <row>
19248 <entry><option>tls_try_verify_hosts</option></entry>
19249 <entry>try to verify client certificate</entry>
19250 </row>
19251 <row>
19252 <entry><option>tls_verify_certificates</option></entry>
19253 <entry>expected client certificates</entry>
19254 </row>
19255 <row>
19256 <entry><option>tls_verify_hosts</option></entry>
19257 <entry>insist on client certificate verify</entry>
19258 </row>
19259 </tbody>
19260 </tgroup>
19261 </informaltable>
19262 </section>
19263 <section id="SECID109">
19264 <title>Local user handling</title>
19265 <informaltable frame="none">
19266 <tgroup cols="2" colsep="0" rowsep="0">
19267 <colspec colwidth="196pt" align="left"/>
19268 <colspec colwidth="254pt" align="left"/>
19269 <tbody>
19270 <row>
19271 <entry><option>finduser_retries</option></entry>
19272 <entry>useful in NIS environments</entry>
19273 </row>
19274 <row>
19275 <entry><option>gecos_name</option></entry>
19276 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19277 </row>
19278 <row>
19279 <entry><option>gecos_pattern</option></entry>
19280 <entry>ditto</entry>
19281 </row>
19282 <row>
19283 <entry><option>max_username_length</option></entry>
19284 <entry>for systems that truncate</entry>
19285 </row>
19286 <row>
19287 <entry><option>unknown_login</option></entry>
19288 <entry>used when no login name found</entry>
19289 </row>
19290 <row>
19291 <entry><option>unknown_username</option></entry>
19292 <entry>ditto</entry>
19293 </row>
19294 <row>
19295 <entry><option>uucp_from_pattern</option></entry>
19296 <entry>for recognizing <quote>From </quote> lines</entry>
19297 </row>
19298 <row>
19299 <entry><option>uucp_from_sender</option></entry>
19300 <entry>ditto</entry>
19301 </row>
19302 </tbody>
19303 </tgroup>
19304 </informaltable>
19305 </section>
19306 <section id="SECID110">
19307 <title>All incoming messages (SMTP and non-SMTP)</title>
19308 <informaltable frame="none">
19309 <tgroup cols="2" colsep="0" rowsep="0">
19310 <colspec colwidth="196pt" align="left"/>
19311 <colspec colwidth="254pt" align="left"/>
19312 <tbody>
19313 <row>
19314 <entry><option>header_maxsize</option></entry>
19315 <entry>total size of message header</entry>
19316 </row>
19317 <row>
19318 <entry><option>header_line_maxsize</option></entry>
19319 <entry>individual header line limit</entry>
19320 </row>
19321 <row>
19322 <entry><option>message_size_limit</option></entry>
19323 <entry>applies to all messages</entry>
19324 </row>
19325 <row>
19326 <entry><option>percent_hack_domains</option></entry>
19327 <entry>recognize %-hack for these domains</entry>
19328 </row>
19329 <row>
19330 <entry><option>received_header_text</option></entry>
19331 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19332 </row>
19333 <row>
19334 <entry><option>received_headers_max</option></entry>
19335 <entry>for mail loop detection</entry>
19336 </row>
19337 <row>
19338 <entry><option>recipients_max</option></entry>
19339 <entry>limit per message</entry>
19340 </row>
19341 <row>
19342 <entry><option>recipients_max_reject</option></entry>
19343 <entry>permanently reject excess recipients</entry>
19344 </row>
19345 </tbody>
19346 </tgroup>
19347 </informaltable>
19348 </section>
19349 <section id="SECID111">
19350 <title>Non-SMTP incoming messages</title>
19351 <informaltable frame="none">
19352 <tgroup cols="2" colsep="0" rowsep="0">
19353 <colspec colwidth="196pt" align="left"/>
19354 <colspec colwidth="254pt" align="left"/>
19355 <tbody>
19356 <row>
19357 <entry><option>receive_timeout</option></entry>
19358 <entry>for non-SMTP messages</entry>
19359 </row>
19360 </tbody>
19361 </tgroup>
19362 </informaltable>
19363 </section>
19364 <section id="SECID112">
19365 <title>Incoming SMTP messages</title>
19366 <para>
19367 See also the <emphasis>Policy controls</emphasis> section above.
19368 </para>
19369 <informaltable frame="none">
19370 <tgroup cols="2" colsep="0" rowsep="0">
19371 <colspec colwidth="196pt" align="left"/>
19372 <colspec colwidth="254pt" align="left"/>
19373 <tbody>
19374 <row>
19375 <entry><option>host_lookup</option></entry>
19376 <entry>host name looked up for these hosts</entry>
19377 </row>
19378 <row>
19379 <entry><option>host_lookup_order</option></entry>
19380 <entry>order of DNS and local name lookups</entry>
19381 </row>
19382 <row>
19383 <entry><option>recipient_unqualified_hosts</option></entry>
19384 <entry>may send unqualified recipients</entry>
19385 </row>
19386 <row>
19387 <entry><option>rfc1413_hosts</option></entry>
19388 <entry>make ident calls to these hosts</entry>
19389 </row>
19390 <row>
19391 <entry><option>rfc1413_query_timeout</option></entry>
19392 <entry>zero disables ident calls</entry>
19393 </row>
19394 <row>
19395 <entry><option>sender_unqualified_hosts</option></entry>
19396 <entry>may send unqualified senders</entry>
19397 </row>
19398 <row>
19399 <entry><option>smtp_accept_keepalive</option></entry>
19400 <entry>some TCP/IP magic</entry>
19401 </row>
19402 <row>
19403 <entry><option>smtp_accept_max</option></entry>
19404 <entry>simultaneous incoming connections</entry>
19405 </row>
19406 <row>
19407 <entry><option>smtp_accept_max_nonmail</option></entry>
19408 <entry>non-mail commands</entry>
19409 </row>
19410 <row>
19411 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19412 <entry>hosts to which the limit applies</entry>
19413 </row>
19414 <row>
19415 <entry><option>smtp_accept_max_per_connection</option></entry>
19416 <entry>messages per connection</entry>
19417 </row>
19418 <row>
19419 <entry><option>smtp_accept_max_per_host</option></entry>
19420 <entry>connections from one host</entry>
19421 </row>
19422 <row>
19423 <entry><option>smtp_accept_queue</option></entry>
19424 <entry>queue mail if more connections</entry>
19425 </row>
19426 <row>
19427 <entry><option>smtp_accept_queue_per_connection</option></entry>
19428 <entry>queue if more messages per connection</entry>
19429 </row>
19430 <row>
19431 <entry><option>smtp_accept_reserve</option></entry>
19432 <entry>only reserve hosts if more connections</entry>
19433 </row>
19434 <row>
19435 <entry><option>smtp_active_hostname</option></entry>
19436 <entry>host name to use in messages</entry>
19437 </row>
19438 <row>
19439 <entry><option>smtp_banner</option></entry>
19440 <entry>text for welcome banner</entry>
19441 </row>
19442 <row>
19443 <entry><option>smtp_check_spool_space</option></entry>
19444 <entry>from SIZE on MAIL command</entry>
19445 </row>
19446 <row>
19447 <entry><option>smtp_connect_backlog</option></entry>
19448 <entry>passed to TCP/IP stack</entry>
19449 </row>
19450 <row>
19451 <entry><option>smtp_enforce_sync</option></entry>
19452 <entry>of SMTP command/responses</entry>
19453 </row>
19454 <row>
19455 <entry><option>smtp_etrn_command</option></entry>
19456 <entry>what to run for ETRN</entry>
19457 </row>
19458 <row>
19459 <entry><option>smtp_etrn_serialize</option></entry>
19460 <entry>only one at once</entry>
19461 </row>
19462 <row>
19463 <entry><option>smtp_load_reserve</option></entry>
19464 <entry>only reserve hosts if this load</entry>
19465 </row>
19466 <row>
19467 <entry><option>smtp_max_unknown_commands</option></entry>
19468 <entry>before dropping connection</entry>
19469 </row>
19470 <row>
19471 <entry><option>smtp_ratelimit_hosts</option></entry>
19472 <entry>apply ratelimiting to these hosts</entry>
19473 </row>
19474 <row>
19475 <entry><option>smtp_ratelimit_mail</option></entry>
19476 <entry>ratelimit for MAIL commands</entry>
19477 </row>
19478 <row>
19479 <entry><option>smtp_ratelimit_rcpt</option></entry>
19480 <entry>ratelimit for RCPT commands</entry>
19481 </row>
19482 <row>
19483 <entry><option>smtp_receive_timeout</option></entry>
19484 <entry>per command or data line</entry>
19485 </row>
19486 <row>
19487 <entry><option>smtp_reserve_hosts</option></entry>
19488 <entry>these are the reserve hosts</entry>
19489 </row>
19490 <row>
19491 <entry><option>smtp_return_error_details</option></entry>
19492 <entry>give detail on rejections</entry>
19493 </row>
19494 </tbody>
19495 </tgroup>
19496 </informaltable>
19497 </section>
19498 <section id="SECID113">
19499 <title>SMTP extensions</title>
19500 <informaltable frame="none">
19501 <tgroup cols="2" colsep="0" rowsep="0">
19502 <colspec colwidth="196pt" align="left"/>
19503 <colspec colwidth="254pt" align="left"/>
19504 <tbody>
19505 <row>
19506 <entry><option>accept_8bitmime</option></entry>
19507 <entry>advertise 8BITMIME</entry>
19508 </row>
19509 <row>
19510 <entry><option>auth_advertise_hosts</option></entry>
19511 <entry>advertise AUTH to these hosts</entry>
19512 </row>
19513 <row>
19514 <entry><option>ignore_fromline_hosts</option></entry>
19515 <entry>allow <quote>From </quote> from these hosts</entry>
19516 </row>
19517 <row>
19518 <entry><option>ignore_fromline_local</option></entry>
19519 <entry>allow <quote>From </quote> from local SMTP</entry>
19520 </row>
19521 <row>
19522 <entry><option>pipelining_advertise_hosts</option></entry>
19523 <entry>advertise pipelining to these hosts</entry>
19524 </row>
19525 <row>
19526 <entry><option>tls_advertise_hosts</option></entry>
19527 <entry>advertise TLS to these hosts</entry>
19528 </row>
19529 </tbody>
19530 </tgroup>
19531 </informaltable>
19532 </section>
19533 <section id="SECID114">
19534 <title>Processing messages</title>
19535 <informaltable frame="none">
19536 <tgroup cols="2" colsep="0" rowsep="0">
19537 <colspec colwidth="196pt" align="left"/>
19538 <colspec colwidth="254pt" align="left"/>
19539 <tbody>
19540 <row>
19541 <entry><option>allow_domain_literals</option></entry>
19542 <entry>recognize domain literal syntax</entry>
19543 </row>
19544 <row>
19545 <entry><option>allow_mx_to_ip</option></entry>
19546 <entry>allow MX to point to IP address</entry>
19547 </row>
19548 <row>
19549 <entry><option>allow_utf8_domains</option></entry>
19550 <entry>in addresses</entry>
19551 </row>
19552 <row>
19553 <entry><option>check_rfc2047_length</option></entry>
19554 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19555 </row>
19556 <row>
19557 <entry><option>delivery_date_remove</option></entry>
19558 <entry>from incoming messages</entry>
19559 </row>
19560 <row>
19561 <entry><option>envelope_to_remove</option></entry>
19562 <entry>from incoming messages</entry>
19563 </row>
19564 <row>
19565 <entry><option>extract_addresses_remove_arguments</option></entry>
19566 <entry>affects <option>-t</option> processing</entry>
19567 </row>
19568 <row>
19569 <entry><option>headers_charset</option></entry>
19570 <entry>default for translations</entry>
19571 </row>
19572 <row>
19573 <entry><option>qualify_domain</option></entry>
19574 <entry>default for senders</entry>
19575 </row>
19576 <row>
19577 <entry><option>qualify_recipient</option></entry>
19578 <entry>default for recipients</entry>
19579 </row>
19580 <row>
19581 <entry><option>return_path_remove</option></entry>
19582 <entry>from incoming messages</entry>
19583 </row>
19584 <row>
19585 <entry><option>strip_excess_angle_brackets</option></entry>
19586 <entry>in addresses</entry>
19587 </row>
19588 <row>
19589 <entry><option>strip_trailing_dot</option></entry>
19590 <entry>at end of addresses</entry>
19591 </row>
19592 <row>
19593 <entry><option>untrusted_set_sender</option></entry>
19594 <entry>untrusted can set envelope sender</entry>
19595 </row>
19596 </tbody>
19597 </tgroup>
19598 </informaltable>
19599 </section>
19600 <section id="SECID115">
19601 <title>System filter</title>
19602 <informaltable frame="none">
19603 <tgroup cols="2" colsep="0" rowsep="0">
19604 <colspec colwidth="196pt" align="left"/>
19605 <colspec colwidth="254pt" align="left"/>
19606 <tbody>
19607 <row>
19608 <entry><option>system_filter</option></entry>
19609 <entry>locate system filter</entry>
19610 </row>
19611 <row>
19612 <entry><option>system_filter_directory_transport</option></entry>
19613 <entry>transport for delivery to a directory</entry>
19614 </row>
19615 <row>
19616 <entry><option>system_filter_file_transport</option></entry>
19617 <entry>transport for delivery to a file</entry>
19618 </row>
19619 <row>
19620 <entry><option>system_filter_group</option></entry>
19621 <entry>group for filter running</entry>
19622 </row>
19623 <row>
19624 <entry><option>system_filter_pipe_transport</option></entry>
19625 <entry>transport for delivery to a pipe</entry>
19626 </row>
19627 <row>
19628 <entry><option>system_filter_reply_transport</option></entry>
19629 <entry>transport for autoreply delivery</entry>
19630 </row>
19631 <row>
19632 <entry><option>system_filter_user</option></entry>
19633 <entry>user for filter running</entry>
19634 </row>
19635 </tbody>
19636 </tgroup>
19637 </informaltable>
19638 </section>
19639 <section id="SECID116">
19640 <title>Routing and delivery</title>
19641 <informaltable frame="none">
19642 <tgroup cols="2" colsep="0" rowsep="0">
19643 <colspec colwidth="196pt" align="left"/>
19644 <colspec colwidth="254pt" align="left"/>
19645 <tbody>
19646 <row>
19647 <entry><option>disable_ipv6</option></entry>
19648 <entry>do no IPv6 processing</entry>
19649 </row>
19650 <row>
19651 <entry><option>dns_again_means_nonexist</option></entry>
19652 <entry>for broken domains</entry>
19653 </row>
19654 <row>
19655 <entry><option>dns_check_names_pattern</option></entry>
19656 <entry>pre-DNS syntax check</entry>
19657 </row>
19658 <row>
19659 <entry><option>dns_ipv4_lookup</option></entry>
19660 <entry>only v4 lookup for these domains</entry>
19661 </row>
19662 <row>
19663 <entry><option>dns_retrans</option></entry>
19664 <entry>parameter for resolver</entry>
19665 </row>
19666 <row>
19667 <entry><option>dns_retry</option></entry>
19668 <entry>parameter for resolver</entry>
19669 </row>
19670 <row>
19671 <entry><option>hold_domains</option></entry>
19672 <entry>hold delivery for these domains</entry>
19673 </row>
19674 <row>
19675 <entry><option>local_interfaces</option></entry>
19676 <entry>for routing checks</entry>
19677 </row>
19678 <row>
19679 <entry><option>queue_domains</option></entry>
19680 <entry>no immediate delivery for these</entry>
19681 </row>
19682 <row>
19683 <entry><option>queue_only</option></entry>
19684 <entry>no immediate delivery at all</entry>
19685 </row>
19686 <row>
19687 <entry><option>queue_only_file</option></entry>
19688 <entry>no immediate delivery if file exists</entry>
19689 </row>
19690 <row>
19691 <entry><option>queue_only_load</option></entry>
19692 <entry>no immediate delivery if load is high</entry>
19693 </row>
19694 <row>
19695 <entry><option>queue_only_override</option></entry>
19696 <entry>allow command line to override</entry>
19697 </row>
19698 <row>
19699 <entry><option>queue_run_in_order</option></entry>
19700 <entry>order of arrival</entry>
19701 </row>
19702 <row>
19703 <entry><option>queue_run_max</option></entry>
19704 <entry>of simultaneous queue runners</entry>
19705 </row>
19706 <row>
19707 <entry><option>queue_smtp_domains</option></entry>
19708 <entry>no immediate SMTP delivery for these</entry>
19709 </row>
19710 <row>
19711 <entry><option>remote_max_parallel</option></entry>
19712 <entry>parallel SMTP delivery per message</entry>
19713 </row>
19714 <row>
19715 <entry><option>remote_sort_domains</option></entry>
19716 <entry>order of remote deliveries</entry>
19717 </row>
19718 <row>
19719 <entry><option>retry_data_expire</option></entry>
19720 <entry>timeout for retry data</entry>
19721 </row>
19722 <row>
19723 <entry><option>retry_interval_max</option></entry>
19724 <entry>safety net for retry rules</entry>
19725 </row>
19726 </tbody>
19727 </tgroup>
19728 </informaltable>
19729 </section>
19730 <section id="SECID117">
19731 <title>Bounce and warning messages</title>
19732 <informaltable frame="none">
19733 <tgroup cols="2" colsep="0" rowsep="0">
19734 <colspec colwidth="196pt" align="left"/>
19735 <colspec colwidth="254pt" align="left"/>
19736 <tbody>
19737 <row>
19738 <entry><option>bounce_message_file</option></entry>
19739 <entry>content of bounce</entry>
19740 </row>
19741 <row>
19742 <entry><option>bounce_message_text</option></entry>
19743 <entry>content of bounce</entry>
19744 </row>
19745 <row>
19746 <entry><option>bounce_return_body</option></entry>
19747 <entry>include body if returning message</entry>
19748 </row>
19749 <row>
19750 <entry><option>bounce_return_message</option></entry>
19751 <entry>include original message in bounce</entry>
19752 </row>
19753 <row>
19754 <entry><option>bounce_return_size_limit</option></entry>
19755 <entry>limit on returned message</entry>
19756 </row>
19757 <row>
19758 <entry><option>bounce_sender_authentication</option></entry>
19759 <entry>send authenticated sender with bounce</entry>
19760 </row>
19761 <row>
19762 <entry><phrase revisionflag="changed"><option>dsn_from</option></phrase></entry>
19763 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
19764 </row>
19765 <row>
19766 <entry><option>errors_copy</option></entry>
19767 <entry>copy bounce messages</entry>
19768 </row>
19769 <row>
19770 <entry><option>errors_reply_to</option></entry>
19771 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
19772 </row>
19773 <row>
19774 <entry><option>delay_warning</option></entry>
19775 <entry>time schedule</entry>
19776 </row>
19777 <row>
19778 <entry><option>delay_warning_condition</option></entry>
19779 <entry>condition for warning messages</entry>
19780 </row>
19781 <row>
19782 <entry><option>ignore_bounce_errors_after</option></entry>
19783 <entry>discard undeliverable bounces</entry>
19784 </row>
19785 <row>
19786 <entry><option>smtp_return_error_details</option></entry>
19787 <entry>give detail on rejections</entry>
19788 </row>
19789 <row>
19790 <entry><option>warn_message_file</option></entry>
19791 <entry>content of warning message</entry>
19792 </row>
19793 </tbody>
19794 </tgroup>
19795 </informaltable>
19796 </section>
19797 <section id="SECTalomo">
19798 <title>Alphabetical list of main options</title>
19799 <para>
19800 Those options that undergo string expansion before use are marked with
19801 &dagger;.
19802 </para>
19803 <para>
19804 <indexterm role="option">
19805 <primary><option>accept_8bitmime</option></primary>
19806 </indexterm>
19807 </para>
19808 <informaltable frame="all">
19809 <tgroup cols="4" colsep="0" rowsep="0">
19810 <colspec colwidth="8*" align="left"/>
19811 <colspec colwidth="6*" align="center"/>
19812 <colspec colwidth="6*" align="center"/>
19813 <colspec colwidth="6*" align="right"/>
19814 <tbody>
19815 <row>
19816 <entry><option>accept_8bitmime</option></entry>
19817 <entry>Use: <emphasis>main</emphasis></entry>
19818 <entry>Type: <emphasis>boolean</emphasis></entry>
19819 <entry>Default: <emphasis>false</emphasis></entry>
19820 </row>
19821 </tbody>
19822 </tgroup>
19823 </informaltable>
19824 <para>
19825 <indexterm role="concept">
19826 <primary>8BITMIME</primary>
19827 </indexterm>
19828 <indexterm role="concept">
19829 <primary>8-bit characters</primary>
19830 </indexterm>
19831 This option causes Exim to send 8BITMIME in its response to an SMTP
19832 EHLO command, and to accept the BODY= parameter on MAIL commands.
19833 However, though Exim is 8-bit clean, it is not a protocol converter, and it
19834 takes no steps to do anything special with messages received by this route.
19835 Consequently, this option is turned off by default.
19836 </para>
19837 <para>
19838 <indexterm role="option">
19839 <primary><option>acl_not_smtp</option></primary>
19840 </indexterm>
19841 </para>
19842 <informaltable frame="all">
19843 <tgroup cols="4" colsep="0" rowsep="0">
19844 <colspec colwidth="8*" align="left"/>
19845 <colspec colwidth="6*" align="center"/>
19846 <colspec colwidth="6*" align="center"/>
19847 <colspec colwidth="6*" align="right"/>
19848 <tbody>
19849 <row>
19850 <entry><option>acl_not_smtp</option></entry>
19851 <entry>Use: <emphasis>main</emphasis></entry>
19852 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19853 <entry>Default: <emphasis>unset</emphasis></entry>
19854 </row>
19855 </tbody>
19856 </tgroup>
19857 </informaltable>
19858 <para>
19859 <indexterm role="concept">
19860 <primary>access control lists (ACLs)</primary>
19861 <secondary>for non-SMTP messages</secondary>
19862 </indexterm>
19863 <indexterm role="concept">
19864 <primary>non-SMTP messages</primary>
19865 <secondary>ACLs for</secondary>
19866 </indexterm>
19867 This option defines the ACL that is run when a non-SMTP message has been
19868 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
19869 further details.
19870 </para>
19871 <para>
19872 <indexterm role="option">
19873 <primary><option>acl_not_smtp_mime</option></primary>
19874 </indexterm>
19875 </para>
19876 <informaltable frame="all">
19877 <tgroup cols="4" colsep="0" rowsep="0">
19878 <colspec colwidth="8*" align="left"/>
19879 <colspec colwidth="6*" align="center"/>
19880 <colspec colwidth="6*" align="center"/>
19881 <colspec colwidth="6*" align="right"/>
19882 <tbody>
19883 <row>
19884 <entry><option>acl_not_smtp_mime</option></entry>
19885 <entry>Use: <emphasis>main</emphasis></entry>
19886 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19887 <entry>Default: <emphasis>unset</emphasis></entry>
19888 </row>
19889 </tbody>
19890 </tgroup>
19891 </informaltable>
19892 <para>
19893 This option defines the ACL that is run for individual MIME parts of non-SMTP
19894 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
19895 SMTP messages.
19896 </para>
19897 <para>
19898 <indexterm role="option">
19899 <primary><option>acl_not_smtp_start</option></primary>
19900 </indexterm>
19901 </para>
19902 <informaltable frame="all">
19903 <tgroup cols="4" colsep="0" rowsep="0">
19904 <colspec colwidth="8*" align="left"/>
19905 <colspec colwidth="6*" align="center"/>
19906 <colspec colwidth="6*" align="center"/>
19907 <colspec colwidth="6*" align="right"/>
19908 <tbody>
19909 <row>
19910 <entry><option>acl_not_smtp_start</option></entry>
19911 <entry>Use: <emphasis>main</emphasis></entry>
19912 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19913 <entry>Default: <emphasis>unset</emphasis></entry>
19914 </row>
19915 </tbody>
19916 </tgroup>
19917 </informaltable>
19918 <para>
19919 <indexterm role="concept">
19920 <primary>access control lists (ACLs)</primary>
19921 <secondary>at start of non-SMTP message</secondary>
19922 </indexterm>
19923 <indexterm role="concept">
19924 <primary>non-SMTP messages</primary>
19925 <secondary>ACLs for</secondary>
19926 </indexterm>
19927 This option defines the ACL that is run before Exim starts reading a
19928 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
19929 </para>
19930 <para>
19931 <indexterm role="option">
19932 <primary><option>acl_smtp_auth</option></primary>
19933 </indexterm>
19934 </para>
19935 <informaltable frame="all">
19936 <tgroup cols="4" colsep="0" rowsep="0">
19937 <colspec colwidth="8*" align="left"/>
19938 <colspec colwidth="6*" align="center"/>
19939 <colspec colwidth="6*" align="center"/>
19940 <colspec colwidth="6*" align="right"/>
19941 <tbody>
19942 <row>
19943 <entry><option>acl_smtp_auth</option></entry>
19944 <entry>Use: <emphasis>main</emphasis></entry>
19945 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19946 <entry>Default: <emphasis>unset</emphasis></entry>
19947 </row>
19948 </tbody>
19949 </tgroup>
19950 </informaltable>
19951 <para>
19952 <indexterm role="concept">
19953 <primary>access control lists (ACLs)</primary>
19954 <secondary>setting up for SMTP commands</secondary>
19955 </indexterm>
19956 <indexterm role="concept">
19957 <primary>AUTH</primary>
19958 <secondary>ACL for</secondary>
19959 </indexterm>
19960 This option defines the ACL that is run when an SMTP AUTH command is
19961 received. See chapter <xref linkend="CHAPACL"/> for further details.
19962 </para>
19963 <para>
19964 <indexterm role="option">
19965 <primary><option>acl_smtp_connect</option></primary>
19966 </indexterm>
19967 </para>
19968 <informaltable frame="all">
19969 <tgroup cols="4" colsep="0" rowsep="0">
19970 <colspec colwidth="8*" align="left"/>
19971 <colspec colwidth="6*" align="center"/>
19972 <colspec colwidth="6*" align="center"/>
19973 <colspec colwidth="6*" align="right"/>
19974 <tbody>
19975 <row>
19976 <entry><option>acl_smtp_connect</option></entry>
19977 <entry>Use: <emphasis>main</emphasis></entry>
19978 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19979 <entry>Default: <emphasis>unset</emphasis></entry>
19980 </row>
19981 </tbody>
19982 </tgroup>
19983 </informaltable>
19984 <para>
19985 <indexterm role="concept">
19986 <primary>access control lists (ACLs)</primary>
19987 <secondary>on SMTP connection</secondary>
19988 </indexterm>
19989 This option defines the ACL that is run when an SMTP connection is received.
19990 See chapter <xref linkend="CHAPACL"/> for further details.
19991 </para>
19992 <para>
19993 <indexterm role="option">
19994 <primary><option>acl_smtp_data</option></primary>
19995 </indexterm>
19996 </para>
19997 <informaltable frame="all">
19998 <tgroup cols="4" colsep="0" rowsep="0">
19999 <colspec colwidth="8*" align="left"/>
20000 <colspec colwidth="6*" align="center"/>
20001 <colspec colwidth="6*" align="center"/>
20002 <colspec colwidth="6*" align="right"/>
20003 <tbody>
20004 <row>
20005 <entry><option>acl_smtp_data</option></entry>
20006 <entry>Use: <emphasis>main</emphasis></entry>
20007 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20008 <entry>Default: <emphasis>unset</emphasis></entry>
20009 </row>
20010 </tbody>
20011 </tgroup>
20012 </informaltable>
20013 <para>
20014 <indexterm role="concept">
20015 <primary>DATA</primary>
20016 <secondary>ACL for</secondary>
20017 </indexterm>
20018 This option defines the ACL that is run after an SMTP DATA command has been
20019 processed and the message itself has been received, but before the final
20020 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20021 </para>
20022 <para>
20023 <indexterm role="option">
20024 <primary><option>acl_smtp_etrn</option></primary>
20025 </indexterm>
20026 </para>
20027 <informaltable frame="all">
20028 <tgroup cols="4" colsep="0" rowsep="0">
20029 <colspec colwidth="8*" align="left"/>
20030 <colspec colwidth="6*" align="center"/>
20031 <colspec colwidth="6*" align="center"/>
20032 <colspec colwidth="6*" align="right"/>
20033 <tbody>
20034 <row>
20035 <entry><option>acl_smtp_etrn</option></entry>
20036 <entry>Use: <emphasis>main</emphasis></entry>
20037 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20038 <entry>Default: <emphasis>unset</emphasis></entry>
20039 </row>
20040 </tbody>
20041 </tgroup>
20042 </informaltable>
20043 <para>
20044 <indexterm role="concept">
20045 <primary>ETRN</primary>
20046 <secondary>ACL for</secondary>
20047 </indexterm>
20048 This option defines the ACL that is run when an SMTP ETRN command is
20049 received. See chapter <xref linkend="CHAPACL"/> for further details.
20050 </para>
20051 <para>
20052 <indexterm role="option">
20053 <primary><option>acl_smtp_expn</option></primary>
20054 </indexterm>
20055 </para>
20056 <informaltable frame="all">
20057 <tgroup cols="4" colsep="0" rowsep="0">
20058 <colspec colwidth="8*" align="left"/>
20059 <colspec colwidth="6*" align="center"/>
20060 <colspec colwidth="6*" align="center"/>
20061 <colspec colwidth="6*" align="right"/>
20062 <tbody>
20063 <row>
20064 <entry><option>acl_smtp_expn</option></entry>
20065 <entry>Use: <emphasis>main</emphasis></entry>
20066 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20067 <entry>Default: <emphasis>unset</emphasis></entry>
20068 </row>
20069 </tbody>
20070 </tgroup>
20071 </informaltable>
20072 <para>
20073 <indexterm role="concept">
20074 <primary>EXPN</primary>
20075 <secondary>ACL for</secondary>
20076 </indexterm>
20077 This option defines the ACL that is run when an SMTP EXPN command is
20078 received. See chapter <xref linkend="CHAPACL"/> for further details.
20079 </para>
20080 <para>
20081 <indexterm role="option">
20082 <primary><option>acl_smtp_helo</option></primary>
20083 </indexterm>
20084 </para>
20085 <informaltable frame="all">
20086 <tgroup cols="4" colsep="0" rowsep="0">
20087 <colspec colwidth="8*" align="left"/>
20088 <colspec colwidth="6*" align="center"/>
20089 <colspec colwidth="6*" align="center"/>
20090 <colspec colwidth="6*" align="right"/>
20091 <tbody>
20092 <row>
20093 <entry><option>acl_smtp_helo</option></entry>
20094 <entry>Use: <emphasis>main</emphasis></entry>
20095 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20096 <entry>Default: <emphasis>unset</emphasis></entry>
20097 </row>
20098 </tbody>
20099 </tgroup>
20100 </informaltable>
20101 <para>
20102 <indexterm role="concept">
20103 <primary>EHLO</primary>
20104 <secondary>ACL for</secondary>
20105 </indexterm>
20106 <indexterm role="concept">
20107 <primary>HELO</primary>
20108 <secondary>ACL for</secondary>
20109 </indexterm>
20110 This option defines the ACL that is run when an SMTP EHLO or HELO
20111 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20112 </para>
20113 <para>
20114 <indexterm role="option">
20115 <primary><option>acl_smtp_mail</option></primary>
20116 </indexterm>
20117 </para>
20118 <informaltable frame="all">
20119 <tgroup cols="4" colsep="0" rowsep="0">
20120 <colspec colwidth="8*" align="left"/>
20121 <colspec colwidth="6*" align="center"/>
20122 <colspec colwidth="6*" align="center"/>
20123 <colspec colwidth="6*" align="right"/>
20124 <tbody>
20125 <row>
20126 <entry><option>acl_smtp_mail</option></entry>
20127 <entry>Use: <emphasis>main</emphasis></entry>
20128 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20129 <entry>Default: <emphasis>unset</emphasis></entry>
20130 </row>
20131 </tbody>
20132 </tgroup>
20133 </informaltable>
20134 <para>
20135 <indexterm role="concept">
20136 <primary>MAIL</primary>
20137 <secondary>ACL for</secondary>
20138 </indexterm>
20139 This option defines the ACL that is run when an SMTP MAIL command is
20140 received. See chapter <xref linkend="CHAPACL"/> for further details.
20141 </para>
20142 <para>
20143 <indexterm role="option">
20144 <primary><option>acl_smtp_mailauth</option></primary>
20145 </indexterm>
20146 </para>
20147 <informaltable frame="all">
20148 <tgroup cols="4" colsep="0" rowsep="0">
20149 <colspec colwidth="8*" align="left"/>
20150 <colspec colwidth="6*" align="center"/>
20151 <colspec colwidth="6*" align="center"/>
20152 <colspec colwidth="6*" align="right"/>
20153 <tbody>
20154 <row>
20155 <entry><option>acl_smtp_mailauth</option></entry>
20156 <entry>Use: <emphasis>main</emphasis></entry>
20157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20158 <entry>Default: <emphasis>unset</emphasis></entry>
20159 </row>
20160 </tbody>
20161 </tgroup>
20162 </informaltable>
20163 <para>
20164 <indexterm role="concept">
20165 <primary>AUTH</primary>
20166 <secondary>on MAIL command</secondary>
20167 </indexterm>
20168 This option defines the ACL that is run when there is an AUTH parameter on
20169 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20170 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20171 </para>
20172 <para>
20173 <indexterm role="option">
20174 <primary><option>acl_smtp_mime</option></primary>
20175 </indexterm>
20176 </para>
20177 <informaltable frame="all">
20178 <tgroup cols="4" colsep="0" rowsep="0">
20179 <colspec colwidth="8*" align="left"/>
20180 <colspec colwidth="6*" align="center"/>
20181 <colspec colwidth="6*" align="center"/>
20182 <colspec colwidth="6*" align="right"/>
20183 <tbody>
20184 <row>
20185 <entry><option>acl_smtp_mime</option></entry>
20186 <entry>Use: <emphasis>main</emphasis></entry>
20187 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20188 <entry>Default: <emphasis>unset</emphasis></entry>
20189 </row>
20190 </tbody>
20191 </tgroup>
20192 </informaltable>
20193 <para>
20194 <indexterm role="concept">
20195 <primary>MIME content scanning</primary>
20196 <secondary>ACL for</secondary>
20197 </indexterm>
20198 This option is available when Exim is built with the content-scanning
20199 extension. It defines the ACL that is run for each MIME part in a message. See
20200 section <xref linkend="SECTscanmimepart"/> for details.
20201 </para>
20202 <para>
20203 <indexterm role="option">
20204 <primary><option>acl_smtp_predata</option></primary>
20205 </indexterm>
20206 </para>
20207 <informaltable frame="all">
20208 <tgroup cols="4" colsep="0" rowsep="0">
20209 <colspec colwidth="8*" align="left"/>
20210 <colspec colwidth="6*" align="center"/>
20211 <colspec colwidth="6*" align="center"/>
20212 <colspec colwidth="6*" align="right"/>
20213 <tbody>
20214 <row>
20215 <entry><option>acl_smtp_predata</option></entry>
20216 <entry>Use: <emphasis>main</emphasis></entry>
20217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20218 <entry>Default: <emphasis>unset</emphasis></entry>
20219 </row>
20220 </tbody>
20221 </tgroup>
20222 </informaltable>
20223 <para>
20224 This option defines the ACL that is run when an SMTP DATA command is
20225 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20226 further details.
20227 </para>
20228 <para>
20229 <indexterm role="option">
20230 <primary><option>acl_smtp_quit</option></primary>
20231 </indexterm>
20232 </para>
20233 <informaltable frame="all">
20234 <tgroup cols="4" colsep="0" rowsep="0">
20235 <colspec colwidth="8*" align="left"/>
20236 <colspec colwidth="6*" align="center"/>
20237 <colspec colwidth="6*" align="center"/>
20238 <colspec colwidth="6*" align="right"/>
20239 <tbody>
20240 <row>
20241 <entry><option>acl_smtp_quit</option></entry>
20242 <entry>Use: <emphasis>main</emphasis></entry>
20243 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20244 <entry>Default: <emphasis>unset</emphasis></entry>
20245 </row>
20246 </tbody>
20247 </tgroup>
20248 </informaltable>
20249 <para>
20250 <indexterm role="concept">
20251 <primary>QUIT, ACL for</primary>
20252 </indexterm>
20253 This option defines the ACL that is run when an SMTP QUIT command is
20254 received. See chapter <xref linkend="CHAPACL"/> for further details.
20255 </para>
20256 <para>
20257 <indexterm role="option">
20258 <primary><option>acl_smtp_rcpt</option></primary>
20259 </indexterm>
20260 </para>
20261 <informaltable frame="all">
20262 <tgroup cols="4" colsep="0" rowsep="0">
20263 <colspec colwidth="8*" align="left"/>
20264 <colspec colwidth="6*" align="center"/>
20265 <colspec colwidth="6*" align="center"/>
20266 <colspec colwidth="6*" align="right"/>
20267 <tbody>
20268 <row>
20269 <entry><option>acl_smtp_rcpt</option></entry>
20270 <entry>Use: <emphasis>main</emphasis></entry>
20271 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20272 <entry>Default: <emphasis>unset</emphasis></entry>
20273 </row>
20274 </tbody>
20275 </tgroup>
20276 </informaltable>
20277 <para>
20278 <indexterm role="concept">
20279 <primary>RCPT</primary>
20280 <secondary>ACL for</secondary>
20281 </indexterm>
20282 This option defines the ACL that is run when an SMTP RCPT command is
20283 received. See chapter <xref linkend="CHAPACL"/> for further details.
20284 </para>
20285 <para>
20286 <indexterm role="option">
20287 <primary><option>acl_smtp_starttls</option></primary>
20288 </indexterm>
20289 </para>
20290 <informaltable frame="all">
20291 <tgroup cols="4" colsep="0" rowsep="0">
20292 <colspec colwidth="8*" align="left"/>
20293 <colspec colwidth="6*" align="center"/>
20294 <colspec colwidth="6*" align="center"/>
20295 <colspec colwidth="6*" align="right"/>
20296 <tbody>
20297 <row>
20298 <entry><option>acl_smtp_starttls</option></entry>
20299 <entry>Use: <emphasis>main</emphasis></entry>
20300 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20301 <entry>Default: <emphasis>unset</emphasis></entry>
20302 </row>
20303 </tbody>
20304 </tgroup>
20305 </informaltable>
20306 <para>
20307 <indexterm role="concept">
20308 <primary>STARTTLS, ACL for</primary>
20309 </indexterm>
20310 This option defines the ACL that is run when an SMTP STARTTLS command is
20311 received. See chapter <xref linkend="CHAPACL"/> for further details.
20312 </para>
20313 <para>
20314 <indexterm role="option">
20315 <primary><option>acl_smtp_vrfy</option></primary>
20316 </indexterm>
20317 </para>
20318 <informaltable frame="all">
20319 <tgroup cols="4" colsep="0" rowsep="0">
20320 <colspec colwidth="8*" align="left"/>
20321 <colspec colwidth="6*" align="center"/>
20322 <colspec colwidth="6*" align="center"/>
20323 <colspec colwidth="6*" align="right"/>
20324 <tbody>
20325 <row>
20326 <entry><option>acl_smtp_vrfy</option></entry>
20327 <entry>Use: <emphasis>main</emphasis></entry>
20328 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20329 <entry>Default: <emphasis>unset</emphasis></entry>
20330 </row>
20331 </tbody>
20332 </tgroup>
20333 </informaltable>
20334 <para>
20335 <indexterm role="concept">
20336 <primary>VRFY</primary>
20337 <secondary>ACL for</secondary>
20338 </indexterm>
20339 This option defines the ACL that is run when an SMTP VRFY command is
20340 received. See chapter <xref linkend="CHAPACL"/> for further details.
20341 </para>
20342 <para>
20343 <indexterm role="option">
20344 <primary><option>admin_groups</option></primary>
20345 </indexterm>
20346 </para>
20347 <informaltable frame="all">
20348 <tgroup cols="4" colsep="0" rowsep="0">
20349 <colspec colwidth="8*" align="left"/>
20350 <colspec colwidth="6*" align="center"/>
20351 <colspec colwidth="6*" align="center"/>
20352 <colspec colwidth="6*" align="right"/>
20353 <tbody>
20354 <row>
20355 <entry><option>admin_groups</option></entry>
20356 <entry>Use: <emphasis>main</emphasis></entry>
20357 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
20358 <entry>Default: <emphasis>unset</emphasis></entry>
20359 </row>
20360 </tbody>
20361 </tgroup>
20362 </informaltable>
20363 <para>
20364 <indexterm role="concept">
20365 <primary>admin user</primary>
20366 </indexterm>
20367 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
20368 current group or any of the supplementary groups of an Exim caller is in this
20369 colon-separated list, the caller has admin privileges. If all your system
20370 programmers are in a specific group, for example, you can give them all Exim
20371 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20372 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
20373 To permit this, you have to add individuals to the Exim group.
20374 </para>
20375 <para>
20376 <indexterm role="option">
20377 <primary><option>allow_domain_literals</option></primary>
20378 </indexterm>
20379 </para>
20380 <informaltable frame="all">
20381 <tgroup cols="4" colsep="0" rowsep="0">
20382 <colspec colwidth="8*" align="left"/>
20383 <colspec colwidth="6*" align="center"/>
20384 <colspec colwidth="6*" align="center"/>
20385 <colspec colwidth="6*" align="right"/>
20386 <tbody>
20387 <row>
20388 <entry><option>allow_domain_literals</option></entry>
20389 <entry>Use: <emphasis>main</emphasis></entry>
20390 <entry>Type: <emphasis>boolean</emphasis></entry>
20391 <entry>Default: <emphasis>false</emphasis></entry>
20392 </row>
20393 </tbody>
20394 </tgroup>
20395 </informaltable>
20396 <para>
20397 <indexterm role="concept">
20398 <primary>domain literal</primary>
20399 </indexterm>
20400 If this option is set, the RFC 2822 domain literal format is permitted in
20401 email addresses. The option is not set by default, because the domain literal
20402 format is not normally required these days, and few people know about it. It
20403 has, however, been exploited by mail abusers.
20404 </para>
20405 <para>
20406 Unfortunately, it seems that some DNS black list maintainers are using this
20407 format to report black listing to postmasters. If you want to accept messages
20408 addressed to your hosts by IP address, you need to set
20409 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20410 domains (defined in the named domain list <option>local_domains</option> in the default
20411 configuration). This <quote>magic string</quote> matches the domain literal form of all
20412 the local host&#x2019;s IP addresses.
20413 </para>
20414 <para>
20415 <indexterm role="option">
20416 <primary><option>allow_mx_to_ip</option></primary>
20417 </indexterm>
20418 </para>
20419 <informaltable frame="all">
20420 <tgroup cols="4" colsep="0" rowsep="0">
20421 <colspec colwidth="8*" align="left"/>
20422 <colspec colwidth="6*" align="center"/>
20423 <colspec colwidth="6*" align="center"/>
20424 <colspec colwidth="6*" align="right"/>
20425 <tbody>
20426 <row>
20427 <entry><option>allow_mx_to_ip</option></entry>
20428 <entry>Use: <emphasis>main</emphasis></entry>
20429 <entry>Type: <emphasis>boolean</emphasis></entry>
20430 <entry>Default: <emphasis>false</emphasis></entry>
20431 </row>
20432 </tbody>
20433 </tgroup>
20434 </informaltable>
20435 <para>
20436 <indexterm role="concept">
20437 <primary>MX record</primary>
20438 <secondary>pointing to IP address</secondary>
20439 </indexterm>
20440 It appears that more and more DNS zone administrators are breaking the rules
20441 and putting domain names that look like IP addresses on the right hand side of
20442 MX records. Exim follows the rules and rejects this, giving an error message
20443 that explains the mis-configuration. However, some other MTAs support this
20444 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
20445 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20446 recommended, except when you have no other choice.
20447 </para>
20448 <para>
20449 <indexterm role="option">
20450 <primary><option>allow_utf8_domains</option></primary>
20451 </indexterm>
20452 </para>
20453 <informaltable frame="all">
20454 <tgroup cols="4" colsep="0" rowsep="0">
20455 <colspec colwidth="8*" align="left"/>
20456 <colspec colwidth="6*" align="center"/>
20457 <colspec colwidth="6*" align="center"/>
20458 <colspec colwidth="6*" align="right"/>
20459 <tbody>
20460 <row>
20461 <entry><option>allow_utf8_domains</option></entry>
20462 <entry>Use: <emphasis>main</emphasis></entry>
20463 <entry>Type: <emphasis>boolean</emphasis></entry>
20464 <entry>Default: <emphasis>false</emphasis></entry>
20465 </row>
20466 </tbody>
20467 </tgroup>
20468 </informaltable>
20469 <para>
20470 <indexterm role="concept">
20471 <primary>domain</primary>
20472 <secondary>UTF-8 characters in</secondary>
20473 </indexterm>
20474 <indexterm role="concept">
20475 <primary>UTF-8</primary>
20476 <secondary>in domain name</secondary>
20477 </indexterm>
20478 Lots of discussion is going on about internationalized domain names. One
20479 camp is strongly in favour of just using UTF-8 characters, and it seems
20480 that at least two other MTAs permit this. This option allows Exim users to
20481 experiment if they wish.
20482 </para>
20483 <para>
20484 If it is set true, Exim&#x2019;s domain parsing function allows valid
20485 UTF-8 multicharacters to appear in domain name components, in addition to
20486 letters, digits, and hyphens. However, just setting this option is not
20487 enough; if you want to look up these domain names in the DNS, you must also
20488 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20489 suitable setting is:
20490 </para>
20491 <literallayout class="monospaced">
20492 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
20493   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20494 </literallayout>
20495 <para>
20496 Alternatively, you can just disable this feature by setting
20497 </para>
20498 <literallayout class="monospaced">
20499 dns_check_names_pattern =
20500 </literallayout>
20501 <para>
20502 That is, set the option to an empty string so that no check is done.
20503 </para>
20504 <para>
20505 <indexterm role="option">
20506 <primary><option>auth_advertise_hosts</option></primary>
20507 </indexterm>
20508 </para>
20509 <informaltable frame="all">
20510 <tgroup cols="4" colsep="0" rowsep="0">
20511 <colspec colwidth="8*" align="left"/>
20512 <colspec colwidth="6*" align="center"/>
20513 <colspec colwidth="6*" align="center"/>
20514 <colspec colwidth="6*" align="right"/>
20515 <tbody>
20516 <row>
20517 <entry><option>auth_advertise_hosts</option></entry>
20518 <entry>Use: <emphasis>main</emphasis></entry>
20519 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
20520 <entry>Default: <emphasis>*</emphasis></entry>
20521 </row>
20522 </tbody>
20523 </tgroup>
20524 </informaltable>
20525 <para>
20526 <indexterm role="concept">
20527 <primary>authentication</primary>
20528 <secondary>advertising</secondary>
20529 </indexterm>
20530 <indexterm role="concept">
20531 <primary>AUTH</primary>
20532 <secondary>advertising</secondary>
20533 </indexterm>
20534 If any server authentication mechanisms are configured, Exim advertises them in
20535 response to an EHLO command only if the calling host matches this list.
20536 Otherwise, Exim does not advertise AUTH.
20537 Exim does not accept AUTH commands from clients to which it has not
20538 advertised the availability of AUTH. The advertising of individual
20539 authentication mechanisms can be controlled by the use of the
20540 <option>server_advertise_condition</option> generic authenticator option on the individual
20541 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20542 </para>
20543 <para>
20544 Certain mail clients (for example, Netscape) require the user to provide a name
20545 and password for authentication if AUTH is advertised, even though it may
20546 not be needed (the host may accept messages from hosts on its local LAN without
20547 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20548 to make these clients more friendly by excluding them from the set of hosts to
20549 which Exim advertises AUTH.
20550 </para>
20551 <para>
20552 <indexterm role="concept">
20553 <primary>AUTH</primary>
20554 <secondary>advertising when encrypted</secondary>
20555 </indexterm>
20556 If you want to advertise the availability of AUTH only when the connection
20557 is encrypted using TLS, you can make use of the fact that the value of this
20558 option is expanded, with a setting like this:
20559 </para>
20560 <literallayout class="monospaced">
20561 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20562 </literallayout>
20563 <para>
20564 <indexterm role="variable">
20565 <primary><varname>$tls_cipher</varname></primary>
20566 </indexterm>
20567 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20568 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20569 expansion is *, which matches all hosts.
20570 </para>
20571 <para>
20572 <indexterm role="option">
20573 <primary><option>auto_thaw</option></primary>
20574 </indexterm>
20575 </para>
20576 <informaltable frame="all">
20577 <tgroup cols="4" colsep="0" rowsep="0">
20578 <colspec colwidth="8*" align="left"/>
20579 <colspec colwidth="6*" align="center"/>
20580 <colspec colwidth="6*" align="center"/>
20581 <colspec colwidth="6*" align="right"/>
20582 <tbody>
20583 <row>
20584 <entry><option>auto_thaw</option></entry>
20585 <entry>Use: <emphasis>main</emphasis></entry>
20586 <entry>Type: <emphasis>time</emphasis></entry>
20587 <entry>Default: <emphasis>0s</emphasis></entry>
20588 </row>
20589 </tbody>
20590 </tgroup>
20591 </informaltable>
20592 <para>
20593 <indexterm role="concept">
20594 <primary>thawing messages</primary>
20595 </indexterm>
20596 <indexterm role="concept">
20597 <primary>unfreezing messages</primary>
20598 </indexterm>
20599 If this option is set to a time greater than zero, a queue runner will try a
20600 new delivery attempt on any frozen message, other than a bounce message, if
20601 this much time has passed since it was frozen. This may result in the message
20602 being re-frozen if nothing has changed since the last attempt. It is a way of
20603 saying <quote>keep on trying, even though there are big problems</quote>.
20604 </para>
20605 <para>
20606 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20607 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20608 thought to be very useful any more, and its use should probably be avoided.
20609 </para>
20610 <para>
20611 <indexterm role="option">
20612 <primary><option>av_scanner</option></primary>
20613 </indexterm>
20614 </para>
20615 <informaltable frame="all">
20616 <tgroup cols="4" colsep="0" rowsep="0">
20617 <colspec colwidth="8*" align="left"/>
20618 <colspec colwidth="6*" align="center"/>
20619 <colspec colwidth="6*" align="center"/>
20620 <colspec colwidth="6*" align="right"/>
20621 <tbody>
20622 <row>
20623 <entry><option>av_scanner</option></entry>
20624 <entry>Use: <emphasis>main</emphasis></entry>
20625 <entry>Type: <emphasis>string</emphasis></entry>
20626 <entry>Default: <emphasis>see below</emphasis></entry>
20627 </row>
20628 </tbody>
20629 </tgroup>
20630 </informaltable>
20631 <para>
20632 This option is available if Exim is built with the content-scanning extension.
20633 It specifies which anti-virus scanner to use. The default value is:
20634 </para>
20635 <literallayout class="monospaced">
20636 sophie:/var/run/sophie
20637 </literallayout>
20638 <para>
20639 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20640 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20641 </para>
20642 <para>
20643 <indexterm role="option">
20644 <primary><option>bi_command</option></primary>
20645 </indexterm>
20646 </para>
20647 <informaltable frame="all">
20648 <tgroup cols="4" colsep="0" rowsep="0">
20649 <colspec colwidth="8*" align="left"/>
20650 <colspec colwidth="6*" align="center"/>
20651 <colspec colwidth="6*" align="center"/>
20652 <colspec colwidth="6*" align="right"/>
20653 <tbody>
20654 <row>
20655 <entry><option>bi_command</option></entry>
20656 <entry>Use: <emphasis>main</emphasis></entry>
20657 <entry>Type: <emphasis>string</emphasis></entry>
20658 <entry>Default: <emphasis>unset</emphasis></entry>
20659 </row>
20660 </tbody>
20661 </tgroup>
20662 </informaltable>
20663 <para>
20664 <indexterm role="option">
20665 <primary><option>-bi</option></primary>
20666 </indexterm>
20667 This option supplies the name of a command that is run when Exim is called with
20668 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20669 just the command name, it is not a complete command line. If an argument is
20670 required, it must come from the <option>-oA</option> command line option.
20671 </para>
20672 <para>
20673 <indexterm role="option">
20674 <primary><option>bounce_message_file</option></primary>
20675 </indexterm>
20676 </para>
20677 <informaltable frame="all">
20678 <tgroup cols="4" colsep="0" rowsep="0">
20679 <colspec colwidth="8*" align="left"/>
20680 <colspec colwidth="6*" align="center"/>
20681 <colspec colwidth="6*" align="center"/>
20682 <colspec colwidth="6*" align="right"/>
20683 <tbody>
20684 <row>
20685 <entry><option>bounce_message_file</option></entry>
20686 <entry>Use: <emphasis>main</emphasis></entry>
20687 <entry>Type: <emphasis>string</emphasis></entry>
20688 <entry>Default: <emphasis>unset</emphasis></entry>
20689 </row>
20690 </tbody>
20691 </tgroup>
20692 </informaltable>
20693 <para>
20694 <indexterm role="concept">
20695 <primary>bounce message</primary>
20696 <secondary>customizing</secondary>
20697 </indexterm>
20698 <indexterm role="concept">
20699 <primary>customizing</primary>
20700 <secondary>bounce message</secondary>
20701 </indexterm>
20702 This option defines a template file containing paragraphs of text to be used
20703 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
20704 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20705 </para>
20706 <para>
20707 <indexterm role="option">
20708 <primary><option>bounce_message_text</option></primary>
20709 </indexterm>
20710 </para>
20711 <informaltable frame="all">
20712 <tgroup cols="4" colsep="0" rowsep="0">
20713 <colspec colwidth="8*" align="left"/>
20714 <colspec colwidth="6*" align="center"/>
20715 <colspec colwidth="6*" align="center"/>
20716 <colspec colwidth="6*" align="right"/>
20717 <tbody>
20718 <row>
20719 <entry><option>bounce_message_text</option></entry>
20720 <entry>Use: <emphasis>main</emphasis></entry>
20721 <entry>Type: <emphasis>string</emphasis></entry>
20722 <entry>Default: <emphasis>unset</emphasis></entry>
20723 </row>
20724 </tbody>
20725 </tgroup>
20726 </informaltable>
20727 <para>
20728 When this option is set, its contents are included in the default bounce
20729 message immediately after <quote>This message was created automatically by mail
20730 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
20731 </para>
20732 <para>
20733 <indexterm role="option">
20734 <primary><option>bounce_return_body</option></primary>
20735 </indexterm>
20736 </para>
20737 <informaltable frame="all">
20738 <tgroup cols="4" colsep="0" rowsep="0">
20739 <colspec colwidth="8*" align="left"/>
20740 <colspec colwidth="6*" align="center"/>
20741 <colspec colwidth="6*" align="center"/>
20742 <colspec colwidth="6*" align="right"/>
20743 <tbody>
20744 <row>
20745 <entry><option>bounce_return_body</option></entry>
20746 <entry>Use: <emphasis>main</emphasis></entry>
20747 <entry>Type: <emphasis>boolean</emphasis></entry>
20748 <entry>Default: <emphasis>true</emphasis></entry>
20749 </row>
20750 </tbody>
20751 </tgroup>
20752 </informaltable>
20753 <para>
20754 <indexterm role="concept">
20755 <primary>bounce message</primary>
20756 <secondary>including body</secondary>
20757 </indexterm>
20758 This option controls whether the body of an incoming message is included in a
20759 bounce message when <option>bounce_return_message</option> is true. The default setting
20760 causes the entire message, both header and body, to be returned (subject to the
20761 value of <option>bounce_return_size_limit</option>). If this option is false, only the
20762 message header is included. In the case of a non-SMTP message containing an
20763 error that is detected during reception, only those header lines preceding the
20764 point at which the error was detected are returned.
20765 <indexterm role="concept">
20766 <primary>bounce message</primary>
20767 <secondary>including original</secondary>
20768 </indexterm>
20769 </para>
20770 <para>
20771 <indexterm role="option">
20772 <primary><option>bounce_return_message</option></primary>
20773 </indexterm>
20774 </para>
20775 <informaltable frame="all">
20776 <tgroup cols="4" colsep="0" rowsep="0">
20777 <colspec colwidth="8*" align="left"/>
20778 <colspec colwidth="6*" align="center"/>
20779 <colspec colwidth="6*" align="center"/>
20780 <colspec colwidth="6*" align="right"/>
20781 <tbody>
20782 <row>
20783 <entry><option>bounce_return_message</option></entry>
20784 <entry>Use: <emphasis>main</emphasis></entry>
20785 <entry>Type: <emphasis>boolean</emphasis></entry>
20786 <entry>Default: <emphasis>true</emphasis></entry>
20787 </row>
20788 </tbody>
20789 </tgroup>
20790 </informaltable>
20791 <para>
20792 If this option is set false, none of the original message is included in
20793 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
20794 <option>bounce_return_body</option>.
20795 </para>
20796 <para>
20797 <indexterm role="option">
20798 <primary><option>bounce_return_size_limit</option></primary>
20799 </indexterm>
20800 </para>
20801 <informaltable frame="all">
20802 <tgroup cols="4" colsep="0" rowsep="0">
20803 <colspec colwidth="8*" align="left"/>
20804 <colspec colwidth="6*" align="center"/>
20805 <colspec colwidth="6*" align="center"/>
20806 <colspec colwidth="6*" align="right"/>
20807 <tbody>
20808 <row>
20809 <entry><option>bounce_return_size_limit</option></entry>
20810 <entry>Use: <emphasis>main</emphasis></entry>
20811 <entry>Type: <emphasis>integer</emphasis></entry>
20812 <entry>Default: <emphasis>100K</emphasis></entry>
20813 </row>
20814 </tbody>
20815 </tgroup>
20816 </informaltable>
20817 <para>
20818 <indexterm role="concept">
20819 <primary>size</primary>
20820 <secondary>of bounce, limit</secondary>
20821 </indexterm>
20822 <indexterm role="concept">
20823 <primary>bounce message</primary>
20824 <secondary>size limit</secondary>
20825 </indexterm>
20826 <indexterm role="concept">
20827 <primary>limit</primary>
20828 <secondary>bounce message size</secondary>
20829 </indexterm>
20830 This option sets a limit in bytes on the size of messages that are returned to
20831 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
20832 limit should be less than the value of the global <option>message_size_limit</option> and of
20833 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
20834 that Exim generates. If this option is set to zero there is no limit.
20835 </para>
20836 <para>
20837 When the body of any message that is to be included in a bounce message is
20838 greater than the limit, it is truncated, and a comment pointing this out is
20839 added at the top. The actual cutoff may be greater than the value given, owing
20840 to the use of buffering for transferring the message in chunks (typically 8K in
20841 size). The idea is to save bandwidth on those undeliverable 15-megabyte
20842 messages.
20843 </para>
20844 <para>
20845 <indexterm role="option">
20846 <primary><option>bounce_sender_authentication</option></primary>
20847 </indexterm>
20848 </para>
20849 <informaltable frame="all">
20850 <tgroup cols="4" colsep="0" rowsep="0">
20851 <colspec colwidth="8*" align="left"/>
20852 <colspec colwidth="6*" align="center"/>
20853 <colspec colwidth="6*" align="center"/>
20854 <colspec colwidth="6*" align="right"/>
20855 <tbody>
20856 <row>
20857 <entry><option>bounce_sender_authentication</option></entry>
20858 <entry>Use: <emphasis>main</emphasis></entry>
20859 <entry>Type: <emphasis>string</emphasis></entry>
20860 <entry>Default: <emphasis>unset</emphasis></entry>
20861 </row>
20862 </tbody>
20863 </tgroup>
20864 </informaltable>
20865 <para>
20866 <indexterm role="concept">
20867 <primary>bounce message</primary>
20868 <secondary>sender authentication</secondary>
20869 </indexterm>
20870 <indexterm role="concept">
20871 <primary>authentication</primary>
20872 <secondary>bounce message</secondary>
20873 </indexterm>
20874 <indexterm role="concept">
20875 <primary>AUTH</primary>
20876 <secondary>on bounce message</secondary>
20877 </indexterm>
20878 This option provides an authenticated sender address that is sent with any
20879 bounce messages generated by Exim that are sent over an authenticated SMTP
20880 connection. A typical setting might be:
20881 </para>
20882 <literallayout class="monospaced">
20883 bounce_sender_authentication = mailer-daemon@my.domain.example
20884 </literallayout>
20885 <para>
20886 which would cause bounce messages to be sent using the SMTP command:
20887 </para>
20888 <literallayout class="monospaced">
20889 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
20890 </literallayout>
20891 <para>
20892 The value of <option>bounce_sender_authentication</option> must always be a complete email
20893 address.
20894 </para>
20895 <para>
20896 <indexterm role="option">
20897 <primary><option>callout_domain_negative_expire</option></primary>
20898 </indexterm>
20899 </para>
20900 <informaltable frame="all">
20901 <tgroup cols="4" colsep="0" rowsep="0">
20902 <colspec colwidth="8*" align="left"/>
20903 <colspec colwidth="6*" align="center"/>
20904 <colspec colwidth="6*" align="center"/>
20905 <colspec colwidth="6*" align="right"/>
20906 <tbody>
20907 <row>
20908 <entry><option>callout_domain_negative_expire</option></entry>
20909 <entry>Use: <emphasis>main</emphasis></entry>
20910 <entry>Type: <emphasis>time</emphasis></entry>
20911 <entry>Default: <emphasis>3h</emphasis></entry>
20912 </row>
20913 </tbody>
20914 </tgroup>
20915 </informaltable>
20916 <para>
20917 <indexterm role="concept">
20918 <primary>caching</primary>
20919 <secondary>callout timeouts</secondary>
20920 </indexterm>
20921 <indexterm role="concept">
20922 <primary>callout</primary>
20923 <secondary>caching timeouts</secondary>
20924 </indexterm>
20925 This option specifies the expiry time for negative callout cache data for a
20926 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20927 section <xref linkend="SECTcallvercache"/> for details of the caching.
20928 </para>
20929 <para>
20930 <indexterm role="option">
20931 <primary><option>callout_domain_positive_expire</option></primary>
20932 </indexterm>
20933 </para>
20934 <informaltable frame="all">
20935 <tgroup cols="4" colsep="0" rowsep="0">
20936 <colspec colwidth="8*" align="left"/>
20937 <colspec colwidth="6*" align="center"/>
20938 <colspec colwidth="6*" align="center"/>
20939 <colspec colwidth="6*" align="right"/>
20940 <tbody>
20941 <row>
20942 <entry><option>callout_domain_positive_expire</option></entry>
20943 <entry>Use: <emphasis>main</emphasis></entry>
20944 <entry>Type: <emphasis>time</emphasis></entry>
20945 <entry>Default: <emphasis>7d</emphasis></entry>
20946 </row>
20947 </tbody>
20948 </tgroup>
20949 </informaltable>
20950 <para>
20951 This option specifies the expiry time for positive callout cache data for a
20952 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20953 section <xref linkend="SECTcallvercache"/> for details of the caching.
20954 </para>
20955 <para>
20956 <indexterm role="option">
20957 <primary><option>callout_negative_expire</option></primary>
20958 </indexterm>
20959 </para>
20960 <informaltable frame="all">
20961 <tgroup cols="4" colsep="0" rowsep="0">
20962 <colspec colwidth="8*" align="left"/>
20963 <colspec colwidth="6*" align="center"/>
20964 <colspec colwidth="6*" align="center"/>
20965 <colspec colwidth="6*" align="right"/>
20966 <tbody>
20967 <row>
20968 <entry><option>callout_negative_expire</option></entry>
20969 <entry>Use: <emphasis>main</emphasis></entry>
20970 <entry>Type: <emphasis>time</emphasis></entry>
20971 <entry>Default: <emphasis>2h</emphasis></entry>
20972 </row>
20973 </tbody>
20974 </tgroup>
20975 </informaltable>
20976 <para>
20977 This option specifies the expiry time for negative callout cache data for an
20978 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20979 section <xref linkend="SECTcallvercache"/> for details of the caching.
20980 </para>
20981 <para>
20982 <indexterm role="option">
20983 <primary><option>callout_positive_expire</option></primary>
20984 </indexterm>
20985 </para>
20986 <informaltable frame="all">
20987 <tgroup cols="4" colsep="0" rowsep="0">
20988 <colspec colwidth="8*" align="left"/>
20989 <colspec colwidth="6*" align="center"/>
20990 <colspec colwidth="6*" align="center"/>
20991 <colspec colwidth="6*" align="right"/>
20992 <tbody>
20993 <row>
20994 <entry><option>callout_positive_expire</option></entry>
20995 <entry>Use: <emphasis>main</emphasis></entry>
20996 <entry>Type: <emphasis>time</emphasis></entry>
20997 <entry>Default: <emphasis>24h</emphasis></entry>
20998 </row>
20999 </tbody>
21000 </tgroup>
21001 </informaltable>
21002 <para>
21003 This option specifies the expiry time for positive callout cache data for an
21004 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21005 section <xref linkend="SECTcallvercache"/> for details of the caching.
21006 </para>
21007 <para>
21008 <indexterm role="option">
21009 <primary><option>callout_random_local_part</option></primary>
21010 </indexterm>
21011 </para>
21012 <informaltable frame="all">
21013 <tgroup cols="4" colsep="0" rowsep="0">
21014 <colspec colwidth="8*" align="left"/>
21015 <colspec colwidth="6*" align="center"/>
21016 <colspec colwidth="6*" align="center"/>
21017 <colspec colwidth="6*" align="right"/>
21018 <tbody>
21019 <row>
21020 <entry><option>callout_random_local_part</option></entry>
21021 <entry>Use: <emphasis>main</emphasis></entry>
21022 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21023 <entry>Default: <emphasis>see below</emphasis></entry>
21024 </row>
21025 </tbody>
21026 </tgroup>
21027 </informaltable>
21028 <para>
21029 This option defines the <quote>random</quote> local part that can be used as part of
21030 callout verification. The default value is
21031 </para>
21032 <literallayout class="monospaced">
21033 $primary_host_name-$tod_epoch-testing
21034 </literallayout>
21035 <para>
21036 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21037 </para>
21038 <para>
21039 <indexterm role="option">
21040 <primary><option>check_log_inodes</option></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="6*" align="center"/>
21047 <colspec colwidth="6*" align="center"/>
21048 <colspec colwidth="6*" align="right"/>
21049 <tbody>
21050 <row>
21051 <entry><option>check_log_inodes</option></entry>
21052 <entry>Use: <emphasis>main</emphasis></entry>
21053 <entry>Type: <emphasis>integer</emphasis></entry>
21054 <entry>Default: <emphasis>0</emphasis></entry>
21055 </row>
21056 </tbody>
21057 </tgroup>
21058 </informaltable>
21059 <para>
21060 See <option>check_spool_space</option> below.
21061 </para>
21062 <para>
21063 <indexterm role="option">
21064 <primary><option>check_log_space</option></primary>
21065 </indexterm>
21066 </para>
21067 <informaltable frame="all">
21068 <tgroup cols="4" colsep="0" rowsep="0">
21069 <colspec colwidth="8*" align="left"/>
21070 <colspec colwidth="6*" align="center"/>
21071 <colspec colwidth="6*" align="center"/>
21072 <colspec colwidth="6*" align="right"/>
21073 <tbody>
21074 <row>
21075 <entry><option>check_log_space</option></entry>
21076 <entry>Use: <emphasis>main</emphasis></entry>
21077 <entry>Type: <emphasis>integer</emphasis></entry>
21078 <entry>Default: <emphasis>0</emphasis></entry>
21079 </row>
21080 </tbody>
21081 </tgroup>
21082 </informaltable>
21083 <para>
21084 See <option>check_spool_space</option> below.
21085 </para>
21086 <para>
21087 <indexterm role="option">
21088 <primary><option>check_rfc2047_length</option></primary>
21089 </indexterm>
21090 <indexterm role="concept">
21091 <primary>RFC 2047</primary>
21092 <secondary>disabling length check</secondary>
21093 </indexterm>
21094 <indexterm role="option">
21095 <primary><option>check_rfc2047_length</option></primary>
21096 </indexterm>
21097 </para>
21098 <informaltable frame="all">
21099 <tgroup cols="4" colsep="0" rowsep="0">
21100 <colspec colwidth="8*" align="left"/>
21101 <colspec colwidth="6*" align="center"/>
21102 <colspec colwidth="6*" align="center"/>
21103 <colspec colwidth="6*" align="right"/>
21104 <tbody>
21105 <row>
21106 <entry><option>check_rfc2047_length</option></entry>
21107 <entry>Use: <emphasis>main</emphasis></entry>
21108 <entry>Type: <emphasis>boolean</emphasis></entry>
21109 <entry>Default: <emphasis>true</emphasis></entry>
21110 </row>
21111 </tbody>
21112 </tgroup>
21113 </informaltable>
21114 <para>
21115 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21116 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21117 word; strings to be encoded that exceed this length are supposed to use
21118 multiple encoded words. By default, Exim does not recognize encoded words that
21119 exceed the maximum length. However, it seems that some software, in violation
21120 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21121 set false, Exim recognizes encoded words of any length.
21122 </para>
21123 <para>
21124 <indexterm role="option">
21125 <primary><option>check_spool_inodes</option></primary>
21126 </indexterm>
21127 </para>
21128 <informaltable frame="all">
21129 <tgroup cols="4" colsep="0" rowsep="0">
21130 <colspec colwidth="8*" align="left"/>
21131 <colspec colwidth="6*" align="center"/>
21132 <colspec colwidth="6*" align="center"/>
21133 <colspec colwidth="6*" align="right"/>
21134 <tbody>
21135 <row>
21136 <entry><option>check_spool_inodes</option></entry>
21137 <entry>Use: <emphasis>main</emphasis></entry>
21138 <entry>Type: <emphasis>integer</emphasis></entry>
21139 <entry>Default: <emphasis>0</emphasis></entry>
21140 </row>
21141 </tbody>
21142 </tgroup>
21143 </informaltable>
21144 <para>
21145 See <option>check_spool_space</option> below.
21146 </para>
21147 <para>
21148 <indexterm role="option">
21149 <primary><option>check_spool_space</option></primary>
21150 </indexterm>
21151 </para>
21152 <informaltable frame="all">
21153 <tgroup cols="4" colsep="0" rowsep="0">
21154 <colspec colwidth="8*" align="left"/>
21155 <colspec colwidth="6*" align="center"/>
21156 <colspec colwidth="6*" align="center"/>
21157 <colspec colwidth="6*" align="right"/>
21158 <tbody>
21159 <row>
21160 <entry><option>check_spool_space</option></entry>
21161 <entry>Use: <emphasis>main</emphasis></entry>
21162 <entry>Type: <emphasis>integer</emphasis></entry>
21163 <entry>Default: <emphasis>0</emphasis></entry>
21164 </row>
21165 </tbody>
21166 </tgroup>
21167 </informaltable>
21168 <para>
21169 <indexterm role="concept">
21170 <primary>checking disk space</primary>
21171 </indexterm>
21172 <indexterm role="concept">
21173 <primary>disk space, checking</primary>
21174 </indexterm>
21175 <indexterm role="concept">
21176 <primary>spool directory</primary>
21177 <secondary>checking space</secondary>
21178 </indexterm>
21179 The four <option>check_...</option> options allow for checking of disk resources before a
21180 message is accepted.
21181 </para>
21182 <para>
21183 <indexterm role="variable">
21184 <primary><varname>$log_inodes</varname></primary>
21185 </indexterm>
21186 <indexterm role="variable">
21187 <primary><varname>$log_space</varname></primary>
21188 </indexterm>
21189 <indexterm role="variable">
21190 <primary><varname>$spool_inodes</varname></primary>
21191 </indexterm>
21192 <indexterm role="variable">
21193 <primary><varname>$spool_space</varname></primary>
21194 </indexterm>
21195 When any of these options are set, they apply to all incoming messages. If you
21196 want to apply different checks to different kinds of message, you can do so by
21197 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21198 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21199 </para>
21200 <para>
21201 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21202 either value is greater than zero, for example:
21203 </para>
21204 <literallayout class="monospaced">
21205 check_spool_space = 10M
21206 check_spool_inodes = 100
21207 </literallayout>
21208 <para>
21209 The spool partition is the one that contains the directory defined by
21210 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21211 transit.
21212 </para>
21213 <para>
21214 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
21215 files are written if either is greater than zero. These should be set only if
21216 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21217 </para>
21218 <para>
21219 If there is less space or fewer inodes than requested, Exim refuses to accept
21220 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21221 error response to the MAIL command. If ESMTP is in use and there was a
21222 SIZE parameter on the MAIL command, its value is added to the
21223 <option>check_spool_space</option> value, and the check is performed even if
21224 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21225 </para>
21226 <para>
21227 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21228 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21229 </para>
21230 <para>
21231 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21232 failure a message is written to stderr and Exim exits with a non-zero code, as
21233 it obviously cannot send an error message of any kind.
21234 </para>
21235 <para>
21236 <indexterm role="option">
21237 <primary><option>daemon_smtp_ports</option></primary>
21238 </indexterm>
21239 </para>
21240 <informaltable frame="all">
21241 <tgroup cols="4" colsep="0" rowsep="0">
21242 <colspec colwidth="8*" align="left"/>
21243 <colspec colwidth="6*" align="center"/>
21244 <colspec colwidth="6*" align="center"/>
21245 <colspec colwidth="6*" align="right"/>
21246 <tbody>
21247 <row>
21248 <entry><option>daemon_smtp_ports</option></entry>
21249 <entry>Use: <emphasis>main</emphasis></entry>
21250 <entry>Type: <emphasis>string</emphasis></entry>
21251 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21252 </row>
21253 </tbody>
21254 </tgroup>
21255 </informaltable>
21256 <para>
21257 <indexterm role="concept">
21258 <primary>port</primary>
21259 <secondary>for daemon</secondary>
21260 </indexterm>
21261 <indexterm role="concept">
21262 <primary>TCP/IP</primary>
21263 <secondary>setting listening ports</secondary>
21264 </indexterm>
21265 This option specifies one or more default SMTP ports on which the Exim daemon
21266 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21267 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21268 </para>
21269 <para>
21270 <indexterm role="option">
21271 <primary><option>daemon_startup_retries</option></primary>
21272 </indexterm>
21273 </para>
21274 <informaltable frame="all">
21275 <tgroup cols="4" colsep="0" rowsep="0">
21276 <colspec colwidth="8*" align="left"/>
21277 <colspec colwidth="6*" align="center"/>
21278 <colspec colwidth="6*" align="center"/>
21279 <colspec colwidth="6*" align="right"/>
21280 <tbody>
21281 <row>
21282 <entry><option>daemon_startup_retries</option></entry>
21283 <entry>Use: <emphasis>main</emphasis></entry>
21284 <entry>Type: <emphasis>integer</emphasis></entry>
21285 <entry>Default: <emphasis>9</emphasis></entry>
21286 </row>
21287 </tbody>
21288 </tgroup>
21289 </informaltable>
21290 <para>
21291 <indexterm role="concept">
21292 <primary>daemon startup, retrying</primary>
21293 </indexterm>
21294 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21295 the daemon at startup when it cannot immediately bind a listening socket
21296 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21297 defines the number of retries after the first failure, and
21298 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21299 </para>
21300 <para>
21301 <indexterm role="option">
21302 <primary><option>daemon_startup_sleep</option></primary>
21303 </indexterm>
21304 </para>
21305 <informaltable frame="all">
21306 <tgroup cols="4" colsep="0" rowsep="0">
21307 <colspec colwidth="8*" align="left"/>
21308 <colspec colwidth="6*" align="center"/>
21309 <colspec colwidth="6*" align="center"/>
21310 <colspec colwidth="6*" align="right"/>
21311 <tbody>
21312 <row>
21313 <entry><option>daemon_startup_sleep</option></entry>
21314 <entry>Use: <emphasis>main</emphasis></entry>
21315 <entry>Type: <emphasis>time</emphasis></entry>
21316 <entry>Default: <emphasis>30s</emphasis></entry>
21317 </row>
21318 </tbody>
21319 </tgroup>
21320 </informaltable>
21321 <para>
21322 See <option>daemon_startup_retries</option>.
21323 </para>
21324 <para>
21325 <indexterm role="option">
21326 <primary><option>delay_warning</option></primary>
21327 </indexterm>
21328 </para>
21329 <informaltable frame="all">
21330 <tgroup cols="4" colsep="0" rowsep="0">
21331 <colspec colwidth="8*" align="left"/>
21332 <colspec colwidth="6*" align="center"/>
21333 <colspec colwidth="6*" align="center"/>
21334 <colspec colwidth="6*" align="right"/>
21335 <tbody>
21336 <row>
21337 <entry><option>delay_warning</option></entry>
21338 <entry>Use: <emphasis>main</emphasis></entry>
21339 <entry>Type: <emphasis>time list</emphasis></entry>
21340 <entry>Default: <emphasis>24h</emphasis></entry>
21341 </row>
21342 </tbody>
21343 </tgroup>
21344 </informaltable>
21345 <para>
21346 <indexterm role="concept">
21347 <primary>warning of delay</primary>
21348 </indexterm>
21349 <indexterm role="concept">
21350 <primary>delay warning, specifying</primary>
21351 </indexterm>
21352 When a message is delayed, Exim sends a warning message to the sender at
21353 intervals specified by this option. The data is a colon-separated list of times
21354 after which to send warning messages. If the value of the option is an empty
21355 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21356 message has been on the queue for longer than the last time, the last interval
21357 between the times is used to compute subsequent warning times. For example,
21358 with
21359 </para>
21360 <literallayout class="monospaced">
21361 delay_warning = 4h:8h:24h
21362 </literallayout>
21363 <para>
21364 the first message is sent after 4 hours, the second after 8 hours, and
21365 the third one after 24 hours. After that, messages are sent every 16 hours,
21366 because that is the interval between the last two times on the list. If you set
21367 just one time, it specifies the repeat interval. For example, with:
21368 </para>
21369 <literallayout class="monospaced">
21370 delay_warning = 6h
21371 </literallayout>
21372 <para>
21373 messages are repeated every six hours. To stop warnings after a given time, set
21374 a very large time at the end of the list. For example:
21375 </para>
21376 <literallayout class="monospaced">
21377 delay_warning = 2h:12h:99d
21378 </literallayout>
21379 <para>
21380 <indexterm role="option">
21381 <primary><option>delay_warning_condition</option></primary>
21382 </indexterm>
21383 </para>
21384 <informaltable frame="all">
21385 <tgroup cols="4" colsep="0" rowsep="0">
21386 <colspec colwidth="8*" align="left"/>
21387 <colspec colwidth="6*" align="center"/>
21388 <colspec colwidth="6*" align="center"/>
21389 <colspec colwidth="6*" align="right"/>
21390 <tbody>
21391 <row>
21392 <entry><option>delay_warning_condition</option></entry>
21393 <entry>Use: <emphasis>main</emphasis></entry>
21394 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21395 <entry>Default: <emphasis>see below</emphasis></entry>
21396 </row>
21397 </tbody>
21398 </tgroup>
21399 </informaltable>
21400 <para>
21401 <indexterm role="variable">
21402 <primary><varname>$domain</varname></primary>
21403 </indexterm>
21404 The string is expanded at the time a warning message might be sent. If all the
21405 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21406 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21407 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21408 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21409 not sent. The default is:
21410 </para>
21411 <literallayout class="monospaced">
21412 delay_warning_condition = ${if or {\
21413   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21414   { match{$h_precedence:}{(?i)bulk|list|junk} }\
21415   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21416   } {no}{yes}}
21417 </literallayout>
21418 <para>
21419 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21420 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21421 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21422 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21423 </para>
21424 <para>
21425 <indexterm role="option">
21426 <primary><option>deliver_drop_privilege</option></primary>
21427 </indexterm>
21428 </para>
21429 <informaltable frame="all">
21430 <tgroup cols="4" colsep="0" rowsep="0">
21431 <colspec colwidth="8*" align="left"/>
21432 <colspec colwidth="6*" align="center"/>
21433 <colspec colwidth="6*" align="center"/>
21434 <colspec colwidth="6*" align="right"/>
21435 <tbody>
21436 <row>
21437 <entry><option>deliver_drop_privilege</option></entry>
21438 <entry>Use: <emphasis>main</emphasis></entry>
21439 <entry>Type: <emphasis>boolean</emphasis></entry>
21440 <entry>Default: <emphasis>false</emphasis></entry>
21441 </row>
21442 </tbody>
21443 </tgroup>
21444 </informaltable>
21445 <para>
21446 <indexterm role="concept">
21447 <primary>unprivileged delivery</primary>
21448 </indexterm>
21449 <indexterm role="concept">
21450 <primary>delivery</primary>
21451 <secondary>unprivileged</secondary>
21452 </indexterm>
21453 If this option is set true, Exim drops its root privilege at the start of a
21454 delivery process, and runs as the Exim user throughout. This severely restricts
21455 the kinds of local delivery that are possible, but is viable in certain types
21456 of configuration. There is a discussion about the use of root privilege in
21457 chapter <xref linkend="CHAPsecurity"/>.
21458 </para>
21459 <para>
21460 <indexterm role="option">
21461 <primary><option>deliver_queue_load_max</option></primary>
21462 </indexterm>
21463 </para>
21464 <informaltable frame="all">
21465 <tgroup cols="4" colsep="0" rowsep="0">
21466 <colspec colwidth="8*" align="left"/>
21467 <colspec colwidth="6*" align="center"/>
21468 <colspec colwidth="6*" align="center"/>
21469 <colspec colwidth="6*" align="right"/>
21470 <tbody>
21471 <row>
21472 <entry><option>deliver_queue_load_max</option></entry>
21473 <entry>Use: <emphasis>main</emphasis></entry>
21474 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21475 <entry>Default: <emphasis>unset</emphasis></entry>
21476 </row>
21477 </tbody>
21478 </tgroup>
21479 </informaltable>
21480 <para>
21481 <indexterm role="concept">
21482 <primary>load average</primary>
21483 </indexterm>
21484 <indexterm role="concept">
21485 <primary>queue runner</primary>
21486 <secondary>abandoning</secondary>
21487 </indexterm>
21488 When this option is set, a queue run is abandoned if the system load average
21489 becomes greater than the value of the option. The option has no effect on
21490 ancient operating systems on which Exim cannot determine the load average.
21491 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21492 </para>
21493 <para>
21494 <indexterm role="option">
21495 <primary><option>delivery_date_remove</option></primary>
21496 </indexterm>
21497 </para>
21498 <informaltable frame="all">
21499 <tgroup cols="4" colsep="0" rowsep="0">
21500 <colspec colwidth="8*" align="left"/>
21501 <colspec colwidth="6*" align="center"/>
21502 <colspec colwidth="6*" align="center"/>
21503 <colspec colwidth="6*" align="right"/>
21504 <tbody>
21505 <row>
21506 <entry><option>delivery_date_remove</option></entry>
21507 <entry>Use: <emphasis>main</emphasis></entry>
21508 <entry>Type: <emphasis>boolean</emphasis></entry>
21509 <entry>Default: <emphasis>true</emphasis></entry>
21510 </row>
21511 </tbody>
21512 </tgroup>
21513 </informaltable>
21514 <para>
21515 <indexterm role="concept">
21516 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21517 </indexterm>
21518 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21519 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21520 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21521 should not be present in incoming messages, and this option causes them to be
21522 removed at the time the message is received, to avoid any problems that might
21523 occur when a delivered message is subsequently sent on to some other recipient.
21524 </para>
21525 <para revisionflag="changed">
21526 <indexterm role="option">
21527 <primary><option>disable_fnync</option></primary>
21528 </indexterm>
21529 </para>
21530 <informaltable frame="all" revisionflag="changed">
21531 <tgroup cols="4" colsep="0" rowsep="0">
21532 <colspec colwidth="8*" align="left"/>
21533 <colspec colwidth="6*" align="center"/>
21534 <colspec colwidth="6*" align="center"/>
21535 <colspec colwidth="6*" align="right"/>
21536 <tbody>
21537 <row>
21538 <entry><option>disable_fnync</option></entry>
21539 <entry>Use: <emphasis>main</emphasis></entry>
21540 <entry>Type: <emphasis>boolean</emphasis></entry>
21541 <entry>Default: <emphasis>false</emphasis></entry>
21542 </row>
21543 </tbody>
21544 </tgroup>
21545 </informaltable>
21546 <para revisionflag="changed">
21547 <indexterm role="concept">
21548 <primary><function>fsync()</function>, disabling</primary>
21549 </indexterm>
21550 This option is available only if Exim was built with the compile-time option
21551 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
21552 a runtime configuration generates an <quote>unknown option</quote> error. You should not
21553 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
21554 really, really, really understand what you are doing. <emphasis>No pre-compiled
21555 distributions of Exim should ever make this option available.</emphasis>
21556 </para>
21557 <para revisionflag="changed">
21558 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
21559 updated files&#x2019; data to be written to disc before continuing. Unexpected events
21560 such as crashes and power outages may cause data to be lost or scrambled.
21561 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
21562 </para>
21563 <para>
21564 <indexterm role="option">
21565 <primary><option>disable_ipv6</option></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="6*" align="center"/>
21572 <colspec colwidth="6*" align="center"/>
21573 <colspec colwidth="6*" align="right"/>
21574 <tbody>
21575 <row>
21576 <entry><option>disable_ipv6</option></entry>
21577 <entry>Use: <emphasis>main</emphasis></entry>
21578 <entry>Type: <emphasis>boolean</emphasis></entry>
21579 <entry>Default: <emphasis>false</emphasis></entry>
21580 </row>
21581 </tbody>
21582 </tgroup>
21583 </informaltable>
21584 <para>
21585 <indexterm role="concept">
21586 <primary>IPv6</primary>
21587 <secondary>disabling</secondary>
21588 </indexterm>
21589 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21590 activities take place. AAAA records are never looked up, and any IPv6 addresses
21591 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21592 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21593 to handle IPv6 literal addresses.
21594 </para>
21595 <para>
21596 <indexterm role="option">
21597 <primary><option>dns_again_means_nonexist</option></primary>
21598 </indexterm>
21599 </para>
21600 <informaltable frame="all">
21601 <tgroup cols="4" colsep="0" rowsep="0">
21602 <colspec colwidth="8*" align="left"/>
21603 <colspec colwidth="6*" align="center"/>
21604 <colspec colwidth="6*" align="center"/>
21605 <colspec colwidth="6*" align="right"/>
21606 <tbody>
21607 <row>
21608 <entry><option>dns_again_means_nonexist</option></entry>
21609 <entry>Use: <emphasis>main</emphasis></entry>
21610 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21611 <entry>Default: <emphasis>unset</emphasis></entry>
21612 </row>
21613 </tbody>
21614 </tgroup>
21615 </informaltable>
21616 <para>
21617 <indexterm role="concept">
21618 <primary>DNS</primary>
21619 <secondary><quote>try again</quote> response; overriding</secondary>
21620 </indexterm>
21621 DNS lookups give a <quote>try again</quote> response for the DNS errors
21622 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21623 keep trying to deliver a message, or to give repeated temporary errors to
21624 incoming mail. Sometimes the effect is caused by a badly set up name server and
21625 may persist for a long time. If a domain which exhibits this problem matches
21626 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21627 This option should be used with care. You can make it apply to reverse lookups
21628 by a setting such as this:
21629 </para>
21630 <literallayout class="monospaced">
21631 dns_again_means_nonexist = *.in-addr.arpa
21632 </literallayout>
21633 <para>
21634 This option applies to all DNS lookups that Exim does. It also applies when the
21635 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21636 since these are most likely to be caused by DNS lookup problems. The
21637 <command>dnslookup</command> router has some options of its own for controlling what happens
21638 when lookups for MX or SRV records give temporary errors. These more specific
21639 options are applied after this global option.
21640 </para>
21641 <para>
21642 <indexterm role="option">
21643 <primary><option>dns_check_names_pattern</option></primary>
21644 </indexterm>
21645 </para>
21646 <informaltable frame="all">
21647 <tgroup cols="4" colsep="0" rowsep="0">
21648 <colspec colwidth="8*" align="left"/>
21649 <colspec colwidth="6*" align="center"/>
21650 <colspec colwidth="6*" align="center"/>
21651 <colspec colwidth="6*" align="right"/>
21652 <tbody>
21653 <row>
21654 <entry><option>dns_check_names_pattern</option></entry>
21655 <entry>Use: <emphasis>main</emphasis></entry>
21656 <entry>Type: <emphasis>string</emphasis></entry>
21657 <entry>Default: <emphasis>see below</emphasis></entry>
21658 </row>
21659 </tbody>
21660 </tgroup>
21661 </informaltable>
21662 <para>
21663 <indexterm role="concept">
21664 <primary>DNS</primary>
21665 <secondary>pre-check of name syntax</secondary>
21666 </indexterm>
21667 When this option is set to a non-empty string, it causes Exim to check domain
21668 names for characters that are not allowed in host names before handing them to
21669 the DNS resolver, because some resolvers give temporary errors for names that
21670 contain unusual characters. If a domain name contains any unwanted characters,
21671 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21672 done by matching the domain name against a regular expression, which is the
21673 value of this option. The default pattern is
21674 </para>
21675 <literallayout class="monospaced">
21676 dns_check_names_pattern = \
21677   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
21678 </literallayout>
21679 <para>
21680 which permits only letters, digits, slashes, and hyphens in components, but
21681 they must start and end with a letter or digit. Hyphens are not, in fact,
21682 permitted in host names, but they are found in certain NS records (which can be
21683 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21684 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21685 empty string.
21686 </para>
21687 <para>
21688 <indexterm role="option">
21689 <primary><option>dns_csa_search_limit</option></primary>
21690 </indexterm>
21691 </para>
21692 <informaltable frame="all">
21693 <tgroup cols="4" colsep="0" rowsep="0">
21694 <colspec colwidth="8*" align="left"/>
21695 <colspec colwidth="6*" align="center"/>
21696 <colspec colwidth="6*" align="center"/>
21697 <colspec colwidth="6*" align="right"/>
21698 <tbody>
21699 <row>
21700 <entry><option>dns_csa_search_limit</option></entry>
21701 <entry>Use: <emphasis>main</emphasis></entry>
21702 <entry>Type: <emphasis>integer</emphasis></entry>
21703 <entry>Default: <emphasis>5</emphasis></entry>
21704 </row>
21705 </tbody>
21706 </tgroup>
21707 </informaltable>
21708 <para>
21709 This option controls the depth of parental searching for CSA SRV records in the
21710 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21711 </para>
21712 <para>
21713 <indexterm role="option">
21714 <primary><option>dns_csa_use_reverse</option></primary>
21715 </indexterm>
21716 </para>
21717 <informaltable frame="all">
21718 <tgroup cols="4" colsep="0" rowsep="0">
21719 <colspec colwidth="8*" align="left"/>
21720 <colspec colwidth="6*" align="center"/>
21721 <colspec colwidth="6*" align="center"/>
21722 <colspec colwidth="6*" align="right"/>
21723 <tbody>
21724 <row>
21725 <entry><option>dns_csa_use_reverse</option></entry>
21726 <entry>Use: <emphasis>main</emphasis></entry>
21727 <entry>Type: <emphasis>boolean</emphasis></entry>
21728 <entry>Default: <emphasis>true</emphasis></entry>
21729 </row>
21730 </tbody>
21731 </tgroup>
21732 </informaltable>
21733 <para>
21734 This option controls whether or not an IP address, given as a CSA domain, is
21735 reversed and looked up in the reverse DNS, as described in more detail in
21736 section <xref linkend="SECTverifyCSA"/>.
21737 </para>
21738 <para>
21739 <indexterm role="option">
21740 <primary><option>dns_ipv4_lookup</option></primary>
21741 </indexterm>
21742 </para>
21743 <informaltable frame="all">
21744 <tgroup cols="4" colsep="0" rowsep="0">
21745 <colspec colwidth="8*" align="left"/>
21746 <colspec colwidth="6*" align="center"/>
21747 <colspec colwidth="6*" align="center"/>
21748 <colspec colwidth="6*" align="right"/>
21749 <tbody>
21750 <row>
21751 <entry><option>dns_ipv4_lookup</option></entry>
21752 <entry>Use: <emphasis>main</emphasis></entry>
21753 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21754 <entry>Default: <emphasis>unset</emphasis></entry>
21755 </row>
21756 </tbody>
21757 </tgroup>
21758 </informaltable>
21759 <para>
21760 <indexterm role="concept">
21761 <primary>IPv6</primary>
21762 <secondary>DNS lookup for AAAA records</secondary>
21763 </indexterm>
21764 <indexterm role="concept">
21765 <primary>DNS</primary>
21766 <secondary>IPv6 lookup for AAAA records</secondary>
21767 </indexterm>
21768 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
21769 looks for IPv6 address records (AAAA records) as well as IPv4 address records
21770 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
21771 domain matches this list.
21772 </para>
21773 <para>
21774 This is a fudge to help with name servers that give big delays or otherwise do
21775 not work for the AAAA record type. In due course, when the world&#x2019;s name
21776 servers have all been upgraded, there should be no need for this option.
21777 </para>
21778 <para>
21779 <indexterm role="option">
21780 <primary><option>dns_retrans</option></primary>
21781 </indexterm>
21782 </para>
21783 <informaltable frame="all">
21784 <tgroup cols="4" colsep="0" rowsep="0">
21785 <colspec colwidth="8*" align="left"/>
21786 <colspec colwidth="6*" align="center"/>
21787 <colspec colwidth="6*" align="center"/>
21788 <colspec colwidth="6*" align="right"/>
21789 <tbody>
21790 <row>
21791 <entry><option>dns_retrans</option></entry>
21792 <entry>Use: <emphasis>main</emphasis></entry>
21793 <entry>Type: <emphasis>time</emphasis></entry>
21794 <entry>Default: <emphasis>0s</emphasis></entry>
21795 </row>
21796 </tbody>
21797 </tgroup>
21798 </informaltable>
21799 <para>
21800 <indexterm role="concept">
21801 <primary>DNS</primary>
21802 <secondary>resolver options</secondary>
21803 </indexterm>
21804 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
21805 retransmission and retry parameters for DNS lookups. Values of zero (the
21806 defaults) leave the system default settings unchanged. The first value is the
21807 time between retries, and the second is the number of retries. It isn&#x2019;t
21808 totally clear exactly how these settings affect the total time a DNS lookup may
21809 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
21810 parameter values are available in the external resolver interface structure,
21811 but nowhere does it seem to describe how they are used or what you might want
21812 to set in them.
21813 </para>
21814 <para>
21815 <indexterm role="option">
21816 <primary><option>dns_retry</option></primary>
21817 </indexterm>
21818 </para>
21819 <informaltable frame="all">
21820 <tgroup cols="4" colsep="0" rowsep="0">
21821 <colspec colwidth="8*" align="left"/>
21822 <colspec colwidth="6*" align="center"/>
21823 <colspec colwidth="6*" align="center"/>
21824 <colspec colwidth="6*" align="right"/>
21825 <tbody>
21826 <row>
21827 <entry><option>dns_retry</option></entry>
21828 <entry>Use: <emphasis>main</emphasis></entry>
21829 <entry>Type: <emphasis>integer</emphasis></entry>
21830 <entry>Default: <emphasis>0</emphasis></entry>
21831 </row>
21832 </tbody>
21833 </tgroup>
21834 </informaltable>
21835 <para>
21836 See <option>dns_retrans</option> above.
21837 </para>
21838 <para>
21839 <indexterm role="option">
21840 <primary><option>drop_cr</option></primary>
21841 </indexterm>
21842 </para>
21843 <informaltable frame="all">
21844 <tgroup cols="4" colsep="0" rowsep="0">
21845 <colspec colwidth="8*" align="left"/>
21846 <colspec colwidth="6*" align="center"/>
21847 <colspec colwidth="6*" align="center"/>
21848 <colspec colwidth="6*" align="right"/>
21849 <tbody>
21850 <row>
21851 <entry><option>drop_cr</option></entry>
21852 <entry>Use: <emphasis>main</emphasis></entry>
21853 <entry>Type: <emphasis>boolean</emphasis></entry>
21854 <entry>Default: <emphasis>false</emphasis></entry>
21855 </row>
21856 </tbody>
21857 </tgroup>
21858 </informaltable>
21859 <para>
21860 This is an obsolete option that is now a no-op. It used to affect the way Exim
21861 handled CR and LF characters in incoming messages. What happens now is
21862 described in section <xref linkend="SECTlineendings"/>.
21863 </para>
21864 <para revisionflag="changed">
21865 <indexterm role="option">
21866 <primary><option>dsn_from</option></primary>
21867 </indexterm>
21868 </para>
21869 <informaltable frame="all" revisionflag="changed">
21870 <tgroup cols="4" colsep="0" rowsep="0">
21871 <colspec colwidth="8*" align="left"/>
21872 <colspec colwidth="6*" align="center"/>
21873 <colspec colwidth="6*" align="center"/>
21874 <colspec colwidth="6*" align="right"/>
21875 <tbody>
21876 <row>
21877 <entry><option>dsn_from</option></entry>
21878 <entry>Use: <emphasis>main</emphasis></entry>
21879 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21880 <entry>Default: <emphasis>see below</emphasis></entry>
21881 </row>
21882 </tbody>
21883 </tgroup>
21884 </informaltable>
21885 <para revisionflag="changed">
21886 <indexterm role="concept">
21887 <primary><emphasis>From:</emphasis> header line</primary>
21888 <secondary>in bounces</secondary>
21889 </indexterm>
21890 <indexterm role="concept">
21891 <primary>bounce messages</primary>
21892 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
21893 </indexterm>
21894 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
21895 bounces and other automatically generated messages (<quote>Delivery Status
21896 Notifications</quote> &ndash; hence the name of the option). The default setting is:
21897 </para>
21898 <literallayout class="monospaced" revisionflag="changed">
21899 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
21900 </literallayout>
21901 <para revisionflag="changed">
21902 The value is expanded every time it is needed. If the expansion fails, a
21903 panic is logged, and the default value is used.
21904 </para>
21905 <para>
21906 <indexterm role="option">
21907 <primary><option>envelope_to_remove</option></primary>
21908 </indexterm>
21909 </para>
21910 <informaltable frame="all">
21911 <tgroup cols="4" colsep="0" rowsep="0">
21912 <colspec colwidth="8*" align="left"/>
21913 <colspec colwidth="6*" align="center"/>
21914 <colspec colwidth="6*" align="center"/>
21915 <colspec colwidth="6*" align="right"/>
21916 <tbody>
21917 <row>
21918 <entry><option>envelope_to_remove</option></entry>
21919 <entry>Use: <emphasis>main</emphasis></entry>
21920 <entry>Type: <emphasis>boolean</emphasis></entry>
21921 <entry>Default: <emphasis>true</emphasis></entry>
21922 </row>
21923 </tbody>
21924 </tgroup>
21925 </informaltable>
21926 <para>
21927 <indexterm role="concept">
21928 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
21929 </indexterm>
21930 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
21931 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21932 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
21933 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
21934 be present in incoming messages, and this option causes them to be removed at
21935 the time the message is received, to avoid any problems that might occur when a
21936 delivered message is subsequently sent on to some other recipient.
21937 </para>
21938 <para>
21939 <indexterm role="option">
21940 <primary><option>errors_copy</option></primary>
21941 </indexterm>
21942 </para>
21943 <informaltable frame="all">
21944 <tgroup cols="4" colsep="0" rowsep="0">
21945 <colspec colwidth="8*" align="left"/>
21946 <colspec colwidth="6*" align="center"/>
21947 <colspec colwidth="6*" align="center"/>
21948 <colspec colwidth="6*" align="right"/>
21949 <tbody>
21950 <row>
21951 <entry><option>errors_copy</option></entry>
21952 <entry>Use: <emphasis>main</emphasis></entry>
21953 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
21954 <entry>Default: <emphasis>unset</emphasis></entry>
21955 </row>
21956 </tbody>
21957 </tgroup>
21958 </informaltable>
21959 <para>
21960 <indexterm role="concept">
21961 <primary>bounce message</primary>
21962 <secondary>copy to other address</secondary>
21963 </indexterm>
21964 <indexterm role="concept">
21965 <primary>copy of bounce message</primary>
21966 </indexterm>
21967 Setting this option causes Exim to send bcc copies of bounce messages that it
21968 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
21969 coming from elsewhere. The value of the option is a colon-separated list of
21970 items. Each item consists of a pattern, terminated by white space, followed by
21971 a comma-separated list of email addresses. If a pattern contains spaces, it
21972 must be enclosed in double quotes.
21973 </para>
21974 <para>
21975 Each pattern is processed in the same way as a single item in an address list
21976 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
21977 the bounce message, the message is copied to the addresses on the list. The
21978 items are scanned in order, and once a matching one is found, no further items
21979 are examined. For example:
21980 </para>
21981 <literallayout class="monospaced">
21982 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
21983               rqps@mydomain   hostmaster@mydomain.example,\
21984                               postmaster@mydomain.example
21985 </literallayout>
21986 <para>
21987 <indexterm role="variable">
21988 <primary><varname>$domain</varname></primary>
21989 </indexterm>
21990 <indexterm role="variable">
21991 <primary><varname>$local_part</varname></primary>
21992 </indexterm>
21993 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
21994 and <varname>$domain</varname> are set from the original recipient of the error message, and if
21995 there was any wildcard matching in the pattern, the expansion
21996 <indexterm role="concept">
21997 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21998 <secondary>in <option>errors_copy</option></secondary>
21999 </indexterm>
22000 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22001 </para>
22002 <para>
22003 <indexterm role="option">
22004 <primary><option>errors_reply_to</option></primary>
22005 </indexterm>
22006 </para>
22007 <informaltable frame="all">
22008 <tgroup cols="4" colsep="0" rowsep="0">
22009 <colspec colwidth="8*" align="left"/>
22010 <colspec colwidth="6*" align="center"/>
22011 <colspec colwidth="6*" align="center"/>
22012 <colspec colwidth="6*" align="right"/>
22013 <tbody>
22014 <row>
22015 <entry><option>errors_reply_to</option></entry>
22016 <entry>Use: <emphasis>main</emphasis></entry>
22017 <entry>Type: <emphasis>string</emphasis></entry>
22018 <entry>Default: <emphasis>unset</emphasis></entry>
22019 </row>
22020 </tbody>
22021 </tgroup>
22022 </informaltable>
22023 <para>
22024 <indexterm role="concept">
22025 <primary>bounce message</primary>
22026 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22027 </indexterm>
22028 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
22029 </para>
22030 <literallayout>
22031 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
22032 </literallayout>
22033 <para>
22034 <indexterm role="option">
22035 <primary><option>quota_warn_message</option></primary>
22036 </indexterm>
22037 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22038 A warning message that is generated by the <option>quota_warn_message</option> option in an
22039 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22040 overrides the default.
22041 </para>
22042 <para>
22043 Experience shows that people reply to bounce messages. If the
22044 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22045 and warning messages. For example:
22046 </para>
22047 <literallayout class="monospaced">
22048 errors_reply_to = postmaster@my.domain.example
22049 </literallayout>
22050 <para>
22051 The value of the option is not expanded. It must specify a valid RFC 2822
22052 address. However, if a warning message that is generated by the
22053 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22054 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22055 not used.
22056 </para>
22057 <para>
22058 <indexterm role="option">
22059 <primary><option>exim_group</option></primary>
22060 </indexterm>
22061 </para>
22062 <informaltable frame="all">
22063 <tgroup cols="4" colsep="0" rowsep="0">
22064 <colspec colwidth="8*" align="left"/>
22065 <colspec colwidth="6*" align="center"/>
22066 <colspec colwidth="6*" align="center"/>
22067 <colspec colwidth="6*" align="right"/>
22068 <tbody>
22069 <row>
22070 <entry><option>exim_group</option></entry>
22071 <entry>Use: <emphasis>main</emphasis></entry>
22072 <entry>Type: <emphasis>string</emphasis></entry>
22073 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22074 </row>
22075 </tbody>
22076 </tgroup>
22077 </informaltable>
22078 <para>
22079 <indexterm role="concept">
22080 <primary>gid (group id)</primary>
22081 <secondary>Exim&#x2019;s own</secondary>
22082 </indexterm>
22083 <indexterm role="concept">
22084 <primary>Exim group</primary>
22085 </indexterm>
22086 This option changes the gid under which Exim runs when it gives up root
22087 privilege. The default value is compiled into the binary. The value of this
22088 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22089 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22090 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22091 security issues.
22092 </para>
22093 <para>
22094 <indexterm role="option">
22095 <primary><option>exim_path</option></primary>
22096 </indexterm>
22097 </para>
22098 <informaltable frame="all">
22099 <tgroup cols="4" colsep="0" rowsep="0">
22100 <colspec colwidth="8*" align="left"/>
22101 <colspec colwidth="6*" align="center"/>
22102 <colspec colwidth="6*" align="center"/>
22103 <colspec colwidth="6*" align="right"/>
22104 <tbody>
22105 <row>
22106 <entry><option>exim_path</option></entry>
22107 <entry>Use: <emphasis>main</emphasis></entry>
22108 <entry>Type: <emphasis>string</emphasis></entry>
22109 <entry>Default: <emphasis>see below</emphasis></entry>
22110 </row>
22111 </tbody>
22112 </tgroup>
22113 </informaltable>
22114 <para>
22115 <indexterm role="concept">
22116 <primary>Exim binary, path name</primary>
22117 </indexterm>
22118 This option specifies the path name of the Exim binary, which is used when Exim
22119 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22120 the directory configured at compile time by the BIN_DIRECTORY setting. It
22121 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22122 other place.
22123 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22124 you will break those Exim utilities that scan the configuration file to find
22125 where the binary is. (They then use the <option>-bP</option> option to extract option
22126 settings such as the value of <option>spool_directory</option>.)
22127 </para>
22128 <para>
22129 <indexterm role="option">
22130 <primary><option>exim_user</option></primary>
22131 </indexterm>
22132 </para>
22133 <informaltable frame="all">
22134 <tgroup cols="4" colsep="0" rowsep="0">
22135 <colspec colwidth="8*" align="left"/>
22136 <colspec colwidth="6*" align="center"/>
22137 <colspec colwidth="6*" align="center"/>
22138 <colspec colwidth="6*" align="right"/>
22139 <tbody>
22140 <row>
22141 <entry><option>exim_user</option></entry>
22142 <entry>Use: <emphasis>main</emphasis></entry>
22143 <entry>Type: <emphasis>string</emphasis></entry>
22144 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22145 </row>
22146 </tbody>
22147 </tgroup>
22148 </informaltable>
22149 <para>
22150 <indexterm role="concept">
22151 <primary>uid (user id)</primary>
22152 <secondary>Exim&#x2019;s own</secondary>
22153 </indexterm>
22154 <indexterm role="concept">
22155 <primary>Exim user</primary>
22156 </indexterm>
22157 This option changes the uid under which Exim runs when it gives up root
22158 privilege. The default value is compiled into the binary. Ownership of the run
22159 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22160 options is checked against the values in the binary, not what is set here.
22161 </para>
22162 <para>
22163 Unless it consists entirely of digits, the string is looked up using
22164 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22165 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22166 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22167 </para>
22168 <para>
22169 <indexterm role="option">
22170 <primary><option>extra_local_interfaces</option></primary>
22171 </indexterm>
22172 </para>
22173 <informaltable frame="all">
22174 <tgroup cols="4" colsep="0" rowsep="0">
22175 <colspec colwidth="8*" align="left"/>
22176 <colspec colwidth="6*" align="center"/>
22177 <colspec colwidth="6*" align="center"/>
22178 <colspec colwidth="6*" align="right"/>
22179 <tbody>
22180 <row>
22181 <entry><option>extra_local_interfaces</option></entry>
22182 <entry>Use: <emphasis>main</emphasis></entry>
22183 <entry>Type: <emphasis>string list</emphasis></entry>
22184 <entry>Default: <emphasis>unset</emphasis></entry>
22185 </row>
22186 </tbody>
22187 </tgroup>
22188 </informaltable>
22189 <para>
22190 This option defines network interfaces that are to be considered local when
22191 routing, but which are not used for listening by the daemon. See section
22192 <xref linkend="SECTreclocipadd"/> for details.
22193 </para>
22194 <para>
22195 <indexterm role="option">
22196 <primary><option>extract_addresses_remove_arguments</option></primary>
22197 </indexterm>
22198 </para>
22199 <informaltable frame="all">
22200 <tgroup cols="4" colsep="0" rowsep="0">
22201 <colspec colwidth="8*" align="left"/>
22202 <colspec colwidth="6*" align="center"/>
22203 <colspec colwidth="6*" align="center"/>
22204 <colspec colwidth="6*" align="right"/>
22205 <tbody>
22206 <row>
22207 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
22208 <entry>Use: <emphasis>main</emphasis></entry>
22209 <entry>Type: <emphasis>boolean</emphasis></entry>
22210 <entry>Default: <emphasis>true</emphasis></entry>
22211 </row>
22212 </tbody>
22213 </tgroup>
22214 </informaltable>
22215 <para>
22216 <indexterm role="option">
22217 <primary><option>-t</option></primary>
22218 </indexterm>
22219 <indexterm role="concept">
22220 <primary>command line</primary>
22221 <secondary>addresses with <option>-t</option></secondary>
22222 </indexterm>
22223 <indexterm role="concept">
22224 <primary>Sendmail compatibility</primary>
22225 <secondary><option>-t</option> option</secondary>
22226 </indexterm>
22227 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22228 are present on the command line when the <option>-t</option> option is used to build an
22229 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22230 line addresses are removed from the recipients list. This is also how Smail
22231 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
22232 command line addresses are added to those obtained from the header lines. When
22233 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22234 argument headers. If it is set false, Exim adds rather than removes argument
22235 addresses.
22236 </para>
22237 <para>
22238 <indexterm role="option">
22239 <primary><option>finduser_retries</option></primary>
22240 </indexterm>
22241 </para>
22242 <informaltable frame="all">
22243 <tgroup cols="4" colsep="0" rowsep="0">
22244 <colspec colwidth="8*" align="left"/>
22245 <colspec colwidth="6*" align="center"/>
22246 <colspec colwidth="6*" align="center"/>
22247 <colspec colwidth="6*" align="right"/>
22248 <tbody>
22249 <row>
22250 <entry><option>finduser_retries</option></entry>
22251 <entry>Use: <emphasis>main</emphasis></entry>
22252 <entry>Type: <emphasis>integer</emphasis></entry>
22253 <entry>Default: <emphasis>0</emphasis></entry>
22254 </row>
22255 </tbody>
22256 </tgroup>
22257 </informaltable>
22258 <para>
22259 <indexterm role="concept">
22260 <primary>NIS, retrying user lookups</primary>
22261 </indexterm>
22262 On systems running NIS or other schemes in which user and group information is
22263 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22264 related functions fail, even when given valid data, because things time out.
22265 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22266 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22267 many extra times to find a user or a group, waiting for one second between
22268 retries.
22269 </para>
22270 <para>
22271 <indexterm role="concept">
22272 <primary><filename>/etc/passwd</filename></primary>
22273 <secondary>multiple reading of</secondary>
22274 </indexterm>
22275 You should not set this option greater than zero if your user information is in
22276 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22277 search the file multiple times for non-existent users, and also cause delay.
22278 </para>
22279 <para>
22280 <indexterm role="option">
22281 <primary><option>freeze_tell</option></primary>
22282 </indexterm>
22283 </para>
22284 <informaltable frame="all">
22285 <tgroup cols="4" colsep="0" rowsep="0">
22286 <colspec colwidth="8*" align="left"/>
22287 <colspec colwidth="6*" align="center"/>
22288 <colspec colwidth="6*" align="center"/>
22289 <colspec colwidth="6*" align="right"/>
22290 <tbody>
22291 <row>
22292 <entry><option>freeze_tell</option></entry>
22293 <entry>Use: <emphasis>main</emphasis></entry>
22294 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22295 <entry>Default: <emphasis>unset</emphasis></entry>
22296 </row>
22297 </tbody>
22298 </tgroup>
22299 </informaltable>
22300 <para>
22301 <indexterm role="concept">
22302 <primary>freezing messages</primary>
22303 <secondary>sending a message when freezing</secondary>
22304 </indexterm>
22305 On encountering certain errors, or when configured to do so in a system filter,
22306 ACL, or special router, Exim freezes a message. This means that no further
22307 delivery attempts take place until an administrator thaws the message, or the
22308 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22309 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22310 warning message whenever it freezes something, unless the message it is
22311 freezing is a locally-generated bounce message. (Without this exception there
22312 is the possibility of looping.) The warning message is sent to the addresses
22313 supplied as the comma-separated value of this option. If several of the
22314 message&#x2019;s addresses cause freezing, only a single message is sent. If the
22315 freezing was automatic, the reason(s) for freezing can be found in the message
22316 log. If you configure freezing in a filter or ACL, you must arrange for any
22317 logging that you require.
22318 </para>
22319 <para>
22320 <indexterm role="option">
22321 <primary><option>gecos_name</option></primary>
22322 </indexterm>
22323 </para>
22324 <informaltable frame="all">
22325 <tgroup cols="4" colsep="0" rowsep="0">
22326 <colspec colwidth="8*" align="left"/>
22327 <colspec colwidth="6*" align="center"/>
22328 <colspec colwidth="6*" align="center"/>
22329 <colspec colwidth="6*" align="right"/>
22330 <tbody>
22331 <row>
22332 <entry><option>gecos_name</option></entry>
22333 <entry>Use: <emphasis>main</emphasis></entry>
22334 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22335 <entry>Default: <emphasis>unset</emphasis></entry>
22336 </row>
22337 </tbody>
22338 </tgroup>
22339 </informaltable>
22340 <para>
22341 <indexterm role="concept">
22342 <primary>HP-UX</primary>
22343 </indexterm>
22344 <indexterm role="concept">
22345 <primary><quote>gecos</quote> field, parsing</primary>
22346 </indexterm>
22347 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22348 password file to hold other information in addition to users&#x2019; real names. Exim
22349 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22350 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22351 of the field are used unchanged, except that, if an ampersand is encountered,
22352 it is replaced by the user&#x2019;s login name with the first character forced to
22353 upper case, since this is a convention that is observed on many systems.
22354 </para>
22355 <para>
22356 When these options are set, <option>gecos_pattern</option> is treated as a regular
22357 expression that is to be applied to the field (again with &amp; replaced by the
22358 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22359 user&#x2019;s name.
22360 </para>
22361 <para>
22362 <indexterm role="concept">
22363 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22364 <secondary>in <option>gecos_name</option></secondary>
22365 </indexterm>
22366 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22367 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
22368 name terminates at the first comma, the following can be used:
22369 </para>
22370 <literallayout class="monospaced">
22371 gecos_pattern = ([^,]*)
22372 gecos_name = $1
22373 </literallayout>
22374 <para>
22375 <indexterm role="option">
22376 <primary><option>gecos_pattern</option></primary>
22377 </indexterm>
22378 </para>
22379 <informaltable frame="all">
22380 <tgroup cols="4" colsep="0" rowsep="0">
22381 <colspec colwidth="8*" align="left"/>
22382 <colspec colwidth="6*" align="center"/>
22383 <colspec colwidth="6*" align="center"/>
22384 <colspec colwidth="6*" align="right"/>
22385 <tbody>
22386 <row>
22387 <entry><option>gecos_pattern</option></entry>
22388 <entry>Use: <emphasis>main</emphasis></entry>
22389 <entry>Type: <emphasis>string</emphasis></entry>
22390 <entry>Default: <emphasis>unset</emphasis></entry>
22391 </row>
22392 </tbody>
22393 </tgroup>
22394 </informaltable>
22395 <para>
22396 See <option>gecos_name</option> above.
22397 </para>
22398 <para revisionflag="changed">
22399 <indexterm role="option">
22400 <primary><option>gnutls_require_kx</option></primary>
22401 </indexterm>
22402 </para>
22403 <informaltable frame="all" revisionflag="changed">
22404 <tgroup cols="4" colsep="0" rowsep="0">
22405 <colspec colwidth="8*" align="left"/>
22406 <colspec colwidth="6*" align="center"/>
22407 <colspec colwidth="6*" align="center"/>
22408 <colspec colwidth="6*" align="right"/>
22409 <tbody>
22410 <row>
22411 <entry><option>gnutls_require_kx</option></entry>
22412 <entry>Use: <emphasis>main</emphasis></entry>
22413 <entry>Type: <emphasis>string</emphasis></entry>
22414 <entry>Default: <emphasis>unset</emphasis></entry>
22415 </row>
22416 </tbody>
22417 </tgroup>
22418 </informaltable>
22419 <para revisionflag="changed">
22420 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22421 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22422 </para>
22423 <para revisionflag="changed">
22424 <indexterm role="option">
22425 <primary><option>gnutls_require_mac</option></primary>
22426 </indexterm>
22427 </para>
22428 <informaltable frame="all" revisionflag="changed">
22429 <tgroup cols="4" colsep="0" rowsep="0">
22430 <colspec colwidth="8*" align="left"/>
22431 <colspec colwidth="6*" align="center"/>
22432 <colspec colwidth="6*" align="center"/>
22433 <colspec colwidth="6*" align="right"/>
22434 <tbody>
22435 <row>
22436 <entry><option>gnutls_require_mac</option></entry>
22437 <entry>Use: <emphasis>main</emphasis></entry>
22438 <entry>Type: <emphasis>string</emphasis></entry>
22439 <entry>Default: <emphasis>unset</emphasis></entry>
22440 </row>
22441 </tbody>
22442 </tgroup>
22443 </informaltable>
22444 <para revisionflag="changed">
22445 This option controls the MAC algorithms when GnuTLS is used in an Exim
22446 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22447 </para>
22448 <para revisionflag="changed">
22449 <indexterm role="option">
22450 <primary><option>gnutls_require_protocols</option></primary>
22451 </indexterm>
22452 </para>
22453 <informaltable frame="all" revisionflag="changed">
22454 <tgroup cols="4" colsep="0" rowsep="0">
22455 <colspec colwidth="8*" align="left"/>
22456 <colspec colwidth="6*" align="center"/>
22457 <colspec colwidth="6*" align="center"/>
22458 <colspec colwidth="6*" align="right"/>
22459 <tbody>
22460 <row>
22461 <entry><option>gnutls_require_protocols</option></entry>
22462 <entry>Use: <emphasis>main</emphasis></entry>
22463 <entry>Type: <emphasis>string</emphasis></entry>
22464 <entry>Default: <emphasis>unset</emphasis></entry>
22465 </row>
22466 </tbody>
22467 </tgroup>
22468 </informaltable>
22469 <para revisionflag="changed">
22470 This option controls the protocols when GnuTLS is used in an Exim
22471 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22472 </para>
22473 <para>
22474 <indexterm role="option">
22475 <primary><option>headers_charset</option></primary>
22476 </indexterm>
22477 </para>
22478 <informaltable frame="all">
22479 <tgroup cols="4" colsep="0" rowsep="0">
22480 <colspec colwidth="8*" align="left"/>
22481 <colspec colwidth="6*" align="center"/>
22482 <colspec colwidth="6*" align="center"/>
22483 <colspec colwidth="6*" align="right"/>
22484 <tbody>
22485 <row>
22486 <entry><option>headers_charset</option></entry>
22487 <entry>Use: <emphasis>main</emphasis></entry>
22488 <entry>Type: <emphasis>string</emphasis></entry>
22489 <entry>Default: <emphasis>see below</emphasis></entry>
22490 </row>
22491 </tbody>
22492 </tgroup>
22493 </informaltable>
22494 <para>
22495 This option sets a default character set for translating from encoded MIME
22496 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22497 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22498 ultimate default is ISO-8859-1. For more details see the description of header
22499 insertions in section <xref linkend="SECTexpansionitems"/>.
22500 </para>
22501 <para>
22502 <indexterm role="option">
22503 <primary><option>header_maxsize</option></primary>
22504 </indexterm>
22505 </para>
22506 <informaltable frame="all">
22507 <tgroup cols="4" colsep="0" rowsep="0">
22508 <colspec colwidth="8*" align="left"/>
22509 <colspec colwidth="6*" align="center"/>
22510 <colspec colwidth="6*" align="center"/>
22511 <colspec colwidth="6*" align="right"/>
22512 <tbody>
22513 <row>
22514 <entry><option>header_maxsize</option></entry>
22515 <entry>Use: <emphasis>main</emphasis></entry>
22516 <entry>Type: <emphasis>integer</emphasis></entry>
22517 <entry>Default: <emphasis>see below</emphasis></entry>
22518 </row>
22519 </tbody>
22520 </tgroup>
22521 </informaltable>
22522 <para>
22523 <indexterm role="concept">
22524 <primary>header section</primary>
22525 <secondary>maximum size of</secondary>
22526 </indexterm>
22527 <indexterm role="concept">
22528 <primary>limit</primary>
22529 <secondary>size of message header section</secondary>
22530 </indexterm>
22531 This option controls the overall maximum size of a message&#x2019;s header
22532 section. The default is the value of HEADER_MAXSIZE in
22533 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
22534 sections are rejected.
22535 </para>
22536 <para>
22537 <indexterm role="option">
22538 <primary><option>header_line_maxsize</option></primary>
22539 </indexterm>
22540 </para>
22541 <informaltable frame="all">
22542 <tgroup cols="4" colsep="0" rowsep="0">
22543 <colspec colwidth="8*" align="left"/>
22544 <colspec colwidth="6*" align="center"/>
22545 <colspec colwidth="6*" align="center"/>
22546 <colspec colwidth="6*" align="right"/>
22547 <tbody>
22548 <row>
22549 <entry><option>header_line_maxsize</option></entry>
22550 <entry>Use: <emphasis>main</emphasis></entry>
22551 <entry>Type: <emphasis>integer</emphasis></entry>
22552 <entry>Default: <emphasis>0</emphasis></entry>
22553 </row>
22554 </tbody>
22555 </tgroup>
22556 </informaltable>
22557 <para>
22558 <indexterm role="concept">
22559 <primary>header lines</primary>
22560 <secondary>maximum size of</secondary>
22561 </indexterm>
22562 <indexterm role="concept">
22563 <primary>limit</primary>
22564 <secondary>size of one header line</secondary>
22565 </indexterm>
22566 This option limits the length of any individual header line in a message, after
22567 all the continuations have been joined together. Messages with individual
22568 header lines that are longer than the limit are rejected. The default value of
22569 zero means <quote>no limit</quote>.
22570 </para>
22571 <para>
22572 <indexterm role="option">
22573 <primary><option>helo_accept_junk_hosts</option></primary>
22574 </indexterm>
22575 </para>
22576 <informaltable frame="all">
22577 <tgroup cols="4" colsep="0" rowsep="0">
22578 <colspec colwidth="8*" align="left"/>
22579 <colspec colwidth="6*" align="center"/>
22580 <colspec colwidth="6*" align="center"/>
22581 <colspec colwidth="6*" align="right"/>
22582 <tbody>
22583 <row>
22584 <entry><option>helo_accept_junk_hosts</option></entry>
22585 <entry>Use: <emphasis>main</emphasis></entry>
22586 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22587 <entry>Default: <emphasis>unset</emphasis></entry>
22588 </row>
22589 </tbody>
22590 </tgroup>
22591 </informaltable>
22592 <para>
22593 <indexterm role="concept">
22594 <primary>HELO</primary>
22595 <secondary>accepting junk data</secondary>
22596 </indexterm>
22597 <indexterm role="concept">
22598 <primary>EHLO</primary>
22599 <secondary>accepting junk data</secondary>
22600 </indexterm>
22601 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
22602 mail, and gives an error response for invalid data. Unfortunately, there are
22603 some SMTP clients that send syntactic junk. They can be accommodated by setting
22604 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
22605 if you want to do semantic checking.
22606 See also <option>helo_allow_chars</option> for a way of extending the permitted character
22607 set.
22608 </para>
22609 <para>
22610 <indexterm role="option">
22611 <primary><option>helo_allow_chars</option></primary>
22612 </indexterm>
22613 </para>
22614 <informaltable frame="all">
22615 <tgroup cols="4" colsep="0" rowsep="0">
22616 <colspec colwidth="8*" align="left"/>
22617 <colspec colwidth="6*" align="center"/>
22618 <colspec colwidth="6*" align="center"/>
22619 <colspec colwidth="6*" align="right"/>
22620 <tbody>
22621 <row>
22622 <entry><option>helo_allow_chars</option></entry>
22623 <entry>Use: <emphasis>main</emphasis></entry>
22624 <entry>Type: <emphasis>string</emphasis></entry>
22625 <entry>Default: <emphasis>unset</emphasis></entry>
22626 </row>
22627 </tbody>
22628 </tgroup>
22629 </informaltable>
22630 <para>
22631 <indexterm role="concept">
22632 <primary>HELO</primary>
22633 <secondary>underscores in</secondary>
22634 </indexterm>
22635 <indexterm role="concept">
22636 <primary>EHLO</primary>
22637 <secondary>underscores in</secondary>
22638 </indexterm>
22639 <indexterm role="concept">
22640 <primary>underscore in EHLO/HELO</primary>
22641 </indexterm>
22642 This option can be set to a string of rogue characters that are permitted in
22643 all EHLO and HELO names in addition to the standard letters, digits,
22644 hyphens, and dots. If you really must allow underscores, you can set
22645 </para>
22646 <literallayout class="monospaced">
22647 helo_allow_chars = _
22648 </literallayout>
22649 <para>
22650 Note that the value is one string, not a list.
22651 </para>
22652 <para>
22653 <indexterm role="option">
22654 <primary><option>helo_lookup_domains</option></primary>
22655 </indexterm>
22656 </para>
22657 <informaltable frame="all">
22658 <tgroup cols="4" colsep="0" rowsep="0">
22659 <colspec colwidth="8*" align="left"/>
22660 <colspec colwidth="6*" align="center"/>
22661 <colspec colwidth="6*" align="center"/>
22662 <colspec colwidth="6*" align="right"/>
22663 <tbody>
22664 <row>
22665 <entry><option>helo_lookup_domains</option></entry>
22666 <entry>Use: <emphasis>main</emphasis></entry>
22667 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22668 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22669 </row>
22670 </tbody>
22671 </tgroup>
22672 </informaltable>
22673 <para>
22674 <indexterm role="concept">
22675 <primary>HELO</primary>
22676 <secondary>forcing reverse lookup</secondary>
22677 </indexterm>
22678 <indexterm role="concept">
22679 <primary>EHLO</primary>
22680 <secondary>forcing reverse lookup</secondary>
22681 </indexterm>
22682 If the domain given by a client in a HELO or EHLO command matches this
22683 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
22684 default forces a lookup if the client host gives the server&#x2019;s name or any of
22685 its IP addresses (in brackets), something that broken clients have been seen to
22686 do.
22687 </para>
22688 <para>
22689 <indexterm role="option">
22690 <primary><option>helo_try_verify_hosts</option></primary>
22691 </indexterm>
22692 </para>
22693 <informaltable frame="all">
22694 <tgroup cols="4" colsep="0" rowsep="0">
22695 <colspec colwidth="8*" align="left"/>
22696 <colspec colwidth="6*" align="center"/>
22697 <colspec colwidth="6*" align="center"/>
22698 <colspec colwidth="6*" align="right"/>
22699 <tbody>
22700 <row>
22701 <entry><option>helo_try_verify_hosts</option></entry>
22702 <entry>Use: <emphasis>main</emphasis></entry>
22703 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22704 <entry>Default: <emphasis>unset</emphasis></entry>
22705 </row>
22706 </tbody>
22707 </tgroup>
22708 </informaltable>
22709 <para>
22710 <indexterm role="concept">
22711 <primary>HELO verifying</primary>
22712 <secondary>optional</secondary>
22713 </indexterm>
22714 <indexterm role="concept">
22715 <primary>EHLO</primary>
22716 <secondary>verifying, optional</secondary>
22717 </indexterm>
22718 By default, Exim just checks the syntax of HELO and EHLO commands (see
22719 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
22720 to do more extensive checking of the data supplied by these commands. The ACL
22721 condition <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is provided to make this possible.
22722 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
22723 to force the check to occur. From release 4.53 onwards, this is no longer
22724 necessary. If the check has not been done before <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is
22725 encountered, it is done at that time. Consequently, this option is obsolete.
22726 Its specification is retained here for backwards compatibility.
22727 </para>
22728 <para>
22729 When an EHLO or HELO command is received, if the calling host matches
22730 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
22731 EHLO command either:
22732 </para>
22733 <itemizedlist>
22734 <listitem>
22735 <para>
22736 is an IP literal matching the calling address of the host, or
22737 </para>
22738 </listitem>
22739 <listitem>
22740 <para>
22741 <indexterm role="concept">
22742 <primary>DNS</primary>
22743 <secondary>reverse lookup</secondary>
22744 </indexterm>
22745 <indexterm role="concept">
22746 <primary>reverse DNS lookup</primary>
22747 </indexterm>
22748 matches the host name that Exim obtains by doing a reverse lookup of the
22749 calling host address, or
22750 </para>
22751 </listitem>
22752 <listitem>
22753 <para>
22754 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
22755 available) yields the calling host address.
22756 </para>
22757 </listitem>
22758 </itemizedlist>
22759 <para>
22760 However, the EHLO or HELO command is not rejected if any of the checks
22761 fail. Processing continues, but the result of the check is remembered, and can
22762 be detected later in an ACL by the <literal>verify</literal> <literal>=</literal> <literal>helo</literal> condition.
22763 </para>
22764 <para>
22765 <indexterm role="option">
22766 <primary><option>helo_verify_hosts</option></primary>
22767 </indexterm>
22768 </para>
22769 <informaltable frame="all">
22770 <tgroup cols="4" colsep="0" rowsep="0">
22771 <colspec colwidth="8*" align="left"/>
22772 <colspec colwidth="6*" align="center"/>
22773 <colspec colwidth="6*" align="center"/>
22774 <colspec colwidth="6*" align="right"/>
22775 <tbody>
22776 <row>
22777 <entry><option>helo_verify_hosts</option></entry>
22778 <entry>Use: <emphasis>main</emphasis></entry>
22779 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22780 <entry>Default: <emphasis>unset</emphasis></entry>
22781 </row>
22782 </tbody>
22783 </tgroup>
22784 </informaltable>
22785 <para>
22786 <indexterm role="concept">
22787 <primary>HELO verifying</primary>
22788 <secondary>mandatory</secondary>
22789 </indexterm>
22790 <indexterm role="concept">
22791 <primary>EHLO</primary>
22792 <secondary>verifying, mandatory</secondary>
22793 </indexterm>
22794 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
22795 backwards compatibility. For hosts that match this option, Exim checks the host
22796 name given in the HELO or EHLO in the same way as for
22797 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
22798 rejected with a 550 error, and entries are written to the main and reject logs.
22799 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
22800 error.
22801 </para>
22802 <para>
22803 <indexterm role="option">
22804 <primary><option>hold_domains</option></primary>
22805 </indexterm>
22806 </para>
22807 <informaltable frame="all">
22808 <tgroup cols="4" colsep="0" rowsep="0">
22809 <colspec colwidth="8*" align="left"/>
22810 <colspec colwidth="6*" align="center"/>
22811 <colspec colwidth="6*" align="center"/>
22812 <colspec colwidth="6*" align="right"/>
22813 <tbody>
22814 <row>
22815 <entry><option>hold_domains</option></entry>
22816 <entry>Use: <emphasis>main</emphasis></entry>
22817 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22818 <entry>Default: <emphasis>unset</emphasis></entry>
22819 </row>
22820 </tbody>
22821 </tgroup>
22822 </informaltable>
22823 <para>
22824 <indexterm role="concept">
22825 <primary>domain</primary>
22826 <secondary>delaying delivery</secondary>
22827 </indexterm>
22828 <indexterm role="concept">
22829 <primary>delivery</primary>
22830 <secondary>delaying certain domains</secondary>
22831 </indexterm>
22832 This option allows mail for particular domains to be held on the queue
22833 manually. The option is overridden if a message delivery is forced with the
22834 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
22835 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
22836 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
22837 it is deferred every time the message is looked at.
22838 </para>
22839 <para>
22840 This option is intended as a temporary operational measure for delaying the
22841 delivery of mail while some problem is being sorted out, or some new
22842 configuration tested. If you just want to delay the processing of some
22843 domains until a queue run occurs, you should use <option>queue_domains</option> or
22844 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
22845 </para>
22846 <para>
22847 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
22848 messages from the queue if they have been there longer than the longest retry
22849 time in any retry rule. If you want to hold messages for longer than the normal
22850 retry times, insert a dummy retry rule with a long retry time.
22851 </para>
22852 <para>
22853 <indexterm role="option">
22854 <primary><option>host_lookup</option></primary>
22855 </indexterm>
22856 </para>
22857 <informaltable frame="all">
22858 <tgroup cols="4" colsep="0" rowsep="0">
22859 <colspec colwidth="8*" align="left"/>
22860 <colspec colwidth="6*" align="center"/>
22861 <colspec colwidth="6*" align="center"/>
22862 <colspec colwidth="6*" align="right"/>
22863 <tbody>
22864 <row>
22865 <entry><option>host_lookup</option></entry>
22866 <entry>Use: <emphasis>main</emphasis></entry>
22867 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22868 <entry>Default: <emphasis>unset</emphasis></entry>
22869 </row>
22870 </tbody>
22871 </tgroup>
22872 </informaltable>
22873 <para>
22874 <indexterm role="concept">
22875 <primary>host name</primary>
22876 <secondary>lookup, forcing</secondary>
22877 </indexterm>
22878 Exim does not look up the name of a calling host from its IP address unless it
22879 is required to compare against some host list, or the host matches
22880 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
22881 option (which normally contains IP addresses rather than host names). The
22882 default configuration file contains
22883 </para>
22884 <literallayout class="monospaced">
22885 host_lookup = *
22886 </literallayout>
22887 <para>
22888 which causes a lookup to happen for all hosts. If the expense of these lookups
22889 is felt to be too great, the setting can be changed or removed.
22890 </para>
22891 <para>
22892 After a successful reverse lookup, Exim does a forward lookup on the name it
22893 has obtained, to verify that it yields the IP address that it started with. If
22894 this check fails, Exim behaves as if the name lookup failed.
22895 </para>
22896 <para>
22897 <indexterm role="variable">
22898 <primary><varname>$host_lookup_failed</varname></primary>
22899 </indexterm>
22900 <indexterm role="variable">
22901 <primary><varname>$sender_host_name</varname></primary>
22902 </indexterm>
22903 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
22904 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
22905 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and <literal>verify</literal> <literal>=</literal>
22906 <literal>reverse_host_lookup</literal> in ACLs.
22907 </para>
22908 <para>
22909 <indexterm role="option">
22910 <primary><option>host_lookup_order</option></primary>
22911 </indexterm>
22912 </para>
22913 <informaltable frame="all">
22914 <tgroup cols="4" colsep="0" rowsep="0">
22915 <colspec colwidth="8*" align="left"/>
22916 <colspec colwidth="6*" align="center"/>
22917 <colspec colwidth="6*" align="center"/>
22918 <colspec colwidth="6*" align="right"/>
22919 <tbody>
22920 <row>
22921 <entry><option>host_lookup_order</option></entry>
22922 <entry>Use: <emphasis>main</emphasis></entry>
22923 <entry>Type: <emphasis>string list</emphasis></entry>
22924 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
22925 </row>
22926 </tbody>
22927 </tgroup>
22928 </informaltable>
22929 <para>
22930 This option specifies the order of different lookup methods when Exim is trying
22931 to find a host name from an IP address. The default is to do a DNS lookup
22932 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
22933 if that fails. You can change the order of these lookups, or omit one entirely,
22934 if you want.
22935 </para>
22936 <para>
22937 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
22938 multiple PTR records in the DNS and the IP address is not listed in
22939 <filename>/etc/hosts</filename>. Different operating systems give different results in this
22940 case. That is why the default tries a DNS lookup first.
22941 </para>
22942 <para>
22943 <indexterm role="option">
22944 <primary><option>host_reject_connection</option></primary>
22945 </indexterm>
22946 </para>
22947 <informaltable frame="all">
22948 <tgroup cols="4" colsep="0" rowsep="0">
22949 <colspec colwidth="8*" align="left"/>
22950 <colspec colwidth="6*" align="center"/>
22951 <colspec colwidth="6*" align="center"/>
22952 <colspec colwidth="6*" align="right"/>
22953 <tbody>
22954 <row>
22955 <entry><option>host_reject_connection</option></entry>
22956 <entry>Use: <emphasis>main</emphasis></entry>
22957 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22958 <entry>Default: <emphasis>unset</emphasis></entry>
22959 </row>
22960 </tbody>
22961 </tgroup>
22962 </informaltable>
22963 <para>
22964 <indexterm role="concept">
22965 <primary>host</primary>
22966 <secondary>rejecting connections from</secondary>
22967 </indexterm>
22968 If this option is set, incoming SMTP calls from the hosts listed are rejected
22969 as soon as the connection is made.
22970 This option is obsolete, and retained only for backward compatibility, because
22971 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
22972 connections immediately.
22973 </para>
22974 <para>
22975 The ability to give an immediate rejection (either by this option or using an
22976 ACL) is provided for use in unusual cases. Many hosts will just try again,
22977 sometimes without much delay. Normally, it is better to use an ACL to reject
22978 incoming messages at a later stage, such as after RCPT commands. See
22979 chapter <xref linkend="CHAPACL"/>.
22980 </para>
22981 <para>
22982 <indexterm role="option">
22983 <primary><option>hosts_connection_nolog</option></primary>
22984 </indexterm>
22985 </para>
22986 <informaltable frame="all">
22987 <tgroup cols="4" colsep="0" rowsep="0">
22988 <colspec colwidth="8*" align="left"/>
22989 <colspec colwidth="6*" align="center"/>
22990 <colspec colwidth="6*" align="center"/>
22991 <colspec colwidth="6*" align="right"/>
22992 <tbody>
22993 <row>
22994 <entry><option>hosts_connection_nolog</option></entry>
22995 <entry>Use: <emphasis>main</emphasis></entry>
22996 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22997 <entry>Default: <emphasis>unset</emphasis></entry>
22998 </row>
22999 </tbody>
23000 </tgroup>
23001 </informaltable>
23002 <para>
23003 <indexterm role="concept">
23004 <primary>host</primary>
23005 <secondary>not logging connections from</secondary>
23006 </indexterm>
23007 This option defines a list of hosts for which connection logging does not
23008 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23009 you might want not to log SMTP connections from local processes, or from
23010 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23011 the daemon; you should therefore strive to restrict its value to a short inline
23012 list of IP addresses and networks. To disable logging SMTP connections from
23013 local processes, you must create a host list with an empty item. For example:
23014 </para>
23015 <literallayout class="monospaced">
23016 hosts_connection_nolog = :
23017 </literallayout>
23018 <para>
23019 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23020 </para>
23021 <para>
23022 <indexterm role="option">
23023 <primary><option>hosts_treat_as_local</option></primary>
23024 </indexterm>
23025 </para>
23026 <informaltable frame="all">
23027 <tgroup cols="4" colsep="0" rowsep="0">
23028 <colspec colwidth="8*" align="left"/>
23029 <colspec colwidth="6*" align="center"/>
23030 <colspec colwidth="6*" align="center"/>
23031 <colspec colwidth="6*" align="right"/>
23032 <tbody>
23033 <row>
23034 <entry><option>hosts_treat_as_local</option></entry>
23035 <entry>Use: <emphasis>main</emphasis></entry>
23036 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23037 <entry>Default: <emphasis>unset</emphasis></entry>
23038 </row>
23039 </tbody>
23040 </tgroup>
23041 </informaltable>
23042 <para>
23043 <indexterm role="concept">
23044 <primary>local host</primary>
23045 <secondary>domains treated as</secondary>
23046 </indexterm>
23047 <indexterm role="concept">
23048 <primary>host</primary>
23049 <secondary>treated as local</secondary>
23050 </indexterm>
23051 If this option is set, any host names that match the domain list are treated as
23052 if they were the local host when Exim is scanning host lists obtained from MX
23053 records
23054 or other sources. Note that the value of this option is a domain list, not a
23055 host list, because it is always used to check host names, not IP addresses.
23056 </para>
23057 <para>
23058 This option also applies when Exim is matching the special items
23059 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23060 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23061 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23062 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23063 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23064 interfaces and recognizing the local host.
23065 </para>
23066 <para>
23067 <indexterm role="option">
23068 <primary><option>ignore_bounce_errors_after</option></primary>
23069 </indexterm>
23070 </para>
23071 <informaltable frame="all">
23072 <tgroup cols="4" colsep="0" rowsep="0">
23073 <colspec colwidth="8*" align="left"/>
23074 <colspec colwidth="6*" align="center"/>
23075 <colspec colwidth="6*" align="center"/>
23076 <colspec colwidth="6*" align="right"/>
23077 <tbody>
23078 <row>
23079 <entry><option>ignore_bounce_errors_after</option></entry>
23080 <entry>Use: <emphasis>main</emphasis></entry>
23081 <entry>Type: <emphasis>time</emphasis></entry>
23082 <entry>Default: <emphasis>10w</emphasis></entry>
23083 </row>
23084 </tbody>
23085 </tgroup>
23086 </informaltable>
23087 <para>
23088 <indexterm role="concept">
23089 <primary>bounce message</primary>
23090 <secondary>discarding</secondary>
23091 </indexterm>
23092 <indexterm role="concept">
23093 <primary>discarding bounce message</primary>
23094 </indexterm>
23095 This option affects the processing of bounce messages that cannot be delivered,
23096 that is, those that suffer a permanent delivery failure. (Bounce messages that
23097 suffer temporary delivery failures are of course retried in the usual way.)
23098 </para>
23099 <para>
23100 After a permanent delivery failure, bounce messages are frozen,
23101 because there is no sender to whom they can be returned. When a frozen bounce
23102 message has been on the queue for more than the given time, it is unfrozen at
23103 the next queue run, and a further delivery is attempted. If delivery fails
23104 again, the bounce message is discarded. This makes it possible to keep failed
23105 bounce messages around for a shorter time than the normal maximum retry time
23106 for frozen messages. For example,
23107 </para>
23108 <literallayout class="monospaced">
23109 ignore_bounce_errors_after = 12h
23110 </literallayout>
23111 <para>
23112 retries failed bounce message deliveries after 12 hours, discarding any further
23113 failures. If the value of this option is set to a zero time period, bounce
23114 failures are discarded immediately. Setting a very long time (as in the default
23115 value) has the effect of disabling this option. For ways of automatically
23116 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23117 <option>timeout_frozen_after</option>.
23118 </para>
23119 <para>
23120 <indexterm role="option">
23121 <primary><option>ignore_fromline_hosts</option></primary>
23122 </indexterm>
23123 </para>
23124 <informaltable frame="all">
23125 <tgroup cols="4" colsep="0" rowsep="0">
23126 <colspec colwidth="8*" align="left"/>
23127 <colspec colwidth="6*" align="center"/>
23128 <colspec colwidth="6*" align="center"/>
23129 <colspec colwidth="6*" align="right"/>
23130 <tbody>
23131 <row>
23132 <entry><option>ignore_fromline_hosts</option></entry>
23133 <entry>Use: <emphasis>main</emphasis></entry>
23134 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23135 <entry>Default: <emphasis>unset</emphasis></entry>
23136 </row>
23137 </tbody>
23138 </tgroup>
23139 </informaltable>
23140 <para>
23141 <indexterm role="concept">
23142 <primary><quote>From</quote> line</primary>
23143 </indexterm>
23144 <indexterm role="concept">
23145 <primary>UUCP</primary>
23146 <secondary><quote>From</quote> line</secondary>
23147 </indexterm>
23148 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
23149 the headers of a message. By default this is treated as the start of the
23150 message&#x2019;s body, which means that any following headers are not recognized as
23151 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23152 match those hosts that insist on sending it. If the sender is actually a local
23153 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23154 <option>ignore_fromline_local</option> must be set to achieve this effect.
23155 </para>
23156 <para>
23157 <indexterm role="option">
23158 <primary><option>ignore_fromline_local</option></primary>
23159 </indexterm>
23160 </para>
23161 <informaltable frame="all">
23162 <tgroup cols="4" colsep="0" rowsep="0">
23163 <colspec colwidth="8*" align="left"/>
23164 <colspec colwidth="6*" align="center"/>
23165 <colspec colwidth="6*" align="center"/>
23166 <colspec colwidth="6*" align="right"/>
23167 <tbody>
23168 <row>
23169 <entry><option>ignore_fromline_local</option></entry>
23170 <entry>Use: <emphasis>main</emphasis></entry>
23171 <entry>Type: <emphasis>boolean</emphasis></entry>
23172 <entry>Default: <emphasis>false</emphasis></entry>
23173 </row>
23174 </tbody>
23175 </tgroup>
23176 </informaltable>
23177 <para>
23178 See <option>ignore_fromline_hosts</option> above.
23179 </para>
23180 <para>
23181 <indexterm role="option">
23182 <primary><option>keep_malformed</option></primary>
23183 </indexterm>
23184 </para>
23185 <informaltable frame="all">
23186 <tgroup cols="4" colsep="0" rowsep="0">
23187 <colspec colwidth="8*" align="left"/>
23188 <colspec colwidth="6*" align="center"/>
23189 <colspec colwidth="6*" align="center"/>
23190 <colspec colwidth="6*" align="right"/>
23191 <tbody>
23192 <row>
23193 <entry><option>keep_malformed</option></entry>
23194 <entry>Use: <emphasis>main</emphasis></entry>
23195 <entry>Type: <emphasis>time</emphasis></entry>
23196 <entry>Default: <emphasis>4d</emphasis></entry>
23197 </row>
23198 </tbody>
23199 </tgroup>
23200 </informaltable>
23201 <para>
23202 This option specifies the length of time to keep messages whose spool files
23203 have been corrupted in some way. This should, of course, never happen. At the
23204 next attempt to deliver such a message, it gets removed. The incident is
23205 logged.
23206 </para>
23207 <para>
23208 <indexterm role="option">
23209 <primary><option>ldap_default_servers</option></primary>
23210 </indexterm>
23211 </para>
23212 <informaltable frame="all">
23213 <tgroup cols="4" colsep="0" rowsep="0">
23214 <colspec colwidth="8*" align="left"/>
23215 <colspec colwidth="6*" align="center"/>
23216 <colspec colwidth="6*" align="center"/>
23217 <colspec colwidth="6*" align="right"/>
23218 <tbody>
23219 <row>
23220 <entry><option>ldap_default_servers</option></entry>
23221 <entry>Use: <emphasis>main</emphasis></entry>
23222 <entry>Type: <emphasis>string list</emphasis></entry>
23223 <entry>Default: <emphasis>unset</emphasis></entry>
23224 </row>
23225 </tbody>
23226 </tgroup>
23227 </informaltable>
23228 <para>
23229 <indexterm role="concept">
23230 <primary>LDAP</primary>
23231 <secondary>default servers</secondary>
23232 </indexterm>
23233 This option provides a list of LDAP servers which are tried in turn when an
23234 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
23235 details of LDAP queries. This option is available only when Exim has been built
23236 with LDAP support.
23237 </para>
23238 <para>
23239 <indexterm role="option">
23240 <primary><option>ldap_version</option></primary>
23241 </indexterm>
23242 </para>
23243 <informaltable frame="all">
23244 <tgroup cols="4" colsep="0" rowsep="0">
23245 <colspec colwidth="8*" align="left"/>
23246 <colspec colwidth="6*" align="center"/>
23247 <colspec colwidth="6*" align="center"/>
23248 <colspec colwidth="6*" align="right"/>
23249 <tbody>
23250 <row>
23251 <entry><option>ldap_version</option></entry>
23252 <entry>Use: <emphasis>main</emphasis></entry>
23253 <entry>Type: <emphasis>integer</emphasis></entry>
23254 <entry>Default: <emphasis>unset</emphasis></entry>
23255 </row>
23256 </tbody>
23257 </tgroup>
23258 </informaltable>
23259 <para>
23260 <indexterm role="concept">
23261 <primary>LDAP</primary>
23262 <secondary>protocol version, forcing</secondary>
23263 </indexterm>
23264 This option can be used to force Exim to set a specific protocol version for
23265 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
23266 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
23267 the LDAP headers; otherwise it is 2. This option is available only when Exim
23268 has been built with LDAP support.
23269 </para>
23270 <para>
23271 <indexterm role="option">
23272 <primary><option>local_from_check</option></primary>
23273 </indexterm>
23274 </para>
23275 <informaltable frame="all">
23276 <tgroup cols="4" colsep="0" rowsep="0">
23277 <colspec colwidth="8*" align="left"/>
23278 <colspec colwidth="6*" align="center"/>
23279 <colspec colwidth="6*" align="center"/>
23280 <colspec colwidth="6*" align="right"/>
23281 <tbody>
23282 <row>
23283 <entry><option>local_from_check</option></entry>
23284 <entry>Use: <emphasis>main</emphasis></entry>
23285 <entry>Type: <emphasis>boolean</emphasis></entry>
23286 <entry>Default: <emphasis>true</emphasis></entry>
23287 </row>
23288 </tbody>
23289 </tgroup>
23290 </informaltable>
23291 <para>
23292 <indexterm role="concept">
23293 <primary><emphasis>Sender:</emphasis> header line</primary>
23294 <secondary>disabling addition of</secondary>
23295 </indexterm>
23296 <indexterm role="concept">
23297 <primary><emphasis>From:</emphasis> header line</primary>
23298 <secondary>disabling checking of</secondary>
23299 </indexterm>
23300 When a message is submitted locally (that is, not over a TCP/IP connection) by
23301 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
23302 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
23303 the domain specified by <option>qualify_domain</option>.
23304 </para>
23305 <para>
23306 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
23307 locally submitted message is automatically qualified by Exim, unless the
23308 <option>-bnq</option> command line option is used.
23309 </para>
23310 <para>
23311 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
23312 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
23313 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
23314 and the default qualify domain.
23315 </para>
23316 <para>
23317 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
23318 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
23319 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
23320 <option>local_sender_retain</option> to be true.
23321 </para>
23322 <para>
23323 <indexterm role="concept">
23324 <primary>envelope sender</primary>
23325 </indexterm>
23326 These options affect only the header lines in the message. The envelope sender
23327 is still forced to be the login id at the qualify domain unless
23328 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
23329 </para>
23330 <para>
23331 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
23332 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
23333 has more details about <emphasis>Sender:</emphasis> processing.
23334 </para>
23335 <para>
23336 <indexterm role="option">
23337 <primary><option>local_from_prefix</option></primary>
23338 </indexterm>
23339 </para>
23340 <informaltable frame="all">
23341 <tgroup cols="4" colsep="0" rowsep="0">
23342 <colspec colwidth="8*" align="left"/>
23343 <colspec colwidth="6*" align="center"/>
23344 <colspec colwidth="6*" align="center"/>
23345 <colspec colwidth="6*" align="right"/>
23346 <tbody>
23347 <row>
23348 <entry><option>local_from_prefix</option></entry>
23349 <entry>Use: <emphasis>main</emphasis></entry>
23350 <entry>Type: <emphasis>string</emphasis></entry>
23351 <entry>Default: <emphasis>unset</emphasis></entry>
23352 </row>
23353 </tbody>
23354 </tgroup>
23355 </informaltable>
23356 <para>
23357 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
23358 matching the login id (see <option>local_from_check</option> above), it can be configured to
23359 ignore certain prefixes and suffixes in the local part of the address. This is
23360 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
23361 appropriate lists, in the same form as the <option>local_part_prefix</option> and
23362 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
23363 example, if
23364 </para>
23365 <literallayout class="monospaced">
23366 local_from_prefix = *-
23367 </literallayout>
23368 <para>
23369 is set, a <emphasis>From:</emphasis> line containing
23370 </para>
23371 <literallayout class="monospaced">
23372 From: anything-user@your.domain.example
23373 </literallayout>
23374 <para>
23375 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
23376 matches the actual sender address that is constructed from the login name and
23377 qualify domain.
23378 </para>
23379 <para>
23380 <indexterm role="option">
23381 <primary><option>local_from_suffix</option></primary>
23382 </indexterm>
23383 </para>
23384 <informaltable frame="all">
23385 <tgroup cols="4" colsep="0" rowsep="0">
23386 <colspec colwidth="8*" align="left"/>
23387 <colspec colwidth="6*" align="center"/>
23388 <colspec colwidth="6*" align="center"/>
23389 <colspec colwidth="6*" align="right"/>
23390 <tbody>
23391 <row>
23392 <entry><option>local_from_suffix</option></entry>
23393 <entry>Use: <emphasis>main</emphasis></entry>
23394 <entry>Type: <emphasis>string</emphasis></entry>
23395 <entry>Default: <emphasis>unset</emphasis></entry>
23396 </row>
23397 </tbody>
23398 </tgroup>
23399 </informaltable>
23400 <para>
23401 See <option>local_from_prefix</option> above.
23402 </para>
23403 <para>
23404 <indexterm role="option">
23405 <primary><option>local_interfaces</option></primary>
23406 </indexterm>
23407 </para>
23408 <informaltable frame="all">
23409 <tgroup cols="4" colsep="0" rowsep="0">
23410 <colspec colwidth="8*" align="left"/>
23411 <colspec colwidth="6*" align="center"/>
23412 <colspec colwidth="6*" align="center"/>
23413 <colspec colwidth="6*" align="right"/>
23414 <tbody>
23415 <row>
23416 <entry><option>local_interfaces</option></entry>
23417 <entry>Use: <emphasis>main</emphasis></entry>
23418 <entry>Type: <emphasis>string list</emphasis></entry>
23419 <entry>Default: <emphasis>see below</emphasis></entry>
23420 </row>
23421 </tbody>
23422 </tgroup>
23423 </informaltable>
23424 <para>
23425 This option controls which network interfaces are used by the daemon for
23426 listening; they are also used to identify the local host when routing. Chapter
23427 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23428 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23429 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23430 <option>local_interfaces</option> is
23431 </para>
23432 <literallayout class="monospaced">
23433 local_interfaces = 0.0.0.0
23434 </literallayout>
23435 <para>
23436 when Exim is built without IPv6 support; otherwise it is
23437 </para>
23438 <literallayout class="monospaced">
23439 local_interfaces = &lt;; ::0 ; 0.0.0.0
23440 </literallayout>
23441 <para>
23442 <indexterm role="option">
23443 <primary><option>local_scan_timeout</option></primary>
23444 </indexterm>
23445 </para>
23446 <informaltable frame="all">
23447 <tgroup cols="4" colsep="0" rowsep="0">
23448 <colspec colwidth="8*" align="left"/>
23449 <colspec colwidth="6*" align="center"/>
23450 <colspec colwidth="6*" align="center"/>
23451 <colspec colwidth="6*" align="right"/>
23452 <tbody>
23453 <row>
23454 <entry><option>local_scan_timeout</option></entry>
23455 <entry>Use: <emphasis>main</emphasis></entry>
23456 <entry>Type: <emphasis>time</emphasis></entry>
23457 <entry>Default: <emphasis>5m</emphasis></entry>
23458 </row>
23459 </tbody>
23460 </tgroup>
23461 </informaltable>
23462 <para>
23463 <indexterm role="concept">
23464 <primary>timeout</primary>
23465 <secondary>for <function>local_scan()</function> function</secondary>
23466 </indexterm>
23467 <indexterm role="concept">
23468 <primary><function>local_scan()</function> function</primary>
23469 <secondary>timeout</secondary>
23470 </indexterm>
23471 This timeout applies to the <function>local_scan()</function> function (see chapter
23472 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23473 the incoming message is rejected with a temporary error if it is an SMTP
23474 message. For a non-SMTP message, the message is dropped and Exim ends with a
23475 non-zero code. The incident is logged on the main and reject logs.
23476 </para>
23477 <para>
23478 <indexterm role="option">
23479 <primary><option>local_sender_retain</option></primary>
23480 </indexterm>
23481 </para>
23482 <informaltable frame="all">
23483 <tgroup cols="4" colsep="0" rowsep="0">
23484 <colspec colwidth="8*" align="left"/>
23485 <colspec colwidth="6*" align="center"/>
23486 <colspec colwidth="6*" align="center"/>
23487 <colspec colwidth="6*" align="right"/>
23488 <tbody>
23489 <row>
23490 <entry><option>local_sender_retain</option></entry>
23491 <entry>Use: <emphasis>main</emphasis></entry>
23492 <entry>Type: <emphasis>boolean</emphasis></entry>
23493 <entry>Default: <emphasis>false</emphasis></entry>
23494 </row>
23495 </tbody>
23496 </tgroup>
23497 </informaltable>
23498 <para>
23499 <indexterm role="concept">
23500 <primary><emphasis>Sender:</emphasis> header line</primary>
23501 <secondary>retaining from local submission</secondary>
23502 </indexterm>
23503 When a message is submitted locally (that is, not over a TCP/IP connection) by
23504 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
23505 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
23506 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
23507 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
23508 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
23509 </para>
23510 <para>
23511 <indexterm role="option">
23512 <primary><option>localhost_number</option></primary>
23513 </indexterm>
23514 </para>
23515 <informaltable frame="all">
23516 <tgroup cols="4" colsep="0" rowsep="0">
23517 <colspec colwidth="8*" align="left"/>
23518 <colspec colwidth="6*" align="center"/>
23519 <colspec colwidth="6*" align="center"/>
23520 <colspec colwidth="6*" align="right"/>
23521 <tbody>
23522 <row>
23523 <entry><option>localhost_number</option></entry>
23524 <entry>Use: <emphasis>main</emphasis></entry>
23525 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23526 <entry>Default: <emphasis>unset</emphasis></entry>
23527 </row>
23528 </tbody>
23529 </tgroup>
23530 </informaltable>
23531 <para>
23532 <indexterm role="concept">
23533 <primary>host</primary>
23534 <secondary>locally unique number for</secondary>
23535 </indexterm>
23536 <indexterm role="concept">
23537 <primary>message ids</primary>
23538 <secondary>with multiple hosts</secondary>
23539 </indexterm>
23540 <indexterm role="variable">
23541 <primary><varname>$localhost_number</varname></primary>
23542 </indexterm>
23543 Exim&#x2019;s message ids are normally unique only within the local host. If
23544 uniqueness among a set of hosts is required, each host must set a different
23545 value for the <option>localhost_number</option> option. The string is expanded immediately
23546 after reading the configuration file (so that a number can be computed from the
23547 host name, for example) and the result of the expansion must be a number in the
23548 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
23549 systems). This is available in subsequent string expansions via the variable
23550 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
23551 characters of the message id, instead of just being a fractional part of the
23552 time, are computed from the time and the local host number as described in
23553 section <xref linkend="SECTmessiden"/>.
23554 </para>
23555 <para>
23556 <indexterm role="option">
23557 <primary><option>log_file_path</option></primary>
23558 </indexterm>
23559 </para>
23560 <informaltable frame="all">
23561 <tgroup cols="4" colsep="0" rowsep="0">
23562 <colspec colwidth="8*" align="left"/>
23563 <colspec colwidth="6*" align="center"/>
23564 <colspec colwidth="6*" align="center"/>
23565 <colspec colwidth="6*" align="right"/>
23566 <tbody>
23567 <row>
23568 <entry><option>log_file_path</option></entry>
23569 <entry>Use: <emphasis>main</emphasis></entry>
23570 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23571 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23572 </row>
23573 </tbody>
23574 </tgroup>
23575 </informaltable>
23576 <para>
23577 <indexterm role="concept">
23578 <primary>log</primary>
23579 <secondary>file path for</secondary>
23580 </indexterm>
23581 This option sets the path which is used to determine the names of Exim&#x2019;s log
23582 files, or indicates that logging is to be to syslog, or both. It is expanded
23583 when Exim is entered, so it can, for example, contain a reference to the host
23584 name. If no specific path is set for the log files at compile or run time, they
23585 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
23586 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
23587 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
23588 used. If this string is fixed at your installation (contains no expansion
23589 variables) it is recommended that you do not set this option in the
23590 configuration file, but instead supply the path using LOG_FILE_PATH in
23591 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
23592 early on &ndash; in particular, failure to read the configuration file.
23593 </para>
23594 <para>
23595 <indexterm role="option">
23596 <primary><option>log_selector</option></primary>
23597 </indexterm>
23598 </para>
23599 <informaltable frame="all">
23600 <tgroup cols="4" colsep="0" rowsep="0">
23601 <colspec colwidth="8*" align="left"/>
23602 <colspec colwidth="6*" align="center"/>
23603 <colspec colwidth="6*" align="center"/>
23604 <colspec colwidth="6*" align="right"/>
23605 <tbody>
23606 <row>
23607 <entry><option>log_selector</option></entry>
23608 <entry>Use: <emphasis>main</emphasis></entry>
23609 <entry>Type: <emphasis>string</emphasis></entry>
23610 <entry>Default: <emphasis>unset</emphasis></entry>
23611 </row>
23612 </tbody>
23613 </tgroup>
23614 </informaltable>
23615 <para>
23616 <indexterm role="concept">
23617 <primary>log</primary>
23618 <secondary>selectors</secondary>
23619 </indexterm>
23620 This option can be used to reduce or increase the number of things that Exim
23621 writes to its log files. Its argument is made up of names preceded by plus or
23622 minus characters. For example:
23623 </para>
23624 <literallayout class="monospaced">
23625 log_selector = +arguments -retry_defer
23626 </literallayout>
23627 <para>
23628 A list of possible names and what they control is given in the chapter on
23629 logging, in section <xref linkend="SECTlogselector"/>.
23630 </para>
23631 <para>
23632 <indexterm role="option">
23633 <primary><option>log_timezone</option></primary>
23634 </indexterm>
23635 </para>
23636 <informaltable frame="all">
23637 <tgroup cols="4" colsep="0" rowsep="0">
23638 <colspec colwidth="8*" align="left"/>
23639 <colspec colwidth="6*" align="center"/>
23640 <colspec colwidth="6*" align="center"/>
23641 <colspec colwidth="6*" align="right"/>
23642 <tbody>
23643 <row>
23644 <entry><option>log_timezone</option></entry>
23645 <entry>Use: <emphasis>main</emphasis></entry>
23646 <entry>Type: <emphasis>boolean</emphasis></entry>
23647 <entry>Default: <emphasis>false</emphasis></entry>
23648 </row>
23649 </tbody>
23650 </tgroup>
23651 </informaltable>
23652 <para>
23653 <indexterm role="concept">
23654 <primary>log</primary>
23655 <secondary>timezone for entries</secondary>
23656 </indexterm>
23657 <indexterm role="variable">
23658 <primary><varname>$tod_log</varname></primary>
23659 </indexterm>
23660 <indexterm role="variable">
23661 <primary><varname>$tod_zone</varname></primary>
23662 </indexterm>
23663 By default, the timestamps on log lines are in local time without the
23664 timezone. This means that if your timezone changes twice a year, the timestamps
23665 in log lines are ambiguous for an hour when the clocks go back. One way of
23666 avoiding this problem is to set the timezone to UTC. An alternative is to set
23667 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23668 timestamps in log lines. Turning on this option can add quite a lot to the size
23669 of log files because each line is extended by 6 characters. Note that the
23670 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
23671 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
23672 </para>
23673 <para>
23674 <indexterm role="option">
23675 <primary><option>lookup_open_max</option></primary>
23676 </indexterm>
23677 </para>
23678 <informaltable frame="all">
23679 <tgroup cols="4" colsep="0" rowsep="0">
23680 <colspec colwidth="8*" align="left"/>
23681 <colspec colwidth="6*" align="center"/>
23682 <colspec colwidth="6*" align="center"/>
23683 <colspec colwidth="6*" align="right"/>
23684 <tbody>
23685 <row>
23686 <entry><option>lookup_open_max</option></entry>
23687 <entry>Use: <emphasis>main</emphasis></entry>
23688 <entry>Type: <emphasis>integer</emphasis></entry>
23689 <entry>Default: <emphasis>25</emphasis></entry>
23690 </row>
23691 </tbody>
23692 </tgroup>
23693 </informaltable>
23694 <para>
23695 <indexterm role="concept">
23696 <primary>too many open files</primary>
23697 </indexterm>
23698 <indexterm role="concept">
23699 <primary>open files, too many</primary>
23700 </indexterm>
23701 <indexterm role="concept">
23702 <primary>file</primary>
23703 <secondary>too many open</secondary>
23704 </indexterm>
23705 <indexterm role="concept">
23706 <primary>lookup</primary>
23707 <secondary>maximum open files</secondary>
23708 </indexterm>
23709 <indexterm role="concept">
23710 <primary>limit</primary>
23711 <secondary>open files for lookups</secondary>
23712 </indexterm>
23713 This option limits the number of simultaneously open files for single-key
23714 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
23715 Exim normally keeps these files open during routing, because often the same
23716 file is required several times. If the limit is reached, Exim closes the least
23717 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
23718 actually opens two files for each logical DBM database, though it still counts
23719 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
23720 open files</quote> errors with NDBM, you need to reduce the value of
23721 <option>lookup_open_max</option>.
23722 </para>
23723 <para>
23724 <indexterm role="option">
23725 <primary><option>max_username_length</option></primary>
23726 </indexterm>
23727 </para>
23728 <informaltable frame="all">
23729 <tgroup cols="4" colsep="0" rowsep="0">
23730 <colspec colwidth="8*" align="left"/>
23731 <colspec colwidth="6*" align="center"/>
23732 <colspec colwidth="6*" align="center"/>
23733 <colspec colwidth="6*" align="right"/>
23734 <tbody>
23735 <row>
23736 <entry><option>max_username_length</option></entry>
23737 <entry>Use: <emphasis>main</emphasis></entry>
23738 <entry>Type: <emphasis>integer</emphasis></entry>
23739 <entry>Default: <emphasis>0</emphasis></entry>
23740 </row>
23741 </tbody>
23742 </tgroup>
23743 </informaltable>
23744 <para>
23745 <indexterm role="concept">
23746 <primary>length of login name</primary>
23747 </indexterm>
23748 <indexterm role="concept">
23749 <primary>user name</primary>
23750 <secondary>maximum length</secondary>
23751 </indexterm>
23752 <indexterm role="concept">
23753 <primary>limit</primary>
23754 <secondary>user name length</secondary>
23755 </indexterm>
23756 Some operating systems are broken in that they truncate long arguments to
23757 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
23758 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
23759 an argument that is longer behaves as if <function>getpwnam()</function> failed.
23760 </para>
23761 <para>
23762 <indexterm role="option">
23763 <primary><option>message_body_visible</option></primary>
23764 </indexterm>
23765 </para>
23766 <informaltable frame="all">
23767 <tgroup cols="4" colsep="0" rowsep="0">
23768 <colspec colwidth="8*" align="left"/>
23769 <colspec colwidth="6*" align="center"/>
23770 <colspec colwidth="6*" align="center"/>
23771 <colspec colwidth="6*" align="right"/>
23772 <tbody>
23773 <row>
23774 <entry><option>message_body_visible</option></entry>
23775 <entry>Use: <emphasis>main</emphasis></entry>
23776 <entry>Type: <emphasis>integer</emphasis></entry>
23777 <entry>Default: <emphasis>500</emphasis></entry>
23778 </row>
23779 </tbody>
23780 </tgroup>
23781 </informaltable>
23782 <para>
23783 <indexterm role="concept">
23784 <primary>body of message</primary>
23785 <secondary>visible size</secondary>
23786 </indexterm>
23787 <indexterm role="concept">
23788 <primary>message body</primary>
23789 <secondary>visible size</secondary>
23790 </indexterm>
23791 <indexterm role="variable">
23792 <primary><varname>$message_body</varname></primary>
23793 </indexterm>
23794 <indexterm role="variable">
23795 <primary><varname>$message_body_end</varname></primary>
23796 </indexterm>
23797 This option specifies how much of a message&#x2019;s body is to be included in the
23798 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
23799 </para>
23800 <para>
23801 <indexterm role="option">
23802 <primary><option>message_id_header_domain</option></primary>
23803 </indexterm>
23804 </para>
23805 <informaltable frame="all">
23806 <tgroup cols="4" colsep="0" rowsep="0">
23807 <colspec colwidth="8*" align="left"/>
23808 <colspec colwidth="6*" align="center"/>
23809 <colspec colwidth="6*" align="center"/>
23810 <colspec colwidth="6*" align="right"/>
23811 <tbody>
23812 <row>
23813 <entry><option>message_id_header_domain</option></entry>
23814 <entry>Use: <emphasis>main</emphasis></entry>
23815 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23816 <entry>Default: <emphasis>unset</emphasis></entry>
23817 </row>
23818 </tbody>
23819 </tgroup>
23820 </informaltable>
23821 <para>
23822 <indexterm role="concept">
23823 <primary><emphasis>Message-ID:</emphasis> header line</primary>
23824 </indexterm>
23825 If this option is set, the string is expanded and used as the right hand side
23826 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
23827 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
23828 means <quote>not received over TCP/IP.</quote>
23829 Otherwise, the primary host name is used.
23830 Only letters, digits, dot and hyphen are accepted; any other characters are
23831 replaced by hyphens. If the expansion is forced to fail, or if the result is an
23832 empty string, the option is ignored.
23833 </para>
23834 <para>
23835 <indexterm role="option">
23836 <primary><option>message_id_header_text</option></primary>
23837 </indexterm>
23838 </para>
23839 <informaltable frame="all">
23840 <tgroup cols="4" colsep="0" rowsep="0">
23841 <colspec colwidth="8*" align="left"/>
23842 <colspec colwidth="6*" align="center"/>
23843 <colspec colwidth="6*" align="center"/>
23844 <colspec colwidth="6*" align="right"/>
23845 <tbody>
23846 <row>
23847 <entry><option>message_id_header_text</option></entry>
23848 <entry>Use: <emphasis>main</emphasis></entry>
23849 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23850 <entry>Default: <emphasis>unset</emphasis></entry>
23851 </row>
23852 </tbody>
23853 </tgroup>
23854 </informaltable>
23855 <para>
23856 If this variable is set, the string is expanded and used to augment the text of
23857 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
23858 message does not have one. The text of this header is required by RFC 2822 to
23859 take the form of an address. By default, Exim uses its internal message id as
23860 the local part, and the primary host name as the domain. If this option is set,
23861 it is expanded, and provided the expansion is not forced to fail, and does not
23862 yield an empty string, the result is inserted into the header immediately
23863 before the @, separated from the internal message id by a dot. Any characters
23864 that are illegal in an address are automatically converted into hyphens. This
23865 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
23866 colons will become hyphens.
23867 </para>
23868 <para>
23869 <indexterm role="option">
23870 <primary><option>message_logs</option></primary>
23871 </indexterm>
23872 </para>
23873 <informaltable frame="all">
23874 <tgroup cols="4" colsep="0" rowsep="0">
23875 <colspec colwidth="8*" align="left"/>
23876 <colspec colwidth="6*" align="center"/>
23877 <colspec colwidth="6*" align="center"/>
23878 <colspec colwidth="6*" align="right"/>
23879 <tbody>
23880 <row>
23881 <entry><option>message_logs</option></entry>
23882 <entry>Use: <emphasis>main</emphasis></entry>
23883 <entry>Type: <emphasis>boolean</emphasis></entry>
23884 <entry>Default: <emphasis>true</emphasis></entry>
23885 </row>
23886 </tbody>
23887 </tgroup>
23888 </informaltable>
23889 <para>
23890 <indexterm role="concept">
23891 <primary>message logs</primary>
23892 <secondary>disabling</secondary>
23893 </indexterm>
23894 <indexterm role="concept">
23895 <primary>log</primary>
23896 <secondary>message log; disabling</secondary>
23897 </indexterm>
23898 If this option is turned off, per-message log files are not created in the
23899 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
23900 Exim, by reducing the number of files involved in handling a message from a
23901 minimum of four (header spool file, body spool file, delivery journal, and
23902 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
23903 which is not affected by this option.
23904 </para>
23905 <para>
23906 <indexterm role="option">
23907 <primary><option>message_size_limit</option></primary>
23908 </indexterm>
23909 </para>
23910 <informaltable frame="all">
23911 <tgroup cols="4" colsep="0" rowsep="0">
23912 <colspec colwidth="8*" align="left"/>
23913 <colspec colwidth="6*" align="center"/>
23914 <colspec colwidth="6*" align="center"/>
23915 <colspec colwidth="6*" align="right"/>
23916 <tbody>
23917 <row>
23918 <entry><option>message_size_limit</option></entry>
23919 <entry>Use: <emphasis>main</emphasis></entry>
23920 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23921 <entry>Default: <emphasis>50M</emphasis></entry>
23922 </row>
23923 </tbody>
23924 </tgroup>
23925 </informaltable>
23926 <para>
23927 <indexterm role="concept">
23928 <primary>message</primary>
23929 <secondary>size limit</secondary>
23930 </indexterm>
23931 <indexterm role="concept">
23932 <primary>limit</primary>
23933 <secondary>message size</secondary>
23934 </indexterm>
23935 <indexterm role="concept">
23936 <primary>size</primary>
23937 <secondary>of message, limit</secondary>
23938 </indexterm>
23939 This option limits the maximum size of message that Exim will process. The
23940 value is expanded for each incoming connection so, for example, it can be made
23941 to depend on the IP address of the remote host for messages arriving via
23942 TCP/IP. After expansion, the value must be a sequence of decimal digits,
23943 optionally followed by K or M.
23944 </para>
23945 <para>
23946 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
23947 other properties of an individual message, because it has to be advertised in
23948 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
23949 error. A value of zero means no limit, but its use is not recommended. See also
23950 <option>bounce_return_size_limit</option>.
23951 </para>
23952 <para>
23953 Incoming SMTP messages are failed with a 552 error if the limit is
23954 exceeded; locally-generated messages either get a stderr message or a delivery
23955 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
23956 an oversized message is logged in both the main and the reject logs. See also
23957 the generic transport option <option>message_size_limit</option>, which limits the size of
23958 message that an individual transport can process.
23959 </para>
23960 <para>
23961 <indexterm role="option">
23962 <primary><option>move_frozen_messages</option></primary>
23963 </indexterm>
23964 </para>
23965 <informaltable frame="all">
23966 <tgroup cols="4" colsep="0" rowsep="0">
23967 <colspec colwidth="8*" align="left"/>
23968 <colspec colwidth="6*" align="center"/>
23969 <colspec colwidth="6*" align="center"/>
23970 <colspec colwidth="6*" align="right"/>
23971 <tbody>
23972 <row>
23973 <entry><option>move_frozen_messages</option></entry>
23974 <entry>Use: <emphasis>main</emphasis></entry>
23975 <entry>Type: <emphasis>boolean</emphasis></entry>
23976 <entry>Default: <emphasis>false</emphasis></entry>
23977 </row>
23978 </tbody>
23979 </tgroup>
23980 </informaltable>
23981 <para>
23982 <indexterm role="concept">
23983 <primary>frozen messages</primary>
23984 <secondary>moving</secondary>
23985 </indexterm>
23986 This option, which is available only if Exim has been built with the setting
23987 </para>
23988 <literallayout class="monospaced">
23989 SUPPORT_MOVE_FROZEN_MESSAGES=yes
23990 </literallayout>
23991 <para>
23992 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
23993 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
23994 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
23995 standard utilities for handling such moved messages, and they do not show up in
23996 lists generated by <option>-bp</option> or by the Exim monitor.
23997 </para>
23998 <para>
23999 <indexterm role="option">
24000 <primary><option>mua_wrapper</option></primary>
24001 </indexterm>
24002 </para>
24003 <informaltable frame="all">
24004 <tgroup cols="4" colsep="0" rowsep="0">
24005 <colspec colwidth="8*" align="left"/>
24006 <colspec colwidth="6*" align="center"/>
24007 <colspec colwidth="6*" align="center"/>
24008 <colspec colwidth="6*" align="right"/>
24009 <tbody>
24010 <row>
24011 <entry><option>mua_wrapper</option></entry>
24012 <entry>Use: <emphasis>main</emphasis></entry>
24013 <entry>Type: <emphasis>boolean</emphasis></entry>
24014 <entry>Default: <emphasis>false</emphasis></entry>
24015 </row>
24016 </tbody>
24017 </tgroup>
24018 </informaltable>
24019 <para>
24020 Setting this option true causes Exim to run in a very restrictive mode in which
24021 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24022 contains a full description of this facility.
24023 </para>
24024 <para>
24025 <indexterm role="option">
24026 <primary><option>mysql_servers</option></primary>
24027 </indexterm>
24028 </para>
24029 <informaltable frame="all">
24030 <tgroup cols="4" colsep="0" rowsep="0">
24031 <colspec colwidth="8*" align="left"/>
24032 <colspec colwidth="6*" align="center"/>
24033 <colspec colwidth="6*" align="center"/>
24034 <colspec colwidth="6*" align="right"/>
24035 <tbody>
24036 <row>
24037 <entry><option>mysql_servers</option></entry>
24038 <entry>Use: <emphasis>main</emphasis></entry>
24039 <entry>Type: <emphasis>string list</emphasis></entry>
24040 <entry>Default: <emphasis>unset</emphasis></entry>
24041 </row>
24042 </tbody>
24043 </tgroup>
24044 </informaltable>
24045 <para>
24046 <indexterm role="concept">
24047 <primary>MySQL</primary>
24048 <secondary>server list</secondary>
24049 </indexterm>
24050 This option provides a list of MySQL servers and associated connection data, to
24051 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECTsql"/>). The
24052 option is available only if Exim has been built with MySQL support.
24053 </para>
24054 <para>
24055 <indexterm role="option">
24056 <primary><option>never_users</option></primary>
24057 </indexterm>
24058 </para>
24059 <informaltable frame="all">
24060 <tgroup cols="4" colsep="0" rowsep="0">
24061 <colspec colwidth="8*" align="left"/>
24062 <colspec colwidth="6*" align="center"/>
24063 <colspec colwidth="6*" align="center"/>
24064 <colspec colwidth="6*" align="right"/>
24065 <tbody>
24066 <row>
24067 <entry><option>never_users</option></entry>
24068 <entry>Use: <emphasis>main</emphasis></entry>
24069 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24070 <entry>Default: <emphasis>unset</emphasis></entry>
24071 </row>
24072 </tbody>
24073 </tgroup>
24074 </informaltable>
24075 <para>
24076 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
24077 message deliveries are normally run in processes that are setuid to the
24078 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
24079 It is usually desirable to prevent any deliveries from running as root, as a
24080 safety precaution.
24081 </para>
24082 <para>
24083 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24084 list of users that must not be used for local deliveries. This list is fixed in
24085 the binary and cannot be overridden by the configuration file. By default, it
24086 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24087 can be used to add more users to the fixed list.
24088 </para>
24089 <para>
24090 If a message is to be delivered as one of the users on the fixed list or the
24091 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24092 example is
24093 </para>
24094 <literallayout class="monospaced">
24095 never_users = root:daemon:bin
24096 </literallayout>
24097 <para>
24098 Including root is redundant if it is also on the fixed list, but it does no
24099 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
24100 transport driver.
24101 </para>
24102 <para>
24103 <indexterm role="option">
24104 <primary><option>oracle_servers</option></primary>
24105 </indexterm>
24106 </para>
24107 <informaltable frame="all">
24108 <tgroup cols="4" colsep="0" rowsep="0">
24109 <colspec colwidth="8*" align="left"/>
24110 <colspec colwidth="6*" align="center"/>
24111 <colspec colwidth="6*" align="center"/>
24112 <colspec colwidth="6*" align="right"/>
24113 <tbody>
24114 <row>
24115 <entry><option>oracle_servers</option></entry>
24116 <entry>Use: <emphasis>main</emphasis></entry>
24117 <entry>Type: <emphasis>string list</emphasis></entry>
24118 <entry>Default: <emphasis>unset</emphasis></entry>
24119 </row>
24120 </tbody>
24121 </tgroup>
24122 </informaltable>
24123 <para>
24124 <indexterm role="concept">
24125 <primary>Oracle</primary>
24126 <secondary>server list</secondary>
24127 </indexterm>
24128 This option provides a list of Oracle servers and associated connection data,
24129 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECTsql"/>).
24130 The option is available only if Exim has been built with Oracle support.
24131 </para>
24132 <para>
24133 <indexterm role="option">
24134 <primary><option>percent_hack_domains</option></primary>
24135 </indexterm>
24136 </para>
24137 <informaltable frame="all">
24138 <tgroup cols="4" colsep="0" rowsep="0">
24139 <colspec colwidth="8*" align="left"/>
24140 <colspec colwidth="6*" align="center"/>
24141 <colspec colwidth="6*" align="center"/>
24142 <colspec colwidth="6*" align="right"/>
24143 <tbody>
24144 <row>
24145 <entry><option>percent_hack_domains</option></entry>
24146 <entry>Use: <emphasis>main</emphasis></entry>
24147 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24148 <entry>Default: <emphasis>unset</emphasis></entry>
24149 </row>
24150 </tbody>
24151 </tgroup>
24152 </informaltable>
24153 <para>
24154 <indexterm role="concept">
24155 <primary><quote>percent hack</quote></primary>
24156 </indexterm>
24157 <indexterm role="concept">
24158 <primary>source routing</primary>
24159 <secondary>in email address</secondary>
24160 </indexterm>
24161 <indexterm role="concept">
24162 <primary>address</primary>
24163 <secondary>source-routed</secondary>
24164 </indexterm>
24165 The <quote>percent hack</quote> is the convention whereby a local part containing a
24166 percent sign is re-interpreted as a new email address, with the percent
24167 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
24168 also applied to RFC 2822 addresses that begin with an @ character. If this
24169 option is set, Exim implements the percent facility for those domains listed,
24170 but no others. This happens before an incoming SMTP address is tested against
24171 an ACL.
24172 </para>
24173 <para>
24174 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
24175 trying to get round relaying restrictions. For this reason, it is best avoided
24176 if at all possible. Unfortunately, a number of less security-conscious MTAs
24177 implement it unconditionally. If you are running Exim on a gateway host, and
24178 routing mail through to internal MTAs without processing the local parts, it is
24179 a good idea to reject recipient addresses with percent characters in their
24180 local parts. Exim&#x2019;s default configuration does this.
24181 </para>
24182 <para>
24183 <indexterm role="option">
24184 <primary><option>perl_at_start</option></primary>
24185 </indexterm>
24186 </para>
24187 <informaltable frame="all">
24188 <tgroup cols="4" colsep="0" rowsep="0">
24189 <colspec colwidth="8*" align="left"/>
24190 <colspec colwidth="6*" align="center"/>
24191 <colspec colwidth="6*" align="center"/>
24192 <colspec colwidth="6*" align="right"/>
24193 <tbody>
24194 <row>
24195 <entry><option>perl_at_start</option></entry>
24196 <entry>Use: <emphasis>main</emphasis></entry>
24197 <entry>Type: <emphasis>boolean</emphasis></entry>
24198 <entry>Default: <emphasis>false</emphasis></entry>
24199 </row>
24200 </tbody>
24201 </tgroup>
24202 </informaltable>
24203 <para>
24204 This option is available only when Exim is built with an embedded Perl
24205 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24206 </para>
24207 <para>
24208 <indexterm role="option">
24209 <primary><option>perl_startup</option></primary>
24210 </indexterm>
24211 </para>
24212 <informaltable frame="all">
24213 <tgroup cols="4" colsep="0" rowsep="0">
24214 <colspec colwidth="8*" align="left"/>
24215 <colspec colwidth="6*" align="center"/>
24216 <colspec colwidth="6*" align="center"/>
24217 <colspec colwidth="6*" align="right"/>
24218 <tbody>
24219 <row>
24220 <entry><option>perl_startup</option></entry>
24221 <entry>Use: <emphasis>main</emphasis></entry>
24222 <entry>Type: <emphasis>string</emphasis></entry>
24223 <entry>Default: <emphasis>unset</emphasis></entry>
24224 </row>
24225 </tbody>
24226 </tgroup>
24227 </informaltable>
24228 <para>
24229 This option is available only when Exim is built with an embedded Perl
24230 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24231 </para>
24232 <para>
24233 <indexterm role="option">
24234 <primary><option>pgsql_servers</option></primary>
24235 </indexterm>
24236 </para>
24237 <informaltable frame="all">
24238 <tgroup cols="4" colsep="0" rowsep="0">
24239 <colspec colwidth="8*" align="left"/>
24240 <colspec colwidth="6*" align="center"/>
24241 <colspec colwidth="6*" align="center"/>
24242 <colspec colwidth="6*" align="right"/>
24243 <tbody>
24244 <row>
24245 <entry><option>pgsql_servers</option></entry>
24246 <entry>Use: <emphasis>main</emphasis></entry>
24247 <entry>Type: <emphasis>string list</emphasis></entry>
24248 <entry>Default: <emphasis>unset</emphasis></entry>
24249 </row>
24250 </tbody>
24251 </tgroup>
24252 </informaltable>
24253 <para>
24254 <indexterm role="concept">
24255 <primary>PostgreSQL lookup type</primary>
24256 <secondary>server list</secondary>
24257 </indexterm>
24258 This option provides a list of PostgreSQL servers and associated connection
24259 data, to be used in conjunction with <command>pgsql</command> lookups (see section
24260 <xref linkend="SECTsql"/>). The option is available only if Exim has been built with
24261 PostgreSQL support.
24262 </para>
24263 <para>
24264 <indexterm role="option">
24265 <primary><option>pid_file_path</option></primary>
24266 </indexterm>
24267 </para>
24268 <informaltable frame="all">
24269 <tgroup cols="4" colsep="0" rowsep="0">
24270 <colspec colwidth="8*" align="left"/>
24271 <colspec colwidth="6*" align="center"/>
24272 <colspec colwidth="6*" align="center"/>
24273 <colspec colwidth="6*" align="right"/>
24274 <tbody>
24275 <row>
24276 <entry><option>pid_file_path</option></entry>
24277 <entry>Use: <emphasis>main</emphasis></entry>
24278 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24279 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24280 </row>
24281 </tbody>
24282 </tgroup>
24283 </informaltable>
24284 <para>
24285 <indexterm role="concept">
24286 <primary>daemon</primary>
24287 <secondary>pid file path</secondary>
24288 </indexterm>
24289 <indexterm role="concept">
24290 <primary>pid file, path for</primary>
24291 </indexterm>
24292 This option sets the name of the file to which the Exim daemon writes its
24293 process id. The string is expanded, so it can contain, for example, references
24294 to the host name:
24295 </para>
24296 <literallayout class="monospaced">
24297 pid_file_path = /var/log/$primary_hostname/exim.pid
24298 </literallayout>
24299 <para>
24300 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
24301 spool directory.
24302 The value set by the option can be overridden by the <option>-oP</option> command line
24303 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
24304 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
24305 </para>
24306 <para>
24307 <indexterm role="option">
24308 <primary><option>pipelining_advertise_hosts</option></primary>
24309 </indexterm>
24310 </para>
24311 <informaltable frame="all">
24312 <tgroup cols="4" colsep="0" rowsep="0">
24313 <colspec colwidth="8*" align="left"/>
24314 <colspec colwidth="6*" align="center"/>
24315 <colspec colwidth="6*" align="center"/>
24316 <colspec colwidth="6*" align="right"/>
24317 <tbody>
24318 <row>
24319 <entry><option>pipelining_advertise_hosts</option></entry>
24320 <entry>Use: <emphasis>main</emphasis></entry>
24321 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24322 <entry>Default: <emphasis>*</emphasis></entry>
24323 </row>
24324 </tbody>
24325 </tgroup>
24326 </informaltable>
24327 <para>
24328 <indexterm role="concept">
24329 <primary>PIPELINING</primary>
24330 <secondary>suppressing advertising</secondary>
24331 </indexterm>
24332 This option can be used to suppress the advertisement of the SMTP
24333 PIPELINING extension to specific hosts. <phrase revisionflag="changed">See also the <emphasis role="bold">no_pipelining</emphasis>
24334 control in section <xref linkend="SECTcontrols"/>.</phrase> When PIPELINING is not advertised and
24335 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
24336 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
24337 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
24338 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
24339 </para>
24340 <para>
24341 <indexterm role="option">
24342 <primary><option>preserve_message_logs</option></primary>
24343 </indexterm>
24344 </para>
24345 <informaltable frame="all">
24346 <tgroup cols="4" colsep="0" rowsep="0">
24347 <colspec colwidth="8*" align="left"/>
24348 <colspec colwidth="6*" align="center"/>
24349 <colspec colwidth="6*" align="center"/>
24350 <colspec colwidth="6*" align="right"/>
24351 <tbody>
24352 <row>
24353 <entry><option>preserve_message_logs</option></entry>
24354 <entry>Use: <emphasis>main</emphasis></entry>
24355 <entry>Type: <emphasis>boolean</emphasis></entry>
24356 <entry>Default: <emphasis>false</emphasis></entry>
24357 </row>
24358 </tbody>
24359 </tgroup>
24360 </informaltable>
24361 <para>
24362 <indexterm role="concept">
24363 <primary>message logs</primary>
24364 <secondary>preserving</secondary>
24365 </indexterm>
24366 If this option is set, message log files are not deleted when messages are
24367 completed. Instead, they are moved to a sub-directory of the spool directory
24368 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
24369 purposes. This is a dangerous option to set on systems with any appreciable
24370 volume of mail. Use with care!
24371 </para>
24372 <para>
24373 <indexterm role="option">
24374 <primary><option>primary_hostname</option></primary>
24375 </indexterm>
24376 </para>
24377 <informaltable frame="all">
24378 <tgroup cols="4" colsep="0" rowsep="0">
24379 <colspec colwidth="8*" align="left"/>
24380 <colspec colwidth="6*" align="center"/>
24381 <colspec colwidth="6*" align="center"/>
24382 <colspec colwidth="6*" align="right"/>
24383 <tbody>
24384 <row>
24385 <entry><option>primary_hostname</option></entry>
24386 <entry>Use: <emphasis>main</emphasis></entry>
24387 <entry>Type: <emphasis>string</emphasis></entry>
24388 <entry>Default: <emphasis>see below</emphasis></entry>
24389 </row>
24390 </tbody>
24391 </tgroup>
24392 </informaltable>
24393 <para>
24394 <indexterm role="concept">
24395 <primary>name</primary>
24396 <secondary>of local host</secondary>
24397 </indexterm>
24398 <indexterm role="concept">
24399 <primary>host</primary>
24400 <secondary>name of local</secondary>
24401 </indexterm>
24402 <indexterm role="concept">
24403 <primary>local host</primary>
24404 <secondary>name of</secondary>
24405 </indexterm>
24406 <indexterm role="variable">
24407 <primary><varname>$primary_hostname</varname></primary>
24408 </indexterm>
24409 This specifies the name of the current host. It is used in the default EHLO or
24410 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
24411 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
24412 The value is also used by default in some SMTP response messages from an Exim
24413 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
24414 </para>
24415 <para>
24416 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
24417 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
24418 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
24419 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
24420 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
24421 explicitly by this option, or defaulted.
24422 </para>
24423 <para>
24424 <indexterm role="option">
24425 <primary><option>print_topbitchars</option></primary>
24426 </indexterm>
24427 </para>
24428 <informaltable frame="all">
24429 <tgroup cols="4" colsep="0" rowsep="0">
24430 <colspec colwidth="8*" align="left"/>
24431 <colspec colwidth="6*" align="center"/>
24432 <colspec colwidth="6*" align="center"/>
24433 <colspec colwidth="6*" align="right"/>
24434 <tbody>
24435 <row>
24436 <entry><option>print_topbitchars</option></entry>
24437 <entry>Use: <emphasis>main</emphasis></entry>
24438 <entry>Type: <emphasis>boolean</emphasis></entry>
24439 <entry>Default: <emphasis>false</emphasis></entry>
24440 </row>
24441 </tbody>
24442 </tgroup>
24443 </informaltable>
24444 <para>
24445 <indexterm role="concept">
24446 <primary>printing characters</primary>
24447 </indexterm>
24448 <indexterm role="concept">
24449 <primary>8-bit characters</primary>
24450 </indexterm>
24451 By default, Exim considers only those characters whose codes lie in the range
24452 32&ndash;126 to be printing characters. In a number of circumstances (for example,
24453 when writing log entries) non-printing characters are converted into escape
24454 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
24455 is set, code values of 128 and above are also considered to be printing
24456 characters.
24457 </para>
24458 <para>
24459 This option also affects the header syntax checks performed by the
24460 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
24461 the user&#x2019;s full name when constructing From: and Sender: addresses (as
24462 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
24463 Exim to generate eight bit message headers that do not conform to the
24464 standards.
24465 </para>
24466 <para>
24467 <indexterm role="option">
24468 <primary><option>process_log_path</option></primary>
24469 </indexterm>
24470 </para>
24471 <informaltable frame="all">
24472 <tgroup cols="4" colsep="0" rowsep="0">
24473 <colspec colwidth="8*" align="left"/>
24474 <colspec colwidth="6*" align="center"/>
24475 <colspec colwidth="6*" align="center"/>
24476 <colspec colwidth="6*" align="right"/>
24477 <tbody>
24478 <row>
24479 <entry><option>process_log_path</option></entry>
24480 <entry>Use: <emphasis>main</emphasis></entry>
24481 <entry>Type: <emphasis>string</emphasis></entry>
24482 <entry>Default: <emphasis>unset</emphasis></entry>
24483 </row>
24484 </tbody>
24485 </tgroup>
24486 </informaltable>
24487 <para>
24488 <indexterm role="concept">
24489 <primary>process log path</primary>
24490 </indexterm>
24491 <indexterm role="concept">
24492 <primary>log</primary>
24493 <secondary>process log</secondary>
24494 </indexterm>
24495 <indexterm role="concept">
24496 <primary><emphasis>exiwhat</emphasis></primary>
24497 </indexterm>
24498 This option sets the name of the file to which an Exim process writes its
24499 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
24500 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
24501 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
24502 can be useful in environments where two different Exims are running, using
24503 different spool directories.
24504 </para>
24505 <para>
24506 <indexterm role="option">
24507 <primary><option>prod_requires_admin</option></primary>
24508 </indexterm>
24509 </para>
24510 <informaltable frame="all">
24511 <tgroup cols="4" colsep="0" rowsep="0">
24512 <colspec colwidth="8*" align="left"/>
24513 <colspec colwidth="6*" align="center"/>
24514 <colspec colwidth="6*" align="center"/>
24515 <colspec colwidth="6*" align="right"/>
24516 <tbody>
24517 <row>
24518 <entry><option>prod_requires_admin</option></entry>
24519 <entry>Use: <emphasis>main</emphasis></entry>
24520 <entry>Type: <emphasis>boolean</emphasis></entry>
24521 <entry>Default: <emphasis>true</emphasis></entry>
24522 </row>
24523 </tbody>
24524 </tgroup>
24525 </informaltable>
24526 <para>
24527 <indexterm role="option">
24528 <primary><option>-M</option></primary>
24529 </indexterm>
24530 <indexterm role="option">
24531 <primary><option>-R</option></primary>
24532 </indexterm>
24533 <indexterm role="option">
24534 <primary><option>-q</option></primary>
24535 </indexterm>
24536 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
24537 admin user unless <option>prod_requires_admin</option> is set false. See also
24538 <option>queue_list_requires_admin</option>.
24539 </para>
24540 <para>
24541 <indexterm role="option">
24542 <primary><option>qualify_domain</option></primary>
24543 </indexterm>
24544 </para>
24545 <informaltable frame="all">
24546 <tgroup cols="4" colsep="0" rowsep="0">
24547 <colspec colwidth="8*" align="left"/>
24548 <colspec colwidth="6*" align="center"/>
24549 <colspec colwidth="6*" align="center"/>
24550 <colspec colwidth="6*" align="right"/>
24551 <tbody>
24552 <row>
24553 <entry><option>qualify_domain</option></entry>
24554 <entry>Use: <emphasis>main</emphasis></entry>
24555 <entry>Type: <emphasis>string</emphasis></entry>
24556 <entry>Default: <emphasis>see below</emphasis></entry>
24557 </row>
24558 </tbody>
24559 </tgroup>
24560 </informaltable>
24561 <para>
24562 <indexterm role="concept">
24563 <primary>domain</primary>
24564 <secondary>for qualifying addresses</secondary>
24565 </indexterm>
24566 <indexterm role="concept">
24567 <primary>address</primary>
24568 <secondary>qualification</secondary>
24569 </indexterm>
24570 This option specifies the domain name that is added to any envelope sender
24571 addresses that do not have a domain qualification. It also applies to
24572 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
24573 are accepted by default only for locally-generated messages. Qualification is
24574 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
24575 locally-generated messages, unless the <option>-bnq</option> command line option is used.
24576 </para>
24577 <para>
24578 Messages from external sources must always contain fully qualified addresses,
24579 unless the sending host matches <option>sender_unqualified_hosts</option> or
24580 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
24581 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
24582 necessary. Internally, Exim always works with fully qualified envelope
24583 addresses. If <option>qualify_domain</option> is not set, it defaults to the
24584 <option>primary_hostname</option> value.
24585 </para>
24586 <para>
24587 <indexterm role="option">
24588 <primary><option>qualify_recipient</option></primary>
24589 </indexterm>
24590 </para>
24591 <informaltable frame="all">
24592 <tgroup cols="4" colsep="0" rowsep="0">
24593 <colspec colwidth="8*" align="left"/>
24594 <colspec colwidth="6*" align="center"/>
24595 <colspec colwidth="6*" align="center"/>
24596 <colspec colwidth="6*" align="right"/>
24597 <tbody>
24598 <row>
24599 <entry><option>qualify_recipient</option></entry>
24600 <entry>Use: <emphasis>main</emphasis></entry>
24601 <entry>Type: <emphasis>string</emphasis></entry>
24602 <entry>Default: <emphasis>see below</emphasis></entry>
24603 </row>
24604 </tbody>
24605 </tgroup>
24606 </informaltable>
24607 <para>
24608 This option allows you to specify a different domain for qualifying recipient
24609 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
24610 </para>
24611 <para>
24612 <indexterm role="option">
24613 <primary><option>queue_domains</option></primary>
24614 </indexterm>
24615 </para>
24616 <informaltable frame="all">
24617 <tgroup cols="4" colsep="0" rowsep="0">
24618 <colspec colwidth="8*" align="left"/>
24619 <colspec colwidth="6*" align="center"/>
24620 <colspec colwidth="6*" align="center"/>
24621 <colspec colwidth="6*" align="right"/>
24622 <tbody>
24623 <row>
24624 <entry><option>queue_domains</option></entry>
24625 <entry>Use: <emphasis>main</emphasis></entry>
24626 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24627 <entry>Default: <emphasis>unset</emphasis></entry>
24628 </row>
24629 </tbody>
24630 </tgroup>
24631 </informaltable>
24632 <para>
24633 <indexterm role="concept">
24634 <primary>domain</primary>
24635 <secondary>specifying non-immediate delivery</secondary>
24636 </indexterm>
24637 <indexterm role="concept">
24638 <primary>queueing incoming messages</primary>
24639 </indexterm>
24640 <indexterm role="concept">
24641 <primary>message</primary>
24642 <secondary>queueing certain domains</secondary>
24643 </indexterm>
24644 This option lists domains for which immediate delivery is not required.
24645 A delivery process is started whenever a message is received, but only those
24646 domains that do not match are processed. All other deliveries wait until the
24647 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
24648 </para>
24649 <para>
24650 <indexterm role="option">
24651 <primary><option>queue_list_requires_admin</option></primary>
24652 </indexterm>
24653 </para>
24654 <informaltable frame="all">
24655 <tgroup cols="4" colsep="0" rowsep="0">
24656 <colspec colwidth="8*" align="left"/>
24657 <colspec colwidth="6*" align="center"/>
24658 <colspec colwidth="6*" align="center"/>
24659 <colspec colwidth="6*" align="right"/>
24660 <tbody>
24661 <row>
24662 <entry><option>queue_list_requires_admin</option></entry>
24663 <entry>Use: <emphasis>main</emphasis></entry>
24664 <entry>Type: <emphasis>boolean</emphasis></entry>
24665 <entry>Default: <emphasis>true</emphasis></entry>
24666 </row>
24667 </tbody>
24668 </tgroup>
24669 </informaltable>
24670 <para>
24671 <indexterm role="option">
24672 <primary><option>-bp</option></primary>
24673 </indexterm>
24674 The <option>-bp</option> command-line option, which lists the messages that are on the
24675 queue, requires the caller to be an admin user unless
24676 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
24677 </para>
24678 <para>
24679 <indexterm role="option">
24680 <primary><option>queue_only</option></primary>
24681 </indexterm>
24682 </para>
24683 <informaltable frame="all">
24684 <tgroup cols="4" colsep="0" rowsep="0">
24685 <colspec colwidth="8*" align="left"/>
24686 <colspec colwidth="6*" align="center"/>
24687 <colspec colwidth="6*" align="center"/>
24688 <colspec colwidth="6*" align="right"/>
24689 <tbody>
24690 <row>
24691 <entry><option>queue_only</option></entry>
24692 <entry>Use: <emphasis>main</emphasis></entry>
24693 <entry>Type: <emphasis>boolean</emphasis></entry>
24694 <entry>Default: <emphasis>false</emphasis></entry>
24695 </row>
24696 </tbody>
24697 </tgroup>
24698 </informaltable>
24699 <para>
24700 <indexterm role="concept">
24701 <primary>queueing incoming messages</primary>
24702 </indexterm>
24703 <indexterm role="concept">
24704 <primary>message</primary>
24705 <secondary>queueing unconditionally</secondary>
24706 </indexterm>
24707 If <option>queue_only</option> is set, a delivery process is not automatically started
24708 whenever a message is received. Instead, the message waits on the queue for the
24709 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
24710 delivered immediately when certain conditions (such as heavy load) occur.
24711 </para>
24712 <para>
24713 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
24714 and <option>-odi</option> command line options override <option>queue_only</option> unless
24715 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
24716 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
24717 </para>
24718 <para>
24719 <indexterm role="option">
24720 <primary><option>queue_only_file</option></primary>
24721 </indexterm>
24722 </para>
24723 <informaltable frame="all">
24724 <tgroup cols="4" colsep="0" rowsep="0">
24725 <colspec colwidth="8*" align="left"/>
24726 <colspec colwidth="6*" align="center"/>
24727 <colspec colwidth="6*" align="center"/>
24728 <colspec colwidth="6*" align="right"/>
24729 <tbody>
24730 <row>
24731 <entry><option>queue_only_file</option></entry>
24732 <entry>Use: <emphasis>main</emphasis></entry>
24733 <entry>Type: <emphasis>string</emphasis></entry>
24734 <entry>Default: <emphasis>unset</emphasis></entry>
24735 </row>
24736 </tbody>
24737 </tgroup>
24738 </informaltable>
24739 <para>
24740 <indexterm role="concept">
24741 <primary>queueing incoming messages</primary>
24742 </indexterm>
24743 <indexterm role="concept">
24744 <primary>message</primary>
24745 <secondary>queueing by file existence</secondary>
24746 </indexterm>
24747 This option can be set to a colon-separated list of absolute path names, each
24748 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
24749 it tests for the existence of each listed path using a call to <function>stat()</function>. For
24750 each path that exists, the corresponding queueing option is set.
24751 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
24752 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
24753 </para>
24754 <literallayout class="monospaced">
24755 queue_only_file = smtp/some/file
24756 </literallayout>
24757 <para>
24758 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
24759 <filename>/some/file</filename> exists.
24760 </para>
24761 <para>
24762 <indexterm role="option">
24763 <primary><option>queue_only_load</option></primary>
24764 </indexterm>
24765 </para>
24766 <informaltable frame="all">
24767 <tgroup cols="4" colsep="0" rowsep="0">
24768 <colspec colwidth="8*" align="left"/>
24769 <colspec colwidth="6*" align="center"/>
24770 <colspec colwidth="6*" align="center"/>
24771 <colspec colwidth="6*" align="right"/>
24772 <tbody>
24773 <row>
24774 <entry><option>queue_only_load</option></entry>
24775 <entry>Use: <emphasis>main</emphasis></entry>
24776 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24777 <entry>Default: <emphasis>unset</emphasis></entry>
24778 </row>
24779 </tbody>
24780 </tgroup>
24781 </informaltable>
24782 <para>
24783 <indexterm role="concept">
24784 <primary>load average</primary>
24785 </indexterm>
24786 <indexterm role="concept">
24787 <primary>queueing incoming messages</primary>
24788 </indexterm>
24789 <indexterm role="concept">
24790 <primary>message</primary>
24791 <secondary>queueing by load</secondary>
24792 </indexterm>
24793 If the system load average is higher than this value, incoming messages from
24794 all sources are queued, and no automatic deliveries are started. If this
24795 happens during local or remote SMTP input, all subsequent messages on the same
24796 connection are queued. Deliveries will subsequently be performed by queue
24797 runner processes. This option has no effect on ancient operating systems on
24798 which Exim cannot determine the load average. See also
24799 <option>deliver_queue_load_max</option> and <option>smtp_load_reserve</option>.
24800 </para>
24801 <para>
24802 <indexterm role="option">
24803 <primary><option>queue_only_override</option></primary>
24804 </indexterm>
24805 </para>
24806 <informaltable frame="all">
24807 <tgroup cols="4" colsep="0" rowsep="0">
24808 <colspec colwidth="8*" align="left"/>
24809 <colspec colwidth="6*" align="center"/>
24810 <colspec colwidth="6*" align="center"/>
24811 <colspec colwidth="6*" align="right"/>
24812 <tbody>
24813 <row>
24814 <entry><option>queue_only_override</option></entry>
24815 <entry>Use: <emphasis>main</emphasis></entry>
24816 <entry>Type: <emphasis>boolean</emphasis></entry>
24817 <entry>Default: <emphasis>true</emphasis></entry>
24818 </row>
24819 </tbody>
24820 </tgroup>
24821 </informaltable>
24822 <para>
24823 <indexterm role="concept">
24824 <primary>queueing incoming messages</primary>
24825 </indexterm>
24826 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
24827 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
24828 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
24829 to override; they are accepted, but ignored.
24830 </para>
24831 <para>
24832 <indexterm role="option">
24833 <primary><option>queue_run_in_order</option></primary>
24834 </indexterm>
24835 </para>
24836 <informaltable frame="all">
24837 <tgroup cols="4" colsep="0" rowsep="0">
24838 <colspec colwidth="8*" align="left"/>
24839 <colspec colwidth="6*" align="center"/>
24840 <colspec colwidth="6*" align="center"/>
24841 <colspec colwidth="6*" align="right"/>
24842 <tbody>
24843 <row>
24844 <entry><option>queue_run_in_order</option></entry>
24845 <entry>Use: <emphasis>main</emphasis></entry>
24846 <entry>Type: <emphasis>boolean</emphasis></entry>
24847 <entry>Default: <emphasis>false</emphasis></entry>
24848 </row>
24849 </tbody>
24850 </tgroup>
24851 </informaltable>
24852 <para>
24853 <indexterm role="concept">
24854 <primary>queue runner</primary>
24855 <secondary>processing messages in order</secondary>
24856 </indexterm>
24857 If this option is set, queue runs happen in order of message arrival instead of
24858 in an arbitrary order. For this to happen, a complete list of the entire queue
24859 must be set up before the deliveries start. When the queue is all held in a
24860 single directory (the default), a single list is created for both the ordered
24861 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
24862 single list is not created when <option>queue_run_in_order</option> is false. In this case,
24863 the sub-directories are processed one at a time (in a random order), and this
24864 avoids setting up one huge list for the whole queue. Thus, setting
24865 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
24866 when the queue is large, because of the extra work in setting up the single,
24867 large list. In most situations, <option>queue_run_in_order</option> should not be set.
24868 </para>
24869 <para>
24870 <indexterm role="option">
24871 <primary><option>queue_run_max</option></primary>
24872 </indexterm>
24873 </para>
24874 <informaltable frame="all">
24875 <tgroup cols="4" colsep="0" rowsep="0">
24876 <colspec colwidth="8*" align="left"/>
24877 <colspec colwidth="6*" align="center"/>
24878 <colspec colwidth="6*" align="center"/>
24879 <colspec colwidth="6*" align="right"/>
24880 <tbody>
24881 <row>
24882 <entry><option>queue_run_max</option></entry>
24883 <entry>Use: <emphasis>main</emphasis></entry>
24884 <entry>Type: <emphasis>integer</emphasis></entry>
24885 <entry>Default: <emphasis>5</emphasis></entry>
24886 </row>
24887 </tbody>
24888 </tgroup>
24889 </informaltable>
24890 <para>
24891 <indexterm role="concept">
24892 <primary>queue runner</primary>
24893 <secondary>maximum number of</secondary>
24894 </indexterm>
24895 This controls the maximum number of queue runner processes that an Exim daemon
24896 can run simultaneously. This does not mean that it starts them all at once,
24897 but rather that if the maximum number are still running when the time comes to
24898 start another one, it refrains from starting another one. This can happen with
24899 very large queues and/or very sluggish deliveries. This option does not,
24900 however, interlock with other processes, so additional queue runners can be
24901 started by other means, or by killing and restarting the daemon.
24902 </para>
24903 <para>
24904 Setting this option to zero does not suppress queue runs; rather, it disables
24905 the limit, allowing any number of simultaneous queue runner processes to be
24906 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
24907 the daemon&#x2019;s command line.
24908 </para>
24909 <para>
24910 <indexterm role="option">
24911 <primary><option>queue_smtp_domains</option></primary>
24912 </indexterm>
24913 </para>
24914 <informaltable frame="all">
24915 <tgroup cols="4" colsep="0" rowsep="0">
24916 <colspec colwidth="8*" align="left"/>
24917 <colspec colwidth="6*" align="center"/>
24918 <colspec colwidth="6*" align="center"/>
24919 <colspec colwidth="6*" align="right"/>
24920 <tbody>
24921 <row>
24922 <entry><option>queue_smtp_domains</option></entry>
24923 <entry>Use: <emphasis>main</emphasis></entry>
24924 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24925 <entry>Default: <emphasis>unset</emphasis></entry>
24926 </row>
24927 </tbody>
24928 </tgroup>
24929 </informaltable>
24930 <para>
24931 <indexterm role="concept">
24932 <primary>queueing incoming messages</primary>
24933 </indexterm>
24934 <indexterm role="concept">
24935 <primary>message</primary>
24936 <secondary>queueing remote deliveries</secondary>
24937 </indexterm>
24938 When this option is set, a delivery process is started whenever a message is
24939 received, routing is performed, and local deliveries take place.
24940 However, if any SMTP deliveries are required for domains that match
24941 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
24942 message waits on the queue for the next queue run. Since routing of the message
24943 has taken place, Exim knows to which remote hosts it must be delivered, and so
24944 when the queue run happens, multiple messages for the same host are delivered
24945 over a single SMTP connection. The <option>-odqs</option> command line option causes all
24946 SMTP deliveries to be queued in this way, and is equivalent to setting
24947 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
24948 <option>queue_domains</option>.
24949 </para>
24950 <para>
24951 <indexterm role="option">
24952 <primary><option>receive_timeout</option></primary>
24953 </indexterm>
24954 </para>
24955 <informaltable frame="all">
24956 <tgroup cols="4" colsep="0" rowsep="0">
24957 <colspec colwidth="8*" align="left"/>
24958 <colspec colwidth="6*" align="center"/>
24959 <colspec colwidth="6*" align="center"/>
24960 <colspec colwidth="6*" align="right"/>
24961 <tbody>
24962 <row>
24963 <entry><option>receive_timeout</option></entry>
24964 <entry>Use: <emphasis>main</emphasis></entry>
24965 <entry>Type: <emphasis>time</emphasis></entry>
24966 <entry>Default: <emphasis>0s</emphasis></entry>
24967 </row>
24968 </tbody>
24969 </tgroup>
24970 </informaltable>
24971 <para>
24972 <indexterm role="concept">
24973 <primary>timeout</primary>
24974 <secondary>for non-SMTP input</secondary>
24975 </indexterm>
24976 This option sets the timeout for accepting a non-SMTP message, that is, the
24977 maximum time that Exim waits when reading a message on the standard input. If
24978 the value is zero, it will wait for ever. This setting is overridden by the
24979 <option>-or</option> command line option. The timeout for incoming SMTP messages is
24980 controlled by <option>smtp_receive_timeout</option>.
24981 </para>
24982 <para>
24983 <indexterm role="option">
24984 <primary><option>received_header_text</option></primary>
24985 </indexterm>
24986 </para>
24987 <informaltable frame="all">
24988 <tgroup cols="4" colsep="0" rowsep="0">
24989 <colspec colwidth="8*" align="left"/>
24990 <colspec colwidth="6*" align="center"/>
24991 <colspec colwidth="6*" align="center"/>
24992 <colspec colwidth="6*" align="right"/>
24993 <tbody>
24994 <row>
24995 <entry><option>received_header_text</option></entry>
24996 <entry>Use: <emphasis>main</emphasis></entry>
24997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24998 <entry>Default: <emphasis>see below</emphasis></entry>
24999 </row>
25000 </tbody>
25001 </tgroup>
25002 </informaltable>
25003 <para>
25004 <indexterm role="concept">
25005 <primary>customizing</primary>
25006 <secondary><emphasis>Received:</emphasis> header</secondary>
25007 </indexterm>
25008 <indexterm role="concept">
25009 <primary><emphasis>Received:</emphasis> header line</primary>
25010 <secondary>customizing</secondary>
25011 </indexterm>
25012 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
25013 added to each message, except for the timestamp, which is automatically added
25014 on at the end (preceded by a semicolon). The string is expanded each time it is
25015 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
25016 added to the message. Otherwise, the string should start with the text
25017 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
25018 header lines. The default setting is:
25019 </para>
25020 <literallayout class="monospaced">
25021 received_header_text = Received: \
25022   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
25023   {${if def:sender_ident \
25024   {from ${quote_local_part:$sender_ident} }}\
25025   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
25026   by $primary_hostname \
25027   ${if def:received_protocol {with $received_protocol}} \
25028   ${if def:tls_cipher {($tls_cipher)\n\t}}\
25029   (Exim $version_number)\n\t\
25030   ${if def:sender_address \
25031   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
25032   id $message_exim_id\
25033   ${if def:received_for {\n\tfor $received_for}}
25034 </literallayout>
25035 <para>
25036 The reference to the TLS cipher is omitted when Exim is built without TLS
25037 support. The use of conditional expansions ensures that this works for both
25038 locally generated messages and messages received from remote hosts, giving
25039 header lines such as the following:
25040 </para>
25041 <literallayout class="monospaced">
25042 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
25043 by marley.carol.example with esmtp (Exim 4.00)
25044 (envelope-from &lt;bob@carol.example&gt;)
25045 id 16IOWa-00019l-00
25046 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
25047 Received: by scrooge.carol.example with local (Exim 4.00)
25048 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
25049 </literallayout>
25050 <para>
25051 Until the body of the message has been received, the timestamp is the time when
25052 the message started to be received. Once the body has arrived, and all policy
25053 checks have taken place, the timestamp is updated to the time at which the
25054 message was accepted.
25055 </para>
25056 <para>
25057 <indexterm role="option">
25058 <primary><option>received_headers_max</option></primary>
25059 </indexterm>
25060 </para>
25061 <informaltable frame="all">
25062 <tgroup cols="4" colsep="0" rowsep="0">
25063 <colspec colwidth="8*" align="left"/>
25064 <colspec colwidth="6*" align="center"/>
25065 <colspec colwidth="6*" align="center"/>
25066 <colspec colwidth="6*" align="right"/>
25067 <tbody>
25068 <row>
25069 <entry><option>received_headers_max</option></entry>
25070 <entry>Use: <emphasis>main</emphasis></entry>
25071 <entry>Type: <emphasis>integer</emphasis></entry>
25072 <entry>Default: <emphasis>30</emphasis></entry>
25073 </row>
25074 </tbody>
25075 </tgroup>
25076 </informaltable>
25077 <para>
25078 <indexterm role="concept">
25079 <primary>loop</primary>
25080 <secondary>prevention</secondary>
25081 </indexterm>
25082 <indexterm role="concept">
25083 <primary>mail loop prevention</primary>
25084 </indexterm>
25085 <indexterm role="concept">
25086 <primary><emphasis>Received:</emphasis> header line</primary>
25087 <secondary>counting</secondary>
25088 </indexterm>
25089 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
25090 counted, and if it is greater than this parameter, a mail loop is assumed to
25091 have occurred, the delivery is abandoned, and an error message is generated.
25092 This applies to both local and remote deliveries.
25093 </para>
25094 <para>
25095 <indexterm role="option">
25096 <primary><option>recipient_unqualified_hosts</option></primary>
25097 </indexterm>
25098 </para>
25099 <informaltable frame="all">
25100 <tgroup cols="4" colsep="0" rowsep="0">
25101 <colspec colwidth="8*" align="left"/>
25102 <colspec colwidth="6*" align="center"/>
25103 <colspec colwidth="6*" align="center"/>
25104 <colspec colwidth="6*" align="right"/>
25105 <tbody>
25106 <row>
25107 <entry><option>recipient_unqualified_hosts</option></entry>
25108 <entry>Use: <emphasis>main</emphasis></entry>
25109 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25110 <entry>Default: <emphasis>unset</emphasis></entry>
25111 </row>
25112 </tbody>
25113 </tgroup>
25114 </informaltable>
25115 <para>
25116 <indexterm role="concept">
25117 <primary>unqualified addresses</primary>
25118 </indexterm>
25119 <indexterm role="concept">
25120 <primary>host</primary>
25121 <secondary>unqualified addresses from</secondary>
25122 </indexterm>
25123 This option lists those hosts from which Exim is prepared to accept unqualified
25124 recipient addresses in message envelopes. The addresses are made fully
25125 qualified by the addition of the <option>qualify_recipient</option> value. This option also
25126 affects message header lines. Exim does not reject unqualified recipient
25127 addresses in headers, but it qualifies them only if the message came from a
25128 host that matches <option>recipient_unqualified_hosts</option>,
25129 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
25130 option was not set.
25131 </para>
25132 <para>
25133 <indexterm role="option">
25134 <primary><option>recipients_max</option></primary>
25135 </indexterm>
25136 </para>
25137 <informaltable frame="all">
25138 <tgroup cols="4" colsep="0" rowsep="0">
25139 <colspec colwidth="8*" align="left"/>
25140 <colspec colwidth="6*" align="center"/>
25141 <colspec colwidth="6*" align="center"/>
25142 <colspec colwidth="6*" align="right"/>
25143 <tbody>
25144 <row>
25145 <entry><option>recipients_max</option></entry>
25146 <entry>Use: <emphasis>main</emphasis></entry>
25147 <entry>Type: <emphasis>integer</emphasis></entry>
25148 <entry>Default: <emphasis>0</emphasis></entry>
25149 </row>
25150 </tbody>
25151 </tgroup>
25152 </informaltable>
25153 <para>
25154 <indexterm role="concept">
25155 <primary>limit</primary>
25156 <secondary>number of recipients</secondary>
25157 </indexterm>
25158 <indexterm role="concept">
25159 <primary>recipient</primary>
25160 <secondary>maximum number</secondary>
25161 </indexterm>
25162 If this option is set greater than zero, it specifies the maximum number of
25163 original recipients for any message. Additional recipients that are generated
25164 by aliasing or forwarding do not count. SMTP messages get a 452 response for
25165 all recipients over the limit; earlier recipients are delivered as normal.
25166 Non-SMTP messages with too many recipients are failed, and no deliveries are
25167 done.
25168 </para>
25169 <para>
25170 <indexterm role="concept">
25171 <primary>RCPT</primary>
25172 <secondary>maximum number of incoming</secondary>
25173 </indexterm>
25174 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
25175 RCPT commands in a single message.
25176 </para>
25177 <para>
25178 <indexterm role="option">
25179 <primary><option>recipients_max_reject</option></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="6*" align="center"/>
25186 <colspec colwidth="6*" align="center"/>
25187 <colspec colwidth="6*" align="right"/>
25188 <tbody>
25189 <row>
25190 <entry><option>recipients_max_reject</option></entry>
25191 <entry>Use: <emphasis>main</emphasis></entry>
25192 <entry>Type: <emphasis>boolean</emphasis></entry>
25193 <entry>Default: <emphasis>false</emphasis></entry>
25194 </row>
25195 </tbody>
25196 </tgroup>
25197 </informaltable>
25198 <para>
25199 If this option is set true, Exim rejects SMTP messages containing too many
25200 recipients by giving 552 errors to the surplus RCPT commands, and a 554
25201 error to the eventual DATA command. Otherwise (the default) it gives a 452
25202 error to the surplus RCPT commands and accepts the message on behalf of the
25203 initial set of recipients. The remote server should then re-send the message
25204 for the remaining recipients at a later time.
25205 </para>
25206 <para>
25207 <indexterm role="option">
25208 <primary><option>remote_max_parallel</option></primary>
25209 </indexterm>
25210 </para>
25211 <informaltable frame="all">
25212 <tgroup cols="4" colsep="0" rowsep="0">
25213 <colspec colwidth="8*" align="left"/>
25214 <colspec colwidth="6*" align="center"/>
25215 <colspec colwidth="6*" align="center"/>
25216 <colspec colwidth="6*" align="right"/>
25217 <tbody>
25218 <row>
25219 <entry><option>remote_max_parallel</option></entry>
25220 <entry>Use: <emphasis>main</emphasis></entry>
25221 <entry>Type: <emphasis>integer</emphasis></entry>
25222 <entry>Default: <emphasis>2</emphasis></entry>
25223 </row>
25224 </tbody>
25225 </tgroup>
25226 </informaltable>
25227 <para>
25228 <indexterm role="concept">
25229 <primary>delivery</primary>
25230 <secondary>parallelism for remote</secondary>
25231 </indexterm>
25232 This option controls parallel delivery of one message to a number of remote
25233 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
25234 does all the remote deliveries for a message one by one. Otherwise, if a single
25235 message has to be delivered to more than one remote host, or if several copies
25236 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
25237 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
25238 deliveries are required, the maximum number of processes are started, and as
25239 each one finishes, another is begun. The order of starting processes is the
25240 same as if sequential delivery were being done, and can be controlled by the
25241 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
25242 with debugging turned on, the debugging output from each delivery process is
25243 tagged with its process id.
25244 </para>
25245 <para>
25246 This option controls only the maximum number of parallel deliveries for one
25247 message in one Exim delivery process. Because Exim has no central queue
25248 manager, there is no way of controlling the total number of simultaneous
25249 deliveries if the configuration allows a delivery attempt as soon as a message
25250 is received.
25251 </para>
25252 <para>
25253 <indexterm role="concept">
25254 <primary>number of deliveries</primary>
25255 </indexterm>
25256 <indexterm role="concept">
25257 <primary>delivery</primary>
25258 <secondary>maximum number of</secondary>
25259 </indexterm>
25260 If you want to control the total number of deliveries on the system, you
25261 need to set the <option>queue_only</option> option. This ensures that all incoming messages
25262 are added to the queue without starting a delivery process. Then set up an Exim
25263 daemon to start queue runner processes at appropriate intervals (probably
25264 fairly often, for example, every minute), and limit the total number of queue
25265 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
25266 delivers only one message at a time, the maximum number of deliveries that can
25267 then take place at once is <option>queue_run_max</option> multiplied by
25268 <option>remote_max_parallel</option>.
25269 </para>
25270 <para>
25271 If it is purely remote deliveries you want to control, use
25272 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
25273 doing the SMTP routing before queueing, so that several messages for the same
25274 host will eventually get delivered down the same connection.
25275 </para>
25276 <para>
25277 <indexterm role="option">
25278 <primary><option>remote_sort_domains</option></primary>
25279 </indexterm>
25280 </para>
25281 <informaltable frame="all">
25282 <tgroup cols="4" colsep="0" rowsep="0">
25283 <colspec colwidth="8*" align="left"/>
25284 <colspec colwidth="6*" align="center"/>
25285 <colspec colwidth="6*" align="center"/>
25286 <colspec colwidth="6*" align="right"/>
25287 <tbody>
25288 <row>
25289 <entry><option>remote_sort_domains</option></entry>
25290 <entry>Use: <emphasis>main</emphasis></entry>
25291 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25292 <entry>Default: <emphasis>unset</emphasis></entry>
25293 </row>
25294 </tbody>
25295 </tgroup>
25296 </informaltable>
25297 <para>
25298 <indexterm role="concept">
25299 <primary>sorting remote deliveries</primary>
25300 </indexterm>
25301 <indexterm role="concept">
25302 <primary>delivery</primary>
25303 <secondary>sorting remote</secondary>
25304 </indexterm>
25305 When there are a number of remote deliveries for a message, they are sorted by
25306 domain into the order given by this list. For example,
25307 </para>
25308 <literallayout class="monospaced">
25309 remote_sort_domains = *.cam.ac.uk:*.uk
25310 </literallayout>
25311 <para>
25312 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
25313 then to those in the <option>uk</option> domain, then to any others.
25314 </para>
25315 <para>
25316 <indexterm role="option">
25317 <primary><option>retry_data_expire</option></primary>
25318 </indexterm>
25319 </para>
25320 <informaltable frame="all">
25321 <tgroup cols="4" colsep="0" rowsep="0">
25322 <colspec colwidth="8*" align="left"/>
25323 <colspec colwidth="6*" align="center"/>
25324 <colspec colwidth="6*" align="center"/>
25325 <colspec colwidth="6*" align="right"/>
25326 <tbody>
25327 <row>
25328 <entry><option>retry_data_expire</option></entry>
25329 <entry>Use: <emphasis>main</emphasis></entry>
25330 <entry>Type: <emphasis>time</emphasis></entry>
25331 <entry>Default: <emphasis>7d</emphasis></entry>
25332 </row>
25333 </tbody>
25334 </tgroup>
25335 </informaltable>
25336 <para>
25337 <indexterm role="concept">
25338 <primary>hints database</primary>
25339 <secondary>data expiry</secondary>
25340 </indexterm>
25341 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
25342 database. Any older retry data is ignored. This means that, for example, once a
25343 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
25344 past failures.
25345 </para>
25346 <para>
25347 <indexterm role="option">
25348 <primary><option>retry_interval_max</option></primary>
25349 </indexterm>
25350 </para>
25351 <informaltable frame="all">
25352 <tgroup cols="4" colsep="0" rowsep="0">
25353 <colspec colwidth="8*" align="left"/>
25354 <colspec colwidth="6*" align="center"/>
25355 <colspec colwidth="6*" align="center"/>
25356 <colspec colwidth="6*" align="right"/>
25357 <tbody>
25358 <row>
25359 <entry><option>retry_interval_max</option></entry>
25360 <entry>Use: <emphasis>main</emphasis></entry>
25361 <entry>Type: <emphasis>time</emphasis></entry>
25362 <entry>Default: <emphasis>24h</emphasis></entry>
25363 </row>
25364 </tbody>
25365 </tgroup>
25366 </informaltable>
25367 <para>
25368 <indexterm role="concept">
25369 <primary>retry</primary>
25370 <secondary>limit on interval</secondary>
25371 </indexterm>
25372 <indexterm role="concept">
25373 <primary>limit</primary>
25374 <secondary>on retry interval</secondary>
25375 </indexterm>
25376 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
25377 intervals between delivery attempts for messages that cannot be delivered
25378 straight away. This option sets an overall limit to the length of time between
25379 retries. It cannot be set greater than 24 hours; any attempt to do so forces
25380 the default value.
25381 </para>
25382 <para>
25383 <indexterm role="option">
25384 <primary><option>return_path_remove</option></primary>
25385 </indexterm>
25386 </para>
25387 <informaltable frame="all">
25388 <tgroup cols="4" colsep="0" rowsep="0">
25389 <colspec colwidth="8*" align="left"/>
25390 <colspec colwidth="6*" align="center"/>
25391 <colspec colwidth="6*" align="center"/>
25392 <colspec colwidth="6*" align="right"/>
25393 <tbody>
25394 <row>
25395 <entry><option>return_path_remove</option></entry>
25396 <entry>Use: <emphasis>main</emphasis></entry>
25397 <entry>Type: <emphasis>boolean</emphasis></entry>
25398 <entry>Default: <emphasis>true</emphasis></entry>
25399 </row>
25400 </tbody>
25401 </tgroup>
25402 </informaltable>
25403 <para>
25404 <indexterm role="concept">
25405 <primary><emphasis>Return-path:</emphasis> header line</primary>
25406 <secondary>removing</secondary>
25407 </indexterm>
25408 RFC 2821, section 4.4, states that an SMTP server must insert a
25409 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
25410 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
25411 MAIL command. This description implies that this header should not be present
25412 in an incoming message. If <option>return_path_remove</option> is true, any existing
25413 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
25414 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
25415 the time of delivery. They are normally used only for final local deliveries.
25416 </para>
25417 <para>
25418 <indexterm role="option">
25419 <primary><option>return_size_limit</option></primary>
25420 </indexterm>
25421 </para>
25422 <informaltable frame="all">
25423 <tgroup cols="4" colsep="0" rowsep="0">
25424 <colspec colwidth="8*" align="left"/>
25425 <colspec colwidth="6*" align="center"/>
25426 <colspec colwidth="6*" align="center"/>
25427 <colspec colwidth="6*" align="right"/>
25428 <tbody>
25429 <row>
25430 <entry><option>return_size_limit</option></entry>
25431 <entry>Use: <emphasis>main</emphasis></entry>
25432 <entry>Type: <emphasis>integer</emphasis></entry>
25433 <entry>Default: <emphasis>100K</emphasis></entry>
25434 </row>
25435 </tbody>
25436 </tgroup>
25437 </informaltable>
25438 <para>
25439 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
25440 </para>
25441 <para>
25442 <indexterm role="option">
25443 <primary><option>rfc1413_hosts</option></primary>
25444 </indexterm>
25445 </para>
25446 <informaltable frame="all">
25447 <tgroup cols="4" colsep="0" rowsep="0">
25448 <colspec colwidth="8*" align="left"/>
25449 <colspec colwidth="6*" align="center"/>
25450 <colspec colwidth="6*" align="center"/>
25451 <colspec colwidth="6*" align="right"/>
25452 <tbody>
25453 <row>
25454 <entry><option>rfc1413_hosts</option></entry>
25455 <entry>Use: <emphasis>main</emphasis></entry>
25456 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25457 <entry>Default: <emphasis>*</emphasis></entry>
25458 </row>
25459 </tbody>
25460 </tgroup>
25461 </informaltable>
25462 <para>
25463 <indexterm role="concept">
25464 <primary>RFC 1413</primary>
25465 </indexterm>
25466 <indexterm role="concept">
25467 <primary>host</primary>
25468 <secondary>for RFC 1413 calls</secondary>
25469 </indexterm>
25470 RFC 1413 identification calls are made to any client host which matches an item
25471 in the list.
25472 </para>
25473 <para>
25474 <indexterm role="option">
25475 <primary><option>rfc1413_query_timeout</option></primary>
25476 </indexterm>
25477 </para>
25478 <informaltable frame="all">
25479 <tgroup cols="4" colsep="0" rowsep="0">
25480 <colspec colwidth="8*" align="left"/>
25481 <colspec colwidth="6*" align="center"/>
25482 <colspec colwidth="6*" align="center"/>
25483 <colspec colwidth="6*" align="right"/>
25484 <tbody>
25485 <row>
25486 <entry><option>rfc1413_query_timeout</option></entry>
25487 <entry>Use: <emphasis>main</emphasis></entry>
25488 <entry>Type: <emphasis>time</emphasis></entry>
25489 <entry>Default: <emphasis>5s</emphasis></entry>
25490 </row>
25491 </tbody>
25492 </tgroup>
25493 </informaltable>
25494 <para>
25495 <indexterm role="concept">
25496 <primary>RFC 1413</primary>
25497 <secondary>query timeout</secondary>
25498 </indexterm>
25499 <indexterm role="concept">
25500 <primary>timeout</primary>
25501 <secondary>for RFC 1413 call</secondary>
25502 </indexterm>
25503 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
25504 no RFC 1413 calls are ever made.
25505 </para>
25506 <para>
25507 <indexterm role="option">
25508 <primary><option>sender_unqualified_hosts</option></primary>
25509 </indexterm>
25510 </para>
25511 <informaltable frame="all">
25512 <tgroup cols="4" colsep="0" rowsep="0">
25513 <colspec colwidth="8*" align="left"/>
25514 <colspec colwidth="6*" align="center"/>
25515 <colspec colwidth="6*" align="center"/>
25516 <colspec colwidth="6*" align="right"/>
25517 <tbody>
25518 <row>
25519 <entry><option>sender_unqualified_hosts</option></entry>
25520 <entry>Use: <emphasis>main</emphasis></entry>
25521 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25522 <entry>Default: <emphasis>unset</emphasis></entry>
25523 </row>
25524 </tbody>
25525 </tgroup>
25526 </informaltable>
25527 <para>
25528 <indexterm role="concept">
25529 <primary>unqualified addresses</primary>
25530 </indexterm>
25531 <indexterm role="concept">
25532 <primary>host</primary>
25533 <secondary>unqualified addresses from</secondary>
25534 </indexterm>
25535 This option lists those hosts from which Exim is prepared to accept unqualified
25536 sender addresses. The addresses are made fully qualified by the addition of
25537 <option>qualify_domain</option>. This option also affects message header lines. Exim does
25538 not reject unqualified addresses in headers that contain sender addresses, but
25539 it qualifies them only if the message came from a host that matches
25540 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
25541 using TCP/IP), and the <option>-bnq</option> option was not set.
25542 </para>
25543 <para>
25544 <indexterm role="option">
25545 <primary><option>smtp_accept_keepalive</option></primary>
25546 </indexterm>
25547 </para>
25548 <informaltable frame="all">
25549 <tgroup cols="4" colsep="0" rowsep="0">
25550 <colspec colwidth="8*" align="left"/>
25551 <colspec colwidth="6*" align="center"/>
25552 <colspec colwidth="6*" align="center"/>
25553 <colspec colwidth="6*" align="right"/>
25554 <tbody>
25555 <row>
25556 <entry><option>smtp_accept_keepalive</option></entry>
25557 <entry>Use: <emphasis>main</emphasis></entry>
25558 <entry>Type: <emphasis>boolean</emphasis></entry>
25559 <entry>Default: <emphasis>true</emphasis></entry>
25560 </row>
25561 </tbody>
25562 </tgroup>
25563 </informaltable>
25564 <para>
25565 <indexterm role="concept">
25566 <primary>keepalive</primary>
25567 <secondary>on incoming connection</secondary>
25568 </indexterm>
25569 This option controls the setting of the SO_KEEPALIVE option on incoming
25570 TCP/IP socket connections. When set, it causes the kernel to probe idle
25571 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
25572 other end of the connection should send an acknowledgment if the connection is
25573 still okay or a reset if the connection has been aborted. The reason for doing
25574 this is that it has the beneficial effect of freeing up certain types of
25575 connection that can get stuck when the remote host is disconnected without
25576 tidying up the TCP/IP call properly. The keepalive mechanism takes several
25577 hours to detect unreachable hosts.
25578 </para>
25579 <para>
25580 <indexterm role="option">
25581 <primary><option>smtp_accept_max</option></primary>
25582 </indexterm>
25583 </para>
25584 <informaltable frame="all">
25585 <tgroup cols="4" colsep="0" rowsep="0">
25586 <colspec colwidth="8*" align="left"/>
25587 <colspec colwidth="6*" align="center"/>
25588 <colspec colwidth="6*" align="center"/>
25589 <colspec colwidth="6*" align="right"/>
25590 <tbody>
25591 <row>
25592 <entry><option>smtp_accept_max</option></entry>
25593 <entry>Use: <emphasis>main</emphasis></entry>
25594 <entry>Type: <emphasis>integer</emphasis></entry>
25595 <entry>Default: <emphasis>20</emphasis></entry>
25596 </row>
25597 </tbody>
25598 </tgroup>
25599 </informaltable>
25600 <para>
25601 <indexterm role="concept">
25602 <primary>limit</primary>
25603 <secondary>incoming SMTP connections</secondary>
25604 </indexterm>
25605 <indexterm role="concept">
25606 <primary>SMTP</primary>
25607 <secondary>incoming connection count</secondary>
25608 </indexterm>
25609 <indexterm role="concept">
25610 <primary>inetd</primary>
25611 </indexterm>
25612 This option specifies the maximum number of simultaneous incoming SMTP calls
25613 that Exim will accept. It applies only to the listening daemon; there is no
25614 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
25615 value is set to zero, no limit is applied. However, it is required to be
25616 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
25617 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
25618 </para>
25619 <para revisionflag="changed">
25620 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
25621 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
25622 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
25623 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
25624 </para>
25625 <para>
25626 <indexterm role="option">
25627 <primary><option>smtp_accept_max_nonmail</option></primary>
25628 </indexterm>
25629 </para>
25630 <informaltable frame="all">
25631 <tgroup cols="4" colsep="0" rowsep="0">
25632 <colspec colwidth="8*" align="left"/>
25633 <colspec colwidth="6*" align="center"/>
25634 <colspec colwidth="6*" align="center"/>
25635 <colspec colwidth="6*" align="right"/>
25636 <tbody>
25637 <row>
25638 <entry><option>smtp_accept_max_nonmail</option></entry>
25639 <entry>Use: <emphasis>main</emphasis></entry>
25640 <entry>Type: <emphasis>integer</emphasis></entry>
25641 <entry>Default: <emphasis>10</emphasis></entry>
25642 </row>
25643 </tbody>
25644 </tgroup>
25645 </informaltable>
25646 <para>
25647 <indexterm role="concept">
25648 <primary>limit</primary>
25649 <secondary>non-mail SMTP commands</secondary>
25650 </indexterm>
25651 <indexterm role="concept">
25652 <primary>SMTP</primary>
25653 <secondary>limiting non-mail commands</secondary>
25654 </indexterm>
25655 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
25656 the connection if there are too many. This option defines <quote>too many</quote>. The
25657 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
25658 client looping sending EHLO, for example. The check is applied only if the
25659 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
25660 </para>
25661 <para>
25662 When a new message is expected, one occurrence of RSET is not counted. This
25663 allows a client to send one RSET between messages (this is not necessary,
25664 but some clients do it). Exim also allows one uncounted occurrence of HELO
25665 or EHLO, and one occurrence of STARTTLS between messages. After
25666 starting up a TLS session, another EHLO is expected, and so it too is not
25667 counted. The first occurrence of AUTH in a connection, or immediately
25668 following STARTTLS is not counted. Otherwise, all commands other than
25669 MAIL, RCPT, DATA, and QUIT are counted.
25670 </para>
25671 <para>
25672 <indexterm role="option">
25673 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
25674 </indexterm>
25675 </para>
25676 <informaltable frame="all">
25677 <tgroup cols="4" colsep="0" rowsep="0">
25678 <colspec colwidth="8*" align="left"/>
25679 <colspec colwidth="6*" align="center"/>
25680 <colspec colwidth="6*" align="center"/>
25681 <colspec colwidth="6*" align="right"/>
25682 <tbody>
25683 <row>
25684 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
25685 <entry>Use: <emphasis>main</emphasis></entry>
25686 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25687 <entry>Default: <emphasis>*</emphasis></entry>
25688 </row>
25689 </tbody>
25690 </tgroup>
25691 </informaltable>
25692 <para>
25693 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
25694 check by setting this option. The default value makes it apply to all hosts. By
25695 changing the value, you can exclude any badly-behaved hosts that you have to
25696 live with.
25697 </para>
25698 <para>
25699 <indexterm role="option">
25700 <primary><option>smtp_accept_max_per_connection</option></primary>
25701 </indexterm>
25702 </para>
25703 <informaltable frame="all">
25704 <tgroup cols="4" colsep="0" rowsep="0">
25705 <colspec colwidth="8*" align="left"/>
25706 <colspec colwidth="6*" align="center"/>
25707 <colspec colwidth="6*" align="center"/>
25708 <colspec colwidth="6*" align="right"/>
25709 <tbody>
25710 <row>
25711 <entry><option>smtp_accept_max_per_ &nbsp;&nbsp;connection</option></entry>
25712 <entry>Use: <emphasis>main</emphasis></entry>
25713 <entry>Type: <emphasis>integer</emphasis></entry>
25714 <entry>Default: <emphasis>1000</emphasis></entry>
25715 </row>
25716 </tbody>
25717 </tgroup>
25718 </informaltable>
25719 <para>
25720 <indexterm role="concept">
25721 <primary>SMTP</primary>
25722 <secondary>limiting incoming message count</secondary>
25723 </indexterm>
25724 <indexterm role="concept">
25725 <primary>limit</primary>
25726 <secondary>messages per SMTP connection</secondary>
25727 </indexterm>
25728 The value of this option limits the number of MAIL commands that Exim is
25729 prepared to accept over a single SMTP connection, whether or not each command
25730 results in the transfer of a message. After the limit is reached, a 421
25731 response is given to subsequent MAIL commands. This limit is a safety
25732 precaution against a client that goes mad (incidents of this type have been
25733 seen).
25734 </para>
25735 <para>
25736 <indexterm role="option">
25737 <primary><option>smtp_accept_max_per_host</option></primary>
25738 </indexterm>
25739 </para>
25740 <informaltable frame="all">
25741 <tgroup cols="4" colsep="0" rowsep="0">
25742 <colspec colwidth="8*" align="left"/>
25743 <colspec colwidth="6*" align="center"/>
25744 <colspec colwidth="6*" align="center"/>
25745 <colspec colwidth="6*" align="right"/>
25746 <tbody>
25747 <row>
25748 <entry><option>smtp_accept_max_per_host</option></entry>
25749 <entry>Use: <emphasis>main</emphasis></entry>
25750 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25751 <entry>Default: <emphasis>unset</emphasis></entry>
25752 </row>
25753 </tbody>
25754 </tgroup>
25755 </informaltable>
25756 <para>
25757 <indexterm role="concept">
25758 <primary>limit</primary>
25759 <secondary>SMTP connections from one host</secondary>
25760 </indexterm>
25761 <indexterm role="concept">
25762 <primary>host</primary>
25763 <secondary>limiting SMTP connections from</secondary>
25764 </indexterm>
25765 </para>
25766 <para revisionflag="changed">
25767 This option restricts the number of simultaneous IP connections from a single
25768 host (strictly, from a single IP address) to the Exim daemon. The option is
25769 expanded, to enable different limits to be applied to different hosts by
25770 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
25771 connection attempts from the same host are rejected with error code 421. This
25772 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
25773 of zero imposes no limit. If this option is set greater than zero, it is
25774 required that <option>smtp_accept_max</option> be non-zero.
25775 </para>
25776 <para>
25777 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
25778 constructions that take an appreciable amount of time. The expansion and test
25779 happen in the main daemon loop, in order to reject additional connections
25780 without forking additional processes (otherwise a denial-of-service attack
25781 could cause a vast number or processes to be created). While the daemon is
25782 doing this processing, it cannot accept any other incoming connections.
25783 </para>
25784 <para>
25785 <indexterm role="option">
25786 <primary><option>smtp_accept_queue</option></primary>
25787 </indexterm>
25788 </para>
25789 <informaltable frame="all">
25790 <tgroup cols="4" colsep="0" rowsep="0">
25791 <colspec colwidth="8*" align="left"/>
25792 <colspec colwidth="6*" align="center"/>
25793 <colspec colwidth="6*" align="center"/>
25794 <colspec colwidth="6*" align="right"/>
25795 <tbody>
25796 <row>
25797 <entry><option>smtp_accept_queue</option></entry>
25798 <entry>Use: <emphasis>main</emphasis></entry>
25799 <entry>Type: <emphasis>integer</emphasis></entry>
25800 <entry>Default: <emphasis>0</emphasis></entry>
25801 </row>
25802 </tbody>
25803 </tgroup>
25804 </informaltable>
25805 <para>
25806 <indexterm role="concept">
25807 <primary>SMTP</primary>
25808 <secondary>incoming connection count</secondary>
25809 </indexterm>
25810 <indexterm role="concept">
25811 <primary>queueing incoming messages</primary>
25812 </indexterm>
25813 <indexterm role="concept">
25814 <primary>message</primary>
25815 <secondary>queueing by SMTP connection count</secondary>
25816 </indexterm>
25817 If the number of simultaneous incoming SMTP calls handled via the listening
25818 daemon exceeds this value, messages received by SMTP are just placed on the
25819 queue; no delivery processes are started automatically. A value of zero implies
25820 no limit, and clearly any non-zero value is useful only if it is less than the
25821 <option>smtp_accept_max</option> value (unless that is zero). See also <option>queue_only</option>,
25822 <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the various <option>-od</option><emphasis>x</emphasis>
25823 command line options.
25824 </para>
25825 <para>
25826 <indexterm role="option">
25827 <primary><option>smtp_accept_queue_per_connection</option></primary>
25828 </indexterm>
25829 </para>
25830 <informaltable frame="all">
25831 <tgroup cols="4" colsep="0" rowsep="0">
25832 <colspec colwidth="8*" align="left"/>
25833 <colspec colwidth="6*" align="center"/>
25834 <colspec colwidth="6*" align="center"/>
25835 <colspec colwidth="6*" align="right"/>
25836 <tbody>
25837 <row>
25838 <entry><option>smtp_accept_queue_per_ &nbsp;&nbsp;connection</option></entry>
25839 <entry>Use: <emphasis>main</emphasis></entry>
25840 <entry>Type: <emphasis>integer</emphasis></entry>
25841 <entry>Default: <emphasis>10</emphasis></entry>
25842 </row>
25843 </tbody>
25844 </tgroup>
25845 </informaltable>
25846 <para>
25847 <indexterm role="concept">
25848 <primary>queueing incoming messages</primary>
25849 </indexterm>
25850 <indexterm role="concept">
25851 <primary>message</primary>
25852 <secondary>queueing by message count</secondary>
25853 </indexterm>
25854 This option limits the number of delivery processes that Exim starts
25855 automatically when receiving messages via SMTP, whether via the daemon or by
25856 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
25857 and the number of messages received in a single SMTP session exceeds this
25858 number, subsequent messages are placed on the queue, but no delivery processes
25859 are started. This helps to limit the number of Exim processes when a server
25860 restarts after downtime and there is a lot of mail waiting for it on other
25861 systems. On large systems, the default should probably be increased, and on
25862 dial-in client systems it should probably be set to zero (that is, disabled).
25863 </para>
25864 <para>
25865 <indexterm role="option">
25866 <primary><option>smtp_accept_reserve</option></primary>
25867 </indexterm>
25868 </para>
25869 <informaltable frame="all">
25870 <tgroup cols="4" colsep="0" rowsep="0">
25871 <colspec colwidth="8*" align="left"/>
25872 <colspec colwidth="6*" align="center"/>
25873 <colspec colwidth="6*" align="center"/>
25874 <colspec colwidth="6*" align="right"/>
25875 <tbody>
25876 <row>
25877 <entry><option>smtp_accept_reserve</option></entry>
25878 <entry>Use: <emphasis>main</emphasis></entry>
25879 <entry>Type: <emphasis>integer</emphasis></entry>
25880 <entry>Default: <emphasis>0</emphasis></entry>
25881 </row>
25882 </tbody>
25883 </tgroup>
25884 </informaltable>
25885 <para>
25886 <indexterm role="concept">
25887 <primary>SMTP</primary>
25888 <secondary>incoming call count</secondary>
25889 </indexterm>
25890 <indexterm role="concept">
25891 <primary>host</primary>
25892 <secondary>reserved</secondary>
25893 </indexterm>
25894 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
25895 number of SMTP connections that are reserved for connections from the hosts
25896 that are specified in <option>smtp_reserve_hosts</option>. The value set in
25897 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
25898 restricted to this number of connections; the option specifies a minimum number
25899 of connection slots for them, not a maximum. It is a guarantee that this group
25900 of hosts can always get at least <option>smtp_accept_reserve</option> connections.
25901 <phrase revisionflag="changed">However, the limit specified by <option>smtp_accept_max_per_host</option> is still
25902 applied to each individual host.</phrase>
25903 </para>
25904 <para>
25905 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
25906 set to 5, once there are 45 active connections (from any hosts), new
25907 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
25908 <phrase revisionflag="changed">provided the other criteria for acceptance are met.</phrase>
25909 </para>
25910 <para>
25911 <indexterm role="option">
25912 <primary><option>smtp_active_hostname</option></primary>
25913 </indexterm>
25914 </para>
25915 <informaltable frame="all">
25916 <tgroup cols="4" colsep="0" rowsep="0">
25917 <colspec colwidth="8*" align="left"/>
25918 <colspec colwidth="6*" align="center"/>
25919 <colspec colwidth="6*" align="center"/>
25920 <colspec colwidth="6*" align="right"/>
25921 <tbody>
25922 <row>
25923 <entry><option>smtp_active_hostname</option></entry>
25924 <entry>Use: <emphasis>main</emphasis></entry>
25925 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25926 <entry>Default: <emphasis>unset</emphasis></entry>
25927 </row>
25928 </tbody>
25929 </tgroup>
25930 </informaltable>
25931 <para>
25932 <indexterm role="concept">
25933 <primary>host</primary>
25934 <secondary>name in SMTP responses</secondary>
25935 </indexterm>
25936 <indexterm role="concept">
25937 <primary>SMTP</primary>
25938 <secondary>host name in responses</secondary>
25939 </indexterm>
25940 <indexterm role="variable">
25941 <primary><varname>$primary_hostname</varname></primary>
25942 </indexterm>
25943 This option is provided for multi-homed servers that want to masquerade as
25944 several different hosts. At the start of an incoming SMTP connection, its value
25945 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
25946 responses. For example, it is used as domain name in the response to an
25947 incoming HELO or EHLO command.
25948 </para>
25949 <para>
25950 <indexterm role="variable">
25951 <primary><varname>$smtp_active_hostname</varname></primary>
25952 </indexterm>
25953 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
25954 is saved with any messages that are received. It is therefore available for use
25955 in routers and transports when the message is later delivered.
25956 </para>
25957 <para>
25958 If this option is unset, or if its expansion is forced to fail, or if the
25959 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
25960 used. Other expansion failures cause a message to be written to the main and
25961 panic logs, and the SMTP command receives a temporary error. Typically, the
25962 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
25963 For example:
25964 </para>
25965 <literallayout class="monospaced">
25966 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
25967   {cox.mydomain}{box.mydomain}}
25968 </literallayout>
25969 <para>
25970 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
25971 messages, it is also used as the default for HELO commands in callout
25972 verification if there is no remote transport from which to obtain a
25973 <option>helo_data</option> value.
25974 </para>
25975 <para>
25976 <indexterm role="option">
25977 <primary><option>smtp_banner</option></primary>
25978 </indexterm>
25979 </para>
25980 <informaltable frame="all">
25981 <tgroup cols="4" colsep="0" rowsep="0">
25982 <colspec colwidth="8*" align="left"/>
25983 <colspec colwidth="6*" align="center"/>
25984 <colspec colwidth="6*" align="center"/>
25985 <colspec colwidth="6*" align="right"/>
25986 <tbody>
25987 <row>
25988 <entry><option>smtp_banner</option></entry>
25989 <entry>Use: <emphasis>main</emphasis></entry>
25990 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25991 <entry>Default: <emphasis>see below</emphasis></entry>
25992 </row>
25993 </tbody>
25994 </tgroup>
25995 </informaltable>
25996 <para>
25997 <indexterm role="concept">
25998 <primary>SMTP</primary>
25999 <secondary>welcome banner</secondary>
26000 </indexterm>
26001 <indexterm role="concept">
26002 <primary>banner for SMTP</primary>
26003 </indexterm>
26004 <indexterm role="concept">
26005 <primary>welcome banner for SMTP</primary>
26006 </indexterm>
26007 <indexterm role="concept">
26008 <primary>customizing</primary>
26009 <secondary>SMTP banner</secondary>
26010 </indexterm>
26011 This string, which is expanded every time it is used, is output as the initial
26012 positive response to an SMTP connection. The default setting is:
26013 </para>
26014 <literallayout class="monospaced">
26015 smtp_banner = $smtp_active_hostname ESMTP Exim \
26016   $version_number $tod_full
26017 </literallayout>
26018 <para>
26019 Failure to expand the string causes a panic error. If you want to create a
26020 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
26021 appropriate points, but not at the end. Note that the 220 code is not included
26022 in this string. Exim adds it automatically (several times in the case of a
26023 multiline response).
26024 </para>
26025 <para>
26026 <indexterm role="option">
26027 <primary><option>smtp_check_spool_space</option></primary>
26028 </indexterm>
26029 </para>
26030 <informaltable frame="all">
26031 <tgroup cols="4" colsep="0" rowsep="0">
26032 <colspec colwidth="8*" align="left"/>
26033 <colspec colwidth="6*" align="center"/>
26034 <colspec colwidth="6*" align="center"/>
26035 <colspec colwidth="6*" align="right"/>
26036 <tbody>
26037 <row>
26038 <entry><option>smtp_check_spool_space</option></entry>
26039 <entry>Use: <emphasis>main</emphasis></entry>
26040 <entry>Type: <emphasis>boolean</emphasis></entry>
26041 <entry>Default: <emphasis>true</emphasis></entry>
26042 </row>
26043 </tbody>
26044 </tgroup>
26045 </informaltable>
26046 <para>
26047 <indexterm role="concept">
26048 <primary>checking disk space</primary>
26049 </indexterm>
26050 <indexterm role="concept">
26051 <primary>disk space, checking</primary>
26052 </indexterm>
26053 <indexterm role="concept">
26054 <primary>spool directory</primary>
26055 <secondary>checking space</secondary>
26056 </indexterm>
26057 When this option is set, if an incoming SMTP session encounters the SIZE
26058 option on a MAIL command, it checks that there is enough space in the
26059 spool directory&#x2019;s partition to accept a message of that size, while still
26060 leaving free the amount specified by <option>check_spool_space</option> (even if that value
26061 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
26062 </para>
26063 <para>
26064 <indexterm role="option">
26065 <primary><option>smtp_connect_backlog</option></primary>
26066 </indexterm>
26067 </para>
26068 <informaltable frame="all">
26069 <tgroup cols="4" colsep="0" rowsep="0">
26070 <colspec colwidth="8*" align="left"/>
26071 <colspec colwidth="6*" align="center"/>
26072 <colspec colwidth="6*" align="center"/>
26073 <colspec colwidth="6*" align="right"/>
26074 <tbody>
26075 <row>
26076 <entry><option>smtp_connect_backlog</option></entry>
26077 <entry>Use: <emphasis>main</emphasis></entry>
26078 <entry>Type: <emphasis>integer</emphasis></entry>
26079 <entry>Default: <emphasis>20</emphasis></entry>
26080 </row>
26081 </tbody>
26082 </tgroup>
26083 </informaltable>
26084 <para>
26085 <indexterm role="concept">
26086 <primary>connection backlog</primary>
26087 </indexterm>
26088 <indexterm role="concept">
26089 <primary>SMTP</primary>
26090 <secondary>connection backlog</secondary>
26091 </indexterm>
26092 <indexterm role="concept">
26093 <primary>backlog of connections</primary>
26094 </indexterm>
26095 This option specifies a maximum number of waiting SMTP connections. Exim passes
26096 this value to the TCP/IP system when it sets up its listener. Once this number
26097 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
26098 attempts are refused at the TCP/IP level. At least, that is what the manuals
26099 say; in some circumstances such connection attempts have been observed to time
26100 out instead. For large systems it is probably a good idea to increase the
26101 value (to 50, say). It also gives some protection against denial-of-service
26102 attacks by SYN flooding.
26103 </para>
26104 <para>
26105 <indexterm role="option">
26106 <primary><option>smtp_enforce_sync</option></primary>
26107 </indexterm>
26108 </para>
26109 <informaltable frame="all">
26110 <tgroup cols="4" colsep="0" rowsep="0">
26111 <colspec colwidth="8*" align="left"/>
26112 <colspec colwidth="6*" align="center"/>
26113 <colspec colwidth="6*" align="center"/>
26114 <colspec colwidth="6*" align="right"/>
26115 <tbody>
26116 <row>
26117 <entry><option>smtp_enforce_sync</option></entry>
26118 <entry>Use: <emphasis>main</emphasis></entry>
26119 <entry>Type: <emphasis>boolean</emphasis></entry>
26120 <entry>Default: <emphasis>true</emphasis></entry>
26121 </row>
26122 </tbody>
26123 </tgroup>
26124 </informaltable>
26125 <para>
26126 <indexterm role="concept">
26127 <primary>SMTP</primary>
26128 <secondary>synchronization checking</secondary>
26129 </indexterm>
26130 <indexterm role="concept">
26131 <primary>synchronization checking in SMTP</primary>
26132 </indexterm>
26133 The SMTP protocol specification requires the client to wait for a response from
26134 the server at certain points in the dialogue. Without PIPELINING these
26135 synchronization points are after every command; with PIPELINING they are
26136 fewer, but they still exist.
26137 </para>
26138 <para>
26139 Some spamming sites send out a complete set of SMTP commands without waiting
26140 for any response. Exim protects against this by rejecting a message if the
26141 client has sent further input when it should not have. The error response <quote>554
26142 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
26143 for this error cannot be perfect because of transmission delays (unexpected
26144 input may be on its way but not yet received when Exim checks). However, it
26145 does detect many instances.
26146 </para>
26147 <para>
26148 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
26149 If you want to disable the check selectively (for example, only for certain
26150 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
26151 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
26152 </para>
26153 <para>
26154 <indexterm role="option">
26155 <primary><option>smtp_etrn_command</option></primary>
26156 </indexterm>
26157 </para>
26158 <informaltable frame="all">
26159 <tgroup cols="4" colsep="0" rowsep="0">
26160 <colspec colwidth="8*" align="left"/>
26161 <colspec colwidth="6*" align="center"/>
26162 <colspec colwidth="6*" align="center"/>
26163 <colspec colwidth="6*" align="right"/>
26164 <tbody>
26165 <row>
26166 <entry><option>smtp_etrn_command</option></entry>
26167 <entry>Use: <emphasis>main</emphasis></entry>
26168 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26169 <entry>Default: <emphasis>unset</emphasis></entry>
26170 </row>
26171 </tbody>
26172 </tgroup>
26173 </informaltable>
26174 <para>
26175 <indexterm role="concept">
26176 <primary>ETRN</primary>
26177 <secondary>command to be run</secondary>
26178 </indexterm>
26179 <indexterm role="variable">
26180 <primary><varname>$domain</varname></primary>
26181 </indexterm>
26182 If this option is set, the given command is run whenever an SMTP ETRN
26183 command is received from a host that is permitted to issue such commands (see
26184 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
26185 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
26186 argument of the ETRN command, and no syntax checking is done on it. For
26187 example:
26188 </para>
26189 <literallayout class="monospaced">
26190 smtp_etrn_command = /etc/etrn_command $domain \
26191                     $sender_host_address
26192 </literallayout>
26193 <para>
26194 A new process is created to run the command, but Exim does not wait for it to
26195 complete. Consequently, its status cannot be checked. If the command cannot be
26196 run, a line is written to the panic log, but the ETRN caller still receives
26197 a 250 success response. Exim is normally running under its own uid when
26198 receiving SMTP, so it is not possible for it to change the uid before running
26199 the command.
26200 </para>
26201 <para>
26202 <indexterm role="option">
26203 <primary><option>smtp_etrn_serialize</option></primary>
26204 </indexterm>
26205 </para>
26206 <informaltable frame="all">
26207 <tgroup cols="4" colsep="0" rowsep="0">
26208 <colspec colwidth="8*" align="left"/>
26209 <colspec colwidth="6*" align="center"/>
26210 <colspec colwidth="6*" align="center"/>
26211 <colspec colwidth="6*" align="right"/>
26212 <tbody>
26213 <row>
26214 <entry><option>smtp_etrn_serialize</option></entry>
26215 <entry>Use: <emphasis>main</emphasis></entry>
26216 <entry>Type: <emphasis>boolean</emphasis></entry>
26217 <entry>Default: <emphasis>true</emphasis></entry>
26218 </row>
26219 </tbody>
26220 </tgroup>
26221 </informaltable>
26222 <para>
26223 <indexterm role="concept">
26224 <primary>ETRN</primary>
26225 <secondary>serializing</secondary>
26226 </indexterm>
26227 When this option is set, it prevents the simultaneous execution of more than
26228 one identical command as a result of ETRN in an SMTP connection. See
26229 section <xref linkend="SECTETRN"/> for details.
26230 </para>
26231 <para>
26232 <indexterm role="option">
26233 <primary><option>smtp_load_reserve</option></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="6*" align="center"/>
26240 <colspec colwidth="6*" align="center"/>
26241 <colspec colwidth="6*" align="right"/>
26242 <tbody>
26243 <row>
26244 <entry><option>smtp_load_reserve</option></entry>
26245 <entry>Use: <emphasis>main</emphasis></entry>
26246 <entry>Type: <emphasis>fixed-point</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>load average</primary>
26255 </indexterm>
26256 If the system load average ever gets higher than this, incoming SMTP calls are
26257 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
26258 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
26259 the load is over the limit. The option has no effect on ancient operating
26260 systems on which Exim cannot determine the load average. See also
26261 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
26262 </para>
26263 <para>
26264 <indexterm role="option">
26265 <primary><option>smtp_max_synprot_errors</option></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="6*" align="center"/>
26272 <colspec colwidth="6*" align="center"/>
26273 <colspec colwidth="6*" align="right"/>
26274 <tbody>
26275 <row>
26276 <entry><option>smtp_max_synprot_errors</option></entry>
26277 <entry>Use: <emphasis>main</emphasis></entry>
26278 <entry>Type: <emphasis>integer</emphasis></entry>
26279 <entry>Default: <emphasis>3</emphasis></entry>
26280 </row>
26281 </tbody>
26282 </tgroup>
26283 </informaltable>
26284 <para>
26285 <indexterm role="concept">
26286 <primary>SMTP</primary>
26287 <secondary>limiting syntax and protocol errors</secondary>
26288 </indexterm>
26289 <indexterm role="concept">
26290 <primary>limit</primary>
26291 <secondary>SMTP syntax and protocol errors</secondary>
26292 </indexterm>
26293 Exim rejects SMTP commands that contain syntax or protocol errors. In
26294 particular, a syntactically invalid email address, as in this command:
26295 </para>
26296 <literallayout class="monospaced">
26297 RCPT TO:&lt;abc xyz@a.b.c&gt;
26298 </literallayout>
26299 <para>
26300 causes immediate rejection of the command, before any other tests are done.
26301 (The ACL cannot be run if there is no valid address to set up for it.) An
26302 example of a protocol error is receiving RCPT before MAIL. If there are
26303 too many syntax or protocol errors in one SMTP session, the connection is
26304 dropped. The limit is set by this option.
26305 </para>
26306 <para>
26307 <indexterm role="concept">
26308 <primary>PIPELINING</primary>
26309 <secondary>expected errors</secondary>
26310 </indexterm>
26311 When the PIPELINING extension to SMTP is in use, some protocol errors are
26312 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
26313 Exim assumes that PIPELINING will be used if it advertises it (see
26314 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
26315 not count towards the limit.
26316 </para>
26317 <para>
26318 <indexterm role="option">
26319 <primary><option>smtp_max_unknown_commands</option></primary>
26320 </indexterm>
26321 </para>
26322 <informaltable frame="all">
26323 <tgroup cols="4" colsep="0" rowsep="0">
26324 <colspec colwidth="8*" align="left"/>
26325 <colspec colwidth="6*" align="center"/>
26326 <colspec colwidth="6*" align="center"/>
26327 <colspec colwidth="6*" align="right"/>
26328 <tbody>
26329 <row>
26330 <entry><option>smtp_max_unknown_commands</option></entry>
26331 <entry>Use: <emphasis>main</emphasis></entry>
26332 <entry>Type: <emphasis>integer</emphasis></entry>
26333 <entry>Default: <emphasis>3</emphasis></entry>
26334 </row>
26335 </tbody>
26336 </tgroup>
26337 </informaltable>
26338 <para>
26339 <indexterm role="concept">
26340 <primary>SMTP</primary>
26341 <secondary>limiting unknown commands</secondary>
26342 </indexterm>
26343 <indexterm role="concept">
26344 <primary>limit</primary>
26345 <secondary>unknown SMTP commands</secondary>
26346 </indexterm>
26347 If there are too many unrecognized commands in an incoming SMTP session, an
26348 Exim server drops the connection. This is a defence against some kinds of abuse
26349 that subvert web
26350 clients
26351 into making connections to SMTP ports; in these circumstances, a number of
26352 non-SMTP command lines are sent first.
26353 </para>
26354 <para>
26355 <indexterm role="option">
26356 <primary><option>smtp_ratelimit_hosts</option></primary>
26357 </indexterm>
26358 </para>
26359 <informaltable frame="all">
26360 <tgroup cols="4" colsep="0" rowsep="0">
26361 <colspec colwidth="8*" align="left"/>
26362 <colspec colwidth="6*" align="center"/>
26363 <colspec colwidth="6*" align="center"/>
26364 <colspec colwidth="6*" align="right"/>
26365 <tbody>
26366 <row>
26367 <entry><option>smtp_ratelimit_hosts</option></entry>
26368 <entry>Use: <emphasis>main</emphasis></entry>
26369 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26370 <entry>Default: <emphasis>unset</emphasis></entry>
26371 </row>
26372 </tbody>
26373 </tgroup>
26374 </informaltable>
26375 <para>
26376 <indexterm role="concept">
26377 <primary>SMTP</primary>
26378 <secondary>rate limiting</secondary>
26379 </indexterm>
26380 <indexterm role="concept">
26381 <primary>limit</primary>
26382 <secondary>rate of message arrival</secondary>
26383 </indexterm>
26384 <indexterm role="concept">
26385 <primary>RCPT</primary>
26386 <secondary>rate limiting</secondary>
26387 </indexterm>
26388 Some sites find it helpful to be able to limit the rate at which certain hosts
26389 can send them messages, and the rate at which an individual message can specify
26390 recipients.
26391 </para>
26392 <para>
26393 Exim has two rate-limiting facilities. This section describes the older
26394 facility, which can limit rates within a single connection. The newer
26395 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
26396 <xref linkend="SECTratelimiting"/> for details of the newer facility.
26397 </para>
26398 <para>
26399 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
26400 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
26401 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
26402 respectively. Each option, if set, must contain a set of four comma-separated
26403 values:
26404 </para>
26405 <itemizedlist>
26406 <listitem>
26407 <para>
26408 A threshold, before which there is no rate limiting.
26409 </para>
26410 </listitem>
26411 <listitem>
26412 <para>
26413 An initial time delay. Unlike other times in Exim, numbers with decimal
26414 fractional parts are allowed here.
26415 </para>
26416 </listitem>
26417 <listitem>
26418 <para>
26419 A factor by which to increase the delay each time.
26420 </para>
26421 </listitem>
26422 <listitem>
26423 <para>
26424 A maximum value for the delay. This should normally be less than 5 minutes,
26425 because after that time, the client is liable to timeout the SMTP command.
26426 </para>
26427 </listitem>
26428 </itemizedlist>
26429 <para>
26430 For example, these settings have been used successfully at the site which
26431 first suggested this feature, for controlling mail from their customers:
26432 </para>
26433 <literallayout class="monospaced">
26434 smtp_ratelimit_mail = 2,0.5s,1.05,4m
26435 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
26436 </literallayout>
26437 <para>
26438 The first setting specifies delays that are applied to MAIL commands after
26439 two have been received over a single connection. The initial delay is 0.5
26440 seconds, increasing by a factor of 1.05 each time. The second setting applies
26441 delays to RCPT commands when more than four occur in a single message.
26442 </para>
26443 <para>
26444 <indexterm role="option">
26445 <primary><option>smtp_ratelimit_mail</option></primary>
26446 </indexterm>
26447 </para>
26448 <informaltable frame="all">
26449 <tgroup cols="4" colsep="0" rowsep="0">
26450 <colspec colwidth="8*" align="left"/>
26451 <colspec colwidth="6*" align="center"/>
26452 <colspec colwidth="6*" align="center"/>
26453 <colspec colwidth="6*" align="right"/>
26454 <tbody>
26455 <row>
26456 <entry><option>smtp_ratelimit_mail</option></entry>
26457 <entry>Use: <emphasis>main</emphasis></entry>
26458 <entry>Type: <emphasis>string</emphasis></entry>
26459 <entry>Default: <emphasis>unset</emphasis></entry>
26460 </row>
26461 </tbody>
26462 </tgroup>
26463 </informaltable>
26464 <para>
26465 See <option>smtp_ratelimit_hosts</option> above.
26466 </para>
26467 <para>
26468 <indexterm role="option">
26469 <primary><option>smtp_ratelimit_rcpt</option></primary>
26470 </indexterm>
26471 </para>
26472 <informaltable frame="all">
26473 <tgroup cols="4" colsep="0" rowsep="0">
26474 <colspec colwidth="8*" align="left"/>
26475 <colspec colwidth="6*" align="center"/>
26476 <colspec colwidth="6*" align="center"/>
26477 <colspec colwidth="6*" align="right"/>
26478 <tbody>
26479 <row>
26480 <entry><option>smtp_ratelimit_rcpt</option></entry>
26481 <entry>Use: <emphasis>main</emphasis></entry>
26482 <entry>Type: <emphasis>string</emphasis></entry>
26483 <entry>Default: <emphasis>unset</emphasis></entry>
26484 </row>
26485 </tbody>
26486 </tgroup>
26487 </informaltable>
26488 <para>
26489 See <option>smtp_ratelimit_hosts</option> above.
26490 </para>
26491 <para>
26492 <indexterm role="option">
26493 <primary><option>smtp_receive_timeout</option></primary>
26494 </indexterm>
26495 </para>
26496 <informaltable frame="all">
26497 <tgroup cols="4" colsep="0" rowsep="0">
26498 <colspec colwidth="8*" align="left"/>
26499 <colspec colwidth="6*" align="center"/>
26500 <colspec colwidth="6*" align="center"/>
26501 <colspec colwidth="6*" align="right"/>
26502 <tbody>
26503 <row>
26504 <entry><option>smtp_receive_timeout</option></entry>
26505 <entry>Use: <emphasis>main</emphasis></entry>
26506 <entry>Type: <emphasis>time</emphasis></entry>
26507 <entry>Default: <emphasis>5m</emphasis></entry>
26508 </row>
26509 </tbody>
26510 </tgroup>
26511 </informaltable>
26512 <para>
26513 <indexterm role="concept">
26514 <primary>timeout</primary>
26515 <secondary>for SMTP input</secondary>
26516 </indexterm>
26517 <indexterm role="concept">
26518 <primary>SMTP</primary>
26519 <secondary>input timeout</secondary>
26520 </indexterm>
26521 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
26522 input, including batch SMTP. If a line of input (either an SMTP command or a
26523 data line) is not received within this time, the SMTP connection is dropped and
26524 the message is abandoned.
26525 A line is written to the log containing one of the following messages:
26526 </para>
26527 <literallayout class="monospaced">
26528 SMTP command timeout on connection from...
26529 SMTP data timeout on connection from...
26530 </literallayout>
26531 <para>
26532 The former means that Exim was expecting to read an SMTP command; the latter
26533 means that it was in the DATA phase, reading the contents of a message.
26534 </para>
26535 <para>
26536 <indexterm role="option">
26537 <primary><option>-os</option></primary>
26538 </indexterm>
26539 The value set by this option can be overridden by the
26540 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
26541 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
26542 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
26543 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
26544 </para>
26545 <para>
26546 <indexterm role="option">
26547 <primary><option>smtp_reserve_hosts</option></primary>
26548 </indexterm>
26549 </para>
26550 <informaltable frame="all">
26551 <tgroup cols="4" colsep="0" rowsep="0">
26552 <colspec colwidth="8*" align="left"/>
26553 <colspec colwidth="6*" align="center"/>
26554 <colspec colwidth="6*" align="center"/>
26555 <colspec colwidth="6*" align="right"/>
26556 <tbody>
26557 <row>
26558 <entry><option>smtp_reserve_hosts</option></entry>
26559 <entry>Use: <emphasis>main</emphasis></entry>
26560 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26561 <entry>Default: <emphasis>unset</emphasis></entry>
26562 </row>
26563 </tbody>
26564 </tgroup>
26565 </informaltable>
26566 <para>
26567 This option defines hosts for which SMTP connections are reserved; see
26568 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
26569 </para>
26570 <para>
26571 <indexterm role="option">
26572 <primary><option>smtp_return_error_details</option></primary>
26573 </indexterm>
26574 </para>
26575 <informaltable frame="all">
26576 <tgroup cols="4" colsep="0" rowsep="0">
26577 <colspec colwidth="8*" align="left"/>
26578 <colspec colwidth="6*" align="center"/>
26579 <colspec colwidth="6*" align="center"/>
26580 <colspec colwidth="6*" align="right"/>
26581 <tbody>
26582 <row>
26583 <entry><option>smtp_return_error_details</option></entry>
26584 <entry>Use: <emphasis>main</emphasis></entry>
26585 <entry>Type: <emphasis>boolean</emphasis></entry>
26586 <entry>Default: <emphasis>false</emphasis></entry>
26587 </row>
26588 </tbody>
26589 </tgroup>
26590 </informaltable>
26591 <para>
26592 <indexterm role="concept">
26593 <primary>SMTP</primary>
26594 <secondary>details policy failures</secondary>
26595 </indexterm>
26596 <indexterm role="concept">
26597 <primary>policy control</primary>
26598 <secondary>rejection, returning details</secondary>
26599 </indexterm>
26600 In the default state, Exim uses bland messages such as
26601 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
26602 reasons. Many sysadmins like this because it gives away little information
26603 to spammers. However, some other sysadmins who are applying strict checking
26604 policies want to give out much fuller information about failures. Setting
26605 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
26606 example, instead of <quote>Administrative prohibition</quote>, it might give:
26607 </para>
26608 <literallayout class="monospaced">
26609 550-Rejected after DATA: '&gt;' missing at end of address:
26610 550 failing address in "From" header is: &lt;user@dom.ain
26611 </literallayout>
26612 <para>
26613 <indexterm role="option">
26614 <primary><option>spamd_address</option></primary>
26615 </indexterm>
26616 </para>
26617 <informaltable frame="all">
26618 <tgroup cols="4" colsep="0" rowsep="0">
26619 <colspec colwidth="8*" align="left"/>
26620 <colspec colwidth="6*" align="center"/>
26621 <colspec colwidth="6*" align="center"/>
26622 <colspec colwidth="6*" align="right"/>
26623 <tbody>
26624 <row>
26625 <entry><option>spamd_address</option></entry>
26626 <entry>Use: <emphasis>main</emphasis></entry>
26627 <entry>Type: <emphasis>string</emphasis></entry>
26628 <entry>Default: <emphasis>see below</emphasis></entry>
26629 </row>
26630 </tbody>
26631 </tgroup>
26632 </informaltable>
26633 <para>
26634 This option is available when Exim is compiled with the content-scanning
26635 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
26636 The default value is
26637 </para>
26638 <literallayout class="monospaced">
26639 127.0.0.1 783
26640 </literallayout>
26641 <para>
26642 See section <xref linkend="SECTscanspamass"/> for more details.
26643 </para>
26644 <para>
26645 <indexterm role="option">
26646 <primary><option>split_spool_directory</option></primary>
26647 </indexterm>
26648 </para>
26649 <informaltable frame="all">
26650 <tgroup cols="4" colsep="0" rowsep="0">
26651 <colspec colwidth="8*" align="left"/>
26652 <colspec colwidth="6*" align="center"/>
26653 <colspec colwidth="6*" align="center"/>
26654 <colspec colwidth="6*" align="right"/>
26655 <tbody>
26656 <row>
26657 <entry><option>split_spool_directory</option></entry>
26658 <entry>Use: <emphasis>main</emphasis></entry>
26659 <entry>Type: <emphasis>boolean</emphasis></entry>
26660 <entry>Default: <emphasis>false</emphasis></entry>
26661 </row>
26662 </tbody>
26663 </tgroup>
26664 </informaltable>
26665 <para>
26666 <indexterm role="concept">
26667 <primary>multiple spool directories</primary>
26668 </indexterm>
26669 <indexterm role="concept">
26670 <primary>spool directory</primary>
26671 <secondary>split</secondary>
26672 </indexterm>
26673 <indexterm role="concept">
26674 <primary>directories, multiple</primary>
26675 </indexterm>
26676 If this option is set, it causes Exim to split its input directory into 62
26677 subdirectories, each with a single alphanumeric character as its name. The
26678 sixth character of the message id is used to allocate messages to
26679 subdirectories; this is the least significant base-62 digit of the time of
26680 arrival of the message.
26681 </para>
26682 <para>
26683 Splitting up the spool in this way may provide better performance on systems
26684 where there are long mail queues, by reducing the number of files in any one
26685 directory. The msglog directory is also split up in a similar way to the input
26686 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
26687 are still placed in the single directory <filename>msglog.OLD</filename>.
26688 </para>
26689 <para>
26690 It is not necessary to take any special action for existing messages when
26691 changing <option>split_spool_directory</option>. Exim notices messages that are in the
26692 <quote>wrong</quote> place, and continues to process them. If the option is turned off
26693 after a period of being on, the subdirectories will eventually empty and be
26694 automatically deleted.
26695 </para>
26696 <para>
26697 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
26698 changes. Instead of creating a list of all messages in the queue, and then
26699 trying to deliver each one in turn, it constructs a list of those in one
26700 sub-directory and tries to deliver them, before moving on to the next
26701 sub-directory. The sub-directories are processed in a random order. This
26702 spreads out the scanning of the input directories, and uses less memory. It is
26703 particularly beneficial when there are lots of messages on the queue. However,
26704 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
26705 entire queue has to be scanned and sorted before any deliveries can start.
26706 </para>
26707 <para>
26708 <indexterm role="option">
26709 <primary><option>spool_directory</option></primary>
26710 </indexterm>
26711 </para>
26712 <informaltable frame="all">
26713 <tgroup cols="4" colsep="0" rowsep="0">
26714 <colspec colwidth="8*" align="left"/>
26715 <colspec colwidth="6*" align="center"/>
26716 <colspec colwidth="6*" align="center"/>
26717 <colspec colwidth="6*" align="right"/>
26718 <tbody>
26719 <row>
26720 <entry><option>spool_directory</option></entry>
26721 <entry>Use: <emphasis>main</emphasis></entry>
26722 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26723 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26724 </row>
26725 </tbody>
26726 </tgroup>
26727 </informaltable>
26728 <para>
26729 <indexterm role="concept">
26730 <primary>spool directory</primary>
26731 <secondary>path to</secondary>
26732 </indexterm>
26733 This defines the directory in which Exim keeps its spool, that is, the messages
26734 it is waiting to deliver. The default value is taken from the compile-time
26735 configuration setting, if there is one. If not, this option must be set. The
26736 string is expanded, so it can contain, for example, a reference to
26737 <varname>$primary_hostname</varname>.
26738 </para>
26739 <para>
26740 If the spool directory name is fixed on your installation, it is recommended
26741 that you set it at build time rather than from this option, particularly if the
26742 log files are being written to the spool directory (see <option>log_file_path</option>).
26743 Otherwise log files cannot be used for errors that are detected early on, such
26744 as failures in the configuration file.
26745 </para>
26746 <para>
26747 By using this option to override the compiled-in path, it is possible to run
26748 tests of Exim without using the standard spool.
26749 </para>
26750 <para>
26751 <indexterm role="option">
26752 <primary><option>sqlite_lock_timeout</option></primary>
26753 </indexterm>
26754 </para>
26755 <informaltable frame="all">
26756 <tgroup cols="4" colsep="0" rowsep="0">
26757 <colspec colwidth="8*" align="left"/>
26758 <colspec colwidth="6*" align="center"/>
26759 <colspec colwidth="6*" align="center"/>
26760 <colspec colwidth="6*" align="right"/>
26761 <tbody>
26762 <row>
26763 <entry><option>sqlite_lock_timeout</option></entry>
26764 <entry>Use: <emphasis>main</emphasis></entry>
26765 <entry>Type: <emphasis>time</emphasis></entry>
26766 <entry>Default: <emphasis>5s</emphasis></entry>
26767 </row>
26768 </tbody>
26769 </tgroup>
26770 </informaltable>
26771 <para>
26772 <indexterm role="concept">
26773 <primary>sqlite lookup type</primary>
26774 <secondary>lock timeout</secondary>
26775 </indexterm>
26776 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
26777 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
26778 </para>
26779 <para>
26780 <indexterm role="option">
26781 <primary><option>strict_acl_vars</option></primary>
26782 </indexterm>
26783 </para>
26784 <informaltable frame="all">
26785 <tgroup cols="4" colsep="0" rowsep="0">
26786 <colspec colwidth="8*" align="left"/>
26787 <colspec colwidth="6*" align="center"/>
26788 <colspec colwidth="6*" align="center"/>
26789 <colspec colwidth="6*" align="right"/>
26790 <tbody>
26791 <row>
26792 <entry><option>strict_acl_vars</option></entry>
26793 <entry>Use: <emphasis>main</emphasis></entry>
26794 <entry>Type: <emphasis>boolean</emphasis></entry>
26795 <entry>Default: <emphasis>false</emphasis></entry>
26796 </row>
26797 </tbody>
26798 </tgroup>
26799 </informaltable>
26800 <para>
26801 <indexterm role="concept">
26802 <primary>access control lists (ACLs)</primary>
26803 <secondary>variables, handling unset</secondary>
26804 </indexterm>
26805 This option controls what happens if a syntactically valid but undefined ACL
26806 variable is referenced. If it is false (the default), an empty string
26807 is substituted; if it is true, an error is generated. See section
26808 <xref linkend="SECTaclvariables"/> for details of ACL variables.
26809 </para>
26810 <para>
26811 <indexterm role="option">
26812 <primary><option>strip_excess_angle_brackets</option></primary>
26813 </indexterm>
26814 </para>
26815 <informaltable frame="all">
26816 <tgroup cols="4" colsep="0" rowsep="0">
26817 <colspec colwidth="8*" align="left"/>
26818 <colspec colwidth="6*" align="center"/>
26819 <colspec colwidth="6*" align="center"/>
26820 <colspec colwidth="6*" align="right"/>
26821 <tbody>
26822 <row>
26823 <entry><option>strip_excess_angle_brackets</option></entry>
26824 <entry>Use: <emphasis>main</emphasis></entry>
26825 <entry>Type: <emphasis>boolean</emphasis></entry>
26826 <entry>Default: <emphasis>false</emphasis></entry>
26827 </row>
26828 </tbody>
26829 </tgroup>
26830 </informaltable>
26831 <para>
26832 <indexterm role="concept">
26833 <primary>angle brackets, excess</primary>
26834 </indexterm>
26835 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
26836 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
26837 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
26838 passed on to another MTA, the excess angle brackets are not passed on. If this
26839 option is not set, multiple pairs of angle brackets cause a syntax error.
26840 </para>
26841 <para>
26842 <indexterm role="option">
26843 <primary><option>strip_trailing_dot</option></primary>
26844 </indexterm>
26845 </para>
26846 <informaltable frame="all">
26847 <tgroup cols="4" colsep="0" rowsep="0">
26848 <colspec colwidth="8*" align="left"/>
26849 <colspec colwidth="6*" align="center"/>
26850 <colspec colwidth="6*" align="center"/>
26851 <colspec colwidth="6*" align="right"/>
26852 <tbody>
26853 <row>
26854 <entry><option>strip_trailing_dot</option></entry>
26855 <entry>Use: <emphasis>main</emphasis></entry>
26856 <entry>Type: <emphasis>boolean</emphasis></entry>
26857 <entry>Default: <emphasis>false</emphasis></entry>
26858 </row>
26859 </tbody>
26860 </tgroup>
26861 </informaltable>
26862 <para>
26863 <indexterm role="concept">
26864 <primary>trailing dot on domain</primary>
26865 </indexterm>
26866 <indexterm role="concept">
26867 <primary>dot</primary>
26868 <secondary>trailing on domain</secondary>
26869 </indexterm>
26870 If this option is set, a trailing dot at the end of a domain in an address is
26871 ignored. If this is in the envelope and the message is passed on to another
26872 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
26873 domain causes a syntax error.
26874 However, addresses in header lines are checked only when an ACL requests header
26875 syntax checking.
26876 </para>
26877 <para>
26878 <indexterm role="option">
26879 <primary><option>syslog_duplication</option></primary>
26880 </indexterm>
26881 </para>
26882 <informaltable frame="all">
26883 <tgroup cols="4" colsep="0" rowsep="0">
26884 <colspec colwidth="8*" align="left"/>
26885 <colspec colwidth="6*" align="center"/>
26886 <colspec colwidth="6*" align="center"/>
26887 <colspec colwidth="6*" align="right"/>
26888 <tbody>
26889 <row>
26890 <entry><option>syslog_duplication</option></entry>
26891 <entry>Use: <emphasis>main</emphasis></entry>
26892 <entry>Type: <emphasis>boolean</emphasis></entry>
26893 <entry>Default: <emphasis>true</emphasis></entry>
26894 </row>
26895 </tbody>
26896 </tgroup>
26897 </informaltable>
26898 <para>
26899 <indexterm role="concept">
26900 <primary>syslog</primary>
26901 <secondary>duplicate log lines; suppressing</secondary>
26902 </indexterm>
26903 When Exim is logging to syslog, it writes the log lines for its three
26904 separate logs at different syslog priorities so that they can in principle
26905 be separated on the logging hosts. Some installations do not require this
26906 separation, and in those cases, the duplication of certain log lines is a
26907 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
26908 particular log line is written to syslog. For lines that normally go to
26909 both the main log and the reject log, the reject log version (possibly
26910 containing message header lines) is written, at LOG_NOTICE priority.
26911 Lines that normally go to both the main and the panic log are written at
26912 the LOG_ALERT priority.
26913 </para>
26914 <para>
26915 <indexterm role="option">
26916 <primary><option>syslog_facility</option></primary>
26917 </indexterm>
26918 </para>
26919 <informaltable frame="all">
26920 <tgroup cols="4" colsep="0" rowsep="0">
26921 <colspec colwidth="8*" align="left"/>
26922 <colspec colwidth="6*" align="center"/>
26923 <colspec colwidth="6*" align="center"/>
26924 <colspec colwidth="6*" align="right"/>
26925 <tbody>
26926 <row>
26927 <entry><option>syslog_facility</option></entry>
26928 <entry>Use: <emphasis>main</emphasis></entry>
26929 <entry>Type: <emphasis>string</emphasis></entry>
26930 <entry>Default: <emphasis>unset</emphasis></entry>
26931 </row>
26932 </tbody>
26933 </tgroup>
26934 </informaltable>
26935 <para>
26936 <indexterm role="concept">
26937 <primary>syslog</primary>
26938 <secondary>facility; setting</secondary>
26939 </indexterm>
26940 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
26941 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
26942 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
26943 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
26944 details of Exim&#x2019;s logging.
26945 </para>
26946 <para>
26947 <indexterm role="option">
26948 <primary><option>syslog_processname</option></primary>
26949 </indexterm>
26950 </para>
26951 <informaltable frame="all">
26952 <tgroup cols="4" colsep="0" rowsep="0">
26953 <colspec colwidth="8*" align="left"/>
26954 <colspec colwidth="6*" align="center"/>
26955 <colspec colwidth="6*" align="center"/>
26956 <colspec colwidth="6*" align="right"/>
26957 <tbody>
26958 <row>
26959 <entry><option>syslog_processname</option></entry>
26960 <entry>Use: <emphasis>main</emphasis></entry>
26961 <entry>Type: <emphasis>string</emphasis></entry>
26962 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
26963 </row>
26964 </tbody>
26965 </tgroup>
26966 </informaltable>
26967 <para>
26968 <indexterm role="concept">
26969 <primary>syslog</primary>
26970 <secondary>process name; setting</secondary>
26971 </indexterm>
26972 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
26973 syslog. The value must be no longer than 32 characters. See chapter
26974 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
26975 </para>
26976 <para>
26977 <indexterm role="option">
26978 <primary><option>syslog_timestamp</option></primary>
26979 </indexterm>
26980 </para>
26981 <informaltable frame="all">
26982 <tgroup cols="4" colsep="0" rowsep="0">
26983 <colspec colwidth="8*" align="left"/>
26984 <colspec colwidth="6*" align="center"/>
26985 <colspec colwidth="6*" align="center"/>
26986 <colspec colwidth="6*" align="right"/>
26987 <tbody>
26988 <row>
26989 <entry><option>syslog_timestamp</option></entry>
26990 <entry>Use: <emphasis>main</emphasis></entry>
26991 <entry>Type: <emphasis>boolean</emphasis></entry>
26992 <entry>Default: <emphasis>true</emphasis></entry>
26993 </row>
26994 </tbody>
26995 </tgroup>
26996 </informaltable>
26997 <para>
26998 <indexterm role="concept">
26999 <primary>syslog</primary>
27000 <secondary>timestamps</secondary>
27001 </indexterm>
27002 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
27003 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
27004 details of Exim&#x2019;s logging.
27005 </para>
27006 <para>
27007 <indexterm role="option">
27008 <primary><option>system_filter</option></primary>
27009 </indexterm>
27010 </para>
27011 <informaltable frame="all">
27012 <tgroup cols="4" colsep="0" rowsep="0">
27013 <colspec colwidth="8*" align="left"/>
27014 <colspec colwidth="6*" align="center"/>
27015 <colspec colwidth="6*" align="center"/>
27016 <colspec colwidth="6*" align="right"/>
27017 <tbody>
27018 <row>
27019 <entry><option>system_filter</option></entry>
27020 <entry>Use: <emphasis>main</emphasis></entry>
27021 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27022 <entry>Default: <emphasis>unset</emphasis></entry>
27023 </row>
27024 </tbody>
27025 </tgroup>
27026 </informaltable>
27027 <para>
27028 <indexterm role="concept">
27029 <primary>filter</primary>
27030 <secondary>system filter</secondary>
27031 </indexterm>
27032 <indexterm role="concept">
27033 <primary>system filter</primary>
27034 <secondary>specifying</secondary>
27035 </indexterm>
27036 <indexterm role="concept">
27037 <primary>Sieve filter</primary>
27038 <secondary>not available for system filter</secondary>
27039 </indexterm>
27040 This option specifies an Exim filter file that is applied to all messages at
27041 the start of each delivery attempt, before any routing is done. System filters
27042 must be Exim filters; they cannot be Sieve filters. If the system filter
27043 generates any deliveries to files or pipes, or any new mail messages, the
27044 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
27045 which transports are to be used. Details of this facility are given in chapter
27046 <xref linkend="CHAPsystemfilter"/>.
27047 </para>
27048 <para>
27049 <indexterm role="option">
27050 <primary><option>system_filter_directory_transport</option></primary>
27051 </indexterm>
27052 </para>
27053 <informaltable frame="all">
27054 <tgroup cols="4" colsep="0" rowsep="0">
27055 <colspec colwidth="8*" align="left"/>
27056 <colspec colwidth="6*" align="center"/>
27057 <colspec colwidth="6*" align="center"/>
27058 <colspec colwidth="6*" align="right"/>
27059 <tbody>
27060 <row>
27061 <entry><option>system_filter_directory_transport</option></entry>
27062 <entry>Use: <emphasis>main</emphasis></entry>
27063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27064 <entry>Default: <emphasis>unset</emphasis></entry>
27065 </row>
27066 </tbody>
27067 </tgroup>
27068 </informaltable>
27069 <para>
27070 <indexterm role="variable">
27071 <primary><varname>$address_file</varname></primary>
27072 </indexterm>
27073 This sets the name of the transport driver that is to be used when the
27074 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
27075 implying delivery of each message into a separate file in some directory.
27076 During the delivery, the variable <varname>$address_file</varname> contains the path name.
27077 </para>
27078 <para>
27079 <indexterm role="option">
27080 <primary><option>system_filter_file_transport</option></primary>
27081 </indexterm>
27082 </para>
27083 <informaltable frame="all">
27084 <tgroup cols="4" colsep="0" rowsep="0">
27085 <colspec colwidth="8*" align="left"/>
27086 <colspec colwidth="6*" align="center"/>
27087 <colspec colwidth="6*" align="center"/>
27088 <colspec colwidth="6*" align="right"/>
27089 <tbody>
27090 <row>
27091 <entry><option>system_filter_file_transport</option></entry>
27092 <entry>Use: <emphasis>main</emphasis></entry>
27093 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27094 <entry>Default: <emphasis>unset</emphasis></entry>
27095 </row>
27096 </tbody>
27097 </tgroup>
27098 </informaltable>
27099 <para>
27100 <indexterm role="concept">
27101 <primary>file</primary>
27102 <secondary>transport for system filter</secondary>
27103 </indexterm>
27104 This sets the name of the transport driver that is to be used when the <option>save</option>
27105 command in a system message filter specifies a path not ending in <quote>/</quote>. During
27106 the delivery, the variable <varname>$address_file</varname> contains the path name.
27107 </para>
27108 <para>
27109 <indexterm role="option">
27110 <primary><option>system_filter_group</option></primary>
27111 </indexterm>
27112 </para>
27113 <informaltable frame="all">
27114 <tgroup cols="4" colsep="0" rowsep="0">
27115 <colspec colwidth="8*" align="left"/>
27116 <colspec colwidth="6*" align="center"/>
27117 <colspec colwidth="6*" align="center"/>
27118 <colspec colwidth="6*" align="right"/>
27119 <tbody>
27120 <row>
27121 <entry><option>system_filter_group</option></entry>
27122 <entry>Use: <emphasis>main</emphasis></entry>
27123 <entry>Type: <emphasis>string</emphasis></entry>
27124 <entry>Default: <emphasis>unset</emphasis></entry>
27125 </row>
27126 </tbody>
27127 </tgroup>
27128 </informaltable>
27129 <para>
27130 <indexterm role="concept">
27131 <primary>gid (group id)</primary>
27132 <secondary>system filter</secondary>
27133 </indexterm>
27134 This option is used only when <option>system_filter_user</option> is also set. It sets the
27135 gid under which the system filter is run, overriding any gid that is associated
27136 with the user. The value may be numerical or symbolic.
27137 </para>
27138 <para>
27139 <indexterm role="option">
27140 <primary><option>system_filter_pipe_transport</option></primary>
27141 </indexterm>
27142 </para>
27143 <informaltable frame="all">
27144 <tgroup cols="4" colsep="0" rowsep="0">
27145 <colspec colwidth="8*" align="left"/>
27146 <colspec colwidth="6*" align="center"/>
27147 <colspec colwidth="6*" align="center"/>
27148 <colspec colwidth="6*" align="right"/>
27149 <tbody>
27150 <row>
27151 <entry><option>system_filter_pipe_transport</option></entry>
27152 <entry>Use: <emphasis>main</emphasis></entry>
27153 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27154 <entry>Default: <emphasis>unset</emphasis></entry>
27155 </row>
27156 </tbody>
27157 </tgroup>
27158 </informaltable>
27159 <para>
27160 <indexterm role="concept">
27161 <primary><command>pipe</command> transport</primary>
27162 <secondary>for system filter</secondary>
27163 </indexterm>
27164 <indexterm role="variable">
27165 <primary><varname>$address_pipe</varname></primary>
27166 </indexterm>
27167 This specifies the transport driver that is to be used when a <option>pipe</option> command
27168 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
27169 contains the pipe command.
27170 </para>
27171 <para>
27172 <indexterm role="option">
27173 <primary><option>system_filter_reply_transport</option></primary>
27174 </indexterm>
27175 </para>
27176 <informaltable frame="all">
27177 <tgroup cols="4" colsep="0" rowsep="0">
27178 <colspec colwidth="8*" align="left"/>
27179 <colspec colwidth="6*" align="center"/>
27180 <colspec colwidth="6*" align="center"/>
27181 <colspec colwidth="6*" align="right"/>
27182 <tbody>
27183 <row>
27184 <entry><option>system_filter_reply_transport</option></entry>
27185 <entry>Use: <emphasis>main</emphasis></entry>
27186 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27187 <entry>Default: <emphasis>unset</emphasis></entry>
27188 </row>
27189 </tbody>
27190 </tgroup>
27191 </informaltable>
27192 <para>
27193 <indexterm role="concept">
27194 <primary><command>autoreply</command> transport</primary>
27195 <secondary>for system filter</secondary>
27196 </indexterm>
27197 This specifies the transport driver that is to be used when a <option>mail</option> command
27198 is used in a system filter.
27199 </para>
27200 <para>
27201 <indexterm role="option">
27202 <primary><option>system_filter_user</option></primary>
27203 </indexterm>
27204 </para>
27205 <informaltable frame="all">
27206 <tgroup cols="4" colsep="0" rowsep="0">
27207 <colspec colwidth="8*" align="left"/>
27208 <colspec colwidth="6*" align="center"/>
27209 <colspec colwidth="6*" align="center"/>
27210 <colspec colwidth="6*" align="right"/>
27211 <tbody>
27212 <row>
27213 <entry><option>system_filter_user</option></entry>
27214 <entry>Use: <emphasis>main</emphasis></entry>
27215 <entry>Type: <emphasis>string</emphasis></entry>
27216 <entry>Default: <emphasis>unset</emphasis></entry>
27217 </row>
27218 </tbody>
27219 </tgroup>
27220 </informaltable>
27221 <para>
27222 <indexterm role="concept">
27223 <primary>uid (user id)</primary>
27224 <secondary>system filter</secondary>
27225 </indexterm>
27226 If this option is not set, the system filter is run in the main Exim delivery
27227 process, as root. When the option is set, the system filter runs in a separate
27228 process, as the given user. Unless the string consists entirely of digits, it
27229 is looked up in the password data. Failure to find the named user causes a
27230 configuration error. The gid is either taken from the password data, or
27231 specified by <option>system_filter_group</option>. When the uid is specified numerically,
27232 <option>system_filter_group</option> is required to be set.
27233 </para>
27234 <para>
27235 If the system filter generates any pipe, file, or reply deliveries, the uid
27236 under which the filter is run is used when transporting them, unless a
27237 transport option overrides. Normally you should set <option>system_filter_user</option> if
27238 your system filter generates these kinds of delivery.
27239 </para>
27240 <para>
27241 <indexterm role="option">
27242 <primary><option>tcp_nodelay</option></primary>
27243 </indexterm>
27244 </para>
27245 <informaltable frame="all">
27246 <tgroup cols="4" colsep="0" rowsep="0">
27247 <colspec colwidth="8*" align="left"/>
27248 <colspec colwidth="6*" align="center"/>
27249 <colspec colwidth="6*" align="center"/>
27250 <colspec colwidth="6*" align="right"/>
27251 <tbody>
27252 <row>
27253 <entry><option>tcp_nodelay</option></entry>
27254 <entry>Use: <emphasis>main</emphasis></entry>
27255 <entry>Type: <emphasis>boolean</emphasis></entry>
27256 <entry>Default: <emphasis>true</emphasis></entry>
27257 </row>
27258 </tbody>
27259 </tgroup>
27260 </informaltable>
27261 <para>
27262 <indexterm role="concept">
27263 <primary>daemon</primary>
27264 <secondary>TCP_NODELAY on sockets</secondary>
27265 </indexterm>
27266 <indexterm role="concept">
27267 <primary>Nagle algorithm</primary>
27268 </indexterm>
27269 <indexterm role="concept">
27270 <primary>TCP_NODELAY on listening sockets</primary>
27271 </indexterm>
27272 If this option is set false, it stops the Exim daemon setting the
27273 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
27274 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
27275 performance in interactive (character-by-character) situations. Turning it off
27276 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
27277 However, it appears that some broken clients cannot cope, and time out. Hence
27278 this option. It affects only those sockets that are set up for listening by the
27279 daemon. Sockets created by the smtp transport for delivering mail always set
27280 TCP_NODELAY.
27281 </para>
27282 <para>
27283 <indexterm role="option">
27284 <primary><option>timeout_frozen_after</option></primary>
27285 </indexterm>
27286 </para>
27287 <informaltable frame="all">
27288 <tgroup cols="4" colsep="0" rowsep="0">
27289 <colspec colwidth="8*" align="left"/>
27290 <colspec colwidth="6*" align="center"/>
27291 <colspec colwidth="6*" align="center"/>
27292 <colspec colwidth="6*" align="right"/>
27293 <tbody>
27294 <row>
27295 <entry><option>timeout_frozen_after</option></entry>
27296 <entry>Use: <emphasis>main</emphasis></entry>
27297 <entry>Type: <emphasis>time</emphasis></entry>
27298 <entry>Default: <emphasis>0s</emphasis></entry>
27299 </row>
27300 </tbody>
27301 </tgroup>
27302 </informaltable>
27303 <para>
27304 <indexterm role="concept">
27305 <primary>frozen messages</primary>
27306 <secondary>timing out</secondary>
27307 </indexterm>
27308 <indexterm role="concept">
27309 <primary>timeout</primary>
27310 <secondary>frozen messages</secondary>
27311 </indexterm>
27312 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
27313 message of any kind that has been on the queue for longer than the given time
27314 is automatically cancelled at the next queue run. If the frozen message is a
27315 bounce message, it is just discarded; otherwise, a bounce is sent to the
27316 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
27317 If you want to timeout frozen bounce messages earlier than other kinds of
27318 frozen message, see <option>ignore_bounce_errors_after</option>.
27319 </para>
27320 <para>
27321 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
27322 frozen messages remain on the queue forever (except for any frozen bounce
27323 messages that are released by <option>ignore_bounce_errors_after</option>).
27324 </para>
27325 <para>
27326 <indexterm role="option">
27327 <primary><option>timezone</option></primary>
27328 </indexterm>
27329 </para>
27330 <informaltable frame="all">
27331 <tgroup cols="4" colsep="0" rowsep="0">
27332 <colspec colwidth="8*" align="left"/>
27333 <colspec colwidth="6*" align="center"/>
27334 <colspec colwidth="6*" align="center"/>
27335 <colspec colwidth="6*" align="right"/>
27336 <tbody>
27337 <row>
27338 <entry><option>timezone</option></entry>
27339 <entry>Use: <emphasis>main</emphasis></entry>
27340 <entry>Type: <emphasis>string</emphasis></entry>
27341 <entry>Default: <emphasis>unset</emphasis></entry>
27342 </row>
27343 </tbody>
27344 </tgroup>
27345 </informaltable>
27346 <para>
27347 <indexterm role="concept">
27348 <primary>timezone, setting</primary>
27349 </indexterm>
27350 The value of <option>timezone</option> is used to set the environment variable TZ while
27351 running Exim (if it is different on entry). This ensures that all timestamps
27352 created by Exim are in the required timezone. If you want all your timestamps
27353 to be in UTC (aka GMT) you should set
27354 </para>
27355 <literallayout class="monospaced">
27356 timezone = UTC
27357 </literallayout>
27358 <para>
27359 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
27360 or, if that is not set, from the value of the TZ environment variable when Exim
27361 is built. If <option>timezone</option> is set to the empty string, either at build or run
27362 time, any existing TZ variable is removed from the environment when Exim
27363 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
27364 unfortunately not all, operating systems.
27365 </para>
27366 <para>
27367 <indexterm role="option">
27368 <primary><option>tls_advertise_hosts</option></primary>
27369 </indexterm>
27370 </para>
27371 <informaltable frame="all">
27372 <tgroup cols="4" colsep="0" rowsep="0">
27373 <colspec colwidth="8*" align="left"/>
27374 <colspec colwidth="6*" align="center"/>
27375 <colspec colwidth="6*" align="center"/>
27376 <colspec colwidth="6*" align="right"/>
27377 <tbody>
27378 <row>
27379 <entry><option>tls_advertise_hosts</option></entry>
27380 <entry>Use: <emphasis>main</emphasis></entry>
27381 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27382 <entry>Default: <emphasis>unset</emphasis></entry>
27383 </row>
27384 </tbody>
27385 </tgroup>
27386 </informaltable>
27387 <para>
27388 <indexterm role="concept">
27389 <primary>TLS</primary>
27390 <secondary>advertising</secondary>
27391 </indexterm>
27392 <indexterm role="concept">
27393 <primary>encryption</primary>
27394 <secondary>on SMTP connection</secondary>
27395 </indexterm>
27396 <indexterm role="concept">
27397 <primary>SMTP</primary>
27398 <secondary>encrypted connection</secondary>
27399 </indexterm>
27400 When Exim is built with support for TLS encrypted connections, the availability
27401 of the STARTTLS command to set up an encrypted session is advertised in
27402 response to EHLO only to those client hosts that match this option. See
27403 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
27404 </para>
27405 <para>
27406 <indexterm role="option">
27407 <primary><option>tls_certificate</option></primary>
27408 </indexterm>
27409 </para>
27410 <informaltable frame="all">
27411 <tgroup cols="4" colsep="0" rowsep="0">
27412 <colspec colwidth="8*" align="left"/>
27413 <colspec colwidth="6*" align="center"/>
27414 <colspec colwidth="6*" align="center"/>
27415 <colspec colwidth="6*" align="right"/>
27416 <tbody>
27417 <row>
27418 <entry><option>tls_certificate</option></entry>
27419 <entry>Use: <emphasis>main</emphasis></entry>
27420 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27421 <entry>Default: <emphasis>unset</emphasis></entry>
27422 </row>
27423 </tbody>
27424 </tgroup>
27425 </informaltable>
27426 <para>
27427 <indexterm role="concept">
27428 <primary>TLS</primary>
27429 <secondary>server certificate; location of</secondary>
27430 </indexterm>
27431 <indexterm role="concept">
27432 <primary>certificate</primary>
27433 <secondary>server, location of</secondary>
27434 </indexterm>
27435 The value of this option is expanded, and must then be the absolute path to a
27436 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
27437 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
27438 <xref linkend="CHAPTLS"/> for further details.
27439 </para>
27440 <para>
27441 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
27442 receiving incoming messages as a server. If you want to supply certificates for
27443 use when sending messages as a client, you must set the <option>tls_certificate</option>
27444 option in the relevant <command>smtp</command> transport.
27445 </para>
27446 <para>
27447 <indexterm role="option">
27448 <primary><option>tls_crl</option></primary>
27449 </indexterm>
27450 </para>
27451 <informaltable frame="all">
27452 <tgroup cols="4" colsep="0" rowsep="0">
27453 <colspec colwidth="8*" align="left"/>
27454 <colspec colwidth="6*" align="center"/>
27455 <colspec colwidth="6*" align="center"/>
27456 <colspec colwidth="6*" align="right"/>
27457 <tbody>
27458 <row>
27459 <entry><option>tls_crl</option></entry>
27460 <entry>Use: <emphasis>main</emphasis></entry>
27461 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27462 <entry>Default: <emphasis>unset</emphasis></entry>
27463 </row>
27464 </tbody>
27465 </tgroup>
27466 </informaltable>
27467 <para>
27468 <indexterm role="concept">
27469 <primary>TLS</primary>
27470 <secondary>server certificate revocation list</secondary>
27471 </indexterm>
27472 <indexterm role="concept">
27473 <primary>certificate</primary>
27474 <secondary>revocation list for server</secondary>
27475 </indexterm>
27476 This option specifies a certificate revocation list. The expanded value must
27477 be the name of a file that contains a CRL in PEM format.
27478 </para>
27479 <para>
27480 <indexterm role="option">
27481 <primary><option>tls_dhparam</option></primary>
27482 </indexterm>
27483 </para>
27484 <informaltable frame="all">
27485 <tgroup cols="4" colsep="0" rowsep="0">
27486 <colspec colwidth="8*" align="left"/>
27487 <colspec colwidth="6*" align="center"/>
27488 <colspec colwidth="6*" align="center"/>
27489 <colspec colwidth="6*" align="right"/>
27490 <tbody>
27491 <row>
27492 <entry><option>tls_dhparam</option></entry>
27493 <entry>Use: <emphasis>main</emphasis></entry>
27494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27495 <entry>Default: <emphasis>unset</emphasis></entry>
27496 </row>
27497 </tbody>
27498 </tgroup>
27499 </informaltable>
27500 <para>
27501 <indexterm role="concept">
27502 <primary>TLS</primary>
27503 <secondary>D-H parameters for server</secondary>
27504 </indexterm>
27505 The value of this option is expanded, and must then be the absolute path to
27506 a file which contains the server&#x2019;s DH parameter values.
27507 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
27508 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
27509 </para>
27510 <para>
27511 <indexterm role="option">
27512 <primary><option>tls_on_connect_ports</option></primary>
27513 </indexterm>
27514 </para>
27515 <informaltable frame="all">
27516 <tgroup cols="4" colsep="0" rowsep="0">
27517 <colspec colwidth="8*" align="left"/>
27518 <colspec colwidth="6*" align="center"/>
27519 <colspec colwidth="6*" align="center"/>
27520 <colspec colwidth="6*" align="right"/>
27521 <tbody>
27522 <row>
27523 <entry><option>tls_on_connect_ports</option></entry>
27524 <entry>Use: <emphasis>main</emphasis></entry>
27525 <entry>Type: <emphasis>string list</emphasis></entry>
27526 <entry>Default: <emphasis>unset</emphasis></entry>
27527 </row>
27528 </tbody>
27529 </tgroup>
27530 </informaltable>
27531 <para>
27532 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
27533 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
27534 set up without waiting for the client to issue a STARTTLS command. For
27535 further details, see section <xref linkend="SECTsupobssmt"/>.
27536 </para>
27537 <para>
27538 <indexterm role="option">
27539 <primary><option>tls_privatekey</option></primary>
27540 </indexterm>
27541 </para>
27542 <informaltable frame="all">
27543 <tgroup cols="4" colsep="0" rowsep="0">
27544 <colspec colwidth="8*" align="left"/>
27545 <colspec colwidth="6*" align="center"/>
27546 <colspec colwidth="6*" align="center"/>
27547 <colspec colwidth="6*" align="right"/>
27548 <tbody>
27549 <row>
27550 <entry><option>tls_privatekey</option></entry>
27551 <entry>Use: <emphasis>main</emphasis></entry>
27552 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27553 <entry>Default: <emphasis>unset</emphasis></entry>
27554 </row>
27555 </tbody>
27556 </tgroup>
27557 </informaltable>
27558 <para>
27559 <indexterm role="concept">
27560 <primary>TLS</primary>
27561 <secondary>server private key; location of</secondary>
27562 </indexterm>
27563 The value of this option is expanded, and must then be the absolute path to a
27564 file which contains the server&#x2019;s private key. If this option is unset, or if
27565 the expansion is forced to fail, or the result is an empty string, the private
27566 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
27567 <xref linkend="CHAPTLS"/> for further details.
27568 </para>
27569 <para>
27570 <indexterm role="option">
27571 <primary><option>tls_remember_esmtp</option></primary>
27572 </indexterm>
27573 </para>
27574 <informaltable frame="all">
27575 <tgroup cols="4" colsep="0" rowsep="0">
27576 <colspec colwidth="8*" align="left"/>
27577 <colspec colwidth="6*" align="center"/>
27578 <colspec colwidth="6*" align="center"/>
27579 <colspec colwidth="6*" align="right"/>
27580 <tbody>
27581 <row>
27582 <entry><option>tls_remember_esmtp</option></entry>
27583 <entry>Use: <emphasis>main</emphasis></entry>
27584 <entry>Type: <emphasis>boolean</emphasis></entry>
27585 <entry>Default: <emphasis>false</emphasis></entry>
27586 </row>
27587 </tbody>
27588 </tgroup>
27589 </informaltable>
27590 <para>
27591 <indexterm role="concept">
27592 <primary>TLS</primary>
27593 <secondary>esmtp state; remembering</secondary>
27594 </indexterm>
27595 <indexterm role="concept">
27596 <primary>TLS</primary>
27597 <secondary>broken clients</secondary>
27598 </indexterm>
27599 If this option is set true, Exim violates the RFCs by remembering that it is in
27600 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
27601 support for broken clients that fail to send a new EHLO after starting a
27602 TLS session.
27603 </para>
27604 <para>
27605 <indexterm role="option">
27606 <primary><option>tls_require_ciphers</option></primary>
27607 </indexterm>
27608 </para>
27609 <informaltable frame="all">
27610 <tgroup cols="4" colsep="0" rowsep="0">
27611 <colspec colwidth="8*" align="left"/>
27612 <colspec colwidth="6*" align="center"/>
27613 <colspec colwidth="6*" align="center"/>
27614 <colspec colwidth="6*" align="right"/>
27615 <tbody>
27616 <row>
27617 <entry><option>tls_require_ciphers</option></entry>
27618 <entry>Use: <emphasis>main</emphasis></entry>
27619 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27620 <entry>Default: <emphasis>unset</emphasis></entry>
27621 </row>
27622 </tbody>
27623 </tgroup>
27624 </informaltable>
27625 <para>
27626 <indexterm role="concept">
27627 <primary>TLS</primary>
27628 <secondary>requiring specific ciphers</secondary>
27629 </indexterm>
27630 <indexterm role="concept">
27631 <primary>cipher</primary>
27632 <secondary>requiring specific</secondary>
27633 </indexterm>
27634 This option controls which ciphers can be used for incoming TLS connections.
27635 The <command>smtp</command> transport has an option of the same name for controlling outgoing
27636 connections. This option is expanded for each connection, so can be varied for
27637 different clients if required. The value of this option must be a list of
27638 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
27639 in somewhat different ways. If GnuTLS is being used, the client controls the
27640 preference order of the available ciphers. Details are given in sections
27641 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
27642 </para>
27643 <para>
27644 <indexterm role="option">
27645 <primary><option>tls_try_verify_hosts</option></primary>
27646 </indexterm>
27647 </para>
27648 <informaltable frame="all">
27649 <tgroup cols="4" colsep="0" rowsep="0">
27650 <colspec colwidth="8*" align="left"/>
27651 <colspec colwidth="6*" align="center"/>
27652 <colspec colwidth="6*" align="center"/>
27653 <colspec colwidth="6*" align="right"/>
27654 <tbody>
27655 <row>
27656 <entry><option>tls_try_verify_hosts</option></entry>
27657 <entry>Use: <emphasis>main</emphasis></entry>
27658 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27659 <entry>Default: <emphasis>unset</emphasis></entry>
27660 </row>
27661 </tbody>
27662 </tgroup>
27663 </informaltable>
27664 <para>
27665 <indexterm role="concept">
27666 <primary>TLS</primary>
27667 <secondary>client certificate verification</secondary>
27668 </indexterm>
27669 <indexterm role="concept">
27670 <primary>certificate</primary>
27671 <secondary>verification of client</secondary>
27672 </indexterm>
27673 See <option>tls_verify_hosts</option> below.
27674 </para>
27675 <para>
27676 <indexterm role="option">
27677 <primary><option>tls_verify_certificates</option></primary>
27678 </indexterm>
27679 </para>
27680 <informaltable frame="all">
27681 <tgroup cols="4" colsep="0" rowsep="0">
27682 <colspec colwidth="8*" align="left"/>
27683 <colspec colwidth="6*" align="center"/>
27684 <colspec colwidth="6*" align="center"/>
27685 <colspec colwidth="6*" align="right"/>
27686 <tbody>
27687 <row>
27688 <entry><option>tls_verify_certificates</option></entry>
27689 <entry>Use: <emphasis>main</emphasis></entry>
27690 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27691 <entry>Default: <emphasis>unset</emphasis></entry>
27692 </row>
27693 </tbody>
27694 </tgroup>
27695 </informaltable>
27696 <para>
27697 <indexterm role="concept">
27698 <primary>TLS</primary>
27699 <secondary>client certificate verification</secondary>
27700 </indexterm>
27701 <indexterm role="concept">
27702 <primary>certificate</primary>
27703 <secondary>verification of client</secondary>
27704 </indexterm>
27705 The value of this option is expanded, and must then be the absolute path to
27706 a file containing permitted certificates for clients that
27707 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
27708 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
27709 directory containing certificate files. This does not work with GnuTLS; the
27710 option must be set to the name of a single file if you are using GnuTLS.
27711 </para>
27712 <para>
27713 <indexterm role="option">
27714 <primary><option>tls_verify_hosts</option></primary>
27715 </indexterm>
27716 </para>
27717 <informaltable frame="all">
27718 <tgroup cols="4" colsep="0" rowsep="0">
27719 <colspec colwidth="8*" align="left"/>
27720 <colspec colwidth="6*" align="center"/>
27721 <colspec colwidth="6*" align="center"/>
27722 <colspec colwidth="6*" align="right"/>
27723 <tbody>
27724 <row>
27725 <entry><option>tls_verify_hosts</option></entry>
27726 <entry>Use: <emphasis>main</emphasis></entry>
27727 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27728 <entry>Default: <emphasis>unset</emphasis></entry>
27729 </row>
27730 </tbody>
27731 </tgroup>
27732 </informaltable>
27733 <para>
27734 <indexterm role="concept">
27735 <primary>TLS</primary>
27736 <secondary>client certificate verification</secondary>
27737 </indexterm>
27738 <indexterm role="concept">
27739 <primary>certificate</primary>
27740 <secondary>verification of client</secondary>
27741 </indexterm>
27742 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
27743 certificates from clients.
27744 The expected certificates are defined by <option>tls_verify_certificates</option>, which
27745 must be set. A configuration error occurs if either <option>tls_verify_hosts</option> or
27746 <option>tls_try_verify_hosts</option> is set and <option>tls_verify_certificates</option> is not set.
27747 </para>
27748 <para>
27749 Any client that matches <option>tls_verify_hosts</option> is constrained by
27750 <option>tls_verify_certificates</option>. The client must present one of the listed
27751 certificates. If it does not, the connection is aborted.
27752 </para>
27753 <para>
27754 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
27755 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
27756 certificate and checks it against <option>tls_verify_certificates</option>, but does not
27757 abort the connection if there is no certificate or if it does not match. This
27758 state can be detected in an ACL, which makes it possible to implement policies
27759 such as <quote>accept for relay only if a verified certificate has been received,
27760 but accept for local delivery if encrypted, even without a verified
27761 certificate</quote>.
27762 </para>
27763 <para>
27764 Client hosts that match neither of these lists are not asked to present
27765 certificates.
27766 </para>
27767 <para>
27768 <indexterm role="option">
27769 <primary><option>trusted_groups</option></primary>
27770 </indexterm>
27771 </para>
27772 <informaltable frame="all">
27773 <tgroup cols="4" colsep="0" rowsep="0">
27774 <colspec colwidth="8*" align="left"/>
27775 <colspec colwidth="6*" align="center"/>
27776 <colspec colwidth="6*" align="center"/>
27777 <colspec colwidth="6*" align="right"/>
27778 <tbody>
27779 <row>
27780 <entry><option>trusted_groups</option></entry>
27781 <entry>Use: <emphasis>main</emphasis></entry>
27782 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27783 <entry>Default: <emphasis>unset</emphasis></entry>
27784 </row>
27785 </tbody>
27786 </tgroup>
27787 </informaltable>
27788 <para>
27789 <indexterm role="concept">
27790 <primary>trusted groups</primary>
27791 </indexterm>
27792 <indexterm role="concept">
27793 <primary>groups</primary>
27794 <secondary>trusted</secondary>
27795 </indexterm>
27796 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
27797 option is set, any process that is running in one of the listed groups, or
27798 which has one of them as a supplementary group, is trusted. The groups can be
27799 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
27800 details of what trusted callers are permitted to do. If neither
27801 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
27802 are trusted.
27803 </para>
27804 <para>
27805 <indexterm role="option">
27806 <primary><option>trusted_users</option></primary>
27807 </indexterm>
27808 </para>
27809 <informaltable frame="all">
27810 <tgroup cols="4" colsep="0" rowsep="0">
27811 <colspec colwidth="8*" align="left"/>
27812 <colspec colwidth="6*" align="center"/>
27813 <colspec colwidth="6*" align="center"/>
27814 <colspec colwidth="6*" align="right"/>
27815 <tbody>
27816 <row>
27817 <entry><option>trusted_users</option></entry>
27818 <entry>Use: <emphasis>main</emphasis></entry>
27819 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27820 <entry>Default: <emphasis>unset</emphasis></entry>
27821 </row>
27822 </tbody>
27823 </tgroup>
27824 </informaltable>
27825 <para>
27826 <indexterm role="concept">
27827 <primary>trusted users</primary>
27828 </indexterm>
27829 <indexterm role="concept">
27830 <primary>user</primary>
27831 <secondary>trusted</secondary>
27832 </indexterm>
27833 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
27834 option is set, any process that is running as one of the listed users is
27835 trusted. The users can be specified numerically or by name. See section
27836 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
27837 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
27838 Exim user are trusted.
27839 </para>
27840 <para>
27841 <indexterm role="option">
27842 <primary><option>unknown_login</option></primary>
27843 </indexterm>
27844 </para>
27845 <informaltable frame="all">
27846 <tgroup cols="4" colsep="0" rowsep="0">
27847 <colspec colwidth="8*" align="left"/>
27848 <colspec colwidth="6*" align="center"/>
27849 <colspec colwidth="6*" align="center"/>
27850 <colspec colwidth="6*" align="right"/>
27851 <tbody>
27852 <row>
27853 <entry><option>unknown_login</option></entry>
27854 <entry>Use: <emphasis>main</emphasis></entry>
27855 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27856 <entry>Default: <emphasis>unset</emphasis></entry>
27857 </row>
27858 </tbody>
27859 </tgroup>
27860 </informaltable>
27861 <para>
27862 <indexterm role="concept">
27863 <primary>uid (user id)</primary>
27864 <secondary>unknown caller</secondary>
27865 </indexterm>
27866 <indexterm role="variable">
27867 <primary><varname>$caller_uid</varname></primary>
27868 </indexterm>
27869 This is a specialized feature for use in unusual configurations. By default, if
27870 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
27871 gives up. The <option>unknown_login</option> option can be used to set a login name to be
27872 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
27873 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
27874 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
27875 <option>-F</option> option.
27876 </para>
27877 <para>
27878 <indexterm role="option">
27879 <primary><option>unknown_username</option></primary>
27880 </indexterm>
27881 </para>
27882 <informaltable frame="all">
27883 <tgroup cols="4" colsep="0" rowsep="0">
27884 <colspec colwidth="8*" align="left"/>
27885 <colspec colwidth="6*" align="center"/>
27886 <colspec colwidth="6*" align="center"/>
27887 <colspec colwidth="6*" align="right"/>
27888 <tbody>
27889 <row>
27890 <entry><option>unknown_username</option></entry>
27891 <entry>Use: <emphasis>main</emphasis></entry>
27892 <entry>Type: <emphasis>string</emphasis></entry>
27893 <entry>Default: <emphasis>unset</emphasis></entry>
27894 </row>
27895 </tbody>
27896 </tgroup>
27897 </informaltable>
27898 <para>
27899 See <option>unknown_login</option>.
27900 </para>
27901 <para>
27902 <indexterm role="option">
27903 <primary><option>untrusted_set_sender</option></primary>
27904 </indexterm>
27905 </para>
27906 <informaltable frame="all">
27907 <tgroup cols="4" colsep="0" rowsep="0">
27908 <colspec colwidth="8*" align="left"/>
27909 <colspec colwidth="6*" align="center"/>
27910 <colspec colwidth="6*" align="center"/>
27911 <colspec colwidth="6*" align="right"/>
27912 <tbody>
27913 <row>
27914 <entry><option>untrusted_set_sender</option></entry>
27915 <entry>Use: <emphasis>main</emphasis></entry>
27916 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
27917 <entry>Default: <emphasis>unset</emphasis></entry>
27918 </row>
27919 </tbody>
27920 </tgroup>
27921 </informaltable>
27922 <para>
27923 <indexterm role="concept">
27924 <primary>trusted users</primary>
27925 </indexterm>
27926 <indexterm role="concept">
27927 <primary>sender</primary>
27928 <secondary>setting by untrusted user</secondary>
27929 </indexterm>
27930 <indexterm role="concept">
27931 <primary>untrusted user setting sender</primary>
27932 </indexterm>
27933 <indexterm role="concept">
27934 <primary>user</primary>
27935 <secondary>untrusted setting sender</secondary>
27936 </indexterm>
27937 <indexterm role="concept">
27938 <primary>envelope sender</primary>
27939 </indexterm>
27940 When an untrusted user submits a message to Exim using the standard input, Exim
27941 normally creates an envelope sender address from the user&#x2019;s login and the
27942 default qualification domain. Data from the <option>-f</option> option (for setting envelope
27943 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
27944 is used) is ignored.
27945 </para>
27946 <para>
27947 However, untrusted users are permitted to set an empty envelope sender address,
27948 to declare that a message should never generate any bounces. For example:
27949 </para>
27950 <literallayout class="monospaced">
27951 exim -f '&lt;&gt;' user@domain.example
27952 </literallayout>
27953 <para>
27954 <indexterm role="variable">
27955 <primary><varname>$sender_ident</varname></primary>
27956 </indexterm>
27957 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
27958 other envelope sender addresses in a controlled way. When it is set, untrusted
27959 users are allowed to set envelope sender addresses that match any of the
27960 patterns in the list. Like all address lists, the string is expanded. The
27961 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
27962 users to setting senders that start with their login ids
27963 followed by a hyphen
27964 by a setting like this:
27965 </para>
27966 <literallayout class="monospaced">
27967 untrusted_set_sender = ^$sender_ident-
27968 </literallayout>
27969 <para>
27970 If you want to allow untrusted users to set envelope sender addresses without
27971 restriction, you can use
27972 </para>
27973 <literallayout class="monospaced">
27974 untrusted_set_sender = *
27975 </literallayout>
27976 <para>
27977 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
27978 only to the setting of the envelope sender. It does not permit untrusted users
27979 to use the other options which trusted user can use to override message
27980 parameters. Furthermore, it does not stop Exim from removing an existing
27981 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
27982 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
27983 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
27984 described in section <xref linkend="SECTthesenhea"/>.
27985 </para>
27986 <para>
27987 The log line for a message&#x2019;s arrival shows the envelope sender following
27988 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
27989 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
27990 envelope sender address, the user&#x2019;s login is shown in parentheses after the
27991 sender address.
27992 </para>
27993 <para>
27994 <indexterm role="option">
27995 <primary><option>uucp_from_pattern</option></primary>
27996 </indexterm>
27997 </para>
27998 <informaltable frame="all">
27999 <tgroup cols="4" colsep="0" rowsep="0">
28000 <colspec colwidth="8*" align="left"/>
28001 <colspec colwidth="6*" align="center"/>
28002 <colspec colwidth="6*" align="center"/>
28003 <colspec colwidth="6*" align="right"/>
28004 <tbody>
28005 <row>
28006 <entry><option>uucp_from_pattern</option></entry>
28007 <entry>Use: <emphasis>main</emphasis></entry>
28008 <entry>Type: <emphasis>string</emphasis></entry>
28009 <entry>Default: <emphasis>see below</emphasis></entry>
28010 </row>
28011 </tbody>
28012 </tgroup>
28013 </informaltable>
28014 <para>
28015 <indexterm role="concept">
28016 <primary><quote>From</quote> line</primary>
28017 </indexterm>
28018 <indexterm role="concept">
28019 <primary>UUCP</primary>
28020 <secondary><quote>From</quote> line</secondary>
28021 </indexterm>
28022 Some applications that pass messages to an MTA via a command line interface use
28023 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
28024 particular, this is used by UUCP software. Exim recognizes such a line by means
28025 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
28026 matches, the sender address is constructed by expanding the contents of
28027 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
28028 default pattern recognizes lines in the following two forms:
28029 </para>
28030 <literallayout class="monospaced">
28031 From ph10 Fri Jan  5 12:35 GMT 1996
28032 From ph10 Fri, 7 Jan 97 14:00:00 GMT
28033 </literallayout>
28034 <para>
28035 The pattern can be seen by running
28036 </para>
28037 <literallayout class="monospaced">
28038 exim -bP uucp_from_pattern
28039 </literallayout>
28040 <para>
28041 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
28042 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
28043 regular expression by a parenthesized subpattern. The default value for
28044 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
28045 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
28046 <option>ignore_fromline_hosts</option>.
28047 </para>
28048 <para>
28049 <indexterm role="option">
28050 <primary><option>uucp_from_sender</option></primary>
28051 </indexterm>
28052 </para>
28053 <informaltable frame="all">
28054 <tgroup cols="4" colsep="0" rowsep="0">
28055 <colspec colwidth="8*" align="left"/>
28056 <colspec colwidth="6*" align="center"/>
28057 <colspec colwidth="6*" align="center"/>
28058 <colspec colwidth="6*" align="right"/>
28059 <tbody>
28060 <row>
28061 <entry><option>uucp_from_sender</option></entry>
28062 <entry>Use: <emphasis>main</emphasis></entry>
28063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28064 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
28065 </row>
28066 </tbody>
28067 </tgroup>
28068 </informaltable>
28069 <para>
28070 See <option>uucp_from_pattern</option> above.
28071 </para>
28072 <para>
28073 <indexterm role="option">
28074 <primary><option>warn_message_file</option></primary>
28075 </indexterm>
28076 </para>
28077 <informaltable frame="all">
28078 <tgroup cols="4" colsep="0" rowsep="0">
28079 <colspec colwidth="8*" align="left"/>
28080 <colspec colwidth="6*" align="center"/>
28081 <colspec colwidth="6*" align="center"/>
28082 <colspec colwidth="6*" align="right"/>
28083 <tbody>
28084 <row>
28085 <entry><option>warn_message_file</option></entry>
28086 <entry>Use: <emphasis>main</emphasis></entry>
28087 <entry>Type: <emphasis>string</emphasis></entry>
28088 <entry>Default: <emphasis>unset</emphasis></entry>
28089 </row>
28090 </tbody>
28091 </tgroup>
28092 </informaltable>
28093 <para>
28094 <indexterm role="concept">
28095 <primary>warning of delay</primary>
28096 <secondary>customizing the message</secondary>
28097 </indexterm>
28098 <indexterm role="concept">
28099 <primary>customizing</primary>
28100 <secondary>warning message</secondary>
28101 </indexterm>
28102 This option defines a template file containing paragraphs of text to be used
28103 for constructing the warning message which is sent by Exim when a message has
28104 been on the queue for a specified amount of time, as specified by
28105 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
28106 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
28107 </para>
28108 <para>
28109 <indexterm role="option">
28110 <primary><option>write_rejectlog</option></primary>
28111 </indexterm>
28112 </para>
28113 <informaltable frame="all">
28114 <tgroup cols="4" colsep="0" rowsep="0">
28115 <colspec colwidth="8*" align="left"/>
28116 <colspec colwidth="6*" align="center"/>
28117 <colspec colwidth="6*" align="center"/>
28118 <colspec colwidth="6*" align="right"/>
28119 <tbody>
28120 <row>
28121 <entry><option>write_rejectlog</option></entry>
28122 <entry>Use: <emphasis>main</emphasis></entry>
28123 <entry>Type: <emphasis>boolean</emphasis></entry>
28124 <entry>Default: <emphasis>true</emphasis></entry>
28125 </row>
28126 </tbody>
28127 </tgroup>
28128 </informaltable>
28129 <para>
28130 <indexterm role="concept">
28131 <primary>reject log</primary>
28132 <secondary>disabling</secondary>
28133 </indexterm>
28134 If this option is set false, Exim no longer writes anything to the reject log.
28135 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
28136 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
28137 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
28138 </para>
28139 </section>
28140 </chapter>
28141
28142 <chapter id="CHAProutergeneric">
28143 <title>Generic options for routers</title>
28144 <para>
28145 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
28146 <primary>options</primary>
28147 <secondary>generic; for routers</secondary>
28148 </indexterm>
28149 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
28150 <primary>generic options</primary>
28151 <secondary>router</secondary>
28152 </indexterm>
28153 This chapter describes the generic options that apply to all routers.
28154 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
28155 </para>
28156 <para>
28157 For a general description of how a router operates, see sections
28158 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
28159 which the preconditions are tested. The order of expansion of the options that
28160 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
28161 <option>headers_remove</option>, <option>transport</option>.
28162 </para>
28163 <para>
28164 <indexterm role="option">
28165 <primary><option>address_data</option></primary>
28166 </indexterm>
28167 </para>
28168 <informaltable frame="all">
28169 <tgroup cols="4" colsep="0" rowsep="0">
28170 <colspec colwidth="8*" align="left"/>
28171 <colspec colwidth="6*" align="center"/>
28172 <colspec colwidth="6*" align="center"/>
28173 <colspec colwidth="6*" align="right"/>
28174 <tbody>
28175 <row>
28176 <entry><option>address_data</option></entry>
28177 <entry>Use: <emphasis>routers</emphasis></entry>
28178 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28179 <entry>Default: <emphasis>unset</emphasis></entry>
28180 </row>
28181 </tbody>
28182 </tgroup>
28183 </informaltable>
28184 <para>
28185 <indexterm role="concept">
28186 <primary>router</primary>
28187 <secondary>data attached to address</secondary>
28188 </indexterm>
28189 The string is expanded just before the router is run, that is, after all the
28190 precondition tests have succeeded. If the expansion is forced to fail, the
28191 router declines, the value of <option>address_data</option> remains unchanged, and the
28192 <option>more</option> option controls what happens next. Other expansion failures cause
28193 delivery of the address to be deferred.
28194 </para>
28195 <para>
28196 <indexterm role="variable">
28197 <primary><varname>$address_data</varname></primary>
28198 </indexterm>
28199 When the expansion succeeds, the value is retained with the address, and can be
28200 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
28201 routers, and the eventual transport.
28202 </para>
28203 <para>
28204 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
28205 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
28206 in the filter. This is not normally a problem, because such data is usually
28207 either not confidential or it <quote>belongs</quote> to the current user, but if you do
28208 put confidential data into <varname>$address_data</varname> you need to remember this point.
28209 </para>
28210 <para>
28211 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
28212 with the address, though it can be changed by another <option>address_data</option> setting
28213 on a subsequent router. If a router generates child addresses, the value of
28214 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
28215 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
28216 </para>
28217 <para>
28218 The idea of <option>address_data</option> is that you can use it to look up a lot of data
28219 for the address once, and then pick out parts of the data later. For example,
28220 you could use a single LDAP lookup to return a string of the form
28221 </para>
28222 <literallayout class="monospaced">
28223 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
28224 </literallayout>
28225 <para>
28226 In the transport you could pick out the mailbox by a setting such as
28227 </para>
28228 <literallayout class="monospaced">
28229 file = ${extract{mailbox}{$address_data}}
28230 </literallayout>
28231 <para>
28232 This makes the configuration file less messy, and also reduces the number of
28233 lookups (though Exim does cache lookups).
28234 </para>
28235 <para>
28236 The <option>address_data</option> facility is also useful as a means of passing information
28237 from one router to another, and from a router to a transport. In addition, if
28238 </para>
28239 <para>
28240 <indexterm role="variable">
28241 <primary><varname>$sender_address_data</varname></primary>
28242 </indexterm>
28243 <indexterm role="variable">
28244 <primary><varname>$address_data</varname></primary>
28245 </indexterm>
28246 When <varname>$address_data</varname> is set by a router when verifying a recipient address
28247 from an ACL, it remains available for use in the rest of the ACL statement.
28248 After verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
28249 </para>
28250 <para>
28251 <indexterm role="option">
28252 <primary><option>address_test</option></primary>
28253 </indexterm>
28254 </para>
28255 <informaltable frame="all">
28256 <tgroup cols="4" colsep="0" rowsep="0">
28257 <colspec colwidth="8*" align="left"/>
28258 <colspec colwidth="6*" align="center"/>
28259 <colspec colwidth="6*" align="center"/>
28260 <colspec colwidth="6*" align="right"/>
28261 <tbody>
28262 <row>
28263 <entry><option>address_test</option></entry>
28264 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28265 <entry>Type: <emphasis>boolean</emphasis></entry>
28266 <entry>Default: <emphasis>true</emphasis></entry>
28267 </row>
28268 </tbody>
28269 </tgroup>
28270 </informaltable>
28271 <para>
28272 <indexterm role="option">
28273 <primary><option>-bt</option></primary>
28274 </indexterm>
28275 <indexterm role="concept">
28276 <primary>router</primary>
28277 <secondary>skipping when address testing</secondary>
28278 </indexterm>
28279 If this option is set false, the router is skipped when routing is being tested
28280 by means of the <option>-bt</option> command line option. This can be a convenience when
28281 your first router sends messages to an external scanner, because it saves you
28282 having to set the <quote>already scanned</quote> indicator when testing real address
28283 routing.
28284 </para>
28285 <para>
28286 <indexterm role="option">
28287 <primary><option>cannot_route_message</option></primary>
28288 </indexterm>
28289 </para>
28290 <informaltable frame="all">
28291 <tgroup cols="4" colsep="0" rowsep="0">
28292 <colspec colwidth="8*" align="left"/>
28293 <colspec colwidth="6*" align="center"/>
28294 <colspec colwidth="6*" align="center"/>
28295 <colspec colwidth="6*" align="right"/>
28296 <tbody>
28297 <row>
28298 <entry><option>cannot_route_message</option></entry>
28299 <entry>Use: <emphasis>routers</emphasis></entry>
28300 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28301 <entry>Default: <emphasis>unset</emphasis></entry>
28302 </row>
28303 </tbody>
28304 </tgroup>
28305 </informaltable>
28306 <para>
28307 <indexterm role="concept">
28308 <primary>router</primary>
28309 <secondary>customizing <quote>cannot route</quote> message</secondary>
28310 </indexterm>
28311 <indexterm role="concept">
28312 <primary>customizing</primary>
28313 <secondary><quote>cannot route</quote> message</secondary>
28314 </indexterm>
28315 This option specifies a text message that is used when an address cannot be
28316 routed because Exim has run out of routers. The default message is
28317 <quote>Unrouteable address</quote>. This option is useful only on routers that have
28318 <option>more</option> set false, or on the very last router in a configuration, because the
28319 value that is used is taken from the last router that is considered. This
28320 includes a router that is skipped because its preconditions are not met, as
28321 well as a router that declines. For example, using the default configuration,
28322 you could put:
28323 </para>
28324 <literallayout class="monospaced">
28325 cannot_route_message = Remote domain not found in DNS
28326 </literallayout>
28327 <para>
28328 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
28329 and
28330 </para>
28331 <literallayout class="monospaced">
28332 cannot_route_message = Unknown local user
28333 </literallayout>
28334 <para>
28335 on the final router that checks for local users. If string expansion fails for
28336 this option, the default message is used. Unless the expansion failure was
28337 explicitly forced, a message about the failure is written to the main and panic
28338 logs, in addition to the normal message about the routing failure.
28339 </para>
28340 <para>
28341 <indexterm role="option">
28342 <primary><option>caseful_local_part</option></primary>
28343 </indexterm>
28344 </para>
28345 <informaltable frame="all">
28346 <tgroup cols="4" colsep="0" rowsep="0">
28347 <colspec colwidth="8*" align="left"/>
28348 <colspec colwidth="6*" align="center"/>
28349 <colspec colwidth="6*" align="center"/>
28350 <colspec colwidth="6*" align="right"/>
28351 <tbody>
28352 <row>
28353 <entry><option>caseful_local_part</option></entry>
28354 <entry>Use: <emphasis>routers</emphasis></entry>
28355 <entry>Type: <emphasis>boolean</emphasis></entry>
28356 <entry>Default: <emphasis>false</emphasis></entry>
28357 </row>
28358 </tbody>
28359 </tgroup>
28360 </informaltable>
28361 <para>
28362 <indexterm role="concept">
28363 <primary>case of local parts</primary>
28364 </indexterm>
28365 <indexterm role="concept">
28366 <primary>router</primary>
28367 <secondary>case of local parts</secondary>
28368 </indexterm>
28369 By default, routers handle the local parts of addresses in a case-insensitive
28370 manner, though the actual case is preserved for transmission with the message.
28371 If you want the case of letters to be significant in a router, you must set
28372 this option true. For individual router options that contain address or local
28373 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
28374 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
28375 more details.
28376 </para>
28377 <para>
28378 <indexterm role="variable">
28379 <primary><varname>$local_part</varname></primary>
28380 </indexterm>
28381 <indexterm role="variable">
28382 <primary><varname>$original_local_part</varname></primary>
28383 </indexterm>
28384 <indexterm role="variable">
28385 <primary><varname>$parent_local_part</varname></primary>
28386 </indexterm>
28387 The value of the <varname>$local_part</varname> variable is forced to lower case while a
28388 router is running unless <option>caseful_local_part</option> is set. When a router assigns
28389 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
28390 is the same as it was in the router. Similarly, when a router generates child
28391 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
28392 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
28393 </para>
28394 <para>
28395 This option applies to the processing of an address by a router. When a
28396 recipient address is being processed in an ACL, there is a separate <option>control</option>
28397 modifier that can be used to specify case-sensitive processing within the ACL
28398 (see section <xref linkend="SECTcontrols"/>).
28399 </para>
28400 <para>
28401 <indexterm role="option">
28402 <primary><option>check_local_user</option></primary>
28403 </indexterm>
28404 </para>
28405 <informaltable frame="all">
28406 <tgroup cols="4" colsep="0" rowsep="0">
28407 <colspec colwidth="8*" align="left"/>
28408 <colspec colwidth="6*" align="center"/>
28409 <colspec colwidth="6*" align="center"/>
28410 <colspec colwidth="6*" align="right"/>
28411 <tbody>
28412 <row>
28413 <entry><option>check_local_user</option></entry>
28414 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28415 <entry>Type: <emphasis>boolean</emphasis></entry>
28416 <entry>Default: <emphasis>false</emphasis></entry>
28417 </row>
28418 </tbody>
28419 </tgroup>
28420 </informaltable>
28421 <para>
28422 <indexterm role="concept">
28423 <primary>local user, checking in router</primary>
28424 </indexterm>
28425 <indexterm role="concept">
28426 <primary>router</primary>
28427 <secondary>checking for local user</secondary>
28428 </indexterm>
28429 <indexterm role="concept">
28430 <primary><filename>/etc/passwd</filename></primary>
28431 </indexterm>
28432 <indexterm role="variable">
28433 <primary><varname>$home</varname></primary>
28434 </indexterm>
28435 When this option is true, Exim checks that the local part of the recipient
28436 address (with affixes removed if relevant) is the name of an account on the
28437 local system. The check is done by calling the <function>getpwnam()</function> function rather
28438 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
28439 holding password data (such as NIS) are supported. If the local part is a local
28440 user, <varname>$home</varname> is set from the password data, and can be tested in other
28441 preconditions that are evaluated after this one (the order of evaluation is
28442 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
28443 overridden by <option>router_home_directory</option>. If the local part is not a local user,
28444 the router is skipped.
28445 </para>
28446 <para>
28447 If you want to check that the local part is either the name of a local user
28448 or matches something else, you cannot combine <option>check_local_user</option> with a
28449 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
28450 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
28451 setting to achieve this. For example:
28452 </para>
28453 <literallayout class="monospaced">
28454 local_parts = passwd;$local_part : lsearch;/etc/other/users
28455 </literallayout>
28456 <para>
28457 Note, however, that the side effects of <option>check_local_user</option> (such as setting
28458 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
28459 <option>local_parts</option> (or any other) precondition.
28460 </para>
28461 <para>
28462 <indexterm role="option">
28463 <primary><option>condition</option></primary>
28464 </indexterm>
28465 </para>
28466 <informaltable frame="all">
28467 <tgroup cols="4" colsep="0" rowsep="0">
28468 <colspec colwidth="8*" align="left"/>
28469 <colspec colwidth="6*" align="center"/>
28470 <colspec colwidth="6*" align="center"/>
28471 <colspec colwidth="6*" align="right"/>
28472 <tbody>
28473 <row>
28474 <entry><option>condition</option></entry>
28475 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28476 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28477 <entry>Default: <emphasis>unset</emphasis></entry>
28478 </row>
28479 </tbody>
28480 </tgroup>
28481 </informaltable>
28482 <para>
28483 <indexterm role="concept">
28484 <primary>router</primary>
28485 <secondary>customized precondition</secondary>
28486 </indexterm>
28487 This option specifies a general precondition test that has to succeed for the
28488 router to be called. The <option>condition</option> option is the last precondition to be
28489 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
28490 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
28491 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
28492 router is skipped, and the address is offered to the next one.
28493 </para>
28494 <para>
28495 If the result is any other value, the router is run (as this is the last
28496 precondition to be evaluated, all the other preconditions must be true).
28497 </para>
28498 <para>
28499 The <option>condition</option> option provides a means of applying custom conditions to the
28500 running of routers. Note that in the case of a simple conditional expansion,
28501 the default expansion values are exactly what is wanted. For example:
28502 </para>
28503 <literallayout class="monospaced">
28504 condition = ${if &gt;{$message_age}{600}}
28505 </literallayout>
28506 <para>
28507 Because of the default behaviour of the string expansion, this is equivalent to
28508 </para>
28509 <literallayout class="monospaced">
28510 condition = ${if &gt;{$message_age}{600}{true}{}}
28511 </literallayout>
28512 <para>
28513 If the expansion fails (other than forced failure) delivery is deferred. Some
28514 of the other precondition options are common special cases that could in fact
28515 be specified using <option>condition</option>.
28516 </para>
28517 <para>
28518 <indexterm role="option">
28519 <primary><option>debug_print</option></primary>
28520 </indexterm>
28521 </para>
28522 <informaltable frame="all">
28523 <tgroup cols="4" colsep="0" rowsep="0">
28524 <colspec colwidth="8*" align="left"/>
28525 <colspec colwidth="6*" align="center"/>
28526 <colspec colwidth="6*" align="center"/>
28527 <colspec colwidth="6*" align="right"/>
28528 <tbody>
28529 <row>
28530 <entry><option>debug_print</option></entry>
28531 <entry>Use: <emphasis>routers</emphasis></entry>
28532 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28533 <entry>Default: <emphasis>unset</emphasis></entry>
28534 </row>
28535 </tbody>
28536 </tgroup>
28537 </informaltable>
28538 <para>
28539 <indexterm role="concept">
28540 <primary>testing</primary>
28541 <secondary>variables in drivers</secondary>
28542 </indexterm>
28543 If this option is set and debugging is enabled (see the <option>-d</option> command line
28544 option), the string is expanded and included in the debugging output.
28545 If expansion of the string fails, the error message is written to the debugging
28546 output, and Exim carries on processing.
28547 This option is provided to help with checking out the values of variables and
28548 so on when debugging router configurations. For example, if a <option>condition</option>
28549 option appears not to be working, <option>debug_print</option> can be used to output the
28550 variables it references. The output happens after checks for <option>domains</option>,
28551 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
28552 are tested. A newline is added to the text if it does not end with one.
28553 </para>
28554 <para>
28555 <indexterm role="option">
28556 <primary><option>disable_logging</option></primary>
28557 </indexterm>
28558 </para>
28559 <informaltable frame="all">
28560 <tgroup cols="4" colsep="0" rowsep="0">
28561 <colspec colwidth="8*" align="left"/>
28562 <colspec colwidth="6*" align="center"/>
28563 <colspec colwidth="6*" align="center"/>
28564 <colspec colwidth="6*" align="right"/>
28565 <tbody>
28566 <row>
28567 <entry><option>disable_logging</option></entry>
28568 <entry>Use: <emphasis>routers</emphasis></entry>
28569 <entry>Type: <emphasis>boolean</emphasis></entry>
28570 <entry>Default: <emphasis>false</emphasis></entry>
28571 </row>
28572 </tbody>
28573 </tgroup>
28574 </informaltable>
28575 <para>
28576 If this option is set true, nothing is logged for any routing errors
28577 or for any deliveries caused by this router. You should not set this option
28578 unless you really, really know what you are doing. See also the generic
28579 transport option of the same name.
28580 </para>
28581 <para>
28582 <indexterm role="option">
28583 <primary><option>domains</option></primary>
28584 </indexterm>
28585 </para>
28586 <informaltable frame="all">
28587 <tgroup cols="4" colsep="0" rowsep="0">
28588 <colspec colwidth="8*" align="left"/>
28589 <colspec colwidth="6*" align="center"/>
28590 <colspec colwidth="6*" align="center"/>
28591 <colspec colwidth="6*" align="right"/>
28592 <tbody>
28593 <row>
28594 <entry><option>domains</option></entry>
28595 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28596 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28597 <entry>Default: <emphasis>unset</emphasis></entry>
28598 </row>
28599 </tbody>
28600 </tgroup>
28601 </informaltable>
28602 <para>
28603 <indexterm role="concept">
28604 <primary>router</primary>
28605 <secondary>restricting to specific domains</secondary>
28606 </indexterm>
28607 <indexterm role="variable">
28608 <primary><varname>$domain_data</varname></primary>
28609 </indexterm>
28610 If this option is set, the router is skipped unless the current domain matches
28611 the list. If the match is achieved by means of a file lookup, the data that the
28612 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
28613 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
28614 a list of the order in which preconditions are evaluated.
28615 </para>
28616 <para>
28617 <indexterm role="option">
28618 <primary><option>driver</option></primary>
28619 </indexterm>
28620 </para>
28621 <informaltable frame="all">
28622 <tgroup cols="4" colsep="0" rowsep="0">
28623 <colspec colwidth="8*" align="left"/>
28624 <colspec colwidth="6*" align="center"/>
28625 <colspec colwidth="6*" align="center"/>
28626 <colspec colwidth="6*" align="right"/>
28627 <tbody>
28628 <row>
28629 <entry><option>driver</option></entry>
28630 <entry>Use: <emphasis>routers</emphasis></entry>
28631 <entry>Type: <emphasis>string</emphasis></entry>
28632 <entry>Default: <emphasis>unset</emphasis></entry>
28633 </row>
28634 </tbody>
28635 </tgroup>
28636 </informaltable>
28637 <para>
28638 This option must always be set. It specifies which of the available routers is
28639 to be used.
28640 </para>
28641 <para>
28642 <indexterm role="option">
28643 <primary><option>errors_to</option></primary>
28644 </indexterm>
28645 </para>
28646 <informaltable frame="all">
28647 <tgroup cols="4" colsep="0" rowsep="0">
28648 <colspec colwidth="8*" align="left"/>
28649 <colspec colwidth="6*" align="center"/>
28650 <colspec colwidth="6*" align="center"/>
28651 <colspec colwidth="6*" align="right"/>
28652 <tbody>
28653 <row>
28654 <entry><option>errors_to</option></entry>
28655 <entry>Use: <emphasis>routers</emphasis></entry>
28656 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28657 <entry>Default: <emphasis>unset</emphasis></entry>
28658 </row>
28659 </tbody>
28660 </tgroup>
28661 </informaltable>
28662 <para>
28663 <indexterm role="concept">
28664 <primary>envelope sender</primary>
28665 </indexterm>
28666 <indexterm role="concept">
28667 <primary>router</primary>
28668 <secondary>changing address for errors</secondary>
28669 </indexterm>
28670 If a router successfully handles an address, it may assign the address to a
28671 transport for delivery or it may generate child addresses. In both cases, if
28672 there is a delivery problem during later processing, the resulting bounce
28673 message is sent to the address that results from expanding this string,
28674 provided that the address verifies successfully. The <option>errors_to</option> option is
28675 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
28676 </para>
28677 <para>
28678 The <option>errors_to</option> setting associated with an address can be overridden if it
28679 subsequently passes through other routers that have their own <option>errors_to</option>
28680 settings, or if the message is delivered by a transport with a <option>return_path</option>
28681 setting.
28682 </para>
28683 <para>
28684 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
28685 the expansion fails to verify, the errors address associated with the incoming
28686 address is used. At top level, this is the envelope sender. A non-forced
28687 expansion failure causes delivery to be deferred.
28688 </para>
28689 <para>
28690 If an address for which <option>errors_to</option> has been set ends up being delivered over
28691 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
28692 any bounces that are generated by other MTAs on the delivery route are also
28693 sent there. You can set <option>errors_to</option> to the empty string by either of these
28694 settings:
28695 </para>
28696 <literallayout class="monospaced">
28697 errors_to =
28698 errors_to = ""
28699 </literallayout>
28700 <para>
28701 An expansion item that yields an empty string has the same effect. If you do
28702 this, a locally detected delivery error for addresses processed by this router
28703 no longer gives rise to a bounce message; the error is discarded. If the
28704 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
28705 overridden by the <option>return_path</option> option on the transport.
28706 </para>
28707 <para>
28708 <indexterm role="variable">
28709 <primary><varname>$address_data</varname></primary>
28710 </indexterm>
28711 If for some reason you want to discard local errors, but use a non-empty
28712 MAIL command for remote delivery, you can preserve the original return
28713 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
28714 setting <option>return_path</option>.
28715 </para>
28716 <para>
28717 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
28718 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
28719 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
28720 </para>
28721 <para>
28722 <indexterm role="option">
28723 <primary><option>expn</option></primary>
28724 </indexterm>
28725 </para>
28726 <informaltable frame="all">
28727 <tgroup cols="4" colsep="0" rowsep="0">
28728 <colspec colwidth="8*" align="left"/>
28729 <colspec colwidth="6*" align="center"/>
28730 <colspec colwidth="6*" align="center"/>
28731 <colspec colwidth="6*" align="right"/>
28732 <tbody>
28733 <row>
28734 <entry><option>expn</option></entry>
28735 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28736 <entry>Type: <emphasis>boolean</emphasis></entry>
28737 <entry>Default: <emphasis>true</emphasis></entry>
28738 </row>
28739 </tbody>
28740 </tgroup>
28741 </informaltable>
28742 <para>
28743 <indexterm role="concept">
28744 <primary>address</primary>
28745 <secondary>testing</secondary>
28746 </indexterm>
28747 <indexterm role="concept">
28748 <primary>testing</primary>
28749 <secondary>addresses</secondary>
28750 </indexterm>
28751 <indexterm role="concept">
28752 <primary>EXPN</primary>
28753 <secondary>router skipping</secondary>
28754 </indexterm>
28755 <indexterm role="concept">
28756 <primary>router</primary>
28757 <secondary>skipping for EXPN</secondary>
28758 </indexterm>
28759 If this option is turned off, the router is skipped when testing an address
28760 as a result of processing an SMTP EXPN command. You might, for example,
28761 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
28762 on for the system alias file.
28763 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28764 are evaluated.
28765 </para>
28766 <para>
28767 The use of the SMTP EXPN command is controlled by an ACL (see chapter
28768 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
28769 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
28770 </para>
28771 <para>
28772 <indexterm role="option">
28773 <primary><option>fail_verify</option></primary>
28774 </indexterm>
28775 </para>
28776 <informaltable frame="all">
28777 <tgroup cols="4" colsep="0" rowsep="0">
28778 <colspec colwidth="8*" align="left"/>
28779 <colspec colwidth="6*" align="center"/>
28780 <colspec colwidth="6*" align="center"/>
28781 <colspec colwidth="6*" align="right"/>
28782 <tbody>
28783 <row>
28784 <entry><option>fail_verify</option></entry>
28785 <entry>Use: <emphasis>routers</emphasis></entry>
28786 <entry>Type: <emphasis>boolean</emphasis></entry>
28787 <entry>Default: <emphasis>false</emphasis></entry>
28788 </row>
28789 </tbody>
28790 </tgroup>
28791 </informaltable>
28792 <para>
28793 <indexterm role="concept">
28794 <primary>router</primary>
28795 <secondary>forcing verification failure</secondary>
28796 </indexterm>
28797 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
28798 <option>fail_verify_recipient</option> to the same value.
28799 </para>
28800 <para>
28801 <indexterm role="option">
28802 <primary><option>fail_verify_recipient</option></primary>
28803 </indexterm>
28804 </para>
28805 <informaltable frame="all">
28806 <tgroup cols="4" colsep="0" rowsep="0">
28807 <colspec colwidth="8*" align="left"/>
28808 <colspec colwidth="6*" align="center"/>
28809 <colspec colwidth="6*" align="center"/>
28810 <colspec colwidth="6*" align="right"/>
28811 <tbody>
28812 <row>
28813 <entry><option>fail_verify_recipient</option></entry>
28814 <entry>Use: <emphasis>routers</emphasis></entry>
28815 <entry>Type: <emphasis>boolean</emphasis></entry>
28816 <entry>Default: <emphasis>false</emphasis></entry>
28817 </row>
28818 </tbody>
28819 </tgroup>
28820 </informaltable>
28821 <para>
28822 If this option is true and an address is accepted by this router when
28823 verifying a recipient, verification fails.
28824 </para>
28825 <para>
28826 <indexterm role="option">
28827 <primary><option>fail_verify_sender</option></primary>
28828 </indexterm>
28829 </para>
28830 <informaltable frame="all">
28831 <tgroup cols="4" colsep="0" rowsep="0">
28832 <colspec colwidth="8*" align="left"/>
28833 <colspec colwidth="6*" align="center"/>
28834 <colspec colwidth="6*" align="center"/>
28835 <colspec colwidth="6*" align="right"/>
28836 <tbody>
28837 <row>
28838 <entry><option>fail_verify_sender</option></entry>
28839 <entry>Use: <emphasis>routers</emphasis></entry>
28840 <entry>Type: <emphasis>boolean</emphasis></entry>
28841 <entry>Default: <emphasis>false</emphasis></entry>
28842 </row>
28843 </tbody>
28844 </tgroup>
28845 </informaltable>
28846 <para>
28847 If this option is true and an address is accepted by this router when
28848 verifying a sender, verification fails.
28849 </para>
28850 <para>
28851 <indexterm role="option">
28852 <primary><option>fallback_hosts</option></primary>
28853 </indexterm>
28854 </para>
28855 <informaltable frame="all">
28856 <tgroup cols="4" colsep="0" rowsep="0">
28857 <colspec colwidth="8*" align="left"/>
28858 <colspec colwidth="6*" align="center"/>
28859 <colspec colwidth="6*" align="center"/>
28860 <colspec colwidth="6*" align="right"/>
28861 <tbody>
28862 <row>
28863 <entry><option>fallback_hosts</option></entry>
28864 <entry>Use: <emphasis>routers</emphasis></entry>
28865 <entry>Type: <emphasis>string list</emphasis></entry>
28866 <entry>Default: <emphasis>unset</emphasis></entry>
28867 </row>
28868 </tbody>
28869 </tgroup>
28870 </informaltable>
28871 <para>
28872 <indexterm role="concept">
28873 <primary>router</primary>
28874 <secondary>fallback hosts</secondary>
28875 </indexterm>
28876 <indexterm role="concept">
28877 <primary>fallback</primary>
28878 <secondary>hosts specified on router</secondary>
28879 </indexterm>
28880 String expansion is not applied to this option. The argument must be a
28881 colon-separated list of host names or IP addresses. The list separator can be
28882 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
28883 each name or address. In fact, the format of each item is exactly the same as
28884 defined for the list of hosts in a <command>manualroute</command> router (see section
28885 <xref linkend="SECTformatonehostitem"/>).
28886 </para>
28887 <para>
28888 If a router queues an address for a remote transport, this host list is
28889 associated with the address, and used instead of the transport&#x2019;s fallback host
28890 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
28891 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
28892 transport for further details.
28893 </para>
28894 <para>
28895 <indexterm role="option">
28896 <primary><option>group</option></primary>
28897 </indexterm>
28898 </para>
28899 <informaltable frame="all">
28900 <tgroup cols="4" colsep="0" rowsep="0">
28901 <colspec colwidth="8*" align="left"/>
28902 <colspec colwidth="6*" align="center"/>
28903 <colspec colwidth="6*" align="center"/>
28904 <colspec colwidth="6*" align="right"/>
28905 <tbody>
28906 <row>
28907 <entry><option>group</option></entry>
28908 <entry>Use: <emphasis>routers</emphasis></entry>
28909 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28910 <entry>Default: <emphasis>see below</emphasis></entry>
28911 </row>
28912 </tbody>
28913 </tgroup>
28914 </informaltable>
28915 <para>
28916 <indexterm role="concept">
28917 <primary>gid (group id)</primary>
28918 <secondary>local delivery</secondary>
28919 </indexterm>
28920 <indexterm role="concept">
28921 <primary>local transports</primary>
28922 <secondary>uid and gid</secondary>
28923 </indexterm>
28924 <indexterm role="concept">
28925 <primary>transport</primary>
28926 <secondary>local</secondary>
28927 </indexterm>
28928 <indexterm role="concept">
28929 <primary>router</primary>
28930 <secondary>setting group</secondary>
28931 </indexterm>
28932 When a router queues an address for a transport, and the transport does not
28933 specify a group, the group given here is used when running the delivery
28934 process.
28935 The group may be specified numerically or by name. If expansion fails, the
28936 error is logged and delivery is deferred.
28937 The default is unset, unless <option>check_local_user</option> is set, when the default
28938 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
28939 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28940 </para>
28941 <para>
28942 <indexterm role="option">
28943 <primary><option>headers_add</option></primary>
28944 </indexterm>
28945 </para>
28946 <informaltable frame="all">
28947 <tgroup cols="4" colsep="0" rowsep="0">
28948 <colspec colwidth="8*" align="left"/>
28949 <colspec colwidth="6*" align="center"/>
28950 <colspec colwidth="6*" align="center"/>
28951 <colspec colwidth="6*" align="right"/>
28952 <tbody>
28953 <row>
28954 <entry><option>headers_add</option></entry>
28955 <entry>Use: <emphasis>routers</emphasis></entry>
28956 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28957 <entry>Default: <emphasis>unset</emphasis></entry>
28958 </row>
28959 </tbody>
28960 </tgroup>
28961 </informaltable>
28962 <para>
28963 <indexterm role="concept">
28964 <primary>header lines</primary>
28965 <secondary>adding</secondary>
28966 </indexterm>
28967 <indexterm role="concept">
28968 <primary>router</primary>
28969 <secondary>adding header lines</secondary>
28970 </indexterm>
28971 This option specifies a string of text that is expanded at routing time, and
28972 associated with any addresses that are accepted by the router. However, this
28973 option has no effect when an address is just being verified. The way in which
28974 the text is used to add header lines at transport time is described in section
28975 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
28976 message is in the process of being transported. This means that references to
28977 header lines in string expansions in the transport&#x2019;s configuration do not
28978 <quote>see</quote> the added header lines.
28979 </para>
28980 <para>
28981 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
28982 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
28983 the expansion is forced to fail, the option has no effect. Other expansion
28984 failures are treated as configuration errors.
28985 </para>
28986 <para>
28987 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
28988 router that has the <option>one_time</option> option set.
28989 </para>
28990 <para revisionflag="changed">
28991 <indexterm role="concept">
28992 <primary>duplicate addresses</primary>
28993 </indexterm>
28994 <indexterm role="option">
28995 <primary><option>unseen</option></primary>
28996 </indexterm>
28997 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28998 additions are deleted when the address is passed on to subsequent routers.
28999 For a <option>redirect</option> router, if a generated address is the same as the incoming
29000 address, this can lead to duplicate addresses with different header
29001 modifications. Exim does not do duplicate deliveries (except, in certain
29002 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
29003 which of the duplicates is discarded, so this ambiguous situation should be
29004 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
29005 </para>
29006 <para>
29007 <indexterm role="option">
29008 <primary><option>headers_remove</option></primary>
29009 </indexterm>
29010 </para>
29011 <informaltable frame="all">
29012 <tgroup cols="4" colsep="0" rowsep="0">
29013 <colspec colwidth="8*" align="left"/>
29014 <colspec colwidth="6*" align="center"/>
29015 <colspec colwidth="6*" align="center"/>
29016 <colspec colwidth="6*" align="right"/>
29017 <tbody>
29018 <row>
29019 <entry><option>headers_remove</option></entry>
29020 <entry>Use: <emphasis>routers</emphasis></entry>
29021 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29022 <entry>Default: <emphasis>unset</emphasis></entry>
29023 </row>
29024 </tbody>
29025 </tgroup>
29026 </informaltable>
29027 <para>
29028 <indexterm role="concept">
29029 <primary>header lines</primary>
29030 <secondary>removing</secondary>
29031 </indexterm>
29032 <indexterm role="concept">
29033 <primary>router</primary>
29034 <secondary>removing header lines</secondary>
29035 </indexterm>
29036 This option specifies a string of text that is expanded at routing time, and
29037 associated with any addresses that are accepted by the router. However, this
29038 option has no effect when an address is just being verified. The way in which
29039 the text is used to remove header lines at transport time is described in
29040 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
29041 the message is in the process of being transported. This means that references
29042 to header lines in string expansions in the transport&#x2019;s configuration still
29043 <quote>see</quote> the original header lines.
29044 </para>
29045 <para>
29046 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
29047 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
29048 the option has no effect. Other expansion failures are treated as configuration
29049 errors.
29050 </para>
29051 <para>
29052 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
29053 router that has the <option>one_time</option> option set.
29054 </para>
29055 <para revisionflag="changed">
29056 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29057 removal requests are deleted when the address is passed on to subsequent
29058 routers, and this can lead to problems with duplicates -- see the similar
29059 warning for <option>headers_add</option> above.
29060 </para>
29061 <para>
29062 <indexterm role="option">
29063 <primary><option>ignore_target_hosts</option></primary>
29064 </indexterm>
29065 </para>
29066 <informaltable frame="all">
29067 <tgroup cols="4" colsep="0" rowsep="0">
29068 <colspec colwidth="8*" align="left"/>
29069 <colspec colwidth="6*" align="center"/>
29070 <colspec colwidth="6*" align="center"/>
29071 <colspec colwidth="6*" align="right"/>
29072 <tbody>
29073 <row>
29074 <entry><option>ignore_target_hosts</option></entry>
29075 <entry>Use: <emphasis>routers</emphasis></entry>
29076 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29077 <entry>Default: <emphasis>unset</emphasis></entry>
29078 </row>
29079 </tbody>
29080 </tgroup>
29081 </informaltable>
29082 <para>
29083 <indexterm role="concept">
29084 <primary>IP address</primary>
29085 <secondary>discarding</secondary>
29086 </indexterm>
29087 <indexterm role="concept">
29088 <primary>router</primary>
29089 <secondary>discarding IP addresses</secondary>
29090 </indexterm>
29091 Although this option is a host list, it should normally contain IP address
29092 entries rather than names. If any host that is looked up by the router has an
29093 IP address that matches an item in this list, Exim behaves as if that IP
29094 address did not exist. This option allows you to cope with rogue DNS entries
29095 like
29096 </para>
29097 <literallayout class="monospaced">
29098 remote.domain.example.  A  127.0.0.1
29099 </literallayout>
29100 <para>
29101 by setting
29102 </para>
29103 <literallayout class="monospaced">
29104 ignore_target_hosts = 127.0.0.1
29105 </literallayout>
29106 <para>
29107 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
29108 discarded in this way, the router declines. In a conventional configuration, an
29109 attempt to mail to such a domain would normally provoke the <quote>unrouteable
29110 domain</quote> error, and an attempt to verify an address in the domain would fail.
29111 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
29112 router declines if presented with one of the listed addresses.
29113 </para>
29114 <para>
29115 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
29116 means of the first or the second of the following settings, respectively:
29117 </para>
29118 <literallayout class="monospaced">
29119 ignore_target_hosts = 0.0.0.0/0
29120 ignore_target_hosts = &lt;; 0::0/0
29121 </literallayout>
29122 <para>
29123 The pattern in the first line matches all IPv4 addresses, whereas the pattern
29124 in the second line matches all IPv6 addresses.
29125 </para>
29126 <para>
29127 This option may also be useful for ignoring link-local and site-local IPv6
29128 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
29129 is expanded before use as a list, it is possible to make it dependent on the
29130 domain that is being routed.
29131 </para>
29132 <para>
29133 <indexterm role="variable">
29134 <primary><varname>$host_address</varname></primary>
29135 </indexterm>
29136 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
29137 checked.
29138 </para>
29139 <para>
29140 <indexterm role="option">
29141 <primary><option>initgroups</option></primary>
29142 </indexterm>
29143 </para>
29144 <informaltable frame="all">
29145 <tgroup cols="4" colsep="0" rowsep="0">
29146 <colspec colwidth="8*" align="left"/>
29147 <colspec colwidth="6*" align="center"/>
29148 <colspec colwidth="6*" align="center"/>
29149 <colspec colwidth="6*" align="right"/>
29150 <tbody>
29151 <row>
29152 <entry><option>initgroups</option></entry>
29153 <entry>Use: <emphasis>routers</emphasis></entry>
29154 <entry>Type: <emphasis>boolean</emphasis></entry>
29155 <entry>Default: <emphasis>false</emphasis></entry>
29156 </row>
29157 </tbody>
29158 </tgroup>
29159 </informaltable>
29160 <para>
29161 <indexterm role="concept">
29162 <primary>additional groups</primary>
29163 </indexterm>
29164 <indexterm role="concept">
29165 <primary>groups</primary>
29166 <secondary>additional</secondary>
29167 </indexterm>
29168 <indexterm role="concept">
29169 <primary>local transports</primary>
29170 <secondary>uid and gid</secondary>
29171 </indexterm>
29172 <indexterm role="concept">
29173 <primary>transport</primary>
29174 <secondary>local</secondary>
29175 </indexterm>
29176 If the router queues an address for a transport, and this option is true, and
29177 the uid supplied by the router is not overridden by the transport, the
29178 <function>initgroups()</function> function is called when running the transport to ensure that
29179 any additional groups associated with the uid are set up. See also <option>group</option>
29180 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29181 </para>
29182 <para>
29183 <indexterm role="option">
29184 <primary><option>local_part_prefix</option></primary>
29185 </indexterm>
29186 </para>
29187 <informaltable frame="all">
29188 <tgroup cols="4" colsep="0" rowsep="0">
29189 <colspec colwidth="8*" align="left"/>
29190 <colspec colwidth="6*" align="center"/>
29191 <colspec colwidth="6*" align="center"/>
29192 <colspec colwidth="6*" align="right"/>
29193 <tbody>
29194 <row>
29195 <entry><option>local_part_prefix</option></entry>
29196 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29197 <entry>Type: <emphasis>string list</emphasis></entry>
29198 <entry>Default: <emphasis>unset</emphasis></entry>
29199 </row>
29200 </tbody>
29201 </tgroup>
29202 </informaltable>
29203 <para>
29204 <indexterm role="concept">
29205 <primary>router</primary>
29206 <secondary>prefix for local part</secondary>
29207 </indexterm>
29208 <indexterm role="concept">
29209 <primary>prefix</primary>
29210 <secondary>for local part, used in router</secondary>
29211 </indexterm>
29212 If this option is set, the router is skipped unless the local part starts with
29213 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
29214 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
29215 evaluated.
29216 </para>
29217 <para>
29218 The list is scanned from left to right, and the first prefix that matches is
29219 used. A limited form of wildcard is available; if the prefix begins with an
29220 asterisk, it matches the longest possible sequence of arbitrary characters at
29221 the start of the local part. An asterisk should therefore always be followed by
29222 some character that does not occur in normal local parts.
29223 <indexterm role="concept">
29224 <primary>multiple mailboxes</primary>
29225 </indexterm>
29226 <indexterm role="concept">
29227 <primary>mailbox</primary>
29228 <secondary>multiple</secondary>
29229 </indexterm>
29230 Wildcarding can be used to set up multiple user mailboxes, as described in
29231 section <xref linkend="SECTmulbox"/>.
29232 </para>
29233 <para>
29234 <indexterm role="variable">
29235 <primary><varname>$local_part</varname></primary>
29236 </indexterm>
29237 <indexterm role="variable">
29238 <primary><varname>$local_part_prefix</varname></primary>
29239 </indexterm>
29240 During the testing of the <option>local_parts</option> option, and while the router is
29241 running, the prefix is removed from the local part, and is available in the
29242 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
29243 the router accepts the address, this remains true during subsequent delivery by
29244 a transport. In particular, the local part that is transmitted in the RCPT
29245 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
29246 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
29247 the relevant transport.
29248 </para>
29249 <para>
29250 When an address is being verified, <option>local_part_prefix</option> affects only the
29251 behaviour of the router. If the callout feature of verification is in use, this
29252 means that the full address, including the prefix, will be used during the
29253 callout.
29254 </para>
29255 <para>
29256 The prefix facility is commonly used to handle local parts of the form
29257 <option>owner-something</option>. Another common use is to support local parts of the form
29258 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
29259 to tell a user their forwarding is broken &ndash; by placing a router like this one
29260 immediately before the router that handles <filename>.forward</filename> files:
29261 </para>
29262 <literallayout class="monospaced">
29263 real_localuser:
29264   driver = accept
29265   local_part_prefix = real-
29266   check_local_user
29267   transport = local_delivery
29268 </literallayout>
29269 <para>
29270 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
29271 both conditions must be met if not optional. Care must be taken if wildcards
29272 are used in both a prefix and a suffix on the same router. Different
29273 separator characters must be used to avoid ambiguity.
29274 </para>
29275 <para>
29276 <indexterm role="option">
29277 <primary><option>local_part_prefix_optional</option></primary>
29278 </indexterm>
29279 </para>
29280 <informaltable frame="all">
29281 <tgroup cols="4" colsep="0" rowsep="0">
29282 <colspec colwidth="8*" align="left"/>
29283 <colspec colwidth="6*" align="center"/>
29284 <colspec colwidth="6*" align="center"/>
29285 <colspec colwidth="6*" align="right"/>
29286 <tbody>
29287 <row>
29288 <entry><option>local_part_prefix_optional</option></entry>
29289 <entry>Use: <emphasis>routers</emphasis></entry>
29290 <entry>Type: <emphasis>boolean</emphasis></entry>
29291 <entry>Default: <emphasis>false</emphasis></entry>
29292 </row>
29293 </tbody>
29294 </tgroup>
29295 </informaltable>
29296 <para>
29297 See <option>local_part_prefix</option> above.
29298 </para>
29299 <para>
29300 <indexterm role="option">
29301 <primary><option>local_part_suffix</option></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="6*" align="center"/>
29308 <colspec colwidth="6*" align="center"/>
29309 <colspec colwidth="6*" align="right"/>
29310 <tbody>
29311 <row>
29312 <entry><option>local_part_suffix</option></entry>
29313 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29314 <entry>Type: <emphasis>string list</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>suffix for local part</secondary>
29324 </indexterm>
29325 <indexterm role="concept">
29326 <primary>suffix for local part</primary>
29327 <secondary>used in router</secondary>
29328 </indexterm>
29329 This option operates in the same way as <option>local_part_prefix</option>, except that the
29330 local part must end (rather than start) with the given string, the
29331 <option>local_part_suffix_optional</option> option determines whether the suffix is
29332 mandatory, and the wildcard * character, if present, must be the last
29333 character of the suffix. This option facility is commonly used to handle local
29334 parts of the form <option>something-request</option> and multiple user mailboxes of the form
29335 <option>username-foo</option>.
29336 </para>
29337 <para>
29338 <indexterm role="option">
29339 <primary><option>local_part_suffix_optional</option></primary>
29340 </indexterm>
29341 </para>
29342 <informaltable frame="all">
29343 <tgroup cols="4" colsep="0" rowsep="0">
29344 <colspec colwidth="8*" align="left"/>
29345 <colspec colwidth="6*" align="center"/>
29346 <colspec colwidth="6*" align="center"/>
29347 <colspec colwidth="6*" align="right"/>
29348 <tbody>
29349 <row>
29350 <entry><option>local_part_suffix_optional</option></entry>
29351 <entry>Use: <emphasis>routers</emphasis></entry>
29352 <entry>Type: <emphasis>boolean</emphasis></entry>
29353 <entry>Default: <emphasis>false</emphasis></entry>
29354 </row>
29355 </tbody>
29356 </tgroup>
29357 </informaltable>
29358 <para>
29359 See <option>local_part_suffix</option> above.
29360 </para>
29361 <para>
29362 <indexterm role="option">
29363 <primary><option>local_parts</option></primary>
29364 </indexterm>
29365 </para>
29366 <informaltable frame="all">
29367 <tgroup cols="4" colsep="0" rowsep="0">
29368 <colspec colwidth="8*" align="left"/>
29369 <colspec colwidth="6*" align="center"/>
29370 <colspec colwidth="6*" align="center"/>
29371 <colspec colwidth="6*" align="right"/>
29372 <tbody>
29373 <row>
29374 <entry><option>local_parts</option></entry>
29375 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29376 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
29377 <entry>Default: <emphasis>unset</emphasis></entry>
29378 </row>
29379 </tbody>
29380 </tgroup>
29381 </informaltable>
29382 <para>
29383 <indexterm role="concept">
29384 <primary>router</primary>
29385 <secondary>restricting to specific local parts</secondary>
29386 </indexterm>
29387 <indexterm role="concept">
29388 <primary>local part</primary>
29389 <secondary>checking in router</secondary>
29390 </indexterm>
29391 The router is run only if the local part of the address matches the list.
29392 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29393 are evaluated, and
29394 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
29395 string is expanded, it is possible to make it depend on the domain, for
29396 example:
29397 </para>
29398 <literallayout class="monospaced">
29399 local_parts = dbm;/usr/local/specials/$domain
29400 </literallayout>
29401 <para>
29402 <indexterm role="variable">
29403 <primary><varname>$local_part_data</varname></primary>
29404 </indexterm>
29405 If the match is achieved by a lookup, the data that the lookup returned
29406 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
29407 expansions of the router&#x2019;s private options. You might use this option, for
29408 example, if you have a large number of local virtual domains, and you want to
29409 send all postmaster mail to the same place without having to set up an alias in
29410 each virtual domain:
29411 </para>
29412 <literallayout class="monospaced">
29413 postmaster:
29414   driver = redirect
29415   local_parts = postmaster
29416   data = postmaster@real.domain.example
29417 </literallayout>
29418 <para>
29419 <indexterm role="option">
29420 <primary><option>log_as_local</option></primary>
29421 </indexterm>
29422 </para>
29423 <informaltable frame="all">
29424 <tgroup cols="4" colsep="0" rowsep="0">
29425 <colspec colwidth="8*" align="left"/>
29426 <colspec colwidth="6*" align="center"/>
29427 <colspec colwidth="6*" align="center"/>
29428 <colspec colwidth="6*" align="right"/>
29429 <tbody>
29430 <row>
29431 <entry><option>log_as_local</option></entry>
29432 <entry>Use: <emphasis>routers</emphasis></entry>
29433 <entry>Type: <emphasis>boolean</emphasis></entry>
29434 <entry>Default: <emphasis>see below</emphasis></entry>
29435 </row>
29436 </tbody>
29437 </tgroup>
29438 </informaltable>
29439 <para>
29440 <indexterm role="concept">
29441 <primary>log</primary>
29442 <secondary>delivery line</secondary>
29443 </indexterm>
29444 <indexterm role="concept">
29445 <primary>delivery</primary>
29446 <secondary>log line format</secondary>
29447 </indexterm>
29448 Exim has two logging styles for delivery, the idea being to make local
29449 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
29450 recipient address is given just as the local part, without a domain. The use of
29451 this style is controlled by this option. It defaults to true for the <command>accept</command>
29452 router, and false for all the others. This option applies only when a
29453 router assigns an address to a transport. It has no effect on routers that
29454 redirect addresses.
29455 </para>
29456 <para>
29457 <indexterm role="option">
29458 <primary><option>more</option></primary>
29459 </indexterm>
29460 </para>
29461 <informaltable frame="all">
29462 <tgroup cols="4" colsep="0" rowsep="0">
29463 <colspec colwidth="8*" align="left"/>
29464 <colspec colwidth="6*" align="center"/>
29465 <colspec colwidth="6*" align="center"/>
29466 <colspec colwidth="6*" align="right"/>
29467 <tbody>
29468 <row>
29469 <entry><option>more</option></entry>
29470 <entry>Use: <emphasis>routers</emphasis></entry>
29471 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
29472 <entry>Default: <emphasis>true</emphasis></entry>
29473 </row>
29474 </tbody>
29475 </tgroup>
29476 </informaltable>
29477 <para>
29478 The result of string expansion for this option must be a valid boolean value,
29479 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29480 result causes an error, and delivery is deferred. If the expansion is forced to
29481 fail, the default value for the option (true) is used. Other failures cause
29482 delivery to be deferred.
29483 </para>
29484 <para>
29485 If this option is set false, and the router declines to handle the address, no
29486 further routers are tried, routing fails, and the address is bounced.
29487 <indexterm role="option">
29488 <primary><option>self</option></primary>
29489 </indexterm>
29490 However, if the router explicitly passes an address to the following router by
29491 means of the setting
29492 </para>
29493 <literallayout class="monospaced">
29494 self = pass
29495 </literallayout>
29496 <para>
29497 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
29498 does not affect the behaviour if one of the precondition tests fails. In that
29499 case, the address is always passed to the next router.
29500 </para>
29501 <para>
29502 Note that <option>address_data</option> is not considered to be a precondition. If its
29503 expansion is forced to fail, the router declines, and the value of <option>more</option>
29504 controls what happens next.
29505 </para>
29506 <para>
29507 <indexterm role="option">
29508 <primary><option>pass_on_timeout</option></primary>
29509 </indexterm>
29510 </para>
29511 <informaltable frame="all">
29512 <tgroup cols="4" colsep="0" rowsep="0">
29513 <colspec colwidth="8*" align="left"/>
29514 <colspec colwidth="6*" align="center"/>
29515 <colspec colwidth="6*" align="center"/>
29516 <colspec colwidth="6*" align="right"/>
29517 <tbody>
29518 <row>
29519 <entry><option>pass_on_timeout</option></entry>
29520 <entry>Use: <emphasis>routers</emphasis></entry>
29521 <entry>Type: <emphasis>boolean</emphasis></entry>
29522 <entry>Default: <emphasis>false</emphasis></entry>
29523 </row>
29524 </tbody>
29525 </tgroup>
29526 </informaltable>
29527 <para>
29528 <indexterm role="concept">
29529 <primary>timeout</primary>
29530 <secondary>of router</secondary>
29531 </indexterm>
29532 <indexterm role="concept">
29533 <primary>router</primary>
29534 <secondary>timeout</secondary>
29535 </indexterm>
29536 If a router times out during a host lookup, it normally causes deferral of the
29537 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
29538 router, overriding <option>no_more</option>. This may be helpful for systems that are
29539 intermittently connected to the Internet, or those that want to pass to a smart
29540 host any messages that cannot immediately be delivered.
29541 </para>
29542 <para>
29543 There are occasional other temporary errors that can occur while doing DNS
29544 lookups. They are treated in the same way as a timeout, and this option
29545 applies to all of them.
29546 </para>
29547 <para>
29548 <indexterm role="option">
29549 <primary><option>pass_router</option></primary>
29550 </indexterm>
29551 </para>
29552 <informaltable frame="all">
29553 <tgroup cols="4" colsep="0" rowsep="0">
29554 <colspec colwidth="8*" align="left"/>
29555 <colspec colwidth="6*" align="center"/>
29556 <colspec colwidth="6*" align="center"/>
29557 <colspec colwidth="6*" align="right"/>
29558 <tbody>
29559 <row>
29560 <entry><option>pass_router</option></entry>
29561 <entry>Use: <emphasis>routers</emphasis></entry>
29562 <entry>Type: <emphasis>string</emphasis></entry>
29563 <entry>Default: <emphasis>unset</emphasis></entry>
29564 </row>
29565 </tbody>
29566 </tgroup>
29567 </informaltable>
29568 <para>
29569 <indexterm role="concept">
29570 <primary>router</primary>
29571 <secondary>go to after <quote>pass</quote></secondary>
29572 </indexterm>
29573 When a router returns <quote>pass</quote>, the address is normally handed on to the next
29574 router in sequence. This can be changed by setting <option>pass_router</option> to the name
29575 of another router. However (unlike <option>redirect_router</option>) the named router must
29576 be below the current router, to avoid loops. Note that this option applies only
29577 to the special case of <quote>pass</quote>. It does not apply when a router returns
29578 <quote>decline</quote>.
29579 </para>
29580 <para>
29581 <indexterm role="option">
29582 <primary><option>redirect_router</option></primary>
29583 </indexterm>
29584 </para>
29585 <informaltable frame="all">
29586 <tgroup cols="4" colsep="0" rowsep="0">
29587 <colspec colwidth="8*" align="left"/>
29588 <colspec colwidth="6*" align="center"/>
29589 <colspec colwidth="6*" align="center"/>
29590 <colspec colwidth="6*" align="right"/>
29591 <tbody>
29592 <row>
29593 <entry><option>redirect_router</option></entry>
29594 <entry>Use: <emphasis>routers</emphasis></entry>
29595 <entry>Type: <emphasis>string</emphasis></entry>
29596 <entry>Default: <emphasis>unset</emphasis></entry>
29597 </row>
29598 </tbody>
29599 </tgroup>
29600 </informaltable>
29601 <para>
29602 <indexterm role="concept">
29603 <primary>router</primary>
29604 <secondary>start at after redirection</secondary>
29605 </indexterm>
29606 Sometimes an administrator knows that it is pointless to reprocess addresses
29607 generated from alias or forward files with the same router again. For
29608 example, if an alias file translates real names into login ids there is no
29609 point searching the alias file a second time, especially if it is a large file.
29610 </para>
29611 <para>
29612 The <option>redirect_router</option> option can be set to the name of any router instance.
29613 It causes the routing of any generated addresses to start at the named router
29614 instead of at the first router. This option has no effect if the router in
29615 which it is set does not generate new addresses.
29616 </para>
29617 <para>
29618 <indexterm role="option">
29619 <primary><option>require_files</option></primary>
29620 </indexterm>
29621 </para>
29622 <informaltable frame="all">
29623 <tgroup cols="4" colsep="0" rowsep="0">
29624 <colspec colwidth="8*" align="left"/>
29625 <colspec colwidth="6*" align="center"/>
29626 <colspec colwidth="6*" align="center"/>
29627 <colspec colwidth="6*" align="right"/>
29628 <tbody>
29629 <row>
29630 <entry><option>require_files</option></entry>
29631 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29632 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29633 <entry>Default: <emphasis>unset</emphasis></entry>
29634 </row>
29635 </tbody>
29636 </tgroup>
29637 </informaltable>
29638 <para>
29639 <indexterm role="concept">
29640 <primary>file</primary>
29641 <secondary>requiring for router</secondary>
29642 </indexterm>
29643 <indexterm role="concept">
29644 <primary>router</primary>
29645 <secondary>requiring file existence</secondary>
29646 </indexterm>
29647 This option provides a general mechanism for predicating the running of a
29648 router on the existence or non-existence of certain files or directories.
29649 Before running a router, as one of its precondition tests, Exim works its way
29650 through the <option>require_files</option> list, expanding each item separately.
29651 </para>
29652 <para>
29653 Because the list is split before expansion, any colons in expansion items must
29654 be doubled, or the facility for using a different list separator must be used.
29655 If any expansion is forced to fail, the item is ignored. Other expansion
29656 failures cause routing of the address to be deferred.
29657 </para>
29658 <para>
29659 If any expanded string is empty, it is ignored. Otherwise, except as described
29660 below, each string must be a fully qualified file path, optionally preceded by
29661 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
29662 existence of the files or directories. The router is skipped if any paths not
29663 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
29664 </para>
29665 <para>
29666 <indexterm role="concept">
29667 <primary>NFS</primary>
29668 </indexterm>
29669 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
29670 the message is deferred. This can happen when NFS-mounted filesystems are
29671 unavailable.
29672 </para>
29673 <para>
29674 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
29675 options, so you cannot use it to check for the existence of a file in which to
29676 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
29677 full list of the order in which preconditions are evaluated.) However, as
29678 these options are all expanded, you can use the <option>exists</option> expansion condition
29679 to make such tests. The <option>require_files</option> option is intended for checking files
29680 that the router may be going to use internally, or which are needed by a
29681 transport (for example <filename>.procmailrc</filename>).
29682 </para>
29683 <para>
29684 During delivery, the <function>stat()</function> function is run as root, but there is a
29685 facility for some checking of the accessibility of a file by another user.
29686 This is not a proper permissions check, but just a <quote>rough</quote> check that
29687 operates as follows:
29688 </para>
29689 <para>
29690 If an item in a <option>require_files</option> list does not contain any forward slash
29691 characters, it is taken to be the user (and optional group, separated by a
29692 comma) to be checked for subsequent files in the list. If no group is specified
29693 but the user is specified symbolically, the gid associated with the uid is
29694 used. For example:
29695 </para>
29696 <literallayout class="monospaced">
29697 require_files = mail:/some/file
29698 require_files = $local_part:$home/.procmailrc
29699 </literallayout>
29700 <para>
29701 If a user or group name in a <option>require_files</option> list does not exist, the
29702 <option>require_files</option> condition fails.
29703 </para>
29704 <para>
29705 Exim performs the check by scanning along the components of the file path, and
29706 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
29707 directories, and <quote>r</quote> access on the final file. Note that this means that file
29708 access control lists, if the operating system has them, are ignored.
29709 </para>
29710 <para>
29711 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
29712 incoming SMTP message, Exim is not running as root, but under its own uid. This
29713 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
29714 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
29715 user is not permitted to read one of the directories on the file&#x2019;s path.
29716 </para>
29717 <para>
29718 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
29719 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
29720 without root access. In this case, if a check for access by a particular user
29721 is requested, Exim creates a subprocess that runs as that user, and tries the
29722 check again in that process.
29723 </para>
29724 <para>
29725 The default action for handling an unresolved EACCES is to consider it to
29726 be caused by a configuration error, and routing is deferred because the
29727 existence or non-existence of the file cannot be determined. However, in some
29728 circumstances it may be desirable to treat this condition as if the file did
29729 not exist. If the file name (or the exclamation mark that precedes the file
29730 name for non-existence) is preceded by a plus sign, the EACCES error is treated
29731 as if the file did not exist. For example:
29732 </para>
29733 <literallayout class="monospaced">
29734 require_files = +/some/file
29735 </literallayout>
29736 <para>
29737 If the router is not an essential part of verification (for example, it
29738 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
29739 option false so that the router is skipped when verifying.
29740 </para>
29741 <para>
29742 <indexterm role="option">
29743 <primary><option>retry_use_local_part</option></primary>
29744 </indexterm>
29745 </para>
29746 <informaltable frame="all">
29747 <tgroup cols="4" colsep="0" rowsep="0">
29748 <colspec colwidth="8*" align="left"/>
29749 <colspec colwidth="6*" align="center"/>
29750 <colspec colwidth="6*" align="center"/>
29751 <colspec colwidth="6*" align="right"/>
29752 <tbody>
29753 <row>
29754 <entry><option>retry_use_local_part</option></entry>
29755 <entry>Use: <emphasis>routers</emphasis></entry>
29756 <entry>Type: <emphasis>boolean</emphasis></entry>
29757 <entry>Default: <emphasis>see below</emphasis></entry>
29758 </row>
29759 </tbody>
29760 </tgroup>
29761 </informaltable>
29762 <para>
29763 <indexterm role="concept">
29764 <primary>hints database</primary>
29765 <secondary>retry keys</secondary>
29766 </indexterm>
29767 <indexterm role="concept">
29768 <primary>local part</primary>
29769 <secondary>in retry keys</secondary>
29770 </indexterm>
29771 When a delivery suffers a temporary routing failure, a retry record is created
29772 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
29773 domain, the key for the retry record should not involve the local part, but for
29774 other addresses, both the domain and the local part should be included.
29775 Usually, remote routing is of the former kind, and local routing is of the
29776 latter kind.
29777 </para>
29778 <para>
29779 This option controls whether the local part is used to form the key for retry
29780 hints for addresses that suffer temporary errors while being handled by this
29781 router. The default value is true for any router that has <option>check_local_user</option>
29782 set, and false otherwise. Note that this option does not apply to hints keys
29783 for transport delays; they are controlled by a generic transport option of the
29784 same name.
29785 </para>
29786 <para>
29787 The setting of <option>retry_use_local_part</option> applies only to the router on which it
29788 appears. If the router generates child addresses, they are routed
29789 independently; this setting does not become attached to them.
29790 </para>
29791 <para>
29792 <indexterm role="option">
29793 <primary><option>router_home_directory</option></primary>
29794 </indexterm>
29795 </para>
29796 <informaltable frame="all">
29797 <tgroup cols="4" colsep="0" rowsep="0">
29798 <colspec colwidth="8*" align="left"/>
29799 <colspec colwidth="6*" align="center"/>
29800 <colspec colwidth="6*" align="center"/>
29801 <colspec colwidth="6*" align="right"/>
29802 <tbody>
29803 <row>
29804 <entry><option>router_home_directory</option></entry>
29805 <entry>Use: <emphasis>routers</emphasis></entry>
29806 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29807 <entry>Default: <emphasis>unset</emphasis></entry>
29808 </row>
29809 </tbody>
29810 </tgroup>
29811 </informaltable>
29812 <para>
29813 <indexterm role="concept">
29814 <primary>router</primary>
29815 <secondary>home directory for</secondary>
29816 </indexterm>
29817 <indexterm role="concept">
29818 <primary>home directory</primary>
29819 <secondary>for router</secondary>
29820 </indexterm>
29821 <indexterm role="variable">
29822 <primary><varname>$home</varname></primary>
29823 </indexterm>
29824 This option sets a home directory for use while the router is running. (Compare
29825 <option>transport_home_directory</option>, which sets a home directory for later
29826 transporting.) In particular, if used on a <command>redirect</command> router, this option
29827 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
29828 forced expansion failure causes the option to be ignored &ndash; other failures
29829 cause the router to defer.
29830 </para>
29831 <para>
29832 Expansion of <option>router_home_directory</option> happens immediately after the
29833 <option>check_local_user</option> test (if configured), before any further expansions take
29834 place.
29835 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29836 are evaluated.)
29837 While the router is running, <option>router_home_directory</option> overrides the value of
29838 <varname>$home</varname> that came from <option>check_local_user</option>.
29839 </para>
29840 <para>
29841 When a router accepts an address and assigns it to a local transport (including
29842 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
29843 delivery), the home directory setting for the transport is taken from the first
29844 of these values that is set:
29845 </para>
29846 <itemizedlist>
29847 <listitem>
29848 <para>
29849 The <option>home_directory</option> option on the transport;
29850 </para>
29851 </listitem>
29852 <listitem>
29853 <para>
29854 The <option>transport_home_directory</option> option on the router;
29855 </para>
29856 </listitem>
29857 <listitem>
29858 <para>
29859 The password data if <option>check_local_user</option> is set on the router;
29860 </para>
29861 </listitem>
29862 <listitem>
29863 <para>
29864 The <option>router_home_directory</option> option on the router.
29865 </para>
29866 </listitem>
29867 </itemizedlist>
29868 <para>
29869 In other words, <option>router_home_directory</option> overrides the password data for the
29870 router, but not for the transport.
29871 </para>
29872 <para>
29873 <indexterm role="option">
29874 <primary><option>self</option></primary>
29875 </indexterm>
29876 </para>
29877 <informaltable frame="all">
29878 <tgroup cols="4" colsep="0" rowsep="0">
29879 <colspec colwidth="8*" align="left"/>
29880 <colspec colwidth="6*" align="center"/>
29881 <colspec colwidth="6*" align="center"/>
29882 <colspec colwidth="6*" align="right"/>
29883 <tbody>
29884 <row>
29885 <entry><option>self</option></entry>
29886 <entry>Use: <emphasis>routers</emphasis></entry>
29887 <entry>Type: <emphasis>string</emphasis></entry>
29888 <entry>Default: <emphasis>freeze</emphasis></entry>
29889 </row>
29890 </tbody>
29891 </tgroup>
29892 </informaltable>
29893 <para>
29894 <indexterm role="concept">
29895 <primary>MX record</primary>
29896 <secondary>pointing to local host</secondary>
29897 </indexterm>
29898 <indexterm role="concept">
29899 <primary>local host</primary>
29900 <secondary>MX pointing to</secondary>
29901 </indexterm>
29902 This option applies to those routers that use a recipient address to find a
29903 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
29904 and <command>manualroute</command> routers.
29905 Certain configurations of the <command>queryprogram</command> router can also specify a list
29906 of remote hosts.
29907 Usually such routers are configured to send the message to a remote host via an
29908 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
29909 host on the list turns out to be the local host.
29910 The way in which Exim checks for the local host is described in section
29911 <xref linkend="SECTreclocipadd"/>.
29912 </para>
29913 <para>
29914 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
29915 example, the router should be configured not to process this domain), or an
29916 error in the DNS (for example, the MX should not point to this host). For this
29917 reason, the default action is to log the incident, defer the address, and
29918 freeze the message. The following alternatives are provided for use in special
29919 cases:
29920 </para>
29921 <variablelist>
29922 <varlistentry>
29923 <term><option>defer</option></term>
29924 <listitem>
29925 <para>
29926 Delivery of the message is tried again later, but the message is not frozen.
29927 </para>
29928 </listitem></varlistentry>
29929 <varlistentry>
29930 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
29931 <listitem>
29932 <para>
29933 The domain is changed to the given domain, and the address is passed back to
29934 be reprocessed by the routers. No rewriting of headers takes place. This
29935 behaviour is essentially a redirection.
29936 </para>
29937 </listitem></varlistentry>
29938 <varlistentry>
29939 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
29940 <listitem>
29941 <para>
29942 The domain is changed to the given domain, and the address is passed back to be
29943 reprocessed by the routers. Any headers that contain the original domain are
29944 rewritten.
29945 </para>
29946 </listitem></varlistentry>
29947 <varlistentry>
29948 <term><option>pass</option></term>
29949 <listitem>
29950 <para>
29951 <indexterm role="option">
29952 <primary><option>more</option></primary>
29953 </indexterm>
29954 <indexterm role="variable">
29955 <primary><varname>$self_hostname</varname></primary>
29956 </indexterm>
29957 The router passes the address to the next router, or to the router named in the
29958 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
29959 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
29960 name of the local host that the router encountered. This can be used to
29961 distinguish between different cases for hosts with multiple names. The
29962 combination
29963 </para>
29964 <literallayout class="monospaced">
29965 self = pass
29966 no_more
29967 </literallayout>
29968 <para>
29969 ensures that only those addresses that routed to the local host are passed on.
29970 Without <option>no_more</option>, addresses that were declined for other reasons would also
29971 be passed to the next router.
29972 </para>
29973 </listitem></varlistentry>
29974 <varlistentry>
29975 <term><option>fail</option></term>
29976 <listitem>
29977 <para>
29978 Delivery fails and an error report is generated.
29979 </para>
29980 </listitem></varlistentry>
29981 <varlistentry>
29982 <term><option>send</option></term>
29983 <listitem>
29984 <para>
29985 <indexterm role="concept">
29986 <primary>local host</primary>
29987 <secondary>sending to</secondary>
29988 </indexterm>
29989 The anomaly is ignored and the address is queued for the transport. This
29990 setting should be used with extreme caution. For an <command>smtp</command> transport, it
29991 makes sense only in cases where the program that is listening on the SMTP port
29992 is not this version of Exim. That is, it must be some other MTA, or Exim with a
29993 different configuration file that handles the domain in another way.
29994 </para>
29995 </listitem></varlistentry>
29996 </variablelist>
29997 <para>
29998 <indexterm role="option">
29999 <primary><option>senders</option></primary>
30000 </indexterm>
30001 </para>
30002 <informaltable frame="all">
30003 <tgroup cols="4" colsep="0" rowsep="0">
30004 <colspec colwidth="8*" align="left"/>
30005 <colspec colwidth="6*" align="center"/>
30006 <colspec colwidth="6*" align="center"/>
30007 <colspec colwidth="6*" align="right"/>
30008 <tbody>
30009 <row>
30010 <entry><option>senders</option></entry>
30011 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30012 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
30013 <entry>Default: <emphasis>unset</emphasis></entry>
30014 </row>
30015 </tbody>
30016 </tgroup>
30017 </informaltable>
30018 <para>
30019 <indexterm role="concept">
30020 <primary>router</primary>
30021 <secondary>checking senders</secondary>
30022 </indexterm>
30023 If this option is set, the router is skipped unless the message&#x2019;s sender
30024 address matches something on the list.
30025 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30026 are evaluated.
30027 </para>
30028 <para>
30029 There are issues concerning verification when the running of routers is
30030 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
30031 setting, it sets the sender to the null string. When using the <option>-bt</option> option
30032 to check a configuration file, it is necessary also to use the <option>-f</option> option to
30033 set an appropriate sender. For incoming mail, the sender is unset when
30034 verifying the sender, but is available when verifying any recipients. If the
30035 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
30036 matters.
30037 </para>
30038 <para>
30039 <indexterm role="option">
30040 <primary><option>translate_ip_address</option></primary>
30041 </indexterm>
30042 </para>
30043 <informaltable frame="all">
30044 <tgroup cols="4" colsep="0" rowsep="0">
30045 <colspec colwidth="8*" align="left"/>
30046 <colspec colwidth="6*" align="center"/>
30047 <colspec colwidth="6*" align="center"/>
30048 <colspec colwidth="6*" align="right"/>
30049 <tbody>
30050 <row>
30051 <entry><option>translate_ip_address</option></entry>
30052 <entry>Use: <emphasis>routers</emphasis></entry>
30053 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30054 <entry>Default: <emphasis>unset</emphasis></entry>
30055 </row>
30056 </tbody>
30057 </tgroup>
30058 </informaltable>
30059 <para>
30060 <indexterm role="concept">
30061 <primary>IP address</primary>
30062 <secondary>translating</secondary>
30063 </indexterm>
30064 <indexterm role="concept">
30065 <primary>packet radio</primary>
30066 </indexterm>
30067 <indexterm role="concept">
30068 <primary>router</primary>
30069 <secondary>IP address translation</secondary>
30070 </indexterm>
30071 There exist some rare networking situations (for example, packet radio) where
30072 it is helpful to be able to translate IP addresses generated by normal routing
30073 mechanisms into other IP addresses, thus performing a kind of manual IP
30074 routing. This should be done only if the normal IP routing of the TCP/IP stack
30075 is inadequate or broken. Because this is an extremely uncommon requirement, the
30076 code to support this option is not included in the Exim binary unless
30077 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
30078 </para>
30079 <para>
30080 <indexterm role="variable">
30081 <primary><varname>$host_address</varname></primary>
30082 </indexterm>
30083 The <option>translate_ip_address</option> string is expanded for every IP address generated
30084 by the router, with the generated address set in <varname>$host_address</varname>. If the
30085 expansion is forced to fail, no action is taken.
30086 For any other expansion error, delivery of the message is deferred.
30087 If the result of the expansion is an IP address, that replaces the original
30088 address; otherwise the result is assumed to be a host name &ndash; this is looked
30089 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
30090 produce one or more replacement IP addresses. For example, to subvert all IP
30091 addresses in some specific networks, this could be added to a router:
30092 </para>
30093 <literallayout class="monospaced">
30094 translate_ip_address = \
30095   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
30096     {$value}fail}}
30097 </literallayout>
30098 <para>
30099 The file would contain lines like
30100 </para>
30101 <literallayout class="monospaced">
30102 10.2.3.128/26    some.host
30103 10.8.4.34/26     10.44.8.15
30104 </literallayout>
30105 <para>
30106 You should not make use of this facility unless you really understand what you
30107 are doing.
30108 </para>
30109 <para>
30110 <indexterm role="option">
30111 <primary><option>transport</option></primary>
30112 </indexterm>
30113 </para>
30114 <informaltable frame="all">
30115 <tgroup cols="4" colsep="0" rowsep="0">
30116 <colspec colwidth="8*" align="left"/>
30117 <colspec colwidth="6*" align="center"/>
30118 <colspec colwidth="6*" align="center"/>
30119 <colspec colwidth="6*" align="right"/>
30120 <tbody>
30121 <row>
30122 <entry><option>transport</option></entry>
30123 <entry>Use: <emphasis>routers</emphasis></entry>
30124 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30125 <entry>Default: <emphasis>unset</emphasis></entry>
30126 </row>
30127 </tbody>
30128 </tgroup>
30129 </informaltable>
30130 <para>
30131 This option specifies the transport to be used when a router accepts an address
30132 and sets it up for delivery. A transport is never needed if a router is used
30133 only for verification. The value of the option is expanded at routing time,
30134 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
30135 and result must be the name of one of the configured transports. If it is not,
30136 delivery is deferred.
30137 </para>
30138 <para>
30139 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
30140 have some private options that set up transports for pipe and file deliveries
30141 (see chapter <xref linkend="CHAPredirect"/>).
30142 </para>
30143 <para>
30144 <indexterm role="option">
30145 <primary><option>transport_current_directory</option></primary>
30146 </indexterm>
30147 </para>
30148 <informaltable frame="all">
30149 <tgroup cols="4" colsep="0" rowsep="0">
30150 <colspec colwidth="8*" align="left"/>
30151 <colspec colwidth="6*" align="center"/>
30152 <colspec colwidth="6*" align="center"/>
30153 <colspec colwidth="6*" align="right"/>
30154 <tbody>
30155 <row>
30156 <entry><option>transport_current_directory</option></entry>
30157 <entry>Use: <emphasis>routers</emphasis></entry>
30158 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30159 <entry>Default: <emphasis>unset</emphasis></entry>
30160 </row>
30161 </tbody>
30162 </tgroup>
30163 </informaltable>
30164 <para>
30165 <indexterm role="concept">
30166 <primary>current directory for local transport</primary>
30167 </indexterm>
30168 This option associates a current directory with any address that is routed
30169 to a local transport. This can happen either because a transport is
30170 explicitly configured for the router, or because it generates a delivery to a
30171 file or a pipe. During the delivery process (that is, at transport time), this
30172 option string is expanded and is set as the current directory, unless
30173 overridden by a setting on the transport.
30174 If the expansion fails for any reason, including forced failure, an error is
30175 logged, and delivery is deferred.
30176 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
30177 environment.
30178 </para>
30179 <para>
30180 <indexterm role="option">
30181 <primary><option>transport_home_directory</option></primary>
30182 </indexterm>
30183 </para>
30184 <informaltable frame="all">
30185 <tgroup cols="4" colsep="0" rowsep="0">
30186 <colspec colwidth="8*" align="left"/>
30187 <colspec colwidth="6*" align="center"/>
30188 <colspec colwidth="6*" align="center"/>
30189 <colspec colwidth="6*" align="right"/>
30190 <tbody>
30191 <row>
30192 <entry><option>transport_home_directory</option></entry>
30193 <entry>Use: <emphasis>routers</emphasis></entry>
30194 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30195 <entry>Default: <emphasis>see below</emphasis></entry>
30196 </row>
30197 </tbody>
30198 </tgroup>
30199 </informaltable>
30200 <para>
30201 <indexterm role="concept">
30202 <primary>home directory</primary>
30203 <secondary>for local transport</secondary>
30204 </indexterm>
30205 This option associates a home directory with any address that is routed to a
30206 local transport. This can happen either because a transport is explicitly
30207 configured for the router, or because it generates a delivery to a file or a
30208 pipe. During the delivery process (that is, at transport time), the option
30209 string is expanded and is set as the home directory, unless overridden by a
30210 setting of <option>home_directory</option> on the transport.
30211 If the expansion fails for any reason, including forced failure, an error is
30212 logged, and delivery is deferred.
30213 </para>
30214 <para>
30215 If the transport does not specify a home directory, and
30216 <option>transport_home_directory</option> is not set for the router, the home directory for
30217 the transport is taken from the password data if <option>check_local_user</option> is set for
30218 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
30219 is set; if not, no home directory is set for the transport.
30220 </para>
30221 <para>
30222 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
30223 environment.
30224 </para>
30225 <para>
30226 <indexterm role="option">
30227 <primary><option>unseen</option></primary>
30228 </indexterm>
30229 </para>
30230 <informaltable frame="all">
30231 <tgroup cols="4" colsep="0" rowsep="0">
30232 <colspec colwidth="8*" align="left"/>
30233 <colspec colwidth="6*" align="center"/>
30234 <colspec colwidth="6*" align="center"/>
30235 <colspec colwidth="6*" align="right"/>
30236 <tbody>
30237 <row>
30238 <entry><option>unseen</option></entry>
30239 <entry>Use: <emphasis>routers</emphasis></entry>
30240 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
30241 <entry>Default: <emphasis>false</emphasis></entry>
30242 </row>
30243 </tbody>
30244 </tgroup>
30245 </informaltable>
30246 <para>
30247 <indexterm role="concept">
30248 <primary>router</primary>
30249 <secondary>carrying on after success</secondary>
30250 </indexterm>
30251 The result of string expansion for this option must be a valid boolean value,
30252 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30253 result causes an error, and delivery is deferred. If the expansion is forced to
30254 fail, the default value for the option (false) is used. Other failures cause
30255 delivery to be deferred.
30256 </para>
30257 <para>
30258 When this option is set true, routing does not cease if the router accepts the
30259 address. Instead, a copy of the incoming address is passed to the next router,
30260 overriding a false setting of <option>more</option>. There is little point in setting
30261 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
30262 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
30263 sometimes true and sometimes false).
30264 </para>
30265 <para revisionflag="changed">
30266 <indexterm role="concept">
30267 <primary>copy of message (<option>unseen</option> option)</primary>
30268 </indexterm>
30269 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
30270 qualifier in filter files. It can be used to cause copies of messages to be
30271 delivered to some other destination, while also carrying out a normal delivery.
30272 In effect, the current address is made into a <quote>parent</quote> that has two children
30273 &ndash; one that is delivered as specified by this router, and a clone that goes on
30274 to be routed further. For this reason, <option>unseen</option> may not be combined with the
30275 <option>one_time</option> option in a <command>redirect</command> router.
30276 </para>
30277 <para revisionflag="changed">
30278 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
30279 this router or by previous routers affect the <quote>unseen</quote> copy of the message
30280 only. The clone that continues to be processed by further routers starts with
30281 no added headers and none specified for removal. For a <option>redirect</option> router, if
30282 a generated address is the same as the incoming address, this can lead to
30283 duplicate addresses with different header modifications. Exim does not do
30284 duplicate deliveries (except, in certain circumstances, to pipes -- see section
30285 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
30286 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
30287 <option>redirect</option> router may be of help.
30288 </para>
30289 <para revisionflag="changed">
30290 Unlike the handling of header modifications, any data that was set by the
30291 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
30292 subsequent routers.
30293 </para>
30294 <para>
30295 <indexterm role="option">
30296 <primary><option>user</option></primary>
30297 </indexterm>
30298 </para>
30299 <informaltable frame="all">
30300 <tgroup cols="4" colsep="0" rowsep="0">
30301 <colspec colwidth="8*" align="left"/>
30302 <colspec colwidth="6*" align="center"/>
30303 <colspec colwidth="6*" align="center"/>
30304 <colspec colwidth="6*" align="right"/>
30305 <tbody>
30306 <row>
30307 <entry><option>user</option></entry>
30308 <entry>Use: <emphasis>routers</emphasis></entry>
30309 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30310 <entry>Default: <emphasis>see below</emphasis></entry>
30311 </row>
30312 </tbody>
30313 </tgroup>
30314 </informaltable>
30315 <para>
30316 <indexterm role="concept">
30317 <primary>uid (user id)</primary>
30318 <secondary>local delivery</secondary>
30319 </indexterm>
30320 <indexterm role="concept">
30321 <primary>local transports</primary>
30322 <secondary>uid and gid</secondary>
30323 </indexterm>
30324 <indexterm role="concept">
30325 <primary>transport</primary>
30326 <secondary>local</secondary>
30327 </indexterm>
30328 <indexterm role="concept">
30329 <primary>router</primary>
30330 <secondary>user for filter processing</secondary>
30331 </indexterm>
30332 <indexterm role="concept">
30333 <primary>filter</primary>
30334 <secondary>user for processing</secondary>
30335 </indexterm>
30336 When a router queues an address for a transport, and the transport does not
30337 specify a user, the user given here is used when running the delivery process.
30338 The user may be specified numerically or by name. If expansion fails, the
30339 error is logged and delivery is deferred.
30340 This user is also used by the <command>redirect</command> router when running a filter file.
30341 The default is unset, except when <option>check_local_user</option> is set. In this case,
30342 the default is taken from the password information. If the user is specified as
30343 a name, and <option>group</option> is not set, the group associated with the user is used.
30344 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
30345 <xref linkend="CHAPenvironment"/>.
30346 </para>
30347 <para>
30348 <indexterm role="option">
30349 <primary><option>verify</option></primary>
30350 </indexterm>
30351 </para>
30352 <informaltable frame="all">
30353 <tgroup cols="4" colsep="0" rowsep="0">
30354 <colspec colwidth="8*" align="left"/>
30355 <colspec colwidth="6*" align="center"/>
30356 <colspec colwidth="6*" align="center"/>
30357 <colspec colwidth="6*" align="right"/>
30358 <tbody>
30359 <row>
30360 <entry><option>verify</option></entry>
30361 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30362 <entry>Type: <emphasis>boolean</emphasis></entry>
30363 <entry>Default: <emphasis>true</emphasis></entry>
30364 </row>
30365 </tbody>
30366 </tgroup>
30367 </informaltable>
30368 <para>
30369 Setting this option has the effect of setting <option>verify_sender</option> and
30370 <option>verify_recipient</option> to the same value.
30371 </para>
30372 <para>
30373 <indexterm role="option">
30374 <primary><option>verify_only</option></primary>
30375 </indexterm>
30376 </para>
30377 <informaltable frame="all">
30378 <tgroup cols="4" colsep="0" rowsep="0">
30379 <colspec colwidth="8*" align="left"/>
30380 <colspec colwidth="6*" align="center"/>
30381 <colspec colwidth="6*" align="center"/>
30382 <colspec colwidth="6*" align="right"/>
30383 <tbody>
30384 <row>
30385 <entry><option>verify_only</option></entry>
30386 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30387 <entry>Type: <emphasis>boolean</emphasis></entry>
30388 <entry>Default: <emphasis>false</emphasis></entry>
30389 </row>
30390 </tbody>
30391 </tgroup>
30392 </informaltable>
30393 <para>
30394 <indexterm role="concept">
30395 <primary>EXPN</primary>
30396 <secondary>with <option>verify_only</option></secondary>
30397 </indexterm>
30398 <indexterm role="option">
30399 <primary><option>-bv</option></primary>
30400 </indexterm>
30401 <indexterm role="concept">
30402 <primary>router</primary>
30403 <secondary>used only when verifying</secondary>
30404 </indexterm>
30405 If this option is set, the router is used only when verifying an address or
30406 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
30407 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
30408 restricted to verifying only senders or recipients by means of
30409 <option>verify_sender</option> and <option>verify_recipient</option>.
30410 </para>
30411 <para>
30412 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
30413 SMTP message, Exim is not running as root, but under its own uid. If the router
30414 accesses any files, you need to make sure that they are accessible to the Exim
30415 user or group.
30416 </para>
30417 <para>
30418 <indexterm role="option">
30419 <primary><option>verify_recipient</option></primary>
30420 </indexterm>
30421 </para>
30422 <informaltable frame="all">
30423 <tgroup cols="4" colsep="0" rowsep="0">
30424 <colspec colwidth="8*" align="left"/>
30425 <colspec colwidth="6*" align="center"/>
30426 <colspec colwidth="6*" align="center"/>
30427 <colspec colwidth="6*" align="right"/>
30428 <tbody>
30429 <row>
30430 <entry><option>verify_recipient</option></entry>
30431 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30432 <entry>Type: <emphasis>boolean</emphasis></entry>
30433 <entry>Default: <emphasis>true</emphasis></entry>
30434 </row>
30435 </tbody>
30436 </tgroup>
30437 </informaltable>
30438 <para>
30439 If this option is false, the router is skipped when verifying recipient
30440 addresses
30441 or testing recipient verification using <option>-bv</option>.
30442 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30443 are evaluated.
30444 </para>
30445 <para>
30446 <indexterm role="option">
30447 <primary><option>verify_sender</option></primary>
30448 </indexterm>
30449 </para>
30450 <informaltable frame="all">
30451 <tgroup cols="4" colsep="0" rowsep="0">
30452 <colspec colwidth="8*" align="left"/>
30453 <colspec colwidth="6*" align="center"/>
30454 <colspec colwidth="6*" align="center"/>
30455 <colspec colwidth="6*" align="right"/>
30456 <tbody>
30457 <row>
30458 <entry><option>verify_sender</option></entry>
30459 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30460 <entry>Type: <emphasis>boolean</emphasis></entry>
30461 <entry>Default: <emphasis>true</emphasis></entry>
30462 </row>
30463 </tbody>
30464 </tgroup>
30465 </informaltable>
30466 <para>
30467 If this option is false, the router is skipped when verifying sender addresses
30468 or testing sender verification using <option>-bvs</option>.
30469 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30470 are evaluated.
30471 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
30472 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
30473 </para>
30474 </chapter>
30475
30476 <chapter id="CHID4">
30477 <title>The accept router</title>
30478 <para>
30479 <indexterm role="concept">
30480 <primary><command>accept</command> router</primary>
30481 </indexterm>
30482 <indexterm role="concept">
30483 <primary>routers</primary>
30484 <secondary><command>accept</command></secondary>
30485 </indexterm>
30486 The <command>accept</command> router has no private options of its own. Unless it is being
30487 used purely for verification (see <option>verify_only</option>) a transport is required to
30488 be defined by the generic <option>transport</option> option. If the preconditions that are
30489 specified by generic options are met, the router accepts the address and queues
30490 it for the given transport. The most common use of this router is for setting
30491 up deliveries to local mailboxes. For example:
30492 </para>
30493 <literallayout class="monospaced">
30494 localusers:
30495   driver = accept
30496   domains = mydomain.example
30497   check_local_user
30498   transport = local_delivery
30499 </literallayout>
30500 <para>
30501 The <option>domains</option> condition in this example checks the domain of the address, and
30502 <option>check_local_user</option> checks that the local part is the login of a local user.
30503 When both preconditions are met, the <command>accept</command> router runs, and queues the
30504 address for the <command>local_delivery</command> transport.
30505 </para>
30506 </chapter>
30507
30508 <chapter id="CHAPdnslookup">
30509 <title>The dnslookup router</title>
30510 <para>
30511 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
30512 <primary><command>dnslookup</command> router</primary>
30513 </indexterm>
30514 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
30515 <primary>routers</primary>
30516 <secondary><command>dnslookup</command></secondary>
30517 </indexterm>
30518 The <command>dnslookup</command> router looks up the hosts that handle mail for the
30519 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
30520 unless <option>verify_only</option> is set.
30521 </para>
30522 <para>
30523 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
30524 SRV records. If none are found, or if SRV support is not configured,
30525 MX records are looked up. If no MX records exist, address records are sought.
30526 However, <option>mx_domains</option> can be set to disable the direct use of address
30527 records.
30528 </para>
30529 <para>
30530 MX records of equal priority are sorted by Exim into a random order. Exim then
30531 looks for address records for the host names obtained from MX or SRV records.
30532 When a host has more than one IP address, they are sorted into a random order,
30533 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
30534 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
30535 generic option, the router declines.
30536 </para>
30537 <para>
30538 Unless they have the highest priority (lowest MX value), MX records that point
30539 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
30540 are discarded, together with any other MX records of equal or lower priority.
30541 </para>
30542 <para>
30543 <indexterm role="concept">
30544 <primary>MX record</primary>
30545 <secondary>pointing to local host</secondary>
30546 </indexterm>
30547 <indexterm role="concept">
30548 <primary>local host</primary>
30549 <secondary>MX pointing to</secondary>
30550 </indexterm>
30551 <indexterm role="option">
30552 <primary><option>self</option></primary>
30553 <secondary>in <command>dnslookup</command> router</secondary>
30554 </indexterm>
30555 If the host pointed to by the highest priority MX record, or looked up as an
30556 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
30557 happens is controlled by the generic <option>self</option> option.
30558 </para>
30559 <section id="SECTprowitdnsloo">
30560 <title>Problems with DNS lookups</title>
30561 <para>
30562 There have been problems with DNS servers when SRV records are looked up.
30563 Some mis-behaving servers return a DNS error or timeout when a non-existent
30564 SRV record is sought. Similar problems have in the past been reported for
30565 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
30566 problem, but it is heavy-handed because it is a global option.
30567 </para>
30568 <para>
30569 For this reason, there are two options, <option>srv_fail_domains</option> and
30570 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
30571 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
30572 an attempt to look up an SRV or MX record causes one of these results, and the
30573 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
30574 such record</quote>. In the case of an SRV lookup, this means that the router
30575 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
30576 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
30577 case routing fails.
30578 </para>
30579 </section>
30580 <section id="SECID118">
30581 <title>Private options for dnslookup</title>
30582 <para>
30583 <indexterm role="concept">
30584 <primary>options</primary>
30585 <secondary><command>dnslookup</command> router</secondary>
30586 </indexterm>
30587 The private options for the <command>dnslookup</command> router are as follows:
30588 </para>
30589 <para>
30590 <indexterm role="option">
30591 <primary><option>check_secondary_mx</option></primary>
30592 </indexterm>
30593 </para>
30594 <informaltable frame="all">
30595 <tgroup cols="4" colsep="0" rowsep="0">
30596 <colspec colwidth="8*" align="left"/>
30597 <colspec colwidth="6*" align="center"/>
30598 <colspec colwidth="6*" align="center"/>
30599 <colspec colwidth="6*" align="right"/>
30600 <tbody>
30601 <row>
30602 <entry><option>check_secondary_mx</option></entry>
30603 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30604 <entry>Type: <emphasis>boolean</emphasis></entry>
30605 <entry>Default: <emphasis>false</emphasis></entry>
30606 </row>
30607 </tbody>
30608 </tgroup>
30609 </informaltable>
30610 <para>
30611 <indexterm role="concept">
30612 <primary>MX record</primary>
30613 <secondary>checking for secondary</secondary>
30614 </indexterm>
30615 If this option is set, the router declines unless the local host is found in
30616 (and removed from) the list of hosts obtained by MX lookup. This can be used to
30617 process domains for which the local host is a secondary mail exchanger
30618 differently to other domains. The way in which Exim decides whether a host is
30619 the local host is described in section <xref linkend="SECTreclocipadd"/>.
30620 </para>
30621 <para>
30622 <indexterm role="option">
30623 <primary><option>check_srv</option></primary>
30624 </indexterm>
30625 </para>
30626 <informaltable frame="all">
30627 <tgroup cols="4" colsep="0" rowsep="0">
30628 <colspec colwidth="8*" align="left"/>
30629 <colspec colwidth="6*" align="center"/>
30630 <colspec colwidth="6*" align="center"/>
30631 <colspec colwidth="6*" align="right"/>
30632 <tbody>
30633 <row>
30634 <entry><option>check_srv</option></entry>
30635 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30636 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30637 <entry>Default: <emphasis>unset</emphasis></entry>
30638 </row>
30639 </tbody>
30640 </tgroup>
30641 </informaltable>
30642 <para>
30643 <indexterm role="concept">
30644 <primary>SRV record</primary>
30645 <secondary>enabling use of</secondary>
30646 </indexterm>
30647 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
30648 addition to MX and address records. The support is disabled by default. To
30649 enable SRV support, set the <option>check_srv</option> option to the name of the service
30650 required. For example,
30651 </para>
30652 <literallayout class="monospaced">
30653 check_srv = smtp
30654 </literallayout>
30655 <para>
30656 looks for SRV records that refer to the normal smtp service. The option is
30657 expanded, so the service name can vary from message to message or address
30658 to address. This might be helpful if SRV records are being used for a
30659 submission service. If the expansion is forced to fail, the <option>check_srv</option>
30660 option is ignored, and the router proceeds to look for MX records in the
30661 normal way.
30662 </para>
30663 <para>
30664 When the expansion succeeds, the router searches first for SRV records for
30665 the given service (it assumes TCP protocol). A single SRV record with a
30666 host name that consists of just a single dot indicates <quote>no such service for
30667 this domain</quote>; if this is encountered, the router declines. If other kinds of
30668 SRV record are found, they are used to construct a host list for delivery
30669 according to the rules of RFC 2782. MX records are not sought in this case.
30670 </para>
30671 <para>
30672 When no SRV records are found, MX records (and address records) are sought in
30673 the traditional way. In other words, SRV records take precedence over MX
30674 records, just as MX records take precedence over address records. Note that
30675 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
30676 defined it. It is apparently believed that MX records are sufficient for email
30677 and that SRV records should not be used for this purpose. However, SRV records
30678 have an additional <quote>weight</quote> feature which some people might find useful when
30679 trying to split an SMTP load between hosts of different power.
30680 </para>
30681 <para>
30682 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
30683 when there is a DNS lookup error.
30684 </para>
30685 <para>
30686 <indexterm role="option">
30687 <primary><option>mx_domains</option></primary>
30688 </indexterm>
30689 </para>
30690 <informaltable frame="all">
30691 <tgroup cols="4" colsep="0" rowsep="0">
30692 <colspec colwidth="8*" align="left"/>
30693 <colspec colwidth="6*" align="center"/>
30694 <colspec colwidth="6*" align="center"/>
30695 <colspec colwidth="6*" align="right"/>
30696 <tbody>
30697 <row>
30698 <entry><option>mx_domains</option></entry>
30699 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30700 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30701 <entry>Default: <emphasis>unset</emphasis></entry>
30702 </row>
30703 </tbody>
30704 </tgroup>
30705 </informaltable>
30706 <para>
30707 <indexterm role="concept">
30708 <primary>MX record</primary>
30709 <secondary>required to exist</secondary>
30710 </indexterm>
30711 <indexterm role="concept">
30712 <primary>SRV record</primary>
30713 <secondary>required to exist</secondary>
30714 </indexterm>
30715 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
30716 record in order to be recognized. (The name of this option could be improved.)
30717 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
30718 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
30719 setting:
30720 </para>
30721 <literallayout class="monospaced">
30722 mx_domains = ! *.discworld.fict.example : *.fict.example
30723 </literallayout>
30724 <para>
30725 This specifies that messages addressed to a domain that matches the list but
30726 has no MX record should be bounced immediately instead of being routed using
30727 the address record.
30728 </para>
30729 <para>
30730 <indexterm role="option">
30731 <primary><option>mx_fail_domains</option></primary>
30732 </indexterm>
30733 </para>
30734 <informaltable frame="all">
30735 <tgroup cols="4" colsep="0" rowsep="0">
30736 <colspec colwidth="8*" align="left"/>
30737 <colspec colwidth="6*" align="center"/>
30738 <colspec colwidth="6*" align="center"/>
30739 <colspec colwidth="6*" align="right"/>
30740 <tbody>
30741 <row>
30742 <entry><option>mx_fail_domains</option></entry>
30743 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30744 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30745 <entry>Default: <emphasis>unset</emphasis></entry>
30746 </row>
30747 </tbody>
30748 </tgroup>
30749 </informaltable>
30750 <para>
30751 If the DNS lookup for MX records for one of the domains in this list causes a
30752 DNS lookup error, Exim behaves as if no MX records were found. See section
30753 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30754 </para>
30755 <para>
30756 <indexterm role="option">
30757 <primary><option>qualify_single</option></primary>
30758 </indexterm>
30759 </para>
30760 <informaltable frame="all">
30761 <tgroup cols="4" colsep="0" rowsep="0">
30762 <colspec colwidth="8*" align="left"/>
30763 <colspec colwidth="6*" align="center"/>
30764 <colspec colwidth="6*" align="center"/>
30765 <colspec colwidth="6*" align="right"/>
30766 <tbody>
30767 <row>
30768 <entry><option>qualify_single</option></entry>
30769 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30770 <entry>Type: <emphasis>boolean</emphasis></entry>
30771 <entry>Default: <emphasis>true</emphasis></entry>
30772 </row>
30773 </tbody>
30774 </tgroup>
30775 </informaltable>
30776 <para>
30777 <indexterm role="concept">
30778 <primary>DNS</primary>
30779 <secondary>resolver options</secondary>
30780 </indexterm>
30781 <indexterm role="concept">
30782 <primary>DNS</primary>
30783 <secondary>qualifying single-component names</secondary>
30784 </indexterm>
30785 When this option is true, the resolver option RES_DEFNAMES is set for DNS
30786 lookups. Typically, but not standardly, this causes the resolver to qualify
30787 single-component names with the default domain. For example, on a machine
30788 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
30789 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
30790 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
30791 <emphasis>resolv.conf</emphasis>.
30792 </para>
30793 <para>
30794 <indexterm role="option">
30795 <primary><option>rewrite_headers</option></primary>
30796 </indexterm>
30797 </para>
30798 <informaltable frame="all">
30799 <tgroup cols="4" colsep="0" rowsep="0">
30800 <colspec colwidth="8*" align="left"/>
30801 <colspec colwidth="6*" align="center"/>
30802 <colspec colwidth="6*" align="center"/>
30803 <colspec colwidth="6*" align="right"/>
30804 <tbody>
30805 <row>
30806 <entry><option>rewrite_headers</option></entry>
30807 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30808 <entry>Type: <emphasis>boolean</emphasis></entry>
30809 <entry>Default: <emphasis>true</emphasis></entry>
30810 </row>
30811 </tbody>
30812 </tgroup>
30813 </informaltable>
30814 <para>
30815 <indexterm role="concept">
30816 <primary>rewriting</primary>
30817 <secondary>header lines</secondary>
30818 </indexterm>
30819 <indexterm role="concept">
30820 <primary>header lines</primary>
30821 <secondary>rewriting</secondary>
30822 </indexterm>
30823 If the domain name in the address that is being processed is not fully
30824 qualified, it may be expanded to its full form by a DNS lookup. For example, if
30825 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
30826 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
30827 occur as a result of setting the <option>widen_domains</option> option. If
30828 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
30829 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
30830 header lines of the message are rewritten with the full domain name.
30831 </para>
30832 <para>
30833 This option should be turned off only when it is known that no message is
30834 ever going to be sent outside an environment where the abbreviation makes
30835 sense.
30836 </para>
30837 <para>
30838 When an MX record is looked up in the DNS and matches a wildcard record, name
30839 servers normally return a record containing the name that has been looked up,
30840 making it impossible to detect whether a wildcard was present or not. However,
30841 some name servers have recently been seen to return the wildcard entry. If the
30842 name returned by a DNS lookup begins with an asterisk, it is not used for
30843 header rewriting.
30844 </para>
30845 <para>
30846 <indexterm role="option">
30847 <primary><option>same_domain_copy_routing</option></primary>
30848 </indexterm>
30849 </para>
30850 <informaltable frame="all">
30851 <tgroup cols="4" colsep="0" rowsep="0">
30852 <colspec colwidth="8*" align="left"/>
30853 <colspec colwidth="6*" align="center"/>
30854 <colspec colwidth="6*" align="center"/>
30855 <colspec colwidth="6*" align="right"/>
30856 <tbody>
30857 <row>
30858 <entry><option>same_domain_copy_routing</option></entry>
30859 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30860 <entry>Type: <emphasis>boolean</emphasis></entry>
30861 <entry>Default: <emphasis>false</emphasis></entry>
30862 </row>
30863 </tbody>
30864 </tgroup>
30865 </informaltable>
30866 <para>
30867 <indexterm role="concept">
30868 <primary>address</primary>
30869 <secondary>copying routing</secondary>
30870 </indexterm>
30871 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
30872 to the same list of hosts. However, this cannot be presumed, because the router
30873 options and preconditions may refer to the local part of the address. By
30874 default, therefore, Exim routes each address in a message independently. DNS
30875 servers run caches, so repeated DNS lookups are not normally expensive, and in
30876 any case, personal messages rarely have more than a few recipients.
30877 </para>
30878 <para>
30879 If you are running mailing lists with large numbers of subscribers at the same
30880 domain, and you are using a <command>dnslookup</command> router which is independent of the
30881 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
30882 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
30883 routes an address to a remote transport, any other unrouted addresses in the
30884 message that have the same domain are automatically given the same routing
30885 without processing them independently,
30886 provided the following conditions are met:
30887 </para>
30888 <itemizedlist>
30889 <listitem>
30890 <para>
30891 No router that processed the address specified <option>headers_add</option> or
30892 <option>headers_remove</option>.
30893 </para>
30894 </listitem>
30895 <listitem>
30896 <para>
30897 The router did not change the address in any way, for example, by <quote>widening</quote>
30898 the domain.
30899 </para>
30900 </listitem>
30901 </itemizedlist>
30902 <para>
30903 <indexterm role="option">
30904 <primary><option>search_parents</option></primary>
30905 </indexterm>
30906 </para>
30907 <informaltable frame="all">
30908 <tgroup cols="4" colsep="0" rowsep="0">
30909 <colspec colwidth="8*" align="left"/>
30910 <colspec colwidth="6*" align="center"/>
30911 <colspec colwidth="6*" align="center"/>
30912 <colspec colwidth="6*" align="right"/>
30913 <tbody>
30914 <row>
30915 <entry><option>search_parents</option></entry>
30916 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30917 <entry>Type: <emphasis>boolean</emphasis></entry>
30918 <entry>Default: <emphasis>false</emphasis></entry>
30919 </row>
30920 </tbody>
30921 </tgroup>
30922 </informaltable>
30923 <para>
30924 <indexterm role="concept">
30925 <primary>DNS</primary>
30926 <secondary>resolver options</secondary>
30927 </indexterm>
30928 When this option is true, the resolver option RES_DNSRCH is set for DNS
30929 lookups. This is different from the <option>qualify_single</option> option in that it
30930 applies to domains containing dots. Typically, but not standardly, it causes
30931 the resolver to search for the name in the current domain and in parent
30932 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
30933 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
30934 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
30935 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
30936 </para>
30937 <para>
30938 Setting this option true can cause problems in domains that have a wildcard MX
30939 record, because any domain that does not have its own MX record matches the
30940 local wildcard.
30941 </para>
30942 <para>
30943 <indexterm role="option">
30944 <primary><option>srv_fail_domains</option></primary>
30945 </indexterm>
30946 </para>
30947 <informaltable frame="all">
30948 <tgroup cols="4" colsep="0" rowsep="0">
30949 <colspec colwidth="8*" align="left"/>
30950 <colspec colwidth="6*" align="center"/>
30951 <colspec colwidth="6*" align="center"/>
30952 <colspec colwidth="6*" align="right"/>
30953 <tbody>
30954 <row>
30955 <entry><option>srv_fail_domains</option></entry>
30956 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30957 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30958 <entry>Default: <emphasis>unset</emphasis></entry>
30959 </row>
30960 </tbody>
30961 </tgroup>
30962 </informaltable>
30963 <para>
30964 If the DNS lookup for SRV records for one of the domains in this list causes a
30965 DNS lookup error, Exim behaves as if no SRV records were found. See section
30966 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30967 </para>
30968 <para>
30969 <indexterm role="option">
30970 <primary><option>widen_domains</option></primary>
30971 </indexterm>
30972 </para>
30973 <informaltable frame="all">
30974 <tgroup cols="4" colsep="0" rowsep="0">
30975 <colspec colwidth="8*" align="left"/>
30976 <colspec colwidth="6*" align="center"/>
30977 <colspec colwidth="6*" align="center"/>
30978 <colspec colwidth="6*" align="right"/>
30979 <tbody>
30980 <row>
30981 <entry><option>widen_domains</option></entry>
30982 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30983 <entry>Type: <emphasis>string list</emphasis></entry>
30984 <entry>Default: <emphasis>unset</emphasis></entry>
30985 </row>
30986 </tbody>
30987 </tgroup>
30988 </informaltable>
30989 <para>
30990 <indexterm role="concept">
30991 <primary>domain</primary>
30992 <secondary>partial; widening</secondary>
30993 </indexterm>
30994 If a DNS lookup fails and this option is set, each of its strings in turn is
30995 added onto the end of the domain, and the lookup is tried again. For example,
30996 if
30997 </para>
30998 <literallayout class="monospaced">
30999 widen_domains = fict.example:ref.example
31000 </literallayout>
31001 <para>
31002 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
31003 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
31004 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
31005 and <option>search_parents</option> options can cause some widening to be undertaken inside
31006 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
31007 when verifying, unless <option>rewrite_headers</option> is false (not the default).
31008 </para>
31009 </section>
31010 <section id="SECID119">
31011 <title>Effect of qualify_single and search_parents</title>
31012 <para>
31013 When a domain from an envelope recipient is changed by the resolver as a result
31014 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
31015 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
31016 is set false. Exim then re-routes the address, using the full domain.
31017 </para>
31018 <para>
31019 These two options affect only the DNS lookup that takes place inside the router
31020 for the domain of the address that is being routed. They do not affect lookups
31021 such as that implied by
31022 </para>
31023 <literallayout class="monospaced">
31024 domains = @mx_any
31025 </literallayout>
31026 <para>
31027 that may happen while processing a router precondition before the router is
31028 entered. No widening ever takes place for these lookups.
31029 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
31030 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
31031 </para>
31032 </section>
31033 </chapter>
31034
31035 <chapter id="CHID5">
31036 <title>The ipliteral router</title>
31037 <para>
31038 <indexterm role="concept">
31039 <primary><command>ipliteral</command> router</primary>
31040 </indexterm>
31041 <indexterm role="concept">
31042 <primary>domain literal</primary>
31043 <secondary>routing</secondary>
31044 </indexterm>
31045 <indexterm role="concept">
31046 <primary>routers</primary>
31047 <secondary><command>ipliteral</command></secondary>
31048 </indexterm>
31049 This router has no private options. Unless it is being used purely for
31050 verification (see <option>verify_only</option>) a transport is required to be defined by the
31051 generic <option>transport</option> option. The router accepts the address if its domain part
31052 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
31053 router handles the address
31054 </para>
31055 <literallayout class="monospaced">
31056 root@[192.168.1.1]
31057 </literallayout>
31058 <para>
31059 by setting up delivery to the host with that IP address. IPv4 domain literals
31060 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
31061 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
31062 </para>
31063 <literallayout class="monospaced">
31064 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
31065 </literallayout>
31066 <para>
31067 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
31068 grounds that sooner or later somebody will try it.
31069 </para>
31070 <para>
31071 <indexterm role="option">
31072 <primary><option>self</option></primary>
31073 <secondary>in <command>ipliteral</command> router</secondary>
31074 </indexterm>
31075 If the IP address matches something in <option>ignore_target_hosts</option>, the router
31076 declines. If an IP literal turns out to refer to the local host, the generic
31077 <option>self</option> option determines what happens.
31078 </para>
31079 <para>
31080 The RFCs require support for domain literals; however, their use is
31081 controversial in today&#x2019;s Internet. If you want to use this router, you must
31082 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
31083 Exim will not recognize the domain literal syntax in addresses.
31084 </para>
31085 </chapter>
31086
31087 <chapter id="CHID6">
31088 <title>The iplookup router</title>
31089 <para>
31090 <indexterm role="concept">
31091 <primary><command>iplookup</command> router</primary>
31092 </indexterm>
31093 <indexterm role="concept">
31094 <primary>routers</primary>
31095 <secondary><command>iplookup</command></secondary>
31096 </indexterm>
31097 The <command>iplookup</command> router was written to fulfil a specific requirement in
31098 Cambridge University (which in fact no longer exists). For this reason, it is
31099 not included in the binary of Exim by default. If you want to include it, you
31100 must set
31101 </para>
31102 <literallayout class="monospaced">
31103 ROUTER_IPLOOKUP=yes
31104 </literallayout>
31105 <para>
31106 in your <filename>Local/Makefile</filename> configuration file.
31107 </para>
31108 <para>
31109 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
31110 connection to one or more specific hosts. The host can then return the same or
31111 a different address &ndash; in effect rewriting the recipient address in the
31112 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
31113 this process fails, the address can be passed on to other routers, or delivery
31114 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
31115 must not be specified for it.
31116 </para>
31117 <para>
31118 <indexterm role="concept">
31119 <primary>options</primary>
31120 <secondary><command>iplookup</command> router</secondary>
31121 </indexterm>
31122 <indexterm role="option">
31123 <primary><option>hosts</option></primary>
31124 </indexterm>
31125 </para>
31126 <informaltable frame="all">
31127 <tgroup cols="4" colsep="0" rowsep="0">
31128 <colspec colwidth="8*" align="left"/>
31129 <colspec colwidth="6*" align="center"/>
31130 <colspec colwidth="6*" align="center"/>
31131 <colspec colwidth="6*" align="right"/>
31132 <tbody>
31133 <row>
31134 <entry><option>hosts</option></entry>
31135 <entry>Use: <emphasis>iplookup</emphasis></entry>
31136 <entry>Type: <emphasis>string</emphasis></entry>
31137 <entry>Default: <emphasis>unset</emphasis></entry>
31138 </row>
31139 </tbody>
31140 </tgroup>
31141 </informaltable>
31142 <para>
31143 This option must be supplied. Its value is a colon-separated list of host
31144 names. The hosts are looked up using <function>gethostbyname()</function>
31145 (or <function>getipnodebyname()</function> when available)
31146 and are tried in order until one responds to the query. If none respond, what
31147 happens is controlled by <option>optional</option>.
31148 </para>
31149 <para>
31150 <indexterm role="option">
31151 <primary><option>optional</option></primary>
31152 </indexterm>
31153 </para>
31154 <informaltable frame="all">
31155 <tgroup cols="4" colsep="0" rowsep="0">
31156 <colspec colwidth="8*" align="left"/>
31157 <colspec colwidth="6*" align="center"/>
31158 <colspec colwidth="6*" align="center"/>
31159 <colspec colwidth="6*" align="right"/>
31160 <tbody>
31161 <row>
31162 <entry><option>optional</option></entry>
31163 <entry>Use: <emphasis>iplookup</emphasis></entry>
31164 <entry>Type: <emphasis>boolean</emphasis></entry>
31165 <entry>Default: <emphasis>false</emphasis></entry>
31166 </row>
31167 </tbody>
31168 </tgroup>
31169 </informaltable>
31170 <para>
31171 If <option>optional</option> is true, if no response is obtained from any host, the address
31172 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
31173 delivery to the address is deferred.
31174 </para>
31175 <para>
31176 <indexterm role="option">
31177 <primary><option>port</option></primary>
31178 </indexterm>
31179 </para>
31180 <informaltable frame="all">
31181 <tgroup cols="4" colsep="0" rowsep="0">
31182 <colspec colwidth="8*" align="left"/>
31183 <colspec colwidth="6*" align="center"/>
31184 <colspec colwidth="6*" align="center"/>
31185 <colspec colwidth="6*" align="right"/>
31186 <tbody>
31187 <row>
31188 <entry><option>port</option></entry>
31189 <entry>Use: <emphasis>iplookup</emphasis></entry>
31190 <entry>Type: <emphasis>integer</emphasis></entry>
31191 <entry>Default: <emphasis>0</emphasis></entry>
31192 </row>
31193 </tbody>
31194 </tgroup>
31195 </informaltable>
31196 <para>
31197 <indexterm role="concept">
31198 <primary>port</primary>
31199 <secondary><command>iplookup</command> router</secondary>
31200 </indexterm>
31201 This option must be supplied. It specifies the port number for the TCP or UDP
31202 call.
31203 </para>
31204 <para>
31205 <indexterm role="option">
31206 <primary><option>protocol</option></primary>
31207 </indexterm>
31208 </para>
31209 <informaltable frame="all">
31210 <tgroup cols="4" colsep="0" rowsep="0">
31211 <colspec colwidth="8*" align="left"/>
31212 <colspec colwidth="6*" align="center"/>
31213 <colspec colwidth="6*" align="center"/>
31214 <colspec colwidth="6*" align="right"/>
31215 <tbody>
31216 <row>
31217 <entry><option>protocol</option></entry>
31218 <entry>Use: <emphasis>iplookup</emphasis></entry>
31219 <entry>Type: <emphasis>string</emphasis></entry>
31220 <entry>Default: <emphasis>udp</emphasis></entry>
31221 </row>
31222 </tbody>
31223 </tgroup>
31224 </informaltable>
31225 <para>
31226 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
31227 protocols is to be used.
31228 </para>
31229 <para>
31230 <indexterm role="option">
31231 <primary><option>query</option></primary>
31232 </indexterm>
31233 </para>
31234 <informaltable frame="all">
31235 <tgroup cols="4" colsep="0" rowsep="0">
31236 <colspec colwidth="8*" align="left"/>
31237 <colspec colwidth="6*" align="center"/>
31238 <colspec colwidth="6*" align="center"/>
31239 <colspec colwidth="6*" align="right"/>
31240 <tbody>
31241 <row>
31242 <entry><option>query</option></entry>
31243 <entry>Use: <emphasis>iplookup</emphasis></entry>
31244 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31245 <entry>Default: <emphasis>see below</emphasis></entry>
31246 </row>
31247 </tbody>
31248 </tgroup>
31249 </informaltable>
31250 <para>
31251 This defines the content of the query that is sent to the remote hosts. The
31252 default value is:
31253 </para>
31254 <literallayout class="monospaced">
31255 $local_part@$domain $local_part@$domain
31256 </literallayout>
31257 <para>
31258 The repetition serves as a way of checking that a response is to the correct
31259 query in the default case (see <option>response_pattern</option> below).
31260 </para>
31261 <para>
31262 <indexterm role="option">
31263 <primary><option>reroute</option></primary>
31264 </indexterm>
31265 </para>
31266 <informaltable frame="all">
31267 <tgroup cols="4" colsep="0" rowsep="0">
31268 <colspec colwidth="8*" align="left"/>
31269 <colspec colwidth="6*" align="center"/>
31270 <colspec colwidth="6*" align="center"/>
31271 <colspec colwidth="6*" align="right"/>
31272 <tbody>
31273 <row>
31274 <entry><option>reroute</option></entry>
31275 <entry>Use: <emphasis>iplookup</emphasis></entry>
31276 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31277 <entry>Default: <emphasis>unset</emphasis></entry>
31278 </row>
31279 </tbody>
31280 </tgroup>
31281 </informaltable>
31282 <para>
31283 If this option is not set, the rerouted address is precisely the byte string
31284 returned by the remote host, up to the first white space, if any. If set, the
31285 string is expanded to form the rerouted address. It can include parts matched
31286 in the response by <option>response_pattern</option> by means of numeric variables such as
31287 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
31288 whether or not a pattern is in use. In all cases, the rerouted address must end
31289 up in the form <emphasis>local_part@domain</emphasis>.
31290 </para>
31291 <para>
31292 <indexterm role="option">
31293 <primary><option>response_pattern</option></primary>
31294 </indexterm>
31295 </para>
31296 <informaltable frame="all">
31297 <tgroup cols="4" colsep="0" rowsep="0">
31298 <colspec colwidth="8*" align="left"/>
31299 <colspec colwidth="6*" align="center"/>
31300 <colspec colwidth="6*" align="center"/>
31301 <colspec colwidth="6*" align="right"/>
31302 <tbody>
31303 <row>
31304 <entry><option>response_pattern</option></entry>
31305 <entry>Use: <emphasis>iplookup</emphasis></entry>
31306 <entry>Type: <emphasis>string</emphasis></entry>
31307 <entry>Default: <emphasis>unset</emphasis></entry>
31308 </row>
31309 </tbody>
31310 </tgroup>
31311 </informaltable>
31312 <para>
31313 This option can be set to a regular expression that is applied to the string
31314 returned from the remote host. If the pattern does not match the response, the
31315 router declines. If <option>response_pattern</option> is not set, no checking of the
31316 response is done, unless the query was defaulted, in which case there is a
31317 check that the text returned after the first white space is the original
31318 address. This checks that the answer that has been received is in response to
31319 the correct question. For example, if the response is just a new domain, the
31320 following could be used:
31321 </para>
31322 <literallayout class="monospaced">
31323 response_pattern = ^([^@]+)$
31324 reroute = $local_part@$1
31325 </literallayout>
31326 <para>
31327 <indexterm role="option">
31328 <primary><option>timeout</option></primary>
31329 </indexterm>
31330 </para>
31331 <informaltable frame="all">
31332 <tgroup cols="4" colsep="0" rowsep="0">
31333 <colspec colwidth="8*" align="left"/>
31334 <colspec colwidth="6*" align="center"/>
31335 <colspec colwidth="6*" align="center"/>
31336 <colspec colwidth="6*" align="right"/>
31337 <tbody>
31338 <row>
31339 <entry><option>timeout</option></entry>
31340 <entry>Use: <emphasis>iplookup</emphasis></entry>
31341 <entry>Type: <emphasis>time</emphasis></entry>
31342 <entry>Default: <emphasis>5s</emphasis></entry>
31343 </row>
31344 </tbody>
31345 </tgroup>
31346 </informaltable>
31347 <para>
31348 This specifies the amount of time to wait for a response from the remote
31349 machine. The same timeout is used for the <function>connect()</function> function for a TCP
31350 call. It does not apply to UDP.
31351 </para>
31352 </chapter>
31353
31354 <chapter id="CHID7">
31355 <title>The manualroute router</title>
31356 <para>
31357 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
31358 <primary><command>manualroute</command> router</primary>
31359 </indexterm>
31360 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
31361 <primary>routers</primary>
31362 <secondary><command>manualroute</command></secondary>
31363 </indexterm>
31364 <indexterm role="concept">
31365 <primary>domain</primary>
31366 <secondary>manually routing</secondary>
31367 </indexterm>
31368 The <command>manualroute</command> router is so-called because it provides a way of manually
31369 routing an address according to its domain. It is mainly used when you want to
31370 route addresses to remote hosts according to your own rules, bypassing the
31371 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
31372 route to local transports, a facility that may be useful if you want to save
31373 messages for dial-in hosts in local files.
31374 </para>
31375 <para>
31376 The <command>manualroute</command> router compares a list of domain patterns with the domain
31377 it is trying to route. If there is no match, the router declines. Each pattern
31378 has associated with it a list of hosts and some other optional data, which may
31379 include a transport. The combination of a pattern and its data is called a
31380 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
31381 generic <option>transport</option> option must specify a transport, unless the router is
31382 being used purely for verification (see <option>verify_only</option>).
31383 </para>
31384 <para>
31385 <indexterm role="variable">
31386 <primary><varname>$host</varname></primary>
31387 </indexterm>
31388 In the case of verification, matching the domain pattern is sufficient for the
31389 router to accept the address. When actually routing an address for delivery,
31390 an address that matches a domain pattern is queued for the associated
31391 transport. If the transport is not a local one, a host list must be associated
31392 with the pattern; IP addresses are looked up for the hosts, and these are
31393 passed to the transport along with the mail address. For local transports, a
31394 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
31395 text string.
31396 </para>
31397 <para>
31398 The list of routing rules can be provided as an inline string in
31399 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
31400 or database by setting <option>route_data</option>. Only one of these settings may appear in
31401 any one instance of <command>manualroute</command>. The format of routing rules is described
31402 below, following the list of private options.
31403 </para>
31404 <section id="SECTprioptman">
31405 <title>Private options for manualroute</title>
31406 <para>
31407 <indexterm role="concept">
31408 <primary>options</primary>
31409 <secondary><command>manualroute</command> router</secondary>
31410 </indexterm>
31411 The private options for the <command>manualroute</command> router are as follows:
31412 </para>
31413 <para revisionflag="changed">
31414 <indexterm role="option">
31415 <primary><option>host_all_ignored</option></primary>
31416 </indexterm>
31417 </para>
31418 <informaltable frame="all" revisionflag="changed">
31419 <tgroup cols="4" colsep="0" rowsep="0">
31420 <colspec colwidth="8*" align="left"/>
31421 <colspec colwidth="6*" align="center"/>
31422 <colspec colwidth="6*" align="center"/>
31423 <colspec colwidth="6*" align="right"/>
31424 <tbody>
31425 <row>
31426 <entry><option>host_all_ignored</option></entry>
31427 <entry>Use: <emphasis>manualroute</emphasis></entry>
31428 <entry>Type: <emphasis>string</emphasis></entry>
31429 <entry>Default: <emphasis>defer</emphasis></entry>
31430 </row>
31431 </tbody>
31432 </tgroup>
31433 </informaltable>
31434 <para revisionflag="changed">
31435 See <option>host_find_failed</option>.
31436 </para>
31437 <para revisionflag="changed">
31438 <indexterm role="option">
31439 <primary><option>host_find_failed</option></primary>
31440 </indexterm>
31441 </para>
31442 <informaltable frame="all" revisionflag="changed">
31443 <tgroup cols="4" colsep="0" rowsep="0">
31444 <colspec colwidth="8*" align="left"/>
31445 <colspec colwidth="6*" align="center"/>
31446 <colspec colwidth="6*" align="center"/>
31447 <colspec colwidth="6*" align="right"/>
31448 <tbody>
31449 <row>
31450 <entry><option>host_find_failed</option></entry>
31451 <entry>Use: <emphasis>manualroute</emphasis></entry>
31452 <entry>Type: <emphasis>string</emphasis></entry>
31453 <entry>Default: <emphasis>freeze</emphasis></entry>
31454 </row>
31455 </tbody>
31456 </tgroup>
31457 </informaltable>
31458 <para revisionflag="changed">
31459 This option controls what happens when <command>manualroute</command> tries to find an IP
31460 address for a host, and the host does not exist. The option can be set to one
31461 of the following values:
31462 </para>
31463 <literallayout class="monospaced" revisionflag="changed">
31464 decline
31465 defer
31466 fail
31467 freeze
31468 ignore
31469 pass
31470 </literallayout>
31471 <para revisionflag="changed">
31472 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
31473 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
31474 forces the address to be passed to the next router (or the router defined by
31475 <option>pass_router</option>),
31476 <indexterm role="option">
31477 <primary><option>more</option></primary>
31478 </indexterm>
31479 overriding <option>no_more</option>, whereas the latter passes the address to the next
31480 router only if <option>more</option> is true.
31481 </para>
31482 <para revisionflag="changed">
31483 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
31484 cannot be found. If all the hosts in the list are ignored, the behaviour is
31485 controlled by the <option>host_all_ignored</option> option. This takes the same values
31486 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
31487 </para>
31488 <para revisionflag="changed">
31489 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
31490 state; if a host lookup gets a temporary error, delivery is deferred unless the
31491 generic <option>pass_on_timeout</option> option is set.
31492 </para>
31493 <para>
31494 <indexterm role="option">
31495 <primary><option>hosts_randomize</option></primary>
31496 </indexterm>
31497 </para>
31498 <informaltable frame="all">
31499 <tgroup cols="4" colsep="0" rowsep="0">
31500 <colspec colwidth="8*" align="left"/>
31501 <colspec colwidth="6*" align="center"/>
31502 <colspec colwidth="6*" align="center"/>
31503 <colspec colwidth="6*" align="right"/>
31504 <tbody>
31505 <row>
31506 <entry><option>hosts_randomize</option></entry>
31507 <entry>Use: <emphasis>manualroute</emphasis></entry>
31508 <entry>Type: <emphasis>boolean</emphasis></entry>
31509 <entry>Default: <emphasis>false</emphasis></entry>
31510 </row>
31511 </tbody>
31512 </tgroup>
31513 </informaltable>
31514 <para>
31515 <indexterm role="concept">
31516 <primary>randomized host list</primary>
31517 </indexterm>
31518 <indexterm role="concept">
31519 <primary>host</primary>
31520 <secondary>list of; randomized</secondary>
31521 </indexterm>
31522 If this option is set, the order of the items in a host list in a routing rule
31523 is randomized each time the list is used, unless an option in the routing rule
31524 overrides (see below). Randomizing the order of a host list can be used to do
31525 crude load sharing. However, if more than one mail address is routed by the
31526 same router to the same host list, the host lists are considered to be the same
31527 (even though they may be randomized into different orders) for the purpose of
31528 deciding whether to batch the deliveries into a single SMTP transaction.
31529 </para>
31530 <para>
31531 When <option>hosts_randomize</option> is true, a host list may be split
31532 into groups whose order is separately randomized. This makes it possible to
31533 set up MX-like behaviour. The boundaries between groups are indicated by an
31534 item that is just <literal>+</literal> in the host list. For example:
31535 </para>
31536 <literallayout class="monospaced">
31537 route_list = * host1:host2:host3:+:host4:host5
31538 </literallayout>
31539 <para>
31540 The order of the first three hosts and the order of the last two hosts is
31541 randomized for each use, but the first three always end up before the last two.
31542 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
31543 randomized host list is passed to an <command>smtp</command> transport that also has
31544 <option>hosts_randomize set</option>, the list is not re-randomized.
31545 </para>
31546 <para>
31547 <indexterm role="option">
31548 <primary><option>route_data</option></primary>
31549 </indexterm>
31550 </para>
31551 <informaltable frame="all">
31552 <tgroup cols="4" colsep="0" rowsep="0">
31553 <colspec colwidth="8*" align="left"/>
31554 <colspec colwidth="6*" align="center"/>
31555 <colspec colwidth="6*" align="center"/>
31556 <colspec colwidth="6*" align="right"/>
31557 <tbody>
31558 <row>
31559 <entry><option>route_data</option></entry>
31560 <entry>Use: <emphasis>manualroute</emphasis></entry>
31561 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31562 <entry>Default: <emphasis>unset</emphasis></entry>
31563 </row>
31564 </tbody>
31565 </tgroup>
31566 </informaltable>
31567 <para>
31568 If this option is set, it must expand to yield the data part of a routing rule.
31569 Typically, the expansion string includes a lookup based on the domain. For
31570 example:
31571 </para>
31572 <literallayout class="monospaced">
31573 route_data = ${lookup{$domain}dbm{/etc/routes}}
31574 </literallayout>
31575 <para>
31576 If the expansion is forced to fail, or the result is an empty string, the
31577 router declines. Other kinds of expansion failure cause delivery to be
31578 deferred.
31579 </para>
31580 <para>
31581 <indexterm role="option">
31582 <primary><option>route_list</option></primary>
31583 </indexterm>
31584 </para>
31585 <informaltable frame="all">
31586 <tgroup cols="4" colsep="0" rowsep="0">
31587 <colspec colwidth="8*" align="left"/>
31588 <colspec colwidth="6*" align="center"/>
31589 <colspec colwidth="6*" align="center"/>
31590 <colspec colwidth="6*" align="right"/>
31591 <tbody>
31592 <row>
31593 <entry><option>route_list</option></entry>
31594 <entry>Use: <emphasis>manualroute</emphasis></entry>
31595 <entry>Type: <emphasis>string list</emphasis></entry>
31596 <entry>Default: <emphasis>unset</emphasis></entry>
31597 </row>
31598 </tbody>
31599 </tgroup>
31600 </informaltable>
31601 <para>
31602 This string is a list of routing rules, in the form defined below. Note that,
31603 unlike most string lists, the items are separated by semicolons. This is so
31604 that they may contain colon-separated host lists.
31605 </para>
31606 <para>
31607 <indexterm role="option">
31608 <primary><option>same_domain_copy_routing</option></primary>
31609 </indexterm>
31610 </para>
31611 <informaltable frame="all">
31612 <tgroup cols="4" colsep="0" rowsep="0">
31613 <colspec colwidth="8*" align="left"/>
31614 <colspec colwidth="6*" align="center"/>
31615 <colspec colwidth="6*" align="center"/>
31616 <colspec colwidth="6*" align="right"/>
31617 <tbody>
31618 <row>
31619 <entry><option>same_domain_copy_routing</option></entry>
31620 <entry>Use: <emphasis>manualroute</emphasis></entry>
31621 <entry>Type: <emphasis>boolean</emphasis></entry>
31622 <entry>Default: <emphasis>false</emphasis></entry>
31623 </row>
31624 </tbody>
31625 </tgroup>
31626 </informaltable>
31627 <para>
31628 <indexterm role="concept">
31629 <primary>address</primary>
31630 <secondary>copying routing</secondary>
31631 </indexterm>
31632 Addresses with the same domain are normally routed by the <command>manualroute</command>
31633 router to the same list of hosts. However, this cannot be presumed, because the
31634 router options and preconditions may refer to the local part of the address. By
31635 default, therefore, Exim routes each address in a message independently. DNS
31636 servers run caches, so repeated DNS lookups are not normally expensive, and in
31637 any case, personal messages rarely have more than a few recipients.
31638 </para>
31639 <para>
31640 If you are running mailing lists with large numbers of subscribers at the same
31641 domain, and you are using a <command>manualroute</command> router which is independent of the
31642 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31643 lookups for identical domains in one message. In this case, when
31644 <command>manualroute</command> routes an address to a remote transport, any other unrouted
31645 addresses in the message that have the same domain are automatically given the
31646 same routing without processing them independently. However, this is only done
31647 if <option>headers_add</option> and <option>headers_remove</option> are unset.
31648 </para>
31649 </section>
31650 <section id="SECID120">
31651 <title>Routing rules in route_list</title>
31652 <para>
31653 The value of <option>route_list</option> is a string consisting of a sequence of routing
31654 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
31655 entered as two semicolons. Alternatively, the list separator can be changed as
31656 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
31657 Empty rules are ignored. The format of each rule is
31658 </para>
31659 <literallayout>
31660 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
31661 </literallayout>
31662 <para>
31663 The following example contains two rules, each with a simple domain pattern and
31664 no options:
31665 </para>
31666 <literallayout class="monospaced">
31667 route_list = \
31668   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
31669   thes.ref.example  mail-3.ref.example:mail-4.ref.example
31670 </literallayout>
31671 <para>
31672 The three parts of a rule are separated by white space. The pattern and the
31673 list of hosts can be enclosed in quotes if necessary, and if they are, the
31674 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
31675 single domain pattern, which is the only mandatory item in the rule. The
31676 pattern is in the same format as one item in a domain list (see section
31677 <xref linkend="SECTdomainlist"/>),
31678 except that it may not be the name of an interpolated file.
31679 That is, it may be wildcarded, or a regular expression, or a file or database
31680 lookup (with semicolons doubled, because of the use of semicolon as a separator
31681 in a <option>route_list</option>).
31682 </para>
31683 <para>
31684 The rules in <option>route_list</option> are searched in order until one of the patterns
31685 matches the domain that is being routed. The list of hosts and then options are
31686 then used as described below. If there is no match, the router declines. When
31687 <option>route_list</option> is set, <option>route_data</option> must not be set.
31688 </para>
31689 </section>
31690 <section id="SECID121">
31691 <title>Routing rules in route_data</title>
31692 <para>
31693 The use of <option>route_list</option> is convenient when there are only a small number of
31694 routing rules. For larger numbers, it is easier to use a file or database to
31695 hold the routing information, and use the <option>route_data</option> option instead.
31696 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
31697 Most commonly, <option>route_data</option> is set as a string that contains an
31698 expansion lookup. For example, suppose we place two routing rules in a file
31699 like this:
31700 </para>
31701 <literallayout class="monospaced">
31702 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
31703 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
31704 </literallayout>
31705 <para>
31706 This data can be accessed by setting
31707 </para>
31708 <literallayout class="monospaced">
31709 route_data = ${lookup{$domain}lsearch{/the/file/name}}
31710 </literallayout>
31711 <para>
31712 Failure of the lookup results in an empty string, causing the router to
31713 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
31714 requirement is that the result of expanding the string is a list of hosts,
31715 possibly followed by options, separated by white space. The list of hosts must
31716 be enclosed in quotes if it contains white space.
31717 </para>
31718 </section>
31719 <section id="SECID122">
31720 <title>Format of the list of hosts</title>
31721 <para>
31722 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
31723 always separately expanded before use. If the expansion fails, the router
31724 declines. The result of the expansion must be a colon-separated list of names
31725 and/or IP addresses, optionally also including ports. The format of each item
31726 in the list is described in the next section. The list separator can be changed
31727 as described in section <xref linkend="SECTlistconstruct"/>.
31728 </para>
31729 <para>
31730 If the list of hosts was obtained from a <option>route_list</option> item, the following
31731 variables are set during its expansion:
31732 </para>
31733 <itemizedlist>
31734 <listitem>
31735 <para>
31736 <indexterm role="concept">
31737 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
31738 <secondary>in <command>manualroute</command> router</secondary>
31739 </indexterm>
31740 If the domain was matched against a regular expression, the numeric variables
31741 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
31742 </para>
31743 <literallayout class="monospaced">
31744 route_list = ^domain(\d+)   host-$1.text.example
31745 </literallayout>
31746 </listitem>
31747 <listitem>
31748 <para>
31749 <varname>$0</varname> is always set to the entire domain.
31750 </para>
31751 </listitem>
31752 <listitem>
31753 <para>
31754 <varname>$1</varname> is also set when partial matching is done in a file lookup.
31755 </para>
31756 </listitem>
31757 <listitem>
31758 <para>
31759 <indexterm role="variable">
31760 <primary><varname>$value</varname></primary>
31761 </indexterm>
31762 If the pattern that matched the domain was a lookup item, the data that was
31763 looked up is available in the expansion variable <varname>$value</varname>. For example:
31764 </para>
31765 <literallayout class="monospaced">
31766 route_list = lsearch;;/some/file.routes  $value
31767 </literallayout>
31768 </listitem>
31769 </itemizedlist>
31770 <para>
31771 Note the doubling of the semicolon in the pattern that is necessary because
31772 semicolon is the default route list separator.
31773 </para>
31774 </section>
31775 <section id="SECTformatonehostitem">
31776 <title>Format of one host item</title>
31777 <para>
31778 Each item in the list of hosts is either a host name or an IP address,
31779 optionally with an attached port number. When no port is given, an IP address
31780 is not enclosed in brackets. When a port is specified, it overrides the port
31781 specification on the transport. The port is separated from the name or address
31782 by a colon. This leads to some complications:
31783 </para>
31784 <itemizedlist>
31785 <listitem>
31786 <para>
31787 Because colon is the default separator for the list of hosts, either
31788 the colon that specifies a port must be doubled, or the list separator must
31789 be changed. The following two examples have the same effect:
31790 </para>
31791 <literallayout class="monospaced">
31792 route_list = * "host1.tld::1225 : host2.tld::1226"
31793 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
31794 </literallayout>
31795 </listitem>
31796 <listitem>
31797 <para>
31798 When IPv6 addresses are involved, it gets worse, because they contain
31799 colons of their own. To make this case easier, it is permitted to
31800 enclose an IP address (either v4 or v6) in square brackets if a port
31801 number follows. For example:
31802 </para>
31803 <literallayout class="monospaced">
31804 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
31805 </literallayout>
31806 </listitem>
31807 </itemizedlist>
31808 </section>
31809 <section id="SECThostshowused">
31810 <title>How the list of hosts is used</title>
31811 <para>
31812 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
31813 the hosts is tried, in the order specified, when carrying out the SMTP
31814 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
31815 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
31816 transport.
31817 </para>
31818 <para>
31819 Hosts may be listed by name or by IP address. An unadorned name in the list of
31820 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
31821 interpreted as an indirection to a sublist of hosts obtained by looking up MX
31822 records in the DNS. For example:
31823 </para>
31824 <literallayout class="monospaced">
31825 route_list = *  x.y.z:p.q.r/MX:e.f.g
31826 </literallayout>
31827 <para>
31828 If this feature is used with a port specifier, the port must come last. For
31829 example:
31830 </para>
31831 <literallayout class="monospaced">
31832 route_list = *  dom1.tld/mx::1225
31833 </literallayout>
31834 <para>
31835 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
31836 randomized before any lookups are done. Exim then scans the list; for any name
31837 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
31838 be an interface on the local host and the item is not the first in the list,
31839 Exim discards it and any subsequent items. If it is the first item, what
31840 happens is controlled by the
31841 <indexterm role="option">
31842 <primary><option>self</option></primary>
31843 <secondary>in <command>manualroute</command> router</secondary>
31844 </indexterm>
31845 <option>self</option> option of the router.
31846 </para>
31847 <para>
31848 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
31849 hosts obtained by looking up MX records for the name. This is always a DNS
31850 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
31851 below) are not relevant here. The order of these hosts is determined by the
31852 preference values in the MX records, according to the usual rules. Because
31853 randomizing happens before the MX lookup, it does not affect the order that is
31854 defined by MX preferences.
31855 </para>
31856 <para>
31857 If the local host is present in the sublist obtained from MX records, but is
31858 not the most preferred host in that list, it and any equally or less
31859 preferred hosts are removed before the sublist is inserted into the main list.
31860 </para>
31861 <para>
31862 If the local host is the most preferred host in the MX list, what happens
31863 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
31864 is not the first item (that is, there are previous hosts in the main list),
31865 Exim discards this name and any subsequent items in the main list.
31866 </para>
31867 <para>
31868 If the MX item is first in the list of hosts, and the local host is the
31869 most preferred host, what happens is controlled by the <option>self</option> option of the
31870 router.
31871 </para>
31872 <para>
31873 DNS failures when lookup up the MX records are treated in the same way as DNS
31874 failures when looking up IP addresses: <option>pass_on_timeout</option> and
31875 <option>host_find_failed</option> are used when relevant.
31876 </para>
31877 <para>
31878 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
31879 whether obtained from an MX lookup or not.
31880 </para>
31881 </section>
31882 <section id="SECThowoptused">
31883 <title>How the options are used</title>
31884 <para>
31885 The options are a sequence of words; in practice no more than three are ever
31886 present. One of the words can be the name of a transport; this overrides the
31887 <option>transport</option> option on the router for this particular routing rule only. The
31888 other words (if present) control randomization of the list of hosts on a
31889 per-rule basis, and how the IP addresses of the hosts are to be found when
31890 routing to a remote transport. These options are as follows:
31891 </para>
31892 <itemizedlist>
31893 <listitem>
31894 <para>
31895 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
31896 setting of <option>hosts_randomize</option> for this routing rule only.
31897 </para>
31898 </listitem>
31899 <listitem>
31900 <para>
31901 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
31902 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
31903 </para>
31904 </listitem>
31905 <listitem>
31906 <para>
31907 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
31908 find IP addresses. This function may ultimately cause a DNS lookup, but it may
31909 also look in <filename>/etc/hosts</filename> or other sources of information.
31910 </para>
31911 </listitem>
31912 <listitem>
31913 <para>
31914 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
31915 no address records are found. If there is a temporary DNS error (such as a
31916 timeout), delivery is deferred.
31917 </para>
31918 </listitem>
31919 </itemizedlist>
31920 <para>
31921 For example:
31922 </para>
31923 <literallayout class="monospaced">
31924 route_list = domain1  host1:host2:host3  randomize bydns;\
31925              domain2  host4:host5
31926 </literallayout>
31927 <para>
31928 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
31929 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
31930 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
31931 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
31932 call.
31933 </para>
31934 <para>
31935 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
31936 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
31937 instead of TRY_AGAIN. That is why the default action is to try a DNS
31938 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
31939 function called.
31940 </para>
31941 <para>
31942 If no IP address for a host can be found, what happens is controlled by the
31943 <option>host_find_failed</option> option.
31944 </para>
31945 <para>
31946 <indexterm role="variable">
31947 <primary><varname>$host</varname></primary>
31948 </indexterm>
31949 When an address is routed to a local transport, IP addresses are not looked up.
31950 The host list is passed to the transport in the <varname>$host</varname> variable.
31951 </para>
31952 </section>
31953 <section id="SECID123">
31954 <title>Manualroute examples</title>
31955 <para>
31956 In some of the examples that follow, the presence of the <option>remote_smtp</option>
31957 transport, as defined in the default configuration file, is assumed:
31958 </para>
31959 <itemizedlist>
31960 <listitem>
31961 <para>
31962 <indexterm role="concept">
31963 <primary>smart host</primary>
31964 <secondary>example router</secondary>
31965 </indexterm>
31966 The <command>manualroute</command> router can be used to forward all external mail to a
31967 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
31968 named domain list that contains your local domains, for example:
31969 </para>
31970 <literallayout class="monospaced">
31971 domainlist local_domains = my.domain.example
31972 </literallayout>
31973 <para>
31974 You can arrange for all other domains to be routed to a smart host by making
31975 your first router something like this:
31976 </para>
31977 <literallayout class="monospaced">
31978 smart_route:
31979   driver = manualroute
31980   domains = !+local_domains
31981   transport = remote_smtp
31982   route_list = * smarthost.ref.example
31983 </literallayout>
31984 <para>
31985 This causes all non-local addresses to be sent to the single host
31986 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
31987 they are tried in order
31988 (but you can use <option>hosts_randomize</option> to vary the order each time).
31989 Another way of configuring the same thing is this:
31990 </para>
31991 <literallayout class="monospaced">
31992 smart_route:
31993   driver = manualroute
31994   transport = remote_smtp
31995   route_list = !+local_domains  smarthost.ref.example
31996 </literallayout>
31997 <para>
31998 There is no difference in behaviour between these two routers as they stand.
31999 However, they behave differently if <option>no_more</option> is added to them. In the first
32000 example, the router is skipped if the domain does not match the <option>domains</option>
32001 precondition; the following router is always tried. If the router runs, it
32002 always matches the domain and so can never decline. Therefore, <option>no_more</option>
32003 would have no effect. In the second case, the router is never skipped; it
32004 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
32005 <option>no_more</option> would prevent subsequent routers from running.
32006 </para>
32007 </listitem>
32008 <listitem>
32009 <para>
32010 <indexterm role="concept">
32011 <primary>mail hub example</primary>
32012 </indexterm>
32013 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
32014 records in the DNS and delivers it via its own private routing mechanism. Often
32015 the final destinations are behind a firewall, with the mail hub being the one
32016 machine that can connect to machines both inside and outside the firewall. The
32017 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
32018 to the correct hosts. For a small number of domains, the routing can be inline,
32019 using the <option>route_list</option> option, but for a larger number a file or database
32020 lookup is easier to manage.
32021 </para>
32022 <para>
32023 If the domain names are in fact the names of the machines to which the mail is
32024 to be sent by the mail hub, the configuration can be quite simple. For
32025 example:
32026 </para>
32027 <literallayout class="monospaced">
32028 hub_route:
32029   driver = manualroute
32030   transport = remote_smtp
32031   route_list = *.rhodes.tvs.example  $domain
32032 </literallayout>
32033 <para>
32034 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
32035 whose names are the same as the mail domains. A similar approach can be taken
32036 if the host name can be obtained from the domain name by a string manipulation
32037 that the expansion facilities can handle. Otherwise, a lookup based on the
32038 domain can be used to find the host:
32039 </para>
32040 <literallayout class="monospaced">
32041 through_firewall:
32042   driver = manualroute
32043   transport = remote_smtp
32044   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
32045 </literallayout>
32046 <para>
32047 The result of the lookup must be the name or IP address of the host (or
32048 hosts) to which the address is to be routed. If the lookup fails, the route
32049 data is empty, causing the router to decline. The address then passes to the
32050 next router.
32051 </para>
32052 </listitem>
32053 <listitem>
32054 <para>
32055 <indexterm role="concept">
32056 <primary>batched SMTP output example</primary>
32057 </indexterm>
32058 <indexterm role="concept">
32059 <primary>SMTP</primary>
32060 <secondary>batched outgoing; example</secondary>
32061 </indexterm>
32062 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
32063 SMTP format for onward transportation by some other means. This is one way of
32064 storing mail for a dial-up host when it is not connected. The route list entry
32065 can be as simple as a single domain name in a configuration like this:
32066 </para>
32067 <literallayout class="monospaced">
32068 save_in_file:
32069   driver = manualroute
32070   transport = batchsmtp_appendfile
32071   route_list = saved.domain.example
32072 </literallayout>
32073 <para>
32074 though often a pattern is used to pick up more than one domain. If there are
32075 several domains or groups of domains with different transport requirements,
32076 different transports can be listed in the routing information:
32077 </para>
32078 <literallayout class="monospaced">
32079 save_in_file:
32080   driver = manualroute
32081   route_list = \
32082     *.saved.domain1.example  $domain  batch_appendfile; \
32083     *.saved.domain2.example  \
32084       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
32085       batch_pipe
32086 </literallayout>
32087 <para>
32088 <indexterm role="variable">
32089 <primary><varname>$domain</varname></primary>
32090 </indexterm>
32091 <indexterm role="variable">
32092 <primary><varname>$host</varname></primary>
32093 </indexterm>
32094 The first of these just passes the domain in the <varname>$host</varname> variable, which
32095 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
32096 file lookup to find a value to pass, causing the router to decline to handle
32097 the address if the lookup fails.
32098 </para>
32099 </listitem>
32100 <listitem>
32101 <para>
32102 <indexterm role="concept">
32103 <primary>UUCP</primary>
32104 <secondary>example of router for</secondary>
32105 </indexterm>
32106 Routing mail directly to UUCP software is a specific case of the use of
32107 <command>manualroute</command> in a gateway to another mail environment. This is an example of
32108 one way it can be done:
32109 </para>
32110 <literallayout class="monospaced">
32111 # Transport
32112 uucp:
32113   driver = pipe
32114   user = nobody
32115   command = /usr/local/bin/uux -r - \
32116     ${substr_-5:$host}!rmail ${local_part}
32117   return_fail_output = true
32118
32119 # Router
32120 uucphost:
32121   transport = uucp
32122   driver = manualroute
32123   route_data = \
32124     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
32125 </literallayout>
32126 <para>
32127 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
32128 </para>
32129 <literallayout class="monospaced">
32130 darksite.ethereal.example:           darksite.UUCP
32131 </literallayout>
32132 <para>
32133 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
32134 makes clear the distinction between the domain name
32135 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
32136 </para>
32137 </listitem>
32138 </itemizedlist>
32139 <para>
32140 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
32141 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
32142 </para>
32143 </section>
32144 </chapter>
32145
32146 <chapter id="CHAPdriverlast">
32147 <title>The queryprogram router</title>
32148 <para>
32149 <indexterm role="concept" id="IIDquerou1" class="startofrange">
32150 <primary><command>queryprogram</command> router</primary>
32151 </indexterm>
32152 <indexterm role="concept" id="IIDquerou2" class="startofrange">
32153 <primary>routers</primary>
32154 <secondary><command>queryprogram</command></secondary>
32155 </indexterm>
32156 <indexterm role="concept">
32157 <primary>routing</primary>
32158 <secondary>by external program</secondary>
32159 </indexterm>
32160 The <command>queryprogram</command> router routes an address by running an external command
32161 and acting on its output. This is an expensive way to route, and is intended
32162 mainly for use in lightly-loaded systems, or for performing experiments.
32163 However, if it is possible to use the precondition options (<option>domains</option>,
32164 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
32165 be used in special cases, even on a busy host. There are the following private
32166 options:
32167 <indexterm role="concept">
32168 <primary>options</primary>
32169 <secondary><command>queryprogram</command> router</secondary>
32170 </indexterm>
32171 </para>
32172 <para>
32173 <indexterm role="option">
32174 <primary><option>command</option></primary>
32175 </indexterm>
32176 </para>
32177 <informaltable frame="all">
32178 <tgroup cols="4" colsep="0" rowsep="0">
32179 <colspec colwidth="8*" align="left"/>
32180 <colspec colwidth="6*" align="center"/>
32181 <colspec colwidth="6*" align="center"/>
32182 <colspec colwidth="6*" align="right"/>
32183 <tbody>
32184 <row>
32185 <entry><option>command</option></entry>
32186 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32187 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32188 <entry>Default: <emphasis>unset</emphasis></entry>
32189 </row>
32190 </tbody>
32191 </tgroup>
32192 </informaltable>
32193 <para>
32194 This option must be set. It specifies the command that is to be run. The
32195 command is split up into a command name and arguments, and then each is
32196 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
32197 <xref linkend="CHAPpipetransport"/>).
32198 </para>
32199 <para>
32200 <indexterm role="option">
32201 <primary><option>command_group</option></primary>
32202 </indexterm>
32203 </para>
32204 <informaltable frame="all">
32205 <tgroup cols="4" colsep="0" rowsep="0">
32206 <colspec colwidth="8*" align="left"/>
32207 <colspec colwidth="6*" align="center"/>
32208 <colspec colwidth="6*" align="center"/>
32209 <colspec colwidth="6*" align="right"/>
32210 <tbody>
32211 <row>
32212 <entry><option>command_group</option></entry>
32213 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32214 <entry>Type: <emphasis>string</emphasis></entry>
32215 <entry>Default: <emphasis>unset</emphasis></entry>
32216 </row>
32217 </tbody>
32218 </tgroup>
32219 </informaltable>
32220 <para>
32221 <indexterm role="concept">
32222 <primary>gid (group id)</primary>
32223 <secondary>in <command>queryprogram</command> router</secondary>
32224 </indexterm>
32225 This option specifies a gid to be set when running the command while routing an
32226 address for deliver. It must be set if <option>command_user</option> specifies a numerical
32227 uid. If it begins with a digit, it is interpreted as the numerical value of the
32228 gid. Otherwise it is looked up using <function>getgrnam()</function>.
32229 </para>
32230 <para>
32231 <indexterm role="option">
32232 <primary><option>command_user</option></primary>
32233 </indexterm>
32234 </para>
32235 <informaltable frame="all">
32236 <tgroup cols="4" colsep="0" rowsep="0">
32237 <colspec colwidth="8*" align="left"/>
32238 <colspec colwidth="6*" align="center"/>
32239 <colspec colwidth="6*" align="center"/>
32240 <colspec colwidth="6*" align="right"/>
32241 <tbody>
32242 <row>
32243 <entry><option>command_user</option></entry>
32244 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32245 <entry>Type: <emphasis>string</emphasis></entry>
32246 <entry>Default: <emphasis>unset</emphasis></entry>
32247 </row>
32248 </tbody>
32249 </tgroup>
32250 </informaltable>
32251 <para>
32252 <indexterm role="concept">
32253 <primary>uid (user id)</primary>
32254 <secondary>for <command>queryprogram</command></secondary>
32255 </indexterm>
32256 This option must be set. It specifies the uid which is set when running the
32257 command while routing an address for delivery. If the value begins with a digit,
32258 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
32259 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
32260 not set, a value for the gid also.
32261 </para>
32262 <para>
32263 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
32264 root, which it does during a normal delivery in a conventional configuration.
32265 However, when an address is being verified during message reception, Exim is
32266 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
32267 is called from a non-root process, Exim cannot change uid or gid before running
32268 the command. In this circumstance the command runs under the current uid and
32269 gid.
32270 </para>
32271 <para>
32272 <indexterm role="option">
32273 <primary><option>current_directory</option></primary>
32274 </indexterm>
32275 </para>
32276 <informaltable frame="all">
32277 <tgroup cols="4" colsep="0" rowsep="0">
32278 <colspec colwidth="8*" align="left"/>
32279 <colspec colwidth="6*" align="center"/>
32280 <colspec colwidth="6*" align="center"/>
32281 <colspec colwidth="6*" align="right"/>
32282 <tbody>
32283 <row>
32284 <entry><option>current_directory</option></entry>
32285 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32286 <entry>Type: <emphasis>string</emphasis></entry>
32287 <entry>Default: <emphasis>/</emphasis></entry>
32288 </row>
32289 </tbody>
32290 </tgroup>
32291 </informaltable>
32292 <para>
32293 This option specifies an absolute path which is made the current directory
32294 before running the command.
32295 </para>
32296 <para>
32297 <indexterm role="option">
32298 <primary><option>timeout</option></primary>
32299 </indexterm>
32300 </para>
32301 <informaltable frame="all">
32302 <tgroup cols="4" colsep="0" rowsep="0">
32303 <colspec colwidth="8*" align="left"/>
32304 <colspec colwidth="6*" align="center"/>
32305 <colspec colwidth="6*" align="center"/>
32306 <colspec colwidth="6*" align="right"/>
32307 <tbody>
32308 <row>
32309 <entry><option>timeout</option></entry>
32310 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32311 <entry>Type: <emphasis>time</emphasis></entry>
32312 <entry>Default: <emphasis>1h</emphasis></entry>
32313 </row>
32314 </tbody>
32315 </tgroup>
32316 </informaltable>
32317 <para>
32318 If the command does not complete within the timeout period, its process group
32319 is killed and the message is frozen. A value of zero time specifies no
32320 timeout.
32321 </para>
32322 <para>
32323 The standard output of the command is connected to a pipe, which is read when
32324 the command terminates. It should consist of a single line of output,
32325 containing up to five fields, separated by white space. The maximum length of
32326 the line is 1023 characters. Longer lines are silently truncated. The first
32327 field is one of the following words (case-insensitive):
32328 </para>
32329 <itemizedlist>
32330 <listitem>
32331 <para>
32332 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
32333 below).
32334 </para>
32335 </listitem>
32336 <listitem>
32337 <para>
32338 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
32339 <option>no_more</option> is set.
32340 </para>
32341 </listitem>
32342 <listitem>
32343 <para>
32344 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
32345 subsequent text on the line is an error message. If the router is run as part
32346 of address verification during an incoming SMTP message, the message is
32347 included in the SMTP response.
32348 </para>
32349 </listitem>
32350 <listitem>
32351 <para>
32352 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
32353 subsequent text on the line is an error message which is logged. It is not
32354 included in any SMTP response.
32355 </para>
32356 </listitem>
32357 <listitem>
32358 <para>
32359 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
32360 </para>
32361 </listitem>
32362 <listitem>
32363 <para>
32364 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
32365 <option>pass_router</option>), overriding <option>no_more</option>.
32366 </para>
32367 </listitem>
32368 <listitem>
32369 <para>
32370 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
32371 new addresses, which are routed independently, starting with the first router,
32372 or the router specified by <option>redirect_router</option>, if set.
32373 </para>
32374 </listitem>
32375 </itemizedlist>
32376 <para>
32377 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
32378 number of keyed data values, as follows (split into two lines here, to fit on
32379 the page):
32380 </para>
32381 <literallayout class="monospaced">
32382 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
32383 LOOKUP=byname|bydns DATA=&lt;text&gt;
32384 </literallayout>
32385 <para>
32386 The data items can be given in any order, and all are optional. If no transport
32387 is included, the transport specified by the generic <option>transport</option> option is
32388 used. The list of hosts and the lookup type are needed only if the transport is
32389 an <command>smtp</command> transport that does not itself supply a list of hosts.
32390 </para>
32391 <para>
32392 The format of the list of hosts is the same as for the <command>manualroute</command> router.
32393 As well as host names and IP addresses with optional port numbers, as described
32394 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
32395 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
32396 (see section <xref linkend="SECThostshowused"/>).
32397 </para>
32398 <para>
32399 If the lookup type is not specified, Exim behaves as follows when trying to
32400 find an IP address for each host: First, a DNS lookup is done. If this yields
32401 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
32402 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
32403 result of the lookup is the result of that call.
32404 </para>
32405 <para>
32406 <indexterm role="variable">
32407 <primary><varname>$address_data</varname></primary>
32408 </indexterm>
32409 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
32410 variable. For example, this return line
32411 </para>
32412 <literallayout class="monospaced">
32413 accept hosts=x1.y.example:x2.y.example data="rule1"
32414 </literallayout>
32415 <para>
32416 routes the address to the default transport, passing a list of two hosts. When
32417 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
32418 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
32419 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
32420 </para>
32421 </chapter>
32422
32423 <chapter id="CHAPredirect">
32424 <title>The redirect router</title>
32425 <para>
32426 <indexterm role="concept" id="IIDredrou1" class="startofrange">
32427 <primary><command>redirect</command> router</primary>
32428 </indexterm>
32429 <indexterm role="concept" id="IIDredrou2" class="startofrange">
32430 <primary>routers</primary>
32431 <secondary><command>redirect</command></secondary>
32432 </indexterm>
32433 <indexterm role="concept">
32434 <primary>alias file</primary>
32435 <secondary>in a <command>redirect</command> router</secondary>
32436 </indexterm>
32437 <indexterm role="concept">
32438 <primary>address redirection</primary>
32439 <secondary><command>redirect</command> router</secondary>
32440 </indexterm>
32441 The <command>redirect</command> router handles several kinds of address redirection. Its most
32442 common uses are for resolving local part aliases from a central alias file
32443 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
32444 files, but it has many other potential uses. The incoming address can be
32445 redirected in several different ways:
32446 </para>
32447 <itemizedlist>
32448 <listitem>
32449 <para>
32450 It can be replaced by one or more new addresses which are themselves routed
32451 independently.
32452 </para>
32453 </listitem>
32454 <listitem>
32455 <para>
32456 It can be routed to be delivered to a given file or directory.
32457 </para>
32458 </listitem>
32459 <listitem>
32460 <para>
32461 It can be routed to be delivered to a specified pipe command.
32462 </para>
32463 </listitem>
32464 <listitem>
32465 <para>
32466 It can cause an automatic reply to be generated.
32467 </para>
32468 </listitem>
32469 <listitem>
32470 <para revisionflag="changed">
32471 It can be forced to fail, optionally with a custom error message.
32472 </para>
32473 </listitem>
32474 <listitem>
32475 <para revisionflag="changed">
32476 It can be temporarily deferred, optionally with a custom message.
32477 </para>
32478 </listitem>
32479 <listitem>
32480 <para>
32481 It can be discarded.
32482 </para>
32483 </listitem>
32484 </itemizedlist>
32485 <para>
32486 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
32487 However, there are some private options which define transports for delivery to
32488 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
32489 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
32490 </para>
32491 <section id="SECID124">
32492 <title>Redirection data</title>
32493 <para>
32494 The router operates by interpreting a text string which it obtains either by
32495 expanding the contents of the <option>data</option> option, or by reading the entire
32496 contents of a file whose name is given in the <option>file</option> option. These two
32497 options are mutually exclusive. The first is commonly used for handling system
32498 aliases, in a configuration like this:
32499 </para>
32500 <literallayout class="monospaced">
32501 system_aliases:
32502   driver = redirect
32503   data = ${lookup{$local_part}lsearch{/etc/aliases}}
32504 </literallayout>
32505 <para>
32506 If the lookup fails, the expanded string in this example is empty. When the
32507 expansion of <option>data</option> results in an empty string, the router declines. A forced
32508 expansion failure also causes the router to decline; other expansion failures
32509 cause delivery to be deferred.
32510 </para>
32511 <para>
32512 A configuration using <option>file</option> is commonly used for handling users&#x2019;
32513 <filename>.forward</filename> files, like this:
32514 </para>
32515 <literallayout class="monospaced">
32516 userforward:
32517   driver = redirect
32518   check_local_user
32519   file = $home/.forward
32520   no_verify
32521 </literallayout>
32522 <para>
32523 If the file does not exist, or causes no action to be taken (for example, it is
32524 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
32525 is not the case when the file contains syntactically valid items that happen to
32526 yield empty addresses, for example, items containing only RFC 2822 address
32527 comments.
32528 </para>
32529 </section>
32530 <section id="SECID125">
32531 <title>Forward files and address verification</title>
32532 <para>
32533 <indexterm role="concept">
32534 <primary>address redirection</primary>
32535 <secondary>while verifying</secondary>
32536 </indexterm>
32537 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
32538 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
32539 </para>
32540 <itemizedlist>
32541 <listitem>
32542 <para>
32543 When Exim is receiving an incoming SMTP message from a remote host, it is
32544 running under the Exim uid, not as root. Exim is unable to change uid to read
32545 the file as the user, and it may not be able to read it as the Exim user. So in
32546 practice the router may not be able to operate.
32547 </para>
32548 </listitem>
32549 <listitem>
32550 <para>
32551 However, even when the router can operate, the existence of a <filename>.forward</filename> file
32552 is unimportant when verifying an address. What should be checked is whether the
32553 local part is a valid user name or not. Cutting out the redirection processing
32554 saves some resources.
32555 </para>
32556 </listitem>
32557 </itemizedlist>
32558 </section>
32559 <section id="SECID126">
32560 <title>Interpreting redirection data</title>
32561 <para>
32562 <indexterm role="concept">
32563 <primary>Sieve filter</primary>
32564 <secondary>specifying in redirection data</secondary>
32565 </indexterm>
32566 <indexterm role="concept">
32567 <primary>filter</primary>
32568 <secondary>specifying in redirection data</secondary>
32569 </indexterm>
32570 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
32571 can be interpreted in two different ways:
32572 </para>
32573 <itemizedlist>
32574 <listitem>
32575 <para>
32576 If the <option>allow_filter</option> option is set true, and the data begins with the text
32577 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
32578 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
32579 respectively. Details of the syntax and semantics of filter files are described
32580 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
32581 document is intended for use by end users.
32582 </para>
32583 </listitem>
32584 <listitem>
32585 <para>
32586 Otherwise, the data must be a comma-separated list of redirection items, as
32587 described in the next section.
32588 </para>
32589 </listitem>
32590 </itemizedlist>
32591 <para>
32592 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
32593 in a non-filter redirection list must always be an absolute path. A filter may
32594 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
32595 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
32596 for the <command>appendfile</command> transport.
32597 </para>
32598 </section>
32599 <section id="SECTitenonfilred">
32600 <title>Items in a non-filter redirection list</title>
32601 <para>
32602 <indexterm role="concept">
32603 <primary>address redirection</primary>
32604 <secondary>non-filter list items</secondary>
32605 </indexterm>
32606 When the redirection data is not an Exim or Sieve filter, for example, if it
32607 comes from a conventional alias or forward file, it consists of a list of
32608 addresses, file names, pipe commands, or certain special items (see section
32609 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
32610 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
32611 depending on their default values. The items in the list are separated by
32612 commas or newlines.
32613 If a comma is required in an item, the entire item must be enclosed in double
32614 quotes.
32615 </para>
32616 <para>
32617 Lines starting with a # character are comments, and are ignored, and # may
32618 also appear following a comma, in which case everything between the # and the
32619 next newline character is ignored.
32620 </para>
32621 <para>
32622 If an item is entirely enclosed in double quotes, these are removed. Otherwise
32623 double quotes are retained because some forms of mail address require their use
32624 (but never to enclose the entire address). In the following description,
32625 <quote>item</quote> refers to what remains after any surrounding double quotes have been
32626 removed.
32627 </para>
32628 <para>
32629 <indexterm role="variable">
32630 <primary><varname>$local_part</varname></primary>
32631 </indexterm>
32632 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
32633 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
32634 of the <option>quote_local_part</option> expansion operator, in case the local part contains
32635 special characters. For example, to redirect all mail for the domain
32636 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
32637 setting:
32638 </para>
32639 <literallayout class="monospaced">
32640 data = ${quote_local_part:$local_part}@newdomain.example
32641 </literallayout>
32642 </section>
32643 <section id="SECTredlocmai">
32644 <title>Redirecting to a local mailbox</title>
32645 <para>
32646 <indexterm role="concept">
32647 <primary>routing</primary>
32648 <secondary>loops in</secondary>
32649 </indexterm>
32650 <indexterm role="concept">
32651 <primary>loop</primary>
32652 <secondary>while routing, avoidance of</secondary>
32653 </indexterm>
32654 <indexterm role="concept">
32655 <primary>address redirection</primary>
32656 <secondary>to local mailbox</secondary>
32657 </indexterm>
32658 A redirection item may safely be the same as the address currently under
32659 consideration. This does not cause a routing loop, because a router is
32660 automatically skipped if any ancestor of the address that is being processed
32661 is the same as the current address and was processed by the current router.
32662 Such an address is therefore passed to the following routers, so it is handled
32663 as if there were no redirection. When making this loop-avoidance test, the
32664 complete local part, including any prefix or suffix, is used.
32665 </para>
32666 <para>
32667 <indexterm role="concept">
32668 <primary>address redirection</primary>
32669 <secondary>local part without domain</secondary>
32670 </indexterm>
32671 Specifying the same local part without a domain is a common usage in personal
32672 filter files when the user wants to have messages delivered to the local
32673 mailbox and also forwarded elsewhere. For example, the user whose login is
32674 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
32675 </para>
32676 <literallayout class="monospaced">
32677 cleo, cleopatra@egypt.example
32678 </literallayout>
32679 <para>
32680 <indexterm role="concept">
32681 <primary>backslash in alias file</primary>
32682 </indexterm>
32683 <indexterm role="concept">
32684 <primary>alias file</primary>
32685 <secondary>backslash in</secondary>
32686 </indexterm>
32687 For compatibility with other MTAs, such unqualified local parts may be
32688 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
32689 it does make a difference if more than one domain is being handled
32690 synonymously.
32691 </para>
32692 <para>
32693 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
32694 2822 address that does not include a domain, the item is qualified using the
32695 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
32696 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
32697 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
32698 </para>
32699 <para>
32700 Care must be taken if there are alias names for local users.
32701 Consider an MTA handling a single local domain where the system alias file
32702 contains:
32703 </para>
32704 <literallayout class="monospaced">
32705 Sam.Reman: spqr
32706 </literallayout>
32707 <para>
32708 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
32709 messages in the local mailbox, and also forward copies elsewhere. He creates
32710 this forward file:
32711 </para>
32712 <literallayout class="monospaced">
32713 Sam.Reman, spqr@reme.elsewhere.example
32714 </literallayout>
32715 <para>
32716 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
32717 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
32718 second time round, because it has previously routed it,
32719 and the following routers presumably cannot handle the alias. The forward file
32720 should really contain
32721 </para>
32722 <literallayout class="monospaced">
32723 spqr, spqr@reme.elsewhere.example
32724 </literallayout>
32725 <para>
32726 but because this is such a common error, the <option>check_ancestor</option> option (see
32727 below) exists to provide a way to get round it. This is normally set on a
32728 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
32729 </para>
32730 </section>
32731 <section id="SECTspecitredli">
32732 <title>Special items in redirection lists</title>
32733 <para>
32734 In addition to addresses, the following types of item may appear in redirection
32735 lists (that is, in non-filter redirection data):
32736 </para>
32737 <itemizedlist>
32738 <listitem>
32739 <para>
32740 <indexterm role="concept">
32741 <primary>pipe</primary>
32742 <secondary>in redirection list</secondary>
32743 </indexterm>
32744 <indexterm role="concept">
32745 <primary>address redirection</primary>
32746 <secondary>to pipe</secondary>
32747 </indexterm>
32748 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
32749 as a valid RFC 2822 address that includes a domain. A transport for running the
32750 command must be specified by the <option>pipe_transport</option> option.
32751 Normally, either the router or the transport specifies a user and a group under
32752 which to run the delivery. The default is to use the Exim user and group.
32753 </para>
32754 <para>
32755 Single or double quotes can be used for enclosing the individual arguments of
32756 the pipe command; no interpretation of escapes is done for single quotes. If
32757 the command contains a comma character, it is necessary to put the whole item
32758 in double quotes, for example:
32759 </para>
32760 <literallayout class="monospaced">
32761 "|/some/command ready,steady,go"
32762 </literallayout>
32763 <para>
32764 since items in redirection lists are terminated by commas. Do not, however,
32765 quote just the command. An item such as
32766 </para>
32767 <literallayout class="monospaced">
32768 |"/some/command ready,steady,go"
32769 </literallayout>
32770 <para>
32771 is interpreted as a pipe with a rather strange command name, and no arguments.
32772 </para>
32773 </listitem>
32774 <listitem>
32775 <para>
32776 <indexterm role="concept">
32777 <primary>file</primary>
32778 <secondary>in redirection list</secondary>
32779 </indexterm>
32780 <indexterm role="concept">
32781 <primary>address redirection</primary>
32782 <secondary>to file</secondary>
32783 </indexterm>
32784 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
32785 parse as a valid RFC 2822 address that includes a domain. For example,
32786 </para>
32787 <literallayout class="monospaced">
32788 /home/world/minbari
32789 </literallayout>
32790 <para>
32791 is treated as a file name, but
32792 </para>
32793 <literallayout class="monospaced">
32794 /s=molari/o=babylon/@x400gate.way
32795 </literallayout>
32796 <para>
32797 is treated as an address. For a file name, a transport must be specified using
32798 the <option>file_transport</option> option. However, if the generated path name ends with a
32799 forward slash character, it is interpreted as a directory name rather than a
32800 file name, and <option>directory_transport</option> is used instead.
32801 </para>
32802 <para>
32803 Normally, either the router or the transport specifies a user and a group under
32804 which to run the delivery. The default is to use the Exim user and group.
32805 </para>
32806 <para>
32807 <indexterm role="concept">
32808 <primary><filename>/dev/null</filename></primary>
32809 </indexterm>
32810 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
32811 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
32812 instead of a transport name. In this case the user and group are not used.
32813 </para>
32814 </listitem>
32815 <listitem>
32816 <para>
32817 <indexterm role="concept">
32818 <primary>included address list</primary>
32819 </indexterm>
32820 <indexterm role="concept">
32821 <primary>address redirection</primary>
32822 <secondary>included external list</secondary>
32823 </indexterm>
32824 If an item is of the form
32825 </para>
32826 <literallayout class="monospaced">
32827 :include:&lt;path name&gt;
32828 </literallayout>
32829 <para>
32830 a list of further items is taken from the given file and included at that
32831 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
32832 out-of-line addition to the list. The items in the included list are separated
32833 by commas or newlines and are not subject to expansion. If this is the first
32834 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
32835 the alias name. This example is incorrect:
32836 </para>
32837 <literallayout class="monospaced">
32838 list1    :include:/opt/lists/list1
32839 </literallayout>
32840 <para>
32841 It must be given as
32842 </para>
32843 <literallayout class="monospaced">
32844 list1:   :include:/opt/lists/list1
32845 </literallayout>
32846 </listitem>
32847 <listitem>
32848 <para>
32849 <indexterm role="concept">
32850 <primary>address redirection</primary>
32851 <secondary>to black hole</secondary>
32852 </indexterm>
32853 Sometimes you want to throw away mail to a particular local part. Making the
32854 <option>data</option> option expand to an empty string does not work, because that causes
32855 the router to decline. Instead, the alias item
32856 <indexterm role="concept">
32857 <primary>black hole</primary>
32858 </indexterm>
32859 <indexterm role="concept">
32860 <primary>abandoning mail</primary>
32861 </indexterm>
32862 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
32863 done, and no error message is generated. This has the same effect as specifing
32864 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
32865 </para>
32866 <para>
32867 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
32868 delivery is done for the original local part, even if other redirection items
32869 are present. If you are generating a multi-item list (for example, by reading a
32870 database) and need the ability to provide a no-op item, you must use
32871 <filename>/dev/null</filename>.
32872 </para>
32873 </listitem>
32874 <listitem>
32875 <para>
32876 <indexterm role="concept">
32877 <primary>delivery</primary>
32878 <secondary>forcing failure</secondary>
32879 </indexterm>
32880 <indexterm role="concept">
32881 <primary>delivery</primary>
32882 <secondary>forcing deferral</secondary>
32883 </indexterm>
32884 <indexterm role="concept">
32885 <primary>failing delivery</primary>
32886 <secondary>forcing</secondary>
32887 </indexterm>
32888 <indexterm role="concept">
32889 <primary>deferred delivery, forcing</primary>
32890 </indexterm>
32891 <indexterm role="concept">
32892 <primary>customizing</primary>
32893 <secondary>failure message</secondary>
32894 </indexterm>
32895 An attempt to deliver a particular address can be deferred or forced to fail by
32896 redirection items of the form
32897 </para>
32898 <literallayout class="monospaced">
32899 :defer:
32900 :fail:
32901 </literallayout>
32902 <para>
32903 respectively. When a redirection list contains such an item, it applies to the
32904 entire redirection; any other items in the list are ignored (<emphasis>:blackhole:</emphasis> is
32905 different). Any text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error
32906 text associated with the failure. For example, an alias file might contain:
32907 </para>
32908 <literallayout class="monospaced">
32909 X.Employee:  :fail: Gone away, no forwarding address
32910 </literallayout>
32911 <para>
32912 In the case of an address that is being verified from an ACL or as the subject
32913 of a
32914 <indexterm role="concept">
32915 <primary>VRFY</primary>
32916 <secondary>error text, display of</secondary>
32917 </indexterm>
32918 VRFY command, the text is included in the SMTP error response by
32919 default.
32920 <indexterm role="concept">
32921 <primary>EXPN</primary>
32922 <secondary>error text, display of</secondary>
32923 </indexterm>
32924 The text is not included in the response to an EXPN command. In non-SMTP cases
32925 the text is included in the error message that Exim generates.
32926 </para>
32927 <para>
32928 <indexterm role="concept">
32929 <primary>SMTP</primary>
32930 <secondary>error codes</secondary>
32931 </indexterm>
32932 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
32933 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
32934 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
32935 followed by a space, and the very first digit is the same as the default error
32936 code, the code from the message is used instead. If the very first digit is
32937 incorrect, a panic error is logged, and the default code is used. You can
32938 suppress the use of the supplied code in a redirect router by setting the
32939 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
32940 ignored.
32941 </para>
32942 <para>
32943 <indexterm role="variable">
32944 <primary><varname>$acl_verify_message</varname></primary>
32945 </indexterm>
32946 In an ACL, an explicitly provided message overrides the default, but the
32947 default message is available in the variable <varname>$acl_verify_message</varname> and can
32948 therefore be included in a custom message if this is desired.
32949 </para>
32950 <para>
32951 Normally the error text is the rest of the redirection list &ndash; a comma does
32952 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
32953 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
32954 as part of the continuation process, but they may exist in other kinds of
32955 lookup and in <emphasis>:include:</emphasis> files.
32956 </para>
32957 <para>
32958 During routing for message delivery (as opposed to verification), a redirection
32959 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
32960 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
32961 subsequent delivery attempt can happen at a later time. If an address is
32962 deferred for too long, it will ultimately fail, because the normal retry
32963 rules still apply.
32964 </para>
32965 </listitem>
32966 <listitem>
32967 <para>
32968 <indexterm role="concept">
32969 <primary>alias file</primary>
32970 <secondary>exception to default</secondary>
32971 </indexterm>
32972 Sometimes it is useful to use a single-key search type with a default (see
32973 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
32974 for exceptions to the default. These can be handled by aliasing them to
32975 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
32976 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
32977 results in an empty redirection list has the same effect.
32978 </para>
32979 </listitem>
32980 </itemizedlist>
32981 </section>
32982 <section id="SECTdupaddr">
32983 <title>Duplicate addresses</title>
32984 <para>
32985 <indexterm role="concept">
32986 <primary>duplicate addresses</primary>
32987 </indexterm>
32988 <indexterm role="concept">
32989 <primary>address duplicate, discarding</primary>
32990 </indexterm>
32991 <indexterm role="concept">
32992 <primary>pipe</primary>
32993 <secondary>duplicated</secondary>
32994 </indexterm>
32995 Exim removes duplicate addresses from the list to which it is delivering, so as
32996 to deliver just one copy to each address. This does not apply to deliveries
32997 routed to pipes by different immediate parent addresses, but an indirect
32998 aliasing scheme of the type
32999 </para>
33000 <literallayout class="monospaced">
33001 pipe:       |/some/command $local_part
33002 localpart1: pipe
33003 localpart2: pipe
33004 </literallayout>
33005 <para>
33006 does not work with a message that is addressed to both local parts, because
33007 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
33008 discarded as being the same as a previously handled address. However, a scheme
33009 such as
33010 </para>
33011 <literallayout class="monospaced">
33012 localpart1: |/some/command $local_part
33013 localpart2: |/some/command $local_part
33014 </literallayout>
33015 <para>
33016 does result in two different pipe deliveries, because the immediate parents of
33017 the pipes are distinct.
33018 </para>
33019 </section>
33020 <section id="SECID128">
33021 <title>Repeated redirection expansion</title>
33022 <para>
33023 <indexterm role="concept">
33024 <primary>repeated redirection expansion</primary>
33025 </indexterm>
33026 <indexterm role="concept">
33027 <primary>address redirection</primary>
33028 <secondary>repeated for each delivery attempt</secondary>
33029 </indexterm>
33030 When a message cannot be delivered to all of its recipients immediately,
33031 leading to two or more delivery attempts, redirection expansion is carried out
33032 afresh each time for those addresses whose children were not all previously
33033 delivered. If redirection is being used as a mailing list, this can lead to new
33034 members of the list receiving copies of old messages. The <option>one_time</option> option
33035 can be used to avoid this.
33036 </para>
33037 </section>
33038 <section id="SECID129">
33039 <title>Errors in redirection lists</title>
33040 <para>
33041 <indexterm role="concept">
33042 <primary>address redirection</primary>
33043 <secondary>errors</secondary>
33044 </indexterm>
33045 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
33046 error is skipped, and an entry is written to the main log. This may be useful
33047 for mailing lists that are automatically managed. Otherwise, if an error is
33048 detected while generating the list of new addresses, the original address is
33049 deferred. See also <option>syntax_errors_to</option>.
33050 </para>
33051 </section>
33052 <section id="SECID130">
33053 <title>Private options for the redirect router</title>
33054 <para>
33055 <indexterm role="concept">
33056 <primary>options</primary>
33057 <secondary><command>redirect</command> router</secondary>
33058 </indexterm>
33059 The private options for the <command>redirect</command> router are as follows:
33060 </para>
33061 <para>
33062 <indexterm role="option">
33063 <primary><option>allow_defer</option></primary>
33064 </indexterm>
33065 </para>
33066 <informaltable frame="all">
33067 <tgroup cols="4" colsep="0" rowsep="0">
33068 <colspec colwidth="8*" align="left"/>
33069 <colspec colwidth="6*" align="center"/>
33070 <colspec colwidth="6*" align="center"/>
33071 <colspec colwidth="6*" align="right"/>
33072 <tbody>
33073 <row>
33074 <entry><option>allow_defer</option></entry>
33075 <entry>Use: <emphasis>redirect</emphasis></entry>
33076 <entry>Type: <emphasis>boolean</emphasis></entry>
33077 <entry>Default: <emphasis>false</emphasis></entry>
33078 </row>
33079 </tbody>
33080 </tgroup>
33081 </informaltable>
33082 <para>
33083 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
33084 data, or the <option>defer</option> command in an Exim filter file.
33085 </para>
33086 <para>
33087 <indexterm role="option">
33088 <primary><option>allow_fail</option></primary>
33089 </indexterm>
33090 </para>
33091 <informaltable frame="all">
33092 <tgroup cols="4" colsep="0" rowsep="0">
33093 <colspec colwidth="8*" align="left"/>
33094 <colspec colwidth="6*" align="center"/>
33095 <colspec colwidth="6*" align="center"/>
33096 <colspec colwidth="6*" align="right"/>
33097 <tbody>
33098 <row>
33099 <entry><option>allow_fail</option></entry>
33100 <entry>Use: <emphasis>redirect</emphasis></entry>
33101 <entry>Type: <emphasis>boolean</emphasis></entry>
33102 <entry>Default: <emphasis>false</emphasis></entry>
33103 </row>
33104 </tbody>
33105 </tgroup>
33106 </informaltable>
33107 <para>
33108 <indexterm role="concept">
33109 <primary>failing delivery</primary>
33110 <secondary>from filter</secondary>
33111 </indexterm>
33112 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
33113 and the <option>fail</option> command may be used in an Exim filter file.
33114 </para>
33115 <para>
33116 <indexterm role="option">
33117 <primary><option>allow_filter</option></primary>
33118 </indexterm>
33119 </para>
33120 <informaltable frame="all">
33121 <tgroup cols="4" colsep="0" rowsep="0">
33122 <colspec colwidth="8*" align="left"/>
33123 <colspec colwidth="6*" align="center"/>
33124 <colspec colwidth="6*" align="center"/>
33125 <colspec colwidth="6*" align="right"/>
33126 <tbody>
33127 <row>
33128 <entry><option>allow_filter</option></entry>
33129 <entry>Use: <emphasis>redirect</emphasis></entry>
33130 <entry>Type: <emphasis>boolean</emphasis></entry>
33131 <entry>Default: <emphasis>false</emphasis></entry>
33132 </row>
33133 </tbody>
33134 </tgroup>
33135 </informaltable>
33136 <para>
33137 <indexterm role="concept">
33138 <primary>filter</primary>
33139 <secondary>enabling use of</secondary>
33140 </indexterm>
33141 <indexterm role="concept">
33142 <primary>Sieve filter</primary>
33143 <secondary>enabling use of</secondary>
33144 </indexterm>
33145 Setting this option allows Exim to interpret redirection data that starts with
33146 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
33147 are some features of Exim filter files that some administrators may wish to
33148 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
33149 </para>
33150 <para>
33151 It is also possible to lock out Exim filters or Sieve filters while allowing
33152 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
33153 </para>
33154 <para>
33155 The filter is run using the uid and gid set by the generic <option>user</option> and
33156 <option>group</option> options. These take their defaults from the password data if
33157 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
33158 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
33159 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
33160 </para>
33161 <para>
33162 <indexterm role="option">
33163 <primary><option>allow_freeze</option></primary>
33164 </indexterm>
33165 </para>
33166 <informaltable frame="all">
33167 <tgroup cols="4" colsep="0" rowsep="0">
33168 <colspec colwidth="8*" align="left"/>
33169 <colspec colwidth="6*" align="center"/>
33170 <colspec colwidth="6*" align="center"/>
33171 <colspec colwidth="6*" align="right"/>
33172 <tbody>
33173 <row>
33174 <entry><option>allow_freeze</option></entry>
33175 <entry>Use: <emphasis>redirect</emphasis></entry>
33176 <entry>Type: <emphasis>boolean</emphasis></entry>
33177 <entry>Default: <emphasis>false</emphasis></entry>
33178 </row>
33179 </tbody>
33180 </tgroup>
33181 </informaltable>
33182 <para>
33183 <indexterm role="concept">
33184 <primary>freezing messages</primary>
33185 <secondary>allowing in filter</secondary>
33186 </indexterm>
33187 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
33188 This command is more normally encountered in system filters, and is disabled by
33189 default for redirection filters because it isn&#x2019;t something you usually want to
33190 let ordinary users do.
33191 </para>
33192 <para>
33193 <indexterm role="option">
33194 <primary><option>check_ancestor</option></primary>
33195 </indexterm>
33196 </para>
33197 <informaltable frame="all">
33198 <tgroup cols="4" colsep="0" rowsep="0">
33199 <colspec colwidth="8*" align="left"/>
33200 <colspec colwidth="6*" align="center"/>
33201 <colspec colwidth="6*" align="center"/>
33202 <colspec colwidth="6*" align="right"/>
33203 <tbody>
33204 <row>
33205 <entry><option>check_ancestor</option></entry>
33206 <entry>Use: <emphasis>redirect</emphasis></entry>
33207 <entry>Type: <emphasis>boolean</emphasis></entry>
33208 <entry>Default: <emphasis>false</emphasis></entry>
33209 </row>
33210 </tbody>
33211 </tgroup>
33212 </informaltable>
33213 <para>
33214 This option is concerned with handling generated addresses that are the same
33215 as some address in the list of redirection ancestors of the current address.
33216 Although it is turned off by default in the code, it is set in the default
33217 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
33218 for this use of the <command>redirect</command> router.
33219 </para>
33220 <para>
33221 When <option>check_ancestor</option> is set, if a generated address (including the domain)
33222 is the same as any ancestor of the current address, it is replaced by a copy of
33223 the current address. This helps in the case where local part A is aliased to B,
33224 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
33225 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
33226 <filename>&nbsp;jb/.forward</filename> contains:
33227 </para>
33228 <literallayout class="monospaced">
33229 \Joe.Bloggs, &lt;other item(s)&gt;
33230 </literallayout>
33231 <para>
33232 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
33233 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
33234 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
33235 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
33236 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
33237 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
33238 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
33239 original address. See also the <option>repeat_use</option> option below.
33240 </para>
33241 <para>
33242 <indexterm role="option">
33243 <primary><option>check_group</option></primary>
33244 </indexterm>
33245 </para>
33246 <informaltable frame="all">
33247 <tgroup cols="4" colsep="0" rowsep="0">
33248 <colspec colwidth="8*" align="left"/>
33249 <colspec colwidth="6*" align="center"/>
33250 <colspec colwidth="6*" align="center"/>
33251 <colspec colwidth="6*" align="right"/>
33252 <tbody>
33253 <row>
33254 <entry><option>check_group</option></entry>
33255 <entry>Use: <emphasis>redirect</emphasis></entry>
33256 <entry>Type: <emphasis>boolean</emphasis></entry>
33257 <entry>Default: <emphasis>see below</emphasis></entry>
33258 </row>
33259 </tbody>
33260 </tgroup>
33261 </informaltable>
33262 <para>
33263 When the <option>file</option> option is used, the group owner of the file is checked only
33264 when this option is set. The permitted groups are those listed in the
33265 <option>owngroups</option> option, together with the user&#x2019;s default group if
33266 <option>check_local_user</option> is set. If the file has the wrong group, routing is
33267 deferred. The default setting for this option is true if <option>check_local_user</option>
33268 is set and the <option>modemask</option> option permits the group write bit, or if the
33269 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
33270 </para>
33271 <para>
33272 <indexterm role="option">
33273 <primary><option>check_owner</option></primary>
33274 </indexterm>
33275 </para>
33276 <informaltable frame="all">
33277 <tgroup cols="4" colsep="0" rowsep="0">
33278 <colspec colwidth="8*" align="left"/>
33279 <colspec colwidth="6*" align="center"/>
33280 <colspec colwidth="6*" align="center"/>
33281 <colspec colwidth="6*" align="right"/>
33282 <tbody>
33283 <row>
33284 <entry><option>check_owner</option></entry>
33285 <entry>Use: <emphasis>redirect</emphasis></entry>
33286 <entry>Type: <emphasis>boolean</emphasis></entry>
33287 <entry>Default: <emphasis>see below</emphasis></entry>
33288 </row>
33289 </tbody>
33290 </tgroup>
33291 </informaltable>
33292 <para>
33293 When the <option>file</option> option is used, the owner of the file is checked only when
33294 this option is set. If <option>check_local_user</option> is set, the local user is
33295 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
33296 option. The default value for this option is true if <option>check_local_user</option> or
33297 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
33298 </para>
33299 <para>
33300 <indexterm role="option">
33301 <primary><option>data</option></primary>
33302 </indexterm>
33303 </para>
33304 <informaltable frame="all">
33305 <tgroup cols="4" colsep="0" rowsep="0">
33306 <colspec colwidth="8*" align="left"/>
33307 <colspec colwidth="6*" align="center"/>
33308 <colspec colwidth="6*" align="center"/>
33309 <colspec colwidth="6*" align="right"/>
33310 <tbody>
33311 <row>
33312 <entry><option>data</option></entry>
33313 <entry>Use: <emphasis>redirect</emphasis></entry>
33314 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33315 <entry>Default: <emphasis>unset</emphasis></entry>
33316 </row>
33317 </tbody>
33318 </tgroup>
33319 </informaltable>
33320 <para>
33321 This option is mutually exclusive with <option>file</option>. One or other of them must be
33322 set, but not both. The contents of <option>data</option> are expanded, and then used as the
33323 list of forwarding items, or as a set of filtering instructions. If the
33324 expansion is forced to fail, or the result is an empty string or a string that
33325 has no effect (consists entirely of comments), the router declines.
33326 </para>
33327 <para>
33328 When filtering instructions are used, the string must begin with <quote>#Exim
33329 filter</quote>, and all comments in the string, including this initial one, must be
33330 terminated with newline characters. For example:
33331 </para>
33332 <literallayout class="monospaced">
33333 data = #Exim filter\n\
33334        if $h_to: contains Exim then save $home/mail/exim endif
33335 </literallayout>
33336 <para>
33337 If you are reading the data from a database where newlines cannot be included,
33338 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
33339 choice into a newline.
33340 </para>
33341 <para>
33342 <indexterm role="option">
33343 <primary><option>directory_transport</option></primary>
33344 </indexterm>
33345 </para>
33346 <informaltable frame="all">
33347 <tgroup cols="4" colsep="0" rowsep="0">
33348 <colspec colwidth="8*" align="left"/>
33349 <colspec colwidth="6*" align="center"/>
33350 <colspec colwidth="6*" align="center"/>
33351 <colspec colwidth="6*" align="right"/>
33352 <tbody>
33353 <row>
33354 <entry><option>directory_transport</option></entry>
33355 <entry>Use: <emphasis>redirect</emphasis></entry>
33356 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33357 <entry>Default: <emphasis>unset</emphasis></entry>
33358 </row>
33359 </tbody>
33360 </tgroup>
33361 </informaltable>
33362 <para>
33363 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
33364 ending with a slash is specified as a new <quote>address</quote>. The transport used is
33365 specified by this option, which, after expansion, must be the name of a
33366 configured transport. This should normally be an <command>appendfile</command> transport.
33367 </para>
33368 <para>
33369 <indexterm role="option">
33370 <primary><option>file</option></primary>
33371 </indexterm>
33372 </para>
33373 <informaltable frame="all">
33374 <tgroup cols="4" colsep="0" rowsep="0">
33375 <colspec colwidth="8*" align="left"/>
33376 <colspec colwidth="6*" align="center"/>
33377 <colspec colwidth="6*" align="center"/>
33378 <colspec colwidth="6*" align="right"/>
33379 <tbody>
33380 <row>
33381 <entry><option>file</option></entry>
33382 <entry>Use: <emphasis>redirect</emphasis></entry>
33383 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33384 <entry>Default: <emphasis>unset</emphasis></entry>
33385 </row>
33386 </tbody>
33387 </tgroup>
33388 </informaltable>
33389 <para>
33390 This option specifies the name of a file that contains the redirection data. It
33391 is mutually exclusive with the <option>data</option> option. The string is expanded before
33392 use; if the expansion is forced to fail, the router declines. Other expansion
33393 failures cause delivery to be deferred. The result of a successful expansion
33394 must be an absolute path. The entire file is read and used as the redirection
33395 data. If the data is an empty string or a string that has no effect (consists
33396 entirely of comments), the router declines.
33397 </para>
33398 <para>
33399 <indexterm role="concept">
33400 <primary>NFS</primary>
33401 <secondary>checking for file existence</secondary>
33402 </indexterm>
33403 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
33404 runs a check on the containing directory,
33405 unless <option>ignore_enotdir</option> is true (see below).
33406 If the directory does not appear to exist, delivery is deferred. This can
33407 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
33408 is a mount problem. If the containing directory does exist, but the file does
33409 not, the router declines.
33410 </para>
33411 <para>
33412 <indexterm role="option">
33413 <primary><option>file_transport</option></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="6*" align="center"/>
33420 <colspec colwidth="6*" align="center"/>
33421 <colspec colwidth="6*" align="right"/>
33422 <tbody>
33423 <row>
33424 <entry><option>file_transport</option></entry>
33425 <entry>Use: <emphasis>redirect</emphasis></entry>
33426 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33427 <entry>Default: <emphasis>unset</emphasis></entry>
33428 </row>
33429 </tbody>
33430 </tgroup>
33431 </informaltable>
33432 <para>
33433 <indexterm role="variable">
33434 <primary><varname>$address_file</varname></primary>
33435 </indexterm>
33436 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
33437 ending in a slash is specified as a new <quote>address</quote>. The transport used is
33438 specified by this option, which, after expansion, must be the name of a
33439 configured transport. This should normally be an <command>appendfile</command> transport. When
33440 it is running, the file name is in <varname>$address_file</varname>.
33441 </para>
33442 <para>
33443 <indexterm role="option">
33444 <primary><option>filter_prepend_home</option></primary>
33445 </indexterm>
33446 </para>
33447 <informaltable frame="all">
33448 <tgroup cols="4" colsep="0" rowsep="0">
33449 <colspec colwidth="8*" align="left"/>
33450 <colspec colwidth="6*" align="center"/>
33451 <colspec colwidth="6*" align="center"/>
33452 <colspec colwidth="6*" align="right"/>
33453 <tbody>
33454 <row>
33455 <entry><option>filter_prepend_home</option></entry>
33456 <entry>Use: <emphasis>redirect</emphasis></entry>
33457 <entry>Type: <emphasis>boolean</emphasis></entry>
33458 <entry>Default: <emphasis>true</emphasis></entry>
33459 </row>
33460 </tbody>
33461 </tgroup>
33462 </informaltable>
33463 <para>
33464 When this option is true, if a <command>save</command> command in an Exim filter specifies a
33465 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
33466 relative path. If this option is set false, this action does not happen. The
33467 relative path is then passed to the transport unmodified.
33468 </para>
33469 <para>
33470 <indexterm role="option">
33471 <primary><option>forbid_blackhole</option></primary>
33472 </indexterm>
33473 </para>
33474 <informaltable frame="all">
33475 <tgroup cols="4" colsep="0" rowsep="0">
33476 <colspec colwidth="8*" align="left"/>
33477 <colspec colwidth="6*" align="center"/>
33478 <colspec colwidth="6*" align="center"/>
33479 <colspec colwidth="6*" align="right"/>
33480 <tbody>
33481 <row>
33482 <entry><option>forbid_blackhole</option></entry>
33483 <entry>Use: <emphasis>redirect</emphasis></entry>
33484 <entry>Type: <emphasis>boolean</emphasis></entry>
33485 <entry>Default: <emphasis>false</emphasis></entry>
33486 </row>
33487 </tbody>
33488 </tgroup>
33489 </informaltable>
33490 <para>
33491 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
33492 redirection list.
33493 </para>
33494 <para>
33495 <indexterm role="option">
33496 <primary><option>forbid_exim_filter</option></primary>
33497 </indexterm>
33498 </para>
33499 <informaltable frame="all">
33500 <tgroup cols="4" colsep="0" rowsep="0">
33501 <colspec colwidth="8*" align="left"/>
33502 <colspec colwidth="6*" align="center"/>
33503 <colspec colwidth="6*" align="center"/>
33504 <colspec colwidth="6*" align="right"/>
33505 <tbody>
33506 <row>
33507 <entry><option>forbid_exim_filter</option></entry>
33508 <entry>Use: <emphasis>redirect</emphasis></entry>
33509 <entry>Type: <emphasis>boolean</emphasis></entry>
33510 <entry>Default: <emphasis>false</emphasis></entry>
33511 </row>
33512 </tbody>
33513 </tgroup>
33514 </informaltable>
33515 <para>
33516 If this option is set true, only Sieve filters are permitted when
33517 <option>allow_filter</option> is true.
33518 </para>
33519 <para>
33520 <indexterm role="option">
33521 <primary><option>forbid_file</option></primary>
33522 </indexterm>
33523 </para>
33524 <informaltable frame="all">
33525 <tgroup cols="4" colsep="0" rowsep="0">
33526 <colspec colwidth="8*" align="left"/>
33527 <colspec colwidth="6*" align="center"/>
33528 <colspec colwidth="6*" align="center"/>
33529 <colspec colwidth="6*" align="right"/>
33530 <tbody>
33531 <row>
33532 <entry><option>forbid_file</option></entry>
33533 <entry>Use: <emphasis>redirect</emphasis></entry>
33534 <entry>Type: <emphasis>boolean</emphasis></entry>
33535 <entry>Default: <emphasis>false</emphasis></entry>
33536 </row>
33537 </tbody>
33538 </tgroup>
33539 </informaltable>
33540 <para>
33541 <indexterm role="concept">
33542 <primary>delivery</primary>
33543 <secondary>to file; forbidding</secondary>
33544 </indexterm>
33545 <indexterm role="concept">
33546 <primary>Sieve filter</primary>
33547 <secondary>forbidding delivery to a file</secondary>
33548 </indexterm>
33549 <indexterm role="concept">
33550 <primary>Sieve filter</primary>
33551 <secondary><quote>keep</quote> facility; disabling</secondary>
33552 </indexterm>
33553 If this option is true, this router may not generate a new address that
33554 specifies delivery to a local file or directory, either from a filter or from a
33555 conventional forward file. This option is forced to be true if <option>one_time</option> is
33556 set. It applies to Sieve filters as well as to Exim filters, but if true, it
33557 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
33558 </para>
33559 <para>
33560 <indexterm role="option">
33561 <primary><option>forbid_filter_dlfunc</option></primary>
33562 </indexterm>
33563 </para>
33564 <informaltable frame="all">
33565 <tgroup cols="4" colsep="0" rowsep="0">
33566 <colspec colwidth="8*" align="left"/>
33567 <colspec colwidth="6*" align="center"/>
33568 <colspec colwidth="6*" align="center"/>
33569 <colspec colwidth="6*" align="right"/>
33570 <tbody>
33571 <row>
33572 <entry><option>forbid_filter_dlfunc</option></entry>
33573 <entry>Use: <emphasis>redirect</emphasis></entry>
33574 <entry>Type: <emphasis>boolean</emphasis></entry>
33575 <entry>Default: <emphasis>false</emphasis></entry>
33576 </row>
33577 </tbody>
33578 </tgroup>
33579 </informaltable>
33580 <para>
33581 <indexterm role="concept">
33582 <primary>filter</primary>
33583 <secondary>locking out certain features</secondary>
33584 </indexterm>
33585 If this option is true, string expansions in Exim filters are not allowed to
33586 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
33587 functions.
33588 </para>
33589 <para>
33590 <indexterm role="option">
33591 <primary><option>forbid_filter_existstest</option></primary>
33592 </indexterm>
33593 </para>
33594 <informaltable frame="all">
33595 <tgroup cols="4" colsep="0" rowsep="0">
33596 <colspec colwidth="8*" align="left"/>
33597 <colspec colwidth="6*" align="center"/>
33598 <colspec colwidth="6*" align="center"/>
33599 <colspec colwidth="6*" align="right"/>
33600 <tbody>
33601 <row>
33602 <entry><option>forbid_filter_existstest</option></entry>
33603 <entry>Use: <emphasis>redirect</emphasis></entry>
33604 <entry>Type: <emphasis>boolean</emphasis></entry>
33605 <entry>Default: <emphasis>false</emphasis></entry>
33606 </row>
33607 </tbody>
33608 </tgroup>
33609 </informaltable>
33610 <para>
33611 <indexterm role="concept">
33612 <primary>expansion</primary>
33613 <secondary>statting a file</secondary>
33614 </indexterm>
33615 If this option is true, string expansions in Exim filters are not allowed to
33616 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
33617 </para>
33618 <para>
33619 <indexterm role="option">
33620 <primary><option>forbid_filter_logwrite</option></primary>
33621 </indexterm>
33622 </para>
33623 <informaltable frame="all">
33624 <tgroup cols="4" colsep="0" rowsep="0">
33625 <colspec colwidth="8*" align="left"/>
33626 <colspec colwidth="6*" align="center"/>
33627 <colspec colwidth="6*" align="center"/>
33628 <colspec colwidth="6*" align="right"/>
33629 <tbody>
33630 <row>
33631 <entry><option>forbid_filter_logwrite</option></entry>
33632 <entry>Use: <emphasis>redirect</emphasis></entry>
33633 <entry>Type: <emphasis>boolean</emphasis></entry>
33634 <entry>Default: <emphasis>false</emphasis></entry>
33635 </row>
33636 </tbody>
33637 </tgroup>
33638 </informaltable>
33639 <para>
33640 If this option is true, use of the logging facility in Exim filters is not
33641 permitted. Logging is in any case available only if the filter is being run
33642 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
33643 <filename>.forward</filename> files).
33644 </para>
33645 <para>
33646 <indexterm role="option">
33647 <primary><option>forbid_filter_lookup</option></primary>
33648 </indexterm>
33649 </para>
33650 <informaltable frame="all">
33651 <tgroup cols="4" colsep="0" rowsep="0">
33652 <colspec colwidth="8*" align="left"/>
33653 <colspec colwidth="6*" align="center"/>
33654 <colspec colwidth="6*" align="center"/>
33655 <colspec colwidth="6*" align="right"/>
33656 <tbody>
33657 <row>
33658 <entry><option>forbid_filter_lookup</option></entry>
33659 <entry>Use: <emphasis>redirect</emphasis></entry>
33660 <entry>Type: <emphasis>boolean</emphasis></entry>
33661 <entry>Default: <emphasis>false</emphasis></entry>
33662 </row>
33663 </tbody>
33664 </tgroup>
33665 </informaltable>
33666 <para>
33667 If this option is true, string expansions in Exim filter files are not allowed
33668 to make use of <option>lookup</option> items.
33669 </para>
33670 <para>
33671 <indexterm role="option">
33672 <primary><option>forbid_filter_perl</option></primary>
33673 </indexterm>
33674 </para>
33675 <informaltable frame="all">
33676 <tgroup cols="4" colsep="0" rowsep="0">
33677 <colspec colwidth="8*" align="left"/>
33678 <colspec colwidth="6*" align="center"/>
33679 <colspec colwidth="6*" align="center"/>
33680 <colspec colwidth="6*" align="right"/>
33681 <tbody>
33682 <row>
33683 <entry><option>forbid_filter_perl</option></entry>
33684 <entry>Use: <emphasis>redirect</emphasis></entry>
33685 <entry>Type: <emphasis>boolean</emphasis></entry>
33686 <entry>Default: <emphasis>false</emphasis></entry>
33687 </row>
33688 </tbody>
33689 </tgroup>
33690 </informaltable>
33691 <para>
33692 This option has an effect only if Exim is built with embedded Perl support. If
33693 it is true, string expansions in Exim filter files are not allowed to make use
33694 of the embedded Perl support.
33695 </para>
33696 <para>
33697 <indexterm role="option">
33698 <primary><option>forbid_filter_readfile</option></primary>
33699 </indexterm>
33700 </para>
33701 <informaltable frame="all">
33702 <tgroup cols="4" colsep="0" rowsep="0">
33703 <colspec colwidth="8*" align="left"/>
33704 <colspec colwidth="6*" align="center"/>
33705 <colspec colwidth="6*" align="center"/>
33706 <colspec colwidth="6*" align="right"/>
33707 <tbody>
33708 <row>
33709 <entry><option>forbid_filter_readfile</option></entry>
33710 <entry>Use: <emphasis>redirect</emphasis></entry>
33711 <entry>Type: <emphasis>boolean</emphasis></entry>
33712 <entry>Default: <emphasis>false</emphasis></entry>
33713 </row>
33714 </tbody>
33715 </tgroup>
33716 </informaltable>
33717 <para>
33718 If this option is true, string expansions in Exim filter files are not allowed
33719 to make use of <option>readfile</option> items.
33720 </para>
33721 <para>
33722 <indexterm role="option">
33723 <primary><option>forbid_filter_readsocket</option></primary>
33724 </indexterm>
33725 </para>
33726 <informaltable frame="all">
33727 <tgroup cols="4" colsep="0" rowsep="0">
33728 <colspec colwidth="8*" align="left"/>
33729 <colspec colwidth="6*" align="center"/>
33730 <colspec colwidth="6*" align="center"/>
33731 <colspec colwidth="6*" align="right"/>
33732 <tbody>
33733 <row>
33734 <entry><option>forbid_filter_readsocket</option></entry>
33735 <entry>Use: <emphasis>redirect</emphasis></entry>
33736 <entry>Type: <emphasis>boolean</emphasis></entry>
33737 <entry>Default: <emphasis>false</emphasis></entry>
33738 </row>
33739 </tbody>
33740 </tgroup>
33741 </informaltable>
33742 <para>
33743 If this option is true, string expansions in Exim filter files are not allowed
33744 to make use of <option>readsocket</option> items.
33745 </para>
33746 <para>
33747 <indexterm role="option">
33748 <primary><option>forbid_filter_reply</option></primary>
33749 </indexterm>
33750 </para>
33751 <informaltable frame="all">
33752 <tgroup cols="4" colsep="0" rowsep="0">
33753 <colspec colwidth="8*" align="left"/>
33754 <colspec colwidth="6*" align="center"/>
33755 <colspec colwidth="6*" align="center"/>
33756 <colspec colwidth="6*" align="right"/>
33757 <tbody>
33758 <row>
33759 <entry><option>forbid_filter_reply</option></entry>
33760 <entry>Use: <emphasis>redirect</emphasis></entry>
33761 <entry>Type: <emphasis>boolean</emphasis></entry>
33762 <entry>Default: <emphasis>false</emphasis></entry>
33763 </row>
33764 </tbody>
33765 </tgroup>
33766 </informaltable>
33767 <para>
33768 If this option is true, this router may not generate an automatic reply
33769 message. Automatic replies can be generated only from Exim or Sieve filter
33770 files, not from traditional forward files. This option is forced to be true if
33771 <option>one_time</option> is set.
33772 </para>
33773 <para>
33774 <indexterm role="option">
33775 <primary><option>forbid_filter_run</option></primary>
33776 </indexterm>
33777 </para>
33778 <informaltable frame="all">
33779 <tgroup cols="4" colsep="0" rowsep="0">
33780 <colspec colwidth="8*" align="left"/>
33781 <colspec colwidth="6*" align="center"/>
33782 <colspec colwidth="6*" align="center"/>
33783 <colspec colwidth="6*" align="right"/>
33784 <tbody>
33785 <row>
33786 <entry><option>forbid_filter_run</option></entry>
33787 <entry>Use: <emphasis>redirect</emphasis></entry>
33788 <entry>Type: <emphasis>boolean</emphasis></entry>
33789 <entry>Default: <emphasis>false</emphasis></entry>
33790 </row>
33791 </tbody>
33792 </tgroup>
33793 </informaltable>
33794 <para>
33795 If this option is true, string expansions in Exim filter files are not allowed
33796 to make use of <option>run</option> items.
33797 </para>
33798 <para>
33799 <indexterm role="option">
33800 <primary><option>forbid_include</option></primary>
33801 </indexterm>
33802 </para>
33803 <informaltable frame="all">
33804 <tgroup cols="4" colsep="0" rowsep="0">
33805 <colspec colwidth="8*" align="left"/>
33806 <colspec colwidth="6*" align="center"/>
33807 <colspec colwidth="6*" align="center"/>
33808 <colspec colwidth="6*" align="right"/>
33809 <tbody>
33810 <row>
33811 <entry><option>forbid_include</option></entry>
33812 <entry>Use: <emphasis>redirect</emphasis></entry>
33813 <entry>Type: <emphasis>boolean</emphasis></entry>
33814 <entry>Default: <emphasis>false</emphasis></entry>
33815 </row>
33816 </tbody>
33817 </tgroup>
33818 </informaltable>
33819 <para>
33820 If this option is true, items of the form
33821 </para>
33822 <literallayout class="monospaced">
33823 :include:&lt;path name&gt;
33824 </literallayout>
33825 <para>
33826 are not permitted in non-filter redirection lists.
33827 </para>
33828 <para>
33829 <indexterm role="option">
33830 <primary><option>forbid_pipe</option></primary>
33831 </indexterm>
33832 </para>
33833 <informaltable frame="all">
33834 <tgroup cols="4" colsep="0" rowsep="0">
33835 <colspec colwidth="8*" align="left"/>
33836 <colspec colwidth="6*" align="center"/>
33837 <colspec colwidth="6*" align="center"/>
33838 <colspec colwidth="6*" align="right"/>
33839 <tbody>
33840 <row>
33841 <entry><option>forbid_pipe</option></entry>
33842 <entry>Use: <emphasis>redirect</emphasis></entry>
33843 <entry>Type: <emphasis>boolean</emphasis></entry>
33844 <entry>Default: <emphasis>false</emphasis></entry>
33845 </row>
33846 </tbody>
33847 </tgroup>
33848 </informaltable>
33849 <para>
33850 <indexterm role="concept">
33851 <primary>delivery</primary>
33852 <secondary>to pipe; forbidding</secondary>
33853 </indexterm>
33854 If this option is true, this router may not generate a new address which
33855 specifies delivery to a pipe, either from an Exim filter or from a conventional
33856 forward file. This option is forced to be true if <option>one_time</option> is set.
33857 </para>
33858 <para>
33859 <indexterm role="option">
33860 <primary><option>forbid_sieve_filter</option></primary>
33861 </indexterm>
33862 </para>
33863 <informaltable frame="all">
33864 <tgroup cols="4" colsep="0" rowsep="0">
33865 <colspec colwidth="8*" align="left"/>
33866 <colspec colwidth="6*" align="center"/>
33867 <colspec colwidth="6*" align="center"/>
33868 <colspec colwidth="6*" align="right"/>
33869 <tbody>
33870 <row>
33871 <entry><option>forbid_sieve_filter</option></entry>
33872 <entry>Use: <emphasis>redirect</emphasis></entry>
33873 <entry>Type: <emphasis>boolean</emphasis></entry>
33874 <entry>Default: <emphasis>false</emphasis></entry>
33875 </row>
33876 </tbody>
33877 </tgroup>
33878 </informaltable>
33879 <para>
33880 If this option is set true, only Exim filters are permitted when
33881 <option>allow_filter</option> is true.
33882 </para>
33883 <para>
33884 <indexterm role="concept">
33885 <primary>SMTP</primary>
33886 <secondary>error codes</secondary>
33887 </indexterm>
33888 <indexterm role="option">
33889 <primary><option>forbid_smtp_code</option></primary>
33890 </indexterm>
33891 </para>
33892 <informaltable frame="all">
33893 <tgroup cols="4" colsep="0" rowsep="0">
33894 <colspec colwidth="8*" align="left"/>
33895 <colspec colwidth="6*" align="center"/>
33896 <colspec colwidth="6*" align="center"/>
33897 <colspec colwidth="6*" align="right"/>
33898 <tbody>
33899 <row>
33900 <entry><option>forbid_smtp_code</option></entry>
33901 <entry>Use: <emphasis>redirect</emphasis></entry>
33902 <entry>Type: <emphasis>boolean</emphasis></entry>
33903 <entry>Default: <emphasis>false</emphasis></entry>
33904 </row>
33905 </tbody>
33906 </tgroup>
33907 </informaltable>
33908 <para>
33909 If this option is set true, any SMTP error codes that are present at the start
33910 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
33911 the default codes (451 and 550, respectively) are always used.
33912 </para>
33913 <para>
33914 <indexterm role="option">
33915 <primary><option>hide_child_in_errmsg</option></primary>
33916 </indexterm>
33917 </para>
33918 <informaltable frame="all">
33919 <tgroup cols="4" colsep="0" rowsep="0">
33920 <colspec colwidth="8*" align="left"/>
33921 <colspec colwidth="6*" align="center"/>
33922 <colspec colwidth="6*" align="center"/>
33923 <colspec colwidth="6*" align="right"/>
33924 <tbody>
33925 <row>
33926 <entry><option>hide_child_in_errmsg</option></entry>
33927 <entry>Use: <emphasis>redirect</emphasis></entry>
33928 <entry>Type: <emphasis>boolean</emphasis></entry>
33929 <entry>Default: <emphasis>false</emphasis></entry>
33930 </row>
33931 </tbody>
33932 </tgroup>
33933 </informaltable>
33934 <para>
33935 <indexterm role="concept">
33936 <primary>bounce message</primary>
33937 <secondary>redirection details; suppressing</secondary>
33938 </indexterm>
33939 If this option is true, it prevents Exim from quoting a child address if it
33940 generates a bounce or delay message for it. Instead it says <quote>an address
33941 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
33942 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
33943 bounce may well quote the generated address.
33944 </para>
33945 <para>
33946 <indexterm role="option">
33947 <primary><option>ignore_eacces</option></primary>
33948 </indexterm>
33949 </para>
33950 <informaltable frame="all">
33951 <tgroup cols="4" colsep="0" rowsep="0">
33952 <colspec colwidth="8*" align="left"/>
33953 <colspec colwidth="6*" align="center"/>
33954 <colspec colwidth="6*" align="center"/>
33955 <colspec colwidth="6*" align="right"/>
33956 <tbody>
33957 <row>
33958 <entry><option>ignore_eacces</option></entry>
33959 <entry>Use: <emphasis>redirect</emphasis></entry>
33960 <entry>Type: <emphasis>boolean</emphasis></entry>
33961 <entry>Default: <emphasis>false</emphasis></entry>
33962 </row>
33963 </tbody>
33964 </tgroup>
33965 </informaltable>
33966 <para>
33967 <indexterm role="concept">
33968 <primary>EACCES</primary>
33969 </indexterm>
33970 If this option is set and an attempt to open a redirection file yields the
33971 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
33972 file did not exist.
33973 </para>
33974 <para>
33975 <indexterm role="option">
33976 <primary><option>ignore_enotdir</option></primary>
33977 </indexterm>
33978 </para>
33979 <informaltable frame="all">
33980 <tgroup cols="4" colsep="0" rowsep="0">
33981 <colspec colwidth="8*" align="left"/>
33982 <colspec colwidth="6*" align="center"/>
33983 <colspec colwidth="6*" align="center"/>
33984 <colspec colwidth="6*" align="right"/>
33985 <tbody>
33986 <row>
33987 <entry><option>ignore_enotdir</option></entry>
33988 <entry>Use: <emphasis>redirect</emphasis></entry>
33989 <entry>Type: <emphasis>boolean</emphasis></entry>
33990 <entry>Default: <emphasis>false</emphasis></entry>
33991 </row>
33992 </tbody>
33993 </tgroup>
33994 </informaltable>
33995 <para>
33996 <indexterm role="concept">
33997 <primary>ENOTDIR</primary>
33998 </indexterm>
33999 If this option is set and an attempt to open a redirection file yields the
34000 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
34001 router behaves as if the file did not exist.
34002 </para>
34003 <para>
34004 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
34005 router that has the <option>file</option> option set discovers that the file does not exist
34006 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
34007 against unmounted NFS directories. If the parent can not be statted, delivery
34008 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
34009 is set, because that option tells Exim to ignore <quote>something on the path is not
34010 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
34011 that some operating systems give ENOENT where others give ENOTDIR.
34012 </para>
34013 <para>
34014 <indexterm role="option">
34015 <primary><option>include_directory</option></primary>
34016 </indexterm>
34017 </para>
34018 <informaltable frame="all">
34019 <tgroup cols="4" colsep="0" rowsep="0">
34020 <colspec colwidth="8*" align="left"/>
34021 <colspec colwidth="6*" align="center"/>
34022 <colspec colwidth="6*" align="center"/>
34023 <colspec colwidth="6*" align="right"/>
34024 <tbody>
34025 <row>
34026 <entry><option>include_directory</option></entry>
34027 <entry>Use: <emphasis>redirect</emphasis></entry>
34028 <entry>Type: <emphasis>string</emphasis></entry>
34029 <entry>Default: <emphasis>unset</emphasis></entry>
34030 </row>
34031 </tbody>
34032 </tgroup>
34033 </informaltable>
34034 <para>
34035 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
34036 redirection list must start with this directory.
34037 </para>
34038 <para>
34039 <indexterm role="option">
34040 <primary><option>modemask</option></primary>
34041 </indexterm>
34042 </para>
34043 <informaltable frame="all">
34044 <tgroup cols="4" colsep="0" rowsep="0">
34045 <colspec colwidth="8*" align="left"/>
34046 <colspec colwidth="6*" align="center"/>
34047 <colspec colwidth="6*" align="center"/>
34048 <colspec colwidth="6*" align="right"/>
34049 <tbody>
34050 <row>
34051 <entry><option>modemask</option></entry>
34052 <entry>Use: <emphasis>redirect</emphasis></entry>
34053 <entry>Type: <emphasis>octal integer</emphasis></entry>
34054 <entry>Default: <emphasis>022</emphasis></entry>
34055 </row>
34056 </tbody>
34057 </tgroup>
34058 </informaltable>
34059 <para>
34060 This specifies mode bits which must not be set for a file specified by the
34061 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
34062 </para>
34063 <para>
34064 <indexterm role="option">
34065 <primary><option>one_time</option></primary>
34066 </indexterm>
34067 </para>
34068 <informaltable frame="all">
34069 <tgroup cols="4" colsep="0" rowsep="0">
34070 <colspec colwidth="8*" align="left"/>
34071 <colspec colwidth="6*" align="center"/>
34072 <colspec colwidth="6*" align="center"/>
34073 <colspec colwidth="6*" align="right"/>
34074 <tbody>
34075 <row>
34076 <entry><option>one_time</option></entry>
34077 <entry>Use: <emphasis>redirect</emphasis></entry>
34078 <entry>Type: <emphasis>boolean</emphasis></entry>
34079 <entry>Default: <emphasis>false</emphasis></entry>
34080 </row>
34081 </tbody>
34082 </tgroup>
34083 </informaltable>
34084 <para>
34085 <indexterm role="concept">
34086 <primary>one-time aliasing/forwarding expansion</primary>
34087 </indexterm>
34088 <indexterm role="concept">
34089 <primary>alias file</primary>
34090 <secondary>one-time expansion</secondary>
34091 </indexterm>
34092 <indexterm role="concept">
34093 <primary>forward file</primary>
34094 <secondary>one-time expansion</secondary>
34095 </indexterm>
34096 <indexterm role="concept">
34097 <primary>mailing lists</primary>
34098 <secondary>one-time expansion</secondary>
34099 </indexterm>
34100 <indexterm role="concept">
34101 <primary>address redirection</primary>
34102 <secondary>one-time expansion</secondary>
34103 </indexterm>
34104 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
34105 files each time it tries to deliver a message causes a problem when one or more
34106 of the generated addresses fails be delivered at the first attempt. The problem
34107 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
34108 but of what happens when the redirection list changes during the time that the
34109 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
34110 lists, where new subscribers might receive copies of messages that were posted
34111 before they subscribed.
34112 </para>
34113 <para>
34114 If <option>one_time</option> is set and any addresses generated by the router fail to
34115 deliver at the first attempt, the failing addresses are added to the message as
34116 <quote>top level</quote> addresses, and the parent address that generated them is marked
34117 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
34118 attempt.
34119 </para>
34120 <para>
34121 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
34122 router would be lost if delivery did not succeed at the first attempt. For this
34123 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
34124 permitted when <option>one_time</option> is set.
34125 </para>
34126 <para>
34127 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
34128 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
34129 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
34130 </para>
34131 <para>
34132 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
34133 <option>one_time</option>.
34134 </para>
34135 <para>
34136 The original top-level address is remembered with each of the generated
34137 addresses, and is output in any log messages. However, any intermediate parent
34138 addresses are not recorded. This makes a difference to the log only if
34139 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
34140 typically be used for mailing lists, where there is normally just one level of
34141 expansion.
34142 </para>
34143 <para>
34144 <indexterm role="option">
34145 <primary><option>owners</option></primary>
34146 </indexterm>
34147 </para>
34148 <informaltable frame="all">
34149 <tgroup cols="4" colsep="0" rowsep="0">
34150 <colspec colwidth="8*" align="left"/>
34151 <colspec colwidth="6*" align="center"/>
34152 <colspec colwidth="6*" align="center"/>
34153 <colspec colwidth="6*" align="right"/>
34154 <tbody>
34155 <row>
34156 <entry><option>owners</option></entry>
34157 <entry>Use: <emphasis>redirect</emphasis></entry>
34158 <entry>Type: <emphasis>string list</emphasis></entry>
34159 <entry>Default: <emphasis>unset</emphasis></entry>
34160 </row>
34161 </tbody>
34162 </tgroup>
34163 </informaltable>
34164 <para>
34165 <indexterm role="concept">
34166 <primary>ownership</primary>
34167 <secondary>alias file</secondary>
34168 </indexterm>
34169 <indexterm role="concept">
34170 <primary>ownership</primary>
34171 <secondary>forward file</secondary>
34172 </indexterm>
34173 <indexterm role="concept">
34174 <primary>alias file</primary>
34175 <secondary>ownership</secondary>
34176 </indexterm>
34177 <indexterm role="concept">
34178 <primary>forward file</primary>
34179 <secondary>ownership</secondary>
34180 </indexterm>
34181 This specifies a list of permitted owners for the file specified by <option>file</option>.
34182 This list is in addition to the local user when <option>check_local_user</option> is set.
34183 See <option>check_owner</option> above.
34184 </para>
34185 <para>
34186 <indexterm role="option">
34187 <primary><option>owngroups</option></primary>
34188 </indexterm>
34189 </para>
34190 <informaltable frame="all">
34191 <tgroup cols="4" colsep="0" rowsep="0">
34192 <colspec colwidth="8*" align="left"/>
34193 <colspec colwidth="6*" align="center"/>
34194 <colspec colwidth="6*" align="center"/>
34195 <colspec colwidth="6*" align="right"/>
34196 <tbody>
34197 <row>
34198 <entry><option>owngroups</option></entry>
34199 <entry>Use: <emphasis>redirect</emphasis></entry>
34200 <entry>Type: <emphasis>string list</emphasis></entry>
34201 <entry>Default: <emphasis>unset</emphasis></entry>
34202 </row>
34203 </tbody>
34204 </tgroup>
34205 </informaltable>
34206 <para>
34207 This specifies a list of permitted groups for the file specified by <option>file</option>.
34208 The list is in addition to the local user&#x2019;s primary group when
34209 <option>check_local_user</option> is set. See <option>check_group</option> above.
34210 </para>
34211 <para>
34212 <indexterm role="option">
34213 <primary><option>pipe_transport</option></primary>
34214 </indexterm>
34215 </para>
34216 <informaltable frame="all">
34217 <tgroup cols="4" colsep="0" rowsep="0">
34218 <colspec colwidth="8*" align="left"/>
34219 <colspec colwidth="6*" align="center"/>
34220 <colspec colwidth="6*" align="center"/>
34221 <colspec colwidth="6*" align="right"/>
34222 <tbody>
34223 <row>
34224 <entry><option>pipe_transport</option></entry>
34225 <entry>Use: <emphasis>redirect</emphasis></entry>
34226 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34227 <entry>Default: <emphasis>unset</emphasis></entry>
34228 </row>
34229 </tbody>
34230 </tgroup>
34231 </informaltable>
34232 <para>
34233 <indexterm role="variable">
34234 <primary><varname>$address_pipe</varname></primary>
34235 </indexterm>
34236 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
34237 starting with a vertical bar character is specified as a new <quote>address</quote>. The
34238 transport used is specified by this option, which, after expansion, must be the
34239 name of a configured transport. This should normally be a <command>pipe</command> transport.
34240 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
34241 </para>
34242 <para>
34243 <indexterm role="option">
34244 <primary><option>qualify_domain</option></primary>
34245 </indexterm>
34246 </para>
34247 <informaltable frame="all">
34248 <tgroup cols="4" colsep="0" rowsep="0">
34249 <colspec colwidth="8*" align="left"/>
34250 <colspec colwidth="6*" align="center"/>
34251 <colspec colwidth="6*" align="center"/>
34252 <colspec colwidth="6*" align="right"/>
34253 <tbody>
34254 <row>
34255 <entry><option>qualify_domain</option></entry>
34256 <entry>Use: <emphasis>redirect</emphasis></entry>
34257 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34258 <entry>Default: <emphasis>unset</emphasis></entry>
34259 </row>
34260 </tbody>
34261 </tgroup>
34262 </informaltable>
34263 <para>
34264 <indexterm role="variable">
34265 <primary><varname>$qualify_recipient</varname></primary>
34266 </indexterm>
34267 If this option is set, and an unqualified address (one without a domain) is
34268 generated, and that address would normally be qualified by the global setting
34269 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
34270 expanding this string. If the expansion fails, the router declines. If you want
34271 to revert to the default, you can have the expansion generate
34272 <varname>$qualify_recipient</varname>.
34273 </para>
34274 <para>
34275 This option applies to all unqualified addresses generated by Exim filters,
34276 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
34277 not preceded by a backslash. Sieve filters cannot generate unqualified
34278 addresses.
34279 </para>
34280 <para>
34281 <indexterm role="option">
34282 <primary><option>qualify_preserve_domain</option></primary>
34283 </indexterm>
34284 </para>
34285 <informaltable frame="all">
34286 <tgroup cols="4" colsep="0" rowsep="0">
34287 <colspec colwidth="8*" align="left"/>
34288 <colspec colwidth="6*" align="center"/>
34289 <colspec colwidth="6*" align="center"/>
34290 <colspec colwidth="6*" align="right"/>
34291 <tbody>
34292 <row>
34293 <entry><option>qualify_preserve_domain</option></entry>
34294 <entry>Use: <emphasis>redirect</emphasis></entry>
34295 <entry>Type: <emphasis>boolean</emphasis></entry>
34296 <entry>Default: <emphasis>false</emphasis></entry>
34297 </row>
34298 </tbody>
34299 </tgroup>
34300 </informaltable>
34301 <para>
34302 <indexterm role="concept">
34303 <primary>domain</primary>
34304 <secondary>in redirection; preserving</secondary>
34305 </indexterm>
34306 <indexterm role="concept">
34307 <primary>preserving domain in redirection</primary>
34308 </indexterm>
34309 <indexterm role="concept">
34310 <primary>address redirection</primary>
34311 <secondary>domain; preserving</secondary>
34312 </indexterm>
34313 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
34314 set (a configuration error occurs if it is). If an unqualified address (one
34315 without a domain) is generated, it is qualified with the domain of the parent
34316 address (the immediately preceding ancestor) instead of the global
34317 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
34318 this applies whether or not the address is preceded by a backslash.
34319 </para>
34320 <para>
34321 <indexterm role="option">
34322 <primary><option>repeat_use</option></primary>
34323 </indexterm>
34324 </para>
34325 <informaltable frame="all">
34326 <tgroup cols="4" colsep="0" rowsep="0">
34327 <colspec colwidth="8*" align="left"/>
34328 <colspec colwidth="6*" align="center"/>
34329 <colspec colwidth="6*" align="center"/>
34330 <colspec colwidth="6*" align="right"/>
34331 <tbody>
34332 <row>
34333 <entry><option>repeat_use</option></entry>
34334 <entry>Use: <emphasis>redirect</emphasis></entry>
34335 <entry>Type: <emphasis>boolean</emphasis></entry>
34336 <entry>Default: <emphasis>true</emphasis></entry>
34337 </row>
34338 </tbody>
34339 </tgroup>
34340 </informaltable>
34341 <para>
34342 If this option is set false, the router is skipped for a child address that has
34343 any ancestor that was routed by this router. This test happens before any of
34344 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
34345 only when the ancestor is the same as the current address. See also
34346 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
34347 </para>
34348 <para>
34349 <indexterm role="option">
34350 <primary><option>reply_transport</option></primary>
34351 </indexterm>
34352 </para>
34353 <informaltable frame="all">
34354 <tgroup cols="4" colsep="0" rowsep="0">
34355 <colspec colwidth="8*" align="left"/>
34356 <colspec colwidth="6*" align="center"/>
34357 <colspec colwidth="6*" align="center"/>
34358 <colspec colwidth="6*" align="right"/>
34359 <tbody>
34360 <row>
34361 <entry><option>reply_transport</option></entry>
34362 <entry>Use: <emphasis>redirect</emphasis></entry>
34363 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34364 <entry>Default: <emphasis>unset</emphasis></entry>
34365 </row>
34366 </tbody>
34367 </tgroup>
34368 </informaltable>
34369 <para>
34370 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
34371 <option>vacation</option> command is used in a filter file. The transport used is specified
34372 by this option, which, after expansion, must be the name of a configured
34373 transport. This should normally be an <command>autoreply</command> transport. Other transports
34374 are unlikely to do anything sensible or useful.
34375 </para>
34376 <para>
34377 <indexterm role="option">
34378 <primary><option>rewrite</option></primary>
34379 </indexterm>
34380 </para>
34381 <informaltable frame="all">
34382 <tgroup cols="4" colsep="0" rowsep="0">
34383 <colspec colwidth="8*" align="left"/>
34384 <colspec colwidth="6*" align="center"/>
34385 <colspec colwidth="6*" align="center"/>
34386 <colspec colwidth="6*" align="right"/>
34387 <tbody>
34388 <row>
34389 <entry><option>rewrite</option></entry>
34390 <entry>Use: <emphasis>redirect</emphasis></entry>
34391 <entry>Type: <emphasis>boolean</emphasis></entry>
34392 <entry>Default: <emphasis>true</emphasis></entry>
34393 </row>
34394 </tbody>
34395 </tgroup>
34396 </informaltable>
34397 <para>
34398 <indexterm role="concept">
34399 <primary>address redirection</primary>
34400 <secondary>disabling rewriting</secondary>
34401 </indexterm>
34402 If this option is set false, addresses generated by the router are not
34403 subject to address rewriting. Otherwise, they are treated like new addresses
34404 and are rewritten according to the global rewriting rules.
34405 </para>
34406 <para>
34407 <indexterm role="option">
34408 <primary><option>sieve_subaddress</option></primary>
34409 </indexterm>
34410 </para>
34411 <informaltable frame="all">
34412 <tgroup cols="4" colsep="0" rowsep="0">
34413 <colspec colwidth="8*" align="left"/>
34414 <colspec colwidth="6*" align="center"/>
34415 <colspec colwidth="6*" align="center"/>
34416 <colspec colwidth="6*" align="right"/>
34417 <tbody>
34418 <row>
34419 <entry><option>sieve_subaddress</option></entry>
34420 <entry>Use: <emphasis>redirect</emphasis></entry>
34421 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34422 <entry>Default: <emphasis>unset</emphasis></entry>
34423 </row>
34424 </tbody>
34425 </tgroup>
34426 </informaltable>
34427 <para>
34428 The value of this option is passed to a Sieve filter to specify the
34429 :subaddress part of an address.
34430 </para>
34431 <para>
34432 <indexterm role="option">
34433 <primary><option>sieve_useraddress</option></primary>
34434 </indexterm>
34435 </para>
34436 <informaltable frame="all">
34437 <tgroup cols="4" colsep="0" rowsep="0">
34438 <colspec colwidth="8*" align="left"/>
34439 <colspec colwidth="6*" align="center"/>
34440 <colspec colwidth="6*" align="center"/>
34441 <colspec colwidth="6*" align="right"/>
34442 <tbody>
34443 <row>
34444 <entry><option>sieve_useraddress</option></entry>
34445 <entry>Use: <emphasis>redirect</emphasis></entry>
34446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34447 <entry>Default: <emphasis>unset</emphasis></entry>
34448 </row>
34449 </tbody>
34450 </tgroup>
34451 </informaltable>
34452 <para>
34453 The value of this option is passed to a Sieve filter to specify the :user part
34454 of an address. However, if it is unset, the entire original local part
34455 (including any prefix or suffix) is used for :user.
34456 </para>
34457 <para>
34458 <indexterm role="option">
34459 <primary><option>sieve_vacation_directory</option></primary>
34460 </indexterm>
34461 </para>
34462 <informaltable frame="all">
34463 <tgroup cols="4" colsep="0" rowsep="0">
34464 <colspec colwidth="8*" align="left"/>
34465 <colspec colwidth="6*" align="center"/>
34466 <colspec colwidth="6*" align="center"/>
34467 <colspec colwidth="6*" align="right"/>
34468 <tbody>
34469 <row>
34470 <entry><option>sieve_vacation_directory</option></entry>
34471 <entry>Use: <emphasis>redirect</emphasis></entry>
34472 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34473 <entry>Default: <emphasis>unset</emphasis></entry>
34474 </row>
34475 </tbody>
34476 </tgroup>
34477 </informaltable>
34478 <para>
34479 <indexterm role="concept">
34480 <primary>Sieve filter</primary>
34481 <secondary>vacation directory</secondary>
34482 </indexterm>
34483 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
34484 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
34485 (do not put anything else in that directory), and ensure that the
34486 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
34487 needs their own directory; Exim will create it if necessary.
34488 </para>
34489 <para>
34490 <indexterm role="option">
34491 <primary><option>skip_syntax_errors</option></primary>
34492 </indexterm>
34493 </para>
34494 <informaltable frame="all">
34495 <tgroup cols="4" colsep="0" rowsep="0">
34496 <colspec colwidth="8*" align="left"/>
34497 <colspec colwidth="6*" align="center"/>
34498 <colspec colwidth="6*" align="center"/>
34499 <colspec colwidth="6*" align="right"/>
34500 <tbody>
34501 <row>
34502 <entry><option>skip_syntax_errors</option></entry>
34503 <entry>Use: <emphasis>redirect</emphasis></entry>
34504 <entry>Type: <emphasis>boolean</emphasis></entry>
34505 <entry>Default: <emphasis>false</emphasis></entry>
34506 </row>
34507 </tbody>
34508 </tgroup>
34509 </informaltable>
34510 <para>
34511 <indexterm role="concept">
34512 <primary>forward file</primary>
34513 <secondary>broken</secondary>
34514 </indexterm>
34515 <indexterm role="concept">
34516 <primary>address redirection</primary>
34517 <secondary>broken files</secondary>
34518 </indexterm>
34519 <indexterm role="concept">
34520 <primary>alias file</primary>
34521 <secondary>broken</secondary>
34522 </indexterm>
34523 <indexterm role="concept">
34524 <primary>broken alias or forward files</primary>
34525 </indexterm>
34526 <indexterm role="concept">
34527 <primary>ignoring faulty addresses</primary>
34528 </indexterm>
34529 <indexterm role="concept">
34530 <primary>skipping faulty addresses</primary>
34531 </indexterm>
34532 <indexterm role="concept">
34533 <primary>error</primary>
34534 <secondary>skipping bad syntax</secondary>
34535 </indexterm>
34536 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
34537 non-filter redirection data are skipped, and each failing address is logged. If
34538 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
34539 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
34540 are expanded and placed at the head of the error message generated by
34541 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
34542 be the same address as the generic <option>errors_to</option> option. The
34543 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
34544 </para>
34545 <para>
34546 If all the addresses in a redirection list are skipped because of syntax
34547 errors, the router declines to handle the original address, and it is passed to
34548 the following routers.
34549 </para>
34550 <para>
34551 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
34552 error in the filter causes filtering to be abandoned without any action being
34553 taken. The incident is logged, and the router declines to handle the address,
34554 so it is passed to the following routers.
34555 </para>
34556 <para>
34557 <indexterm role="concept">
34558 <primary>Sieve filter</primary>
34559 <secondary>syntax errors in</secondary>
34560 </indexterm>
34561 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
34562 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
34563 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
34564 </para>
34565 <para>
34566 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
34567 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
34568 option, used with an address that does not get redirected, can be used to
34569 notify users of these errors, by means of a router like this:
34570 </para>
34571 <literallayout class="monospaced">
34572 userforward:
34573   driver = redirect
34574   allow_filter
34575   check_local_user
34576   file = $home/.forward
34577   file_transport = address_file
34578   pipe_transport = address_pipe
34579   reply_transport = address_reply
34580   no_verify
34581   skip_syntax_errors
34582   syntax_errors_to = real-$local_part@$domain
34583   syntax_errors_text = \
34584    This is an automatically generated message. An error has\n\
34585    been found in your .forward file. Details of the error are\n\
34586    reported below. While this error persists, you will receive\n\
34587    a copy of this message for every message that is addressed\n\
34588    to you. If your .forward file is a filter file, or if it is\n\
34589    a non-filter file containing no valid forwarding addresses,\n\
34590    a copy of each incoming message will be put in your normal\n\
34591    mailbox. If a non-filter file contains at least one valid\n\
34592    forwarding address, forwarding to the valid addresses will\n\
34593    happen, and those will be the only deliveries that occur.
34594 </literallayout>
34595 <para>
34596 You also need a router to ensure that local addresses that are prefixed by
34597 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
34598 put this immediately before the <command>userforward</command> router:
34599 </para>
34600 <literallayout class="monospaced">
34601 real_localuser:
34602   driver = accept
34603   check_local_user
34604   local_part_prefix = real-
34605   transport = local_delivery
34606 </literallayout>
34607 <para>
34608 <indexterm role="option">
34609 <primary><option>syntax_errors_text</option></primary>
34610 </indexterm>
34611 </para>
34612 <informaltable frame="all">
34613 <tgroup cols="4" colsep="0" rowsep="0">
34614 <colspec colwidth="8*" align="left"/>
34615 <colspec colwidth="6*" align="center"/>
34616 <colspec colwidth="6*" align="center"/>
34617 <colspec colwidth="6*" align="right"/>
34618 <tbody>
34619 <row>
34620 <entry><option>syntax_errors_text</option></entry>
34621 <entry>Use: <emphasis>redirect</emphasis></entry>
34622 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34623 <entry>Default: <emphasis>unset</emphasis></entry>
34624 </row>
34625 </tbody>
34626 </tgroup>
34627 </informaltable>
34628 <para>
34629 See <option>skip_syntax_errors</option> above.
34630 </para>
34631 <para>
34632 <indexterm role="option">
34633 <primary><option>syntax_errors_to</option></primary>
34634 </indexterm>
34635 </para>
34636 <informaltable frame="all">
34637 <tgroup cols="4" colsep="0" rowsep="0">
34638 <colspec colwidth="8*" align="left"/>
34639 <colspec colwidth="6*" align="center"/>
34640 <colspec colwidth="6*" align="center"/>
34641 <colspec colwidth="6*" align="right"/>
34642 <tbody>
34643 <row>
34644 <entry><option>syntax_errors_to</option></entry>
34645 <entry>Use: <emphasis>redirect</emphasis></entry>
34646 <entry>Type: <emphasis>string</emphasis></entry>
34647 <entry>Default: <emphasis>unset</emphasis></entry>
34648 </row>
34649 </tbody>
34650 </tgroup>
34651 </informaltable>
34652 <para>
34653 See <option>skip_syntax_errors</option> above.
34654 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
34655 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
34656 </para>
34657 </section>
34658 </chapter>
34659
34660 <chapter id="CHAPenvironment">
34661 <title>Environment for running local transports</title>
34662 <titleabbrev>Environment for local transports</titleabbrev>
34663 <para>
34664 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
34665 <primary>local transports</primary>
34666 <secondary>environment for</secondary>
34667 </indexterm>
34668 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
34669 <primary>environment for local transports</primary>
34670 </indexterm>
34671 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
34672 <primary>transport</primary>
34673 <secondary>local; environment for</secondary>
34674 </indexterm>
34675 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
34676 transport can be thought of as similar to a pipe.) Exim always runs transports
34677 in subprocesses, under specified uids and gids. Typical deliveries to local
34678 mailboxes run under the uid and gid of the local user.
34679 </para>
34680 <para>
34681 Exim also sets a specific current directory while running the transport; for
34682 some transports a home directory setting is also relevant. The <command>pipe</command>
34683 transport is the only one that sets up environment variables; see section
34684 <xref linkend="SECTpipeenv"/> for details.
34685 </para>
34686 <para>
34687 The values used for the uid, gid, and the directories may come from several
34688 different places. In many cases, the router that handles the address associates
34689 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
34690 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
34691 configuration, and these override anything that comes from the router.
34692 </para>
34693 <section id="SECID131">
34694 <title>Concurrent deliveries</title>
34695 <para>
34696 <indexterm role="concept">
34697 <primary>concurrent deliveries</primary>
34698 </indexterm>
34699 <indexterm role="concept">
34700 <primary>simultaneous deliveries</primary>
34701 </indexterm>
34702 If two different messages for the same local recipient arrive more or less
34703 simultaneously, the two delivery processes are likely to run concurrently. When
34704 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
34705 rules to stop concurrent processes from writing to the same file at the same
34706 time.
34707 </para>
34708 <para>
34709 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
34710 locking that is needed. Here is a silly example:
34711 </para>
34712 <literallayout class="monospaced">
34713 my_transport:
34714   driver = pipe
34715   command = /bin/sh -c 'cat &gt;&gt;/some/file'
34716 </literallayout>
34717 <para>
34718 This is supposed to write the message at the end of the file. However, if two
34719 messages arrive at the same time, the file will be scrambled. You can use the
34720 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
34721 file using the same algorithm that Exim itself uses.
34722 </para>
34723 </section>
34724 <section id="SECTenvuidgid">
34725 <title>Uids and gids</title>
34726 <para>
34727 <indexterm role="concept">
34728 <primary>local transports</primary>
34729 <secondary>uid and gid</secondary>
34730 </indexterm>
34731 <indexterm role="concept">
34732 <primary>transport</primary>
34733 <secondary>local; uid and gid</secondary>
34734 </indexterm>
34735 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
34736 overrides any group that the router set in the address, even if <option>user</option> is not
34737 set for the transport. This makes it possible, for example, to run local mail
34738 delivery under the uid of the recipient (set by the router), but in a special
34739 group (set by the transport). For example:
34740 </para>
34741 <literallayout class="monospaced">
34742 # Routers ...
34743 # User/group are set by check_local_user in this router
34744 local_users:
34745   driver = accept
34746   check_local_user
34747   transport = group_delivery
34748
34749 # Transports ...
34750 # This transport overrides the group
34751 group_delivery:
34752   driver = appendfile
34753   file = /var/spool/mail/$local_part
34754   group = mail
34755 </literallayout>
34756 <para>
34757 If <option>user</option> is set for a transport, its value overrides what is set in the
34758 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
34759 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
34760 set.
34761 </para>
34762 <para>
34763 <indexterm role="option">
34764 <primary><option>initgroups</option></primary>
34765 </indexterm>
34766 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
34767 function is called for the groups associated with that uid if the
34768 <option>initgroups</option> option is set for the transport. When the uid is not specified
34769 by the transport, but is associated with the address by a router, the option
34770 for calling <function>initgroups()</function> is taken from the router configuration.
34771 </para>
34772 <para>
34773 <indexterm role="concept">
34774 <primary><command>pipe</command> transport</primary>
34775 <secondary>uid for</secondary>
34776 </indexterm>
34777 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
34778 is set and <option>user</option> is not set, the uid of the process that called Exim to
34779 receive the message is used, and if <option>group</option> is not set, the corresponding
34780 original gid is also used.
34781 </para>
34782 <para>
34783 This is the detailed preference order for obtaining a gid; the first of the
34784 following that is set is used:
34785 </para>
34786 <itemizedlist>
34787 <listitem>
34788 <para>
34789 A <option>group</option> setting of the transport;
34790 </para>
34791 </listitem>
34792 <listitem>
34793 <para>
34794 A <option>group</option> setting of the router;
34795 </para>
34796 </listitem>
34797 <listitem>
34798 <para>
34799 A gid associated with a user setting of the router, either as a result of
34800 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
34801 </para>
34802 </listitem>
34803 <listitem>
34804 <para>
34805 The group associated with a non-numeric <option>user</option> setting of the transport;
34806 </para>
34807 </listitem>
34808 <listitem>
34809 <para>
34810 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
34811 the uid is the creator&#x2019;s uid;
34812 </para>
34813 </listitem>
34814 <listitem>
34815 <para>
34816 The Exim gid if the Exim uid is being used as a default.
34817 </para>
34818 </listitem>
34819 </itemizedlist>
34820 <para>
34821 If, for example, the user is specified numerically on the router and there are
34822 no group settings, no gid is available. In this situation, an error occurs.
34823 This is different for the uid, for which there always is an ultimate default.
34824 The first of the following that is set is used:
34825 </para>
34826 <itemizedlist>
34827 <listitem>
34828 <para>
34829 A <option>user</option> setting of the transport;
34830 </para>
34831 </listitem>
34832 <listitem>
34833 <para>
34834 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
34835 </para>
34836 </listitem>
34837 <listitem>
34838 <para>
34839 A <option>user</option> setting of the router;
34840 </para>
34841 </listitem>
34842 <listitem>
34843 <para>
34844 A <option>check_local_user</option> setting of the router;
34845 </para>
34846 </listitem>
34847 <listitem>
34848 <para>
34849 The Exim uid.
34850 </para>
34851 </listitem>
34852 </itemizedlist>
34853 <para>
34854 Of course, an error will still occur if the uid that is chosen is on the
34855 <option>never_users</option> list.
34856 </para>
34857 </section>
34858 <section id="SECID132">
34859 <title>Current and home directories</title>
34860 <para>
34861 <indexterm role="concept">
34862 <primary>current directory for local transport</primary>
34863 </indexterm>
34864 <indexterm role="concept">
34865 <primary>home directory</primary>
34866 <secondary>for local transport</secondary>
34867 </indexterm>
34868 <indexterm role="concept">
34869 <primary>transport</primary>
34870 <secondary>local; home directory for</secondary>
34871 </indexterm>
34872 <indexterm role="concept">
34873 <primary>transport</primary>
34874 <secondary>local; current directory for</secondary>
34875 </indexterm>
34876 Routers may set current and home directories for local transports by means of
34877 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
34878 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
34879 are set, they override the router&#x2019;s values. In detail, the home directory
34880 for a local transport is taken from the first of these values that is set:
34881 </para>
34882 <itemizedlist>
34883 <listitem>
34884 <para>
34885 The <option>home_directory</option> option on the transport;
34886 </para>
34887 </listitem>
34888 <listitem>
34889 <para>
34890 The <option>transport_home_directory</option> option on the router;
34891 </para>
34892 </listitem>
34893 <listitem>
34894 <para>
34895 The password data if <option>check_local_user</option> is set on the router;
34896 </para>
34897 </listitem>
34898 <listitem>
34899 <para>
34900 The <option>router_home_directory</option> option on the router.
34901 </para>
34902 </listitem>
34903 </itemizedlist>
34904 <para>
34905 The current directory is taken from the first of these values that is set:
34906 </para>
34907 <itemizedlist>
34908 <listitem>
34909 <para>
34910 The <option>current_directory</option> option on the transport;
34911 </para>
34912 </listitem>
34913 <listitem>
34914 <para>
34915 The <option>transport_current_directory</option> option on the router.
34916 </para>
34917 </listitem>
34918 </itemizedlist>
34919 <para>
34920 If neither the router nor the transport sets a current directory, Exim uses the
34921 value of the home directory, if it is set. Otherwise it sets the current
34922 directory to <filename>/</filename> before running a local transport.
34923 </para>
34924 </section>
34925 <section id="SECID133">
34926 <title>Expansion variables derived from the address</title>
34927 <para>
34928 <indexterm role="variable">
34929 <primary><varname>$domain</varname></primary>
34930 </indexterm>
34931 <indexterm role="variable">
34932 <primary><varname>$local_part</varname></primary>
34933 </indexterm>
34934 <indexterm role="variable">
34935 <primary><varname>$original_domain</varname></primary>
34936 </indexterm>
34937 Normally a local delivery is handling a single address, and in that case the
34938 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
34939 deliveries. However, in some circumstances more than one address may be handled
34940 at once (for example, while writing batch SMTP for onward transmission by some
34941 other means). In this case, the variables associated with the local part are
34942 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
34943 and <varname>$original_domain</varname> is never set.
34944 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
34945 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
34946 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
34947 </para>
34948 </section>
34949 </chapter>
34950
34951 <chapter id="CHAPtransportgeneric">
34952 <title>Generic options for transports</title>
34953 <para>
34954 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
34955 <primary>generic options</primary>
34956 <secondary>transport</secondary>
34957 </indexterm>
34958 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
34959 <primary>options</primary>
34960 <secondary>generic; for transports</secondary>
34961 </indexterm>
34962 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
34963 <primary>transport</primary>
34964 <secondary>generic options for</secondary>
34965 </indexterm>
34966 The following generic options apply to all transports:
34967 </para>
34968 <para>
34969 <indexterm role="option">
34970 <primary><option>body_only</option></primary>
34971 </indexterm>
34972 </para>
34973 <informaltable frame="all">
34974 <tgroup cols="4" colsep="0" rowsep="0">
34975 <colspec colwidth="8*" align="left"/>
34976 <colspec colwidth="6*" align="center"/>
34977 <colspec colwidth="6*" align="center"/>
34978 <colspec colwidth="6*" align="right"/>
34979 <tbody>
34980 <row>
34981 <entry><option>body_only</option></entry>
34982 <entry>Use: <emphasis>transports</emphasis></entry>
34983 <entry>Type: <emphasis>boolean</emphasis></entry>
34984 <entry>Default: <emphasis>false</emphasis></entry>
34985 </row>
34986 </tbody>
34987 </tgroup>
34988 </informaltable>
34989 <para>
34990 <indexterm role="concept">
34991 <primary>transport</primary>
34992 <secondary>body only</secondary>
34993 </indexterm>
34994 <indexterm role="concept">
34995 <primary>message</primary>
34996 <secondary>transporting body only</secondary>
34997 </indexterm>
34998 <indexterm role="concept">
34999 <primary>body of message</primary>
35000 <secondary>transporting</secondary>
35001 </indexterm>
35002 If this option is set, the message&#x2019;s headers are not transported. It is
35003 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
35004 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
35005 <option>message_suffix</option> should be checked, because this option does not
35006 automatically suppress them.
35007 </para>
35008 <para>
35009 <indexterm role="option">
35010 <primary><option>current_directory</option></primary>
35011 </indexterm>
35012 </para>
35013 <informaltable frame="all">
35014 <tgroup cols="4" colsep="0" rowsep="0">
35015 <colspec colwidth="8*" align="left"/>
35016 <colspec colwidth="6*" align="center"/>
35017 <colspec colwidth="6*" align="center"/>
35018 <colspec colwidth="6*" align="right"/>
35019 <tbody>
35020 <row>
35021 <entry><option>current_directory</option></entry>
35022 <entry>Use: <emphasis>transports</emphasis></entry>
35023 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35024 <entry>Default: <emphasis>unset</emphasis></entry>
35025 </row>
35026 </tbody>
35027 </tgroup>
35028 </informaltable>
35029 <para>
35030 <indexterm role="concept">
35031 <primary>transport</primary>
35032 <secondary>current directory for</secondary>
35033 </indexterm>
35034 This specifies the current directory that is to be set while running the
35035 transport, overriding any value that may have been set by the router.
35036 If the expansion fails for any reason, including forced failure, an error is
35037 logged, and delivery is deferred.
35038 </para>
35039 <para>
35040 <indexterm role="option">
35041 <primary><option>disable_logging</option></primary>
35042 </indexterm>
35043 </para>
35044 <informaltable frame="all">
35045 <tgroup cols="4" colsep="0" rowsep="0">
35046 <colspec colwidth="8*" align="left"/>
35047 <colspec colwidth="6*" align="center"/>
35048 <colspec colwidth="6*" align="center"/>
35049 <colspec colwidth="6*" align="right"/>
35050 <tbody>
35051 <row>
35052 <entry><option>disable_logging</option></entry>
35053 <entry>Use: <emphasis>transports</emphasis></entry>
35054 <entry>Type: <emphasis>boolean</emphasis></entry>
35055 <entry>Default: <emphasis>false</emphasis></entry>
35056 </row>
35057 </tbody>
35058 </tgroup>
35059 </informaltable>
35060 <para>
35061 If this option is set true, nothing is logged for any
35062 deliveries by the transport or for any
35063 transport errors. You should not set this option unless you really, really know
35064 what you are doing.
35065 </para>
35066 <para>
35067 <indexterm role="option">
35068 <primary><option>debug_print</option></primary>
35069 </indexterm>
35070 </para>
35071 <informaltable frame="all">
35072 <tgroup cols="4" colsep="0" rowsep="0">
35073 <colspec colwidth="8*" align="left"/>
35074 <colspec colwidth="6*" align="center"/>
35075 <colspec colwidth="6*" align="center"/>
35076 <colspec colwidth="6*" align="right"/>
35077 <tbody>
35078 <row>
35079 <entry><option>debug_print</option></entry>
35080 <entry>Use: <emphasis>transports</emphasis></entry>
35081 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35082 <entry>Default: <emphasis>unset</emphasis></entry>
35083 </row>
35084 </tbody>
35085 </tgroup>
35086 </informaltable>
35087 <para>
35088 <indexterm role="concept">
35089 <primary>testing</primary>
35090 <secondary>variables in drivers</secondary>
35091 </indexterm>
35092 If this option is set and debugging is enabled (see the <option>-d</option> command line
35093 option), the string is expanded and included in the debugging output when the
35094 transport is run.
35095 If expansion of the string fails, the error message is written to the debugging
35096 output, and Exim carries on processing.
35097 This facility is provided to help with checking out the values of variables and
35098 so on when debugging driver configurations. For example, if a <option>headers_add</option>
35099 option is not working properly, <option>debug_print</option> could be used to output the
35100 variables it references. A newline is added to the text if it does not end with
35101 one.
35102 </para>
35103 <para>
35104 <indexterm role="option">
35105 <primary><option>delivery_date_add</option></primary>
35106 </indexterm>
35107 </para>
35108 <informaltable frame="all">
35109 <tgroup cols="4" colsep="0" rowsep="0">
35110 <colspec colwidth="8*" align="left"/>
35111 <colspec colwidth="6*" align="center"/>
35112 <colspec colwidth="6*" align="center"/>
35113 <colspec colwidth="6*" align="right"/>
35114 <tbody>
35115 <row>
35116 <entry><option>delivery_date_add</option></entry>
35117 <entry>Use: <emphasis>transports</emphasis></entry>
35118 <entry>Type: <emphasis>boolean</emphasis></entry>
35119 <entry>Default: <emphasis>false</emphasis></entry>
35120 </row>
35121 </tbody>
35122 </tgroup>
35123 </informaltable>
35124 <para>
35125 <indexterm role="concept">
35126 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
35127 </indexterm>
35128 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
35129 This gives the actual time the delivery was made. As this is not a standard
35130 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
35131 requests its removal from incoming messages, so that delivered messages can
35132 safely be resent to other recipients.
35133 </para>
35134 <para>
35135 <indexterm role="option">
35136 <primary><option>driver</option></primary>
35137 </indexterm>
35138 </para>
35139 <informaltable frame="all">
35140 <tgroup cols="4" colsep="0" rowsep="0">
35141 <colspec colwidth="8*" align="left"/>
35142 <colspec colwidth="6*" align="center"/>
35143 <colspec colwidth="6*" align="center"/>
35144 <colspec colwidth="6*" align="right"/>
35145 <tbody>
35146 <row>
35147 <entry><option>driver</option></entry>
35148 <entry>Use: <emphasis>transports</emphasis></entry>
35149 <entry>Type: <emphasis>string</emphasis></entry>
35150 <entry>Default: <emphasis>unset</emphasis></entry>
35151 </row>
35152 </tbody>
35153 </tgroup>
35154 </informaltable>
35155 <para>
35156 This specifies which of the available transport drivers is to be used.
35157 There is no default, and this option must be set for every transport.
35158 </para>
35159 <para>
35160 <indexterm role="option">
35161 <primary><option>envelope_to_add</option></primary>
35162 </indexterm>
35163 </para>
35164 <informaltable frame="all">
35165 <tgroup cols="4" colsep="0" rowsep="0">
35166 <colspec colwidth="8*" align="left"/>
35167 <colspec colwidth="6*" align="center"/>
35168 <colspec colwidth="6*" align="center"/>
35169 <colspec colwidth="6*" align="right"/>
35170 <tbody>
35171 <row>
35172 <entry><option>envelope_to_add</option></entry>
35173 <entry>Use: <emphasis>transports</emphasis></entry>
35174 <entry>Type: <emphasis>boolean</emphasis></entry>
35175 <entry>Default: <emphasis>false</emphasis></entry>
35176 </row>
35177 </tbody>
35178 </tgroup>
35179 </informaltable>
35180 <para>
35181 <indexterm role="concept">
35182 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35183 </indexterm>
35184 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
35185 This gives the original address(es) in the incoming envelope that caused this
35186 delivery to happen. More than one address may be present if the transport is
35187 configured to handle several addresses at once, or if more than one original
35188 address was redirected to the same final address. As this is not a standard
35189 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
35190 its removal from incoming messages, so that delivered messages can safely be
35191 resent to other recipients.
35192 </para>
35193 <para>
35194 <indexterm role="option">
35195 <primary><option>group</option></primary>
35196 </indexterm>
35197 </para>
35198 <informaltable frame="all">
35199 <tgroup cols="4" colsep="0" rowsep="0">
35200 <colspec colwidth="8*" align="left"/>
35201 <colspec colwidth="6*" align="center"/>
35202 <colspec colwidth="6*" align="center"/>
35203 <colspec colwidth="6*" align="right"/>
35204 <tbody>
35205 <row>
35206 <entry><option>group</option></entry>
35207 <entry>Use: <emphasis>transports</emphasis></entry>
35208 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35209 <entry>Default: <emphasis>Exim group</emphasis></entry>
35210 </row>
35211 </tbody>
35212 </tgroup>
35213 </informaltable>
35214 <para>
35215 <indexterm role="concept">
35216 <primary>transport</primary>
35217 <secondary>group; specifying</secondary>
35218 </indexterm>
35219 This option specifies a gid for running the transport process, overriding any
35220 value that the router supplies, and also overriding any value associated with
35221 <option>user</option> (see below).
35222 </para>
35223 <para>
35224 <indexterm role="option">
35225 <primary><option>headers_add</option></primary>
35226 </indexterm>
35227 </para>
35228 <informaltable frame="all">
35229 <tgroup cols="4" colsep="0" rowsep="0">
35230 <colspec colwidth="8*" align="left"/>
35231 <colspec colwidth="6*" align="center"/>
35232 <colspec colwidth="6*" align="center"/>
35233 <colspec colwidth="6*" align="right"/>
35234 <tbody>
35235 <row>
35236 <entry><option>headers_add</option></entry>
35237 <entry>Use: <emphasis>transports</emphasis></entry>
35238 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35239 <entry>Default: <emphasis>unset</emphasis></entry>
35240 </row>
35241 </tbody>
35242 </tgroup>
35243 </informaltable>
35244 <para>
35245 <indexterm role="concept">
35246 <primary>header lines</primary>
35247 <secondary>adding in transport</secondary>
35248 </indexterm>
35249 <indexterm role="concept">
35250 <primary>transport</primary>
35251 <secondary>header lines; adding</secondary>
35252 </indexterm>
35253 This option specifies a string of text that is expanded and added to the header
35254 portion of a message as it is transported, as described in section
35255 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
35256 routers. If the result of the expansion is an empty string, or if the expansion
35257 is forced to fail, no action is taken. Other expansion failures are treated as
35258 errors and cause the delivery to be deferred.
35259 </para>
35260 <para>
35261 <indexterm role="option">
35262 <primary><option>headers_only</option></primary>
35263 </indexterm>
35264 </para>
35265 <informaltable frame="all">
35266 <tgroup cols="4" colsep="0" rowsep="0">
35267 <colspec colwidth="8*" align="left"/>
35268 <colspec colwidth="6*" align="center"/>
35269 <colspec colwidth="6*" align="center"/>
35270 <colspec colwidth="6*" align="right"/>
35271 <tbody>
35272 <row>
35273 <entry><option>headers_only</option></entry>
35274 <entry>Use: <emphasis>transports</emphasis></entry>
35275 <entry>Type: <emphasis>boolean</emphasis></entry>
35276 <entry>Default: <emphasis>false</emphasis></entry>
35277 </row>
35278 </tbody>
35279 </tgroup>
35280 </informaltable>
35281 <para>
35282 <indexterm role="concept">
35283 <primary>transport</primary>
35284 <secondary>header lines only</secondary>
35285 </indexterm>
35286 <indexterm role="concept">
35287 <primary>message</primary>
35288 <secondary>transporting headers only</secondary>
35289 </indexterm>
35290 <indexterm role="concept">
35291 <primary>header lines</primary>
35292 <secondary>transporting</secondary>
35293 </indexterm>
35294 If this option is set, the message&#x2019;s body is not transported. It is mutually
35295 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
35296 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
35297 checked, since this option does not automatically suppress them.
35298 </para>
35299 <para>
35300 <indexterm role="option">
35301 <primary><option>headers_remove</option></primary>
35302 </indexterm>
35303 </para>
35304 <informaltable frame="all">
35305 <tgroup cols="4" colsep="0" rowsep="0">
35306 <colspec colwidth="8*" align="left"/>
35307 <colspec colwidth="6*" align="center"/>
35308 <colspec colwidth="6*" align="center"/>
35309 <colspec colwidth="6*" align="right"/>
35310 <tbody>
35311 <row>
35312 <entry><option>headers_remove</option></entry>
35313 <entry>Use: <emphasis>transports</emphasis></entry>
35314 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35315 <entry>Default: <emphasis>unset</emphasis></entry>
35316 </row>
35317 </tbody>
35318 </tgroup>
35319 </informaltable>
35320 <para>
35321 <indexterm role="concept">
35322 <primary>header lines</primary>
35323 <secondary>removing</secondary>
35324 </indexterm>
35325 <indexterm role="concept">
35326 <primary>transport</primary>
35327 <secondary>header lines; removing</secondary>
35328 </indexterm>
35329 This option specifies a string that is expanded into a list of header names;
35330 these headers are omitted from the message as it is transported, as described
35331 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
35332 routers. If the result of the expansion is an empty string, or if the expansion
35333 is forced to fail, no action is taken. Other expansion failures are treated as
35334 errors and cause the delivery to be deferred.
35335 </para>
35336 <para>
35337 <indexterm role="option">
35338 <primary><option>headers_rewrite</option></primary>
35339 </indexterm>
35340 </para>
35341 <informaltable frame="all">
35342 <tgroup cols="4" colsep="0" rowsep="0">
35343 <colspec colwidth="8*" align="left"/>
35344 <colspec colwidth="6*" align="center"/>
35345 <colspec colwidth="6*" align="center"/>
35346 <colspec colwidth="6*" align="right"/>
35347 <tbody>
35348 <row>
35349 <entry><option>headers_rewrite</option></entry>
35350 <entry>Use: <emphasis>transports</emphasis></entry>
35351 <entry>Type: <emphasis>string</emphasis></entry>
35352 <entry>Default: <emphasis>unset</emphasis></entry>
35353 </row>
35354 </tbody>
35355 </tgroup>
35356 </informaltable>
35357 <para>
35358 <indexterm role="concept">
35359 <primary>transport</primary>
35360 <secondary>header lines; rewriting</secondary>
35361 </indexterm>
35362 <indexterm role="concept">
35363 <primary>rewriting</primary>
35364 <secondary>at transport time</secondary>
35365 </indexterm>
35366 This option allows addresses in header lines to be rewritten at transport time,
35367 that is, as the message is being copied to its destination. The contents of the
35368 option are a colon-separated list of rewriting rules. Each rule is in exactly
35369 the same form as one of the general rewriting rules that are applied when a
35370 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
35371 example,
35372 </para>
35373 <literallayout class="monospaced">
35374 headers_rewrite = a@b c@d f : \
35375                   x@y w@z
35376 </literallayout>
35377 <para>
35378 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
35379 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
35380 header lines just before they are written out at transport time, so they affect
35381 only those copies of the message that pass through the transport. However, only
35382 the message&#x2019;s original header lines, and any that were added by a system
35383 filter, are rewritten. If a router or transport adds header lines, they are not
35384 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
35385 envelope. You can change the return path using <option>return_path</option>, but you cannot
35386 change envelope recipients at this time.
35387 </para>
35388 <para>
35389 <indexterm role="option">
35390 <primary><option>home_directory</option></primary>
35391 </indexterm>
35392 </para>
35393 <informaltable frame="all">
35394 <tgroup cols="4" colsep="0" rowsep="0">
35395 <colspec colwidth="8*" align="left"/>
35396 <colspec colwidth="6*" align="center"/>
35397 <colspec colwidth="6*" align="center"/>
35398 <colspec colwidth="6*" align="right"/>
35399 <tbody>
35400 <row>
35401 <entry><option>home_directory</option></entry>
35402 <entry>Use: <emphasis>transports</emphasis></entry>
35403 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35404 <entry>Default: <emphasis>unset</emphasis></entry>
35405 </row>
35406 </tbody>
35407 </tgroup>
35408 </informaltable>
35409 <para>
35410 <indexterm role="concept">
35411 <primary>transport</primary>
35412 <secondary>home directory for</secondary>
35413 </indexterm>
35414 <indexterm role="variable">
35415 <primary><varname>$home</varname></primary>
35416 </indexterm>
35417 This option specifies a home directory setting for a local transport,
35418 overriding any value that may be set by the router. The home directory is
35419 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
35420 used as the current directory if no current directory is set by the
35421 <option>current_directory</option> option on the transport or the
35422 <option>transport_current_directory</option> option on the router. If the expansion fails
35423 for any reason, including forced failure, an error is logged, and delivery is
35424 deferred.
35425 </para>
35426 <para>
35427 <indexterm role="option">
35428 <primary><option>initgroups</option></primary>
35429 </indexterm>
35430 </para>
35431 <informaltable frame="all">
35432 <tgroup cols="4" colsep="0" rowsep="0">
35433 <colspec colwidth="8*" align="left"/>
35434 <colspec colwidth="6*" align="center"/>
35435 <colspec colwidth="6*" align="center"/>
35436 <colspec colwidth="6*" align="right"/>
35437 <tbody>
35438 <row>
35439 <entry><option>initgroups</option></entry>
35440 <entry>Use: <emphasis>transports</emphasis></entry>
35441 <entry>Type: <emphasis>boolean</emphasis></entry>
35442 <entry>Default: <emphasis>false</emphasis></entry>
35443 </row>
35444 </tbody>
35445 </tgroup>
35446 </informaltable>
35447 <para>
35448 <indexterm role="concept">
35449 <primary>additional groups</primary>
35450 </indexterm>
35451 <indexterm role="concept">
35452 <primary>groups</primary>
35453 <secondary>additional</secondary>
35454 </indexterm>
35455 <indexterm role="concept">
35456 <primary>transport</primary>
35457 <secondary>group; additional</secondary>
35458 </indexterm>
35459 If this option is true and the uid for the delivery process is provided by the
35460 transport, the <function>initgroups()</function> function is called when running the transport
35461 to ensure that any additional groups associated with the uid are set up.
35462 </para>
35463 <para>
35464 <indexterm role="option">
35465 <primary><option>message_size_limit</option></primary>
35466 </indexterm>
35467 </para>
35468 <informaltable frame="all">
35469 <tgroup cols="4" colsep="0" rowsep="0">
35470 <colspec colwidth="8*" align="left"/>
35471 <colspec colwidth="6*" align="center"/>
35472 <colspec colwidth="6*" align="center"/>
35473 <colspec colwidth="6*" align="right"/>
35474 <tbody>
35475 <row>
35476 <entry><option>message_size_limit</option></entry>
35477 <entry>Use: <emphasis>transports</emphasis></entry>
35478 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35479 <entry>Default: <emphasis>0</emphasis></entry>
35480 </row>
35481 </tbody>
35482 </tgroup>
35483 </informaltable>
35484 <para>
35485 <indexterm role="concept">
35486 <primary>limit</primary>
35487 <secondary>message size per transport</secondary>
35488 </indexterm>
35489 <indexterm role="concept">
35490 <primary>size</primary>
35491 <secondary>of message, limit</secondary>
35492 </indexterm>
35493 <indexterm role="concept">
35494 <primary>transport</primary>
35495 <secondary>message size; limiting</secondary>
35496 </indexterm>
35497 This option controls the size of messages passed through the transport. It is
35498 expanded before use; the result of the expansion must be a sequence of decimal
35499 digits, optionally followed by K or M. If the expansion fails for any reason,
35500 including forced failure, or if the result is not of the required form,
35501 delivery is deferred. If the value is greater than zero and the size of a
35502 message exceeds this limit, the address is failed. If there is any chance that
35503 the resulting bounce message could be routed to the same transport, you should
35504 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
35505 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
35506 delivered.
35507 </para>
35508 <para>
35509 <indexterm role="option">
35510 <primary><option>rcpt_include_affixes</option></primary>
35511 </indexterm>
35512 </para>
35513 <informaltable frame="all">
35514 <tgroup cols="4" colsep="0" rowsep="0">
35515 <colspec colwidth="8*" align="left"/>
35516 <colspec colwidth="6*" align="center"/>
35517 <colspec colwidth="6*" align="center"/>
35518 <colspec colwidth="6*" align="right"/>
35519 <tbody>
35520 <row>
35521 <entry><option>rcpt_include_affixes</option></entry>
35522 <entry>Use: <emphasis>transports</emphasis></entry>
35523 <entry>Type: <emphasis>boolean</emphasis></entry>
35524 <entry>Default: <emphasis>false</emphasis></entry>
35525 </row>
35526 </tbody>
35527 </tgroup>
35528 </informaltable>
35529 <para>
35530 <indexterm role="concept">
35531 <primary>prefix</primary>
35532 <secondary>for local part, including in envelope</secondary>
35533 </indexterm>
35534 <indexterm role="concept">
35535 <primary>suffix for local part</primary>
35536 <secondary>including in envelope</secondary>
35537 </indexterm>
35538 <indexterm role="concept">
35539 <primary>local part</primary>
35540 <secondary>prefix</secondary>
35541 </indexterm>
35542 <indexterm role="concept">
35543 <primary>local part</primary>
35544 <secondary>suffix</secondary>
35545 </indexterm>
35546 When this option is false (the default), and an address that has had any
35547 affixes (prefixes or suffixes) removed from the local part is delivered by any
35548 form of SMTP or LMTP, the affixes are not included. For example, if a router
35549 that contains
35550 </para>
35551 <literallayout class="monospaced">
35552 local_part_prefix = *-
35553 </literallayout>
35554 <para>
35555 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
35556 is delivered with
35557 </para>
35558 <literallayout class="monospaced">
35559 RCPT TO:&lt;xyz@some.domain&gt;
35560 </literallayout>
35561 <para>
35562 This is also the case when an ACL-time callout is being used to verify a
35563 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
35564 whole local part is included in the RCPT command. This option applies to BSMTP
35565 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
35566 <command>lmtp</command> and <command>smtp</command> transports.
35567 </para>
35568 <para>
35569 <indexterm role="option">
35570 <primary><option>retry_use_local_part</option></primary>
35571 </indexterm>
35572 </para>
35573 <informaltable frame="all">
35574 <tgroup cols="4" colsep="0" rowsep="0">
35575 <colspec colwidth="8*" align="left"/>
35576 <colspec colwidth="6*" align="center"/>
35577 <colspec colwidth="6*" align="center"/>
35578 <colspec colwidth="6*" align="right"/>
35579 <tbody>
35580 <row>
35581 <entry><option>retry_use_local_part</option></entry>
35582 <entry>Use: <emphasis>transports</emphasis></entry>
35583 <entry>Type: <emphasis>boolean</emphasis></entry>
35584 <entry>Default: <emphasis>see below</emphasis></entry>
35585 </row>
35586 </tbody>
35587 </tgroup>
35588 </informaltable>
35589 <para>
35590 <indexterm role="concept">
35591 <primary>hints database</primary>
35592 <secondary>retry keys</secondary>
35593 </indexterm>
35594 When a delivery suffers a temporary failure, a retry record is created
35595 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
35596 is based on the name and/or IP address of the failing remote host. For local
35597 deliveries, the key is normally the entire address, including both the local
35598 part and the domain. This is suitable for most common cases of local delivery
35599 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
35600 deliveries to that mailbox, not to the whole domain.
35601 </para>
35602 <para>
35603 However, in some special cases you may want to treat a temporary local delivery
35604 as a failure associated with the domain, and not with a particular local part.
35605 (For example, if you are storing all mail for some domain in files.) You can do
35606 this by setting <option>retry_use_local_part</option> false.
35607 </para>
35608 <para>
35609 For all the local transports, its default value is true. For remote transports,
35610 the default value is false for tidiness, but changing the value has no effect
35611 on a remote transport in the current implementation.
35612 </para>
35613 <para>
35614 <indexterm role="option">
35615 <primary><option>return_path</option></primary>
35616 </indexterm>
35617 </para>
35618 <informaltable frame="all">
35619 <tgroup cols="4" colsep="0" rowsep="0">
35620 <colspec colwidth="8*" align="left"/>
35621 <colspec colwidth="6*" align="center"/>
35622 <colspec colwidth="6*" align="center"/>
35623 <colspec colwidth="6*" align="right"/>
35624 <tbody>
35625 <row>
35626 <entry><option>return_path</option></entry>
35627 <entry>Use: <emphasis>transports</emphasis></entry>
35628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35629 <entry>Default: <emphasis>unset</emphasis></entry>
35630 </row>
35631 </tbody>
35632 </tgroup>
35633 </informaltable>
35634 <para>
35635 <indexterm role="concept">
35636 <primary>envelope sender</primary>
35637 </indexterm>
35638 <indexterm role="concept">
35639 <primary>transport</primary>
35640 <secondary>return path; changing</secondary>
35641 </indexterm>
35642 <indexterm role="concept">
35643 <primary>return path</primary>
35644 <secondary>changing in transport</secondary>
35645 </indexterm>
35646 If this option is set, the string is expanded at transport time and replaces
35647 the existing return path (envelope sender) value in the copy of the message
35648 that is being delivered. An empty return path is permitted. This feature is
35649 designed for remote deliveries, where the value of this option is used in the
35650 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
35651 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
35652 header line, if one is added to the message (see the next option).
35653 </para>
35654 <para>
35655 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
35656 <option>return_path_on_delivery</option> to the log selector.
35657 </para>
35658 <para>
35659 <indexterm role="variable">
35660 <primary><varname>$return_path</varname></primary>
35661 </indexterm>
35662 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
35663 either the message&#x2019;s envelope sender, or an address set by the
35664 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
35665 replacement occurs; if it fails for another reason, delivery is deferred. This
35666 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
35667 section <xref linkend="SECTverp"/>.
35668 </para>
35669 <para>
35670 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
35671 remote server rejects a message at SMTP time, the bounce message is not sent to
35672 the value of this option. It is sent to the previously set errors address.
35673 This defaults to the incoming sender address, but can be changed by setting
35674 <option>errors_to</option> in a router.
35675 </para>
35676 <para>
35677 <indexterm role="option">
35678 <primary><option>return_path_add</option></primary>
35679 </indexterm>
35680 </para>
35681 <informaltable frame="all">
35682 <tgroup cols="4" colsep="0" rowsep="0">
35683 <colspec colwidth="8*" align="left"/>
35684 <colspec colwidth="6*" align="center"/>
35685 <colspec colwidth="6*" align="center"/>
35686 <colspec colwidth="6*" align="right"/>
35687 <tbody>
35688 <row>
35689 <entry><option>return_path_add</option></entry>
35690 <entry>Use: <emphasis>transports</emphasis></entry>
35691 <entry>Type: <emphasis>boolean</emphasis></entry>
35692 <entry>Default: <emphasis>false</emphasis></entry>
35693 </row>
35694 </tbody>
35695 </tgroup>
35696 </informaltable>
35697 <para>
35698 <indexterm role="concept">
35699 <primary><emphasis>Return-path:</emphasis> header line</primary>
35700 </indexterm>
35701 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
35702 Although the return path is normally available in the prefix line of BSD
35703 mailboxes, this is commonly not displayed by MUAs, and so the user does not
35704 have easy access to it.
35705 </para>
35706 <para>
35707 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
35708 the delivery SMTP server makes the final delivery</quote>. This implies that this
35709 header should not be present in incoming messages. Exim has a configuration
35710 option, <option>return_path_remove</option>, which requests removal of this header from
35711 incoming messages, so that delivered messages can safely be resent to other
35712 recipients.
35713 </para>
35714 <para>
35715 <indexterm role="option">
35716 <primary><option>shadow_condition</option></primary>
35717 </indexterm>
35718 </para>
35719 <informaltable frame="all">
35720 <tgroup cols="4" colsep="0" rowsep="0">
35721 <colspec colwidth="8*" align="left"/>
35722 <colspec colwidth="6*" align="center"/>
35723 <colspec colwidth="6*" align="center"/>
35724 <colspec colwidth="6*" align="right"/>
35725 <tbody>
35726 <row>
35727 <entry><option>shadow_condition</option></entry>
35728 <entry>Use: <emphasis>transports</emphasis></entry>
35729 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35730 <entry>Default: <emphasis>unset</emphasis></entry>
35731 </row>
35732 </tbody>
35733 </tgroup>
35734 </informaltable>
35735 <para>
35736 See <option>shadow_transport</option> below.
35737 </para>
35738 <para>
35739 <indexterm role="option">
35740 <primary><option>shadow_transport</option></primary>
35741 </indexterm>
35742 </para>
35743 <informaltable frame="all">
35744 <tgroup cols="4" colsep="0" rowsep="0">
35745 <colspec colwidth="8*" align="left"/>
35746 <colspec colwidth="6*" align="center"/>
35747 <colspec colwidth="6*" align="center"/>
35748 <colspec colwidth="6*" align="right"/>
35749 <tbody>
35750 <row>
35751 <entry><option>shadow_transport</option></entry>
35752 <entry>Use: <emphasis>transports</emphasis></entry>
35753 <entry>Type: <emphasis>string</emphasis></entry>
35754 <entry>Default: <emphasis>unset</emphasis></entry>
35755 </row>
35756 </tbody>
35757 </tgroup>
35758 </informaltable>
35759 <para>
35760 <indexterm role="concept">
35761 <primary>shadow transport</primary>
35762 </indexterm>
35763 <indexterm role="concept">
35764 <primary>transport</primary>
35765 <secondary>shadow</secondary>
35766 </indexterm>
35767 A local transport may set the <option>shadow_transport</option> option to the name of
35768 another local transport. Shadow remote transports are not supported.
35769 </para>
35770 <para>
35771 Whenever a delivery to the main transport succeeds, and either
35772 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
35773 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
35774 passed to the shadow transport, with the same delivery address or addresses. If
35775 expansion fails, no action is taken except that non-forced expansion failures
35776 cause a log line to be written.
35777 </para>
35778 <para>
35779 The result of the shadow transport is discarded and does not affect the
35780 subsequent processing of the message. Only a single level of shadowing is
35781 provided; the <option>shadow_transport</option> option is ignored on any transport when it
35782 is running as a shadow. Options concerned with output from pipes are also
35783 ignored. The log line for the successful delivery has an item added on the end,
35784 of the form
35785 </para>
35786 <literallayout class="monospaced">
35787 ST=&lt;shadow transport name&gt;
35788 </literallayout>
35789 <para>
35790 If the shadow transport did not succeed, the error message is put in
35791 parentheses afterwards. Shadow transports can be used for a number of different
35792 purposes, including keeping more detailed log information than Exim normally
35793 provides, and implementing automatic acknowledgment policies based on message
35794 headers that some sites insist on.
35795 </para>
35796 <para>
35797 <indexterm role="option">
35798 <primary><option>transport_filter</option></primary>
35799 </indexterm>
35800 </para>
35801 <informaltable frame="all">
35802 <tgroup cols="4" colsep="0" rowsep="0">
35803 <colspec colwidth="8*" align="left"/>
35804 <colspec colwidth="6*" align="center"/>
35805 <colspec colwidth="6*" align="center"/>
35806 <colspec colwidth="6*" align="right"/>
35807 <tbody>
35808 <row>
35809 <entry><option>transport_filter</option></entry>
35810 <entry>Use: <emphasis>transports</emphasis></entry>
35811 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35812 <entry>Default: <emphasis>unset</emphasis></entry>
35813 </row>
35814 </tbody>
35815 </tgroup>
35816 </informaltable>
35817 <para>
35818 <indexterm role="concept">
35819 <primary>transport</primary>
35820 <secondary>filter</secondary>
35821 </indexterm>
35822 <indexterm role="concept">
35823 <primary>filter</primary>
35824 <secondary>transport filter</secondary>
35825 </indexterm>
35826 This option sets up a filtering (in the Unix shell sense) process for messages
35827 at transport time. It should not be confused with mail filtering as set up by
35828 individual users or via a system filter.
35829 </para>
35830 <para>
35831 When the message is about to be written out, the command specified by
35832 <option>transport_filter</option> is started up in a separate, parallel process, and
35833 the entire message, including the header lines, is passed to it on its standard
35834 input (this in fact is done from a third process, to avoid deadlock). The
35835 command must be specified as an absolute path.
35836 </para>
35837 <para>
35838 The lines of the message that are written to the transport filter are
35839 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
35840 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
35841 lines beginning with a dot, and also before any processing implied by the
35842 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
35843 <command>pipe</command> transports.
35844 </para>
35845 <para>
35846 The standard error for the filter process is set to the same destination as its
35847 standard output; this is read and written to the message&#x2019;s ultimate
35848 destination. The process that writes the message to the filter, the
35849 filter itself, and the original process that reads the result and delivers it
35850 are all run in parallel, like a shell pipeline.
35851 </para>
35852 <para>
35853 The filter can perform any transformations it likes, but of course should take
35854 care not to break RFC 2822 syntax. A demonstration Perl script is provided in
35855 <filename>util/transport-filter.pl</filename>; this makes a few arbitrary modifications just to
35856 show the possibilities. Exim does not check the result, except to test for a
35857 final newline when SMTP is in use. All messages transmitted over SMTP must end
35858 with a newline, so Exim supplies one if it is missing.
35859 </para>
35860 <para>
35861 <indexterm role="concept">
35862 <primary>content scanning</primary>
35863 <secondary>per user</secondary>
35864 </indexterm>
35865 A transport filter can be used to provide content-scanning on a per-user basis
35866 at delivery time if the only required effect of the scan is to modify the
35867 message. For example, a content scan could insert a new header line containing
35868 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
35869 not possible to discard a message at this stage.
35870 </para>
35871 <para>
35872 <indexterm role="concept">
35873 <primary>SMTP</primary>
35874 <secondary>SIZE</secondary>
35875 </indexterm>
35876 A problem might arise if the filter increases the size of a message that is
35877 being sent down an SMTP connection. If the receiving SMTP server has indicated
35878 support for the SIZE parameter, Exim will have sent the size of the message
35879 at the start of the SMTP session. If what is actually sent is substantially
35880 more, the server might reject the message. This can be worked round by setting
35881 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
35882 additions to the message, or to disable the use of SIZE altogether.
35883 </para>
35884 <para>
35885 <indexterm role="variable">
35886 <primary><varname>$pipe_addresses</varname></primary>
35887 </indexterm>
35888 The value of the <option>transport_filter</option> option is the command string for starting
35889 the filter, which is run directly from Exim, not under a shell. The string is
35890 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
35891 Exim breaks it up into arguments and then expands each argument separately (see
35892 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
35893 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
35894 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
35895 an ideal name for this feature here, but as it was already implemented for the
35896 <command>pipe</command> transport, it seemed sensible not to change it.)
35897 </para>
35898 <para>
35899 <indexterm role="variable">
35900 <primary><varname>$host</varname></primary>
35901 </indexterm>
35902 <indexterm role="variable">
35903 <primary><varname>$host_address</varname></primary>
35904 </indexterm>
35905 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
35906 transport is a remote one. They contain the name and IP address of the host to
35907 which the message is being sent. For example:
35908 </para>
35909 <literallayout class="monospaced">
35910 transport_filter = /some/directory/transport-filter.pl \
35911   $host $host_address $sender_address $pipe_addresses
35912 </literallayout>
35913 <para>
35914 Two problems arise if you want to use more complicated expansion items to
35915 generate transport filter commands, both of which due to the fact that the
35916 command is split up <emphasis>before</emphasis> expansion.
35917 </para>
35918 <itemizedlist>
35919 <listitem>
35920 <para>
35921 If an expansion item contains white space, you must quote it, so that it is all
35922 part of the same command item. If the entire option setting is one such
35923 expansion item, you have to take care what kind of quoting you use. For
35924 example:
35925 </para>
35926 <literallayout class="monospaced">
35927 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
35928 </literallayout>
35929 <para>
35930 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
35931 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
35932 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
35933 the single quotes were missing, the line would be split into two items,
35934 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
35935 Exim tried to expand the first one.
35936 </para>
35937 </listitem>
35938 <listitem>
35939 <para>
35940 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
35941 expansion cannot generate multiple arguments, or a command name followed by
35942 arguments. Consider this example:
35943 </para>
35944 <literallayout class="monospaced">
35945 transport_filter = ${lookup{$host}lsearch{/a/file}\
35946                     {$value}{/bin/cat}}
35947 </literallayout>
35948 <para>
35949 The result of the lookup is interpreted as the name of the command, even
35950 if it contains white space. The simplest way round this is to use a shell:
35951 </para>
35952 <literallayout class="monospaced">
35953 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
35954                                {$value}{/bin/cat}}
35955 </literallayout>
35956 </listitem>
35957 </itemizedlist>
35958 <para>
35959 The filter process is run under the same uid and gid as the normal delivery.
35960 For remote deliveries this is the Exim uid/gid by default. The command should
35961 normally yield a zero return code. Transport filters are not supposed to fail.
35962 A non-zero code is taken to mean that the transport filter encountered some
35963 serious problem. Delivery of the message is deferred; the message remains on
35964 the queue and is tried again later. It is not possible to cause a message to be
35965 bounced from a transport filter.
35966 </para>
35967 <para>
35968 If a transport filter is set on an autoreply transport, the original message is
35969 passed through the filter as it is being copied into the newly generated
35970 message, which happens if the <option>return_message</option> option is set.
35971 </para>
35972 <para>
35973 <indexterm role="option">
35974 <primary><option>transport_filter_timeout</option></primary>
35975 </indexterm>
35976 </para>
35977 <informaltable frame="all">
35978 <tgroup cols="4" colsep="0" rowsep="0">
35979 <colspec colwidth="8*" align="left"/>
35980 <colspec colwidth="6*" align="center"/>
35981 <colspec colwidth="6*" align="center"/>
35982 <colspec colwidth="6*" align="right"/>
35983 <tbody>
35984 <row>
35985 <entry><option>transport_filter_timeout</option></entry>
35986 <entry>Use: <emphasis>transports</emphasis></entry>
35987 <entry>Type: <emphasis>time</emphasis></entry>
35988 <entry>Default: <emphasis>5m</emphasis></entry>
35989 </row>
35990 </tbody>
35991 </tgroup>
35992 </informaltable>
35993 <para>
35994 <indexterm role="concept">
35995 <primary>transport</primary>
35996 <secondary>filter, timeout</secondary>
35997 </indexterm>
35998 When Exim is reading the output of a transport filter, it a applies a timeout
35999 that can be set by this option. Exceeding the timeout is normally treated as a
36000 temporary delivery failure. However, if a transport filter is used with a
36001 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
36002 way as a timeout in the pipe command itself. By default, a timeout is a hard
36003 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
36004 becomes a temporary error.
36005 </para>
36006 <para>
36007 <indexterm role="option">
36008 <primary><option>user</option></primary>
36009 </indexterm>
36010 </para>
36011 <informaltable frame="all">
36012 <tgroup cols="4" colsep="0" rowsep="0">
36013 <colspec colwidth="8*" align="left"/>
36014 <colspec colwidth="6*" align="center"/>
36015 <colspec colwidth="6*" align="center"/>
36016 <colspec colwidth="6*" align="right"/>
36017 <tbody>
36018 <row>
36019 <entry><option>user</option></entry>
36020 <entry>Use: <emphasis>transports</emphasis></entry>
36021 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36022 <entry>Default: <emphasis>Exim user</emphasis></entry>
36023 </row>
36024 </tbody>
36025 </tgroup>
36026 </informaltable>
36027 <para>
36028 <indexterm role="concept">
36029 <primary>uid (user id)</primary>
36030 <secondary>local delivery</secondary>
36031 </indexterm>
36032 <indexterm role="concept">
36033 <primary>transport</primary>
36034 <secondary>user, specifying</secondary>
36035 </indexterm>
36036 This option specifies the user under whose uid the delivery process is to be
36037 run, overriding any uid that may have been set by the router. If the user is
36038 given as a name, the uid is looked up from the password data, and the
36039 associated group is taken as the value of the gid to be used if the <option>group</option>
36040 option is not set.
36041 </para>
36042 <para>
36043 For deliveries that use local transports, a user and group are normally
36044 specified explicitly or implicitly (for example, as a result of
36045 <option>check_local_user</option>) by the router or transport.
36046 </para>
36047 <para>
36048 <indexterm role="concept">
36049 <primary>hints database</primary>
36050 <secondary>access by remote transport</secondary>
36051 </indexterm>
36052 For remote transports, you should leave this option unset unless you really are
36053 sure you know what you are doing. When a remote transport is running, it needs
36054 to be able to access Exim&#x2019;s hints databases, because each host may have its own
36055 retry data.
36056 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
36057 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
36058 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
36059 </para>
36060 </chapter>
36061
36062 <chapter id="CHAPbatching">
36063 <title>Address batching in local transports</title>
36064 <titleabbrev>Address batching</titleabbrev>
36065 <para>
36066 <indexterm role="concept">
36067 <primary>transport</primary>
36068 <secondary>local; address batching in</secondary>
36069 </indexterm>
36070 The only remote transport (<command>smtp</command>) is normally configured to handle more than
36071 one address at a time, so that when several addresses are routed to the same
36072 remote host, just one copy of the message is sent. Local transports, however,
36073 normally handle one address at a time. That is, a separate instance of the
36074 transport is run for each address that is routed to the transport. A separate
36075 copy of the message is delivered each time.
36076 </para>
36077 <para>
36078 <indexterm role="concept">
36079 <primary>batched local delivery</primary>
36080 </indexterm>
36081 <indexterm role="option">
36082 <primary><option>batch_max</option></primary>
36083 </indexterm>
36084 <indexterm role="option">
36085 <primary><option>batch_id</option></primary>
36086 </indexterm>
36087 In special cases, it may be desirable to handle several addresses at once in a
36088 local transport, for example:
36089 </para>
36090 <itemizedlist>
36091 <listitem>
36092 <para>
36093 In an <command>appendfile</command> transport, when storing messages in files for later
36094 delivery by some other means, a single copy of the message with multiple
36095 recipients saves space.
36096 </para>
36097 </listitem>
36098 <listitem>
36099 <para>
36100 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
36101 a single copy saves time, and is the normal way LMTP is expected to work.
36102 </para>
36103 </listitem>
36104 <listitem>
36105 <para>
36106 In a <command>pipe</command> transport, when passing the message
36107 to a scanner program or
36108 to some other delivery mechanism such as UUCP, multiple recipients may be
36109 acceptable.
36110 </para>
36111 </listitem>
36112 </itemizedlist>
36113 <para>
36114 These three local transports all have the same options for controlling multiple
36115 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
36116 repeating the information for each transport, these options are described here.
36117 </para>
36118 <para>
36119 The <option>batch_max</option> option specifies the maximum number of addresses that can be
36120 delivered together in a single run of the transport. Its default value is one
36121 (no batching). When more than one address is routed to a transport that has a
36122 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
36123 (that is, in a single run of the transport with multiple recipients), subject
36124 to certain conditions:
36125 </para>
36126 <itemizedlist>
36127 <listitem>
36128 <para>
36129 <indexterm role="variable">
36130 <primary><varname>$local_part</varname></primary>
36131 </indexterm>
36132 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
36133 batching is possible.
36134 </para>
36135 </listitem>
36136 <listitem>
36137 <para>
36138 <indexterm role="variable">
36139 <primary><varname>$domain</varname></primary>
36140 </indexterm>
36141 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
36142 addresses with the same domain are batched.
36143 </para>
36144 </listitem>
36145 <listitem>
36146 <para>
36147 <indexterm role="concept">
36148 <primary>customizing</primary>
36149 <secondary>batching condition</secondary>
36150 </indexterm>
36151 If <option>batch_id</option> is set, it is expanded for each address, and only those
36152 addresses with the same expanded value are batched. This allows you to specify
36153 customized batching conditions. Failure of the expansion for any reason,
36154 including forced failure, disables batching, but it does not stop the delivery
36155 from taking place.
36156 </para>
36157 </listitem>
36158 <listitem>
36159 <para>
36160 Batched addresses must also have the same errors address (where to send
36161 delivery errors), the same header additions and removals, the same user and
36162 group for the transport, and if a host list is present, the first host must
36163 be the same.
36164 </para>
36165 </listitem>
36166 </itemizedlist>
36167 <para>
36168 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
36169 both when the file or pipe command is specified in the transport, and when it
36170 is specified by a <command>redirect</command> router, but all the batched addresses must of
36171 course be routed to the same file or pipe command. These two transports have an
36172 option called <option>use_bsmtp</option>, which causes them to deliver the message in
36173 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
36174 <option>check_string</option> and <option>escape_string</option> options are forced to the values
36175 </para>
36176 <literallayout class="monospaced">
36177 check_string = "."
36178 escape_string = ".."
36179 </literallayout>
36180 <para>
36181 when batched SMTP is in use. A full description of the batch SMTP mechanism is
36182 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
36183 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
36184 </para>
36185 <para>
36186 <indexterm role="concept">
36187 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36188 </indexterm>
36189 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
36190 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
36191 that are being processed together. If you are using a batching <command>appendfile</command>
36192 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
36193 addresses is to set the <option>envelope_to_add</option> option.
36194 </para>
36195 <para>
36196 <indexterm role="concept">
36197 <primary><command>pipe</command> transport</primary>
36198 <secondary>with multiple addresses</secondary>
36199 </indexterm>
36200 <indexterm role="variable">
36201 <primary><varname>$pipe_addresses</varname></primary>
36202 </indexterm>
36203 If you are using a <command>pipe</command> transport without BSMTP, and setting the
36204 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
36205 the command. This is not a true variable; it is a bit of magic that causes each
36206 of the recipient addresses to be inserted into the command as a separate
36207 argument. This provides a way of accessing all the addresses that are being
36208 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
36209 are specified by a <command>redirect</command> router.
36210 </para>
36211 </chapter>
36212
36213 <chapter id="CHAPappendfile">
36214 <title>The appendfile transport</title>
36215 <para>
36216 <indexterm role="concept" id="IIDapptra1" class="startofrange">
36217 <primary><command>appendfile</command> transport</primary>
36218 </indexterm>
36219 <indexterm role="concept" id="IIDapptra2" class="startofrange">
36220 <primary>transports</primary>
36221 <secondary><command>appendfile</command></secondary>
36222 </indexterm>
36223 <indexterm role="concept">
36224 <primary>directory creation</primary>
36225 </indexterm>
36226 <indexterm role="concept">
36227 <primary>creating directories</primary>
36228 </indexterm>
36229 The <command>appendfile</command> transport delivers a message by appending it to an existing
36230 file, or by creating an entirely new file in a specified directory. Single
36231 files to which messages are appended can be in the traditional Unix mailbox
36232 format, or optionally in the MBX format supported by the Pine MUA and
36233 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
36234 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
36235 to give added protection against failures that happen part-way through the
36236 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
36237 supported. For all file formats, Exim attempts to create as many levels of
36238 directory as necessary, provided that <option>create_directory</option> is set.
36239 </para>
36240 <para>
36241 The code for the optional formats is not included in the Exim binary by
36242 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
36243 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
36244 included.
36245 </para>
36246 <para>
36247 <indexterm role="concept">
36248 <primary>quota</primary>
36249 <secondary>system</secondary>
36250 </indexterm>
36251 Exim recognizes system quota errors, and generates an appropriate message. Exim
36252 also supports its own quota control within the transport, for use when the
36253 system facility is unavailable or cannot be used for some reason.
36254 </para>
36255 <para>
36256 If there is an error while appending to a file (for example, quota exceeded or
36257 partition filled), Exim attempts to reset the file&#x2019;s length and last
36258 modification time back to what they were before. If there is an error while
36259 creating an entirely new file, the new file is removed.
36260 </para>
36261 <para>
36262 Before appending to a file, a number of security checks are made, and the
36263 file is locked. A detailed description is given below, after the list of
36264 private options.
36265 </para>
36266 <para>
36267 The <command>appendfile</command> transport is most commonly used for local deliveries to
36268 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
36269 putting messages into files for remote delivery by some means other than Exim.
36270 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
36271 option).
36272 </para>
36273 <section id="SECTfildiropt">
36274 <title>The file and directory options</title>
36275 <para>
36276 The <option>file</option> option specifies a single file, to which the message is appended;
36277 the <option>directory</option> option specifies a directory, in which a new file containing
36278 the message is created. Only one of these two options can be set, and for
36279 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
36280 </para>
36281 <para>
36282 <indexterm role="variable">
36283 <primary><varname>$address_file</varname></primary>
36284 </indexterm>
36285 <indexterm role="variable">
36286 <primary><varname>$local_part</varname></primary>
36287 </indexterm>
36288 However, <command>appendfile</command> is also used for delivering messages to files or
36289 directories whose names (or parts of names) are obtained from alias,
36290 forwarding, or filtering operations (for example, a <option>save</option> command in a
36291 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
36292 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
36293 name (or partial name) of the file or directory generated by the redirection
36294 operation. There are two cases:
36295 </para>
36296 <itemizedlist>
36297 <listitem>
36298 <para>
36299 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
36300 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
36301 common case when users with local accounts use filtering to sort mail into
36302 different folders. See for example, the <command>address_file</command> transport in the
36303 default configuration. If the path ends with a slash, it is assumed to be the
36304 name of a directory. A delivery to a directory can also be forced by setting
36305 <option>maildir_format</option> or <option>mailstore_format</option>.
36306 </para>
36307 </listitem>
36308 <listitem>
36309 <para>
36310 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
36311 used to determine the file or directory name for the delivery. Normally, the
36312 contents of <varname>$address_file</varname> are used in some way in the string expansion.
36313 </para>
36314 </listitem>
36315 </itemizedlist>
36316 <para>
36317 <indexterm role="concept">
36318 <primary>Sieve filter</primary>
36319 <secondary>configuring <command>appendfile</command></secondary>
36320 </indexterm>
36321 <indexterm role="concept">
36322 <primary>Sieve filter</primary>
36323 <secondary>relative mailbox path handling</secondary>
36324 </indexterm>
36325 As an example of the second case, consider an environment where users do not
36326 have home directories. They may be permitted to use Exim filter commands of the
36327 form:
36328 </para>
36329 <literallayout class="monospaced">
36330 save folder23
36331 </literallayout>
36332 <para>
36333 or Sieve filter commands of the form:
36334 </para>
36335 <literallayout class="monospaced">
36336 require "fileinto";
36337 fileinto "folder23";
36338 </literallayout>
36339 <para>
36340 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
36341 must transform the relative path into an appropriate absolute file name. In the
36342 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
36343 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
36344 way of handling this requirement:
36345 </para>
36346 <literallayout class="monospaced">
36347 file = ${if eq{$address_file}{inbox} \
36348             {/var/mail/$local_part} \
36349             {${if eq{${substr_0_1:$address_file}}{/} \
36350                   {$address_file} \
36351                   {$home/mail/$address_file} \
36352             }} \
36353        }
36354 </literallayout>
36355 <para>
36356 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
36357 location, absolute paths are used without change, and other folders are in the
36358 <filename>mail</filename> directory within the home directory.
36359 </para>
36360 <para>
36361 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
36362 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
36363 the router. In particular, this is the case if <option>check_local_user</option> is set. If
36364 you want to prevent this happening at routing time, you can set
36365 <option>router_home_directory</option> empty. This forces the router to pass the relative
36366 path to the transport.
36367 </para>
36368 <para>
36369 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
36370 the <option>file</option> or <option>directory</option> option is still used if it is set.
36371 </para>
36372 </section>
36373 <section id="SECID134">
36374 <title>Private options for appendfile</title>
36375 <para>
36376 <indexterm role="concept">
36377 <primary>options</primary>
36378 <secondary><command>appendfile</command> transport</secondary>
36379 </indexterm>
36380 </para>
36381 <para>
36382 <indexterm role="option">
36383 <primary><option>allow_fifo</option></primary>
36384 </indexterm>
36385 </para>
36386 <informaltable frame="all">
36387 <tgroup cols="4" colsep="0" rowsep="0">
36388 <colspec colwidth="8*" align="left"/>
36389 <colspec colwidth="6*" align="center"/>
36390 <colspec colwidth="6*" align="center"/>
36391 <colspec colwidth="6*" align="right"/>
36392 <tbody>
36393 <row>
36394 <entry><option>allow_fifo</option></entry>
36395 <entry>Use: <emphasis>appendfile</emphasis></entry>
36396 <entry>Type: <emphasis>boolean</emphasis></entry>
36397 <entry>Default: <emphasis>false</emphasis></entry>
36398 </row>
36399 </tbody>
36400 </tgroup>
36401 </informaltable>
36402 <para>
36403 <indexterm role="concept">
36404 <primary>fifo (named pipe)</primary>
36405 </indexterm>
36406 <indexterm role="concept">
36407 <primary>named pipe (fifo)</primary>
36408 </indexterm>
36409 <indexterm role="concept">
36410 <primary>pipe</primary>
36411 <secondary>named (fifo)</secondary>
36412 </indexterm>
36413 Setting this option permits delivery to named pipes (FIFOs) as well as to
36414 regular files. If no process is reading the named pipe at delivery time, the
36415 delivery is deferred.
36416 </para>
36417 <para>
36418 <indexterm role="option">
36419 <primary><option>allow_symlink</option></primary>
36420 </indexterm>
36421 </para>
36422 <informaltable frame="all">
36423 <tgroup cols="4" colsep="0" rowsep="0">
36424 <colspec colwidth="8*" align="left"/>
36425 <colspec colwidth="6*" align="center"/>
36426 <colspec colwidth="6*" align="center"/>
36427 <colspec colwidth="6*" align="right"/>
36428 <tbody>
36429 <row>
36430 <entry><option>allow_symlink</option></entry>
36431 <entry>Use: <emphasis>appendfile</emphasis></entry>
36432 <entry>Type: <emphasis>boolean</emphasis></entry>
36433 <entry>Default: <emphasis>false</emphasis></entry>
36434 </row>
36435 </tbody>
36436 </tgroup>
36437 </informaltable>
36438 <para>
36439 <indexterm role="concept">
36440 <primary>symbolic link</primary>
36441 <secondary>to mailbox</secondary>
36442 </indexterm>
36443 <indexterm role="concept">
36444 <primary>mailbox</primary>
36445 <secondary>symbolic link</secondary>
36446 </indexterm>
36447 By default, <command>appendfile</command> will not deliver if the path name for the file is
36448 that of a symbolic link. Setting this option relaxes that constraint, but there
36449 are security issues involved in the use of symbolic links. Be sure you know
36450 what you are doing if you set this. Details of exactly what this option affects
36451 are included in the discussion which follows this list of options.
36452 </para>
36453 <para>
36454 <indexterm role="option">
36455 <primary><option>batch_id</option></primary>
36456 </indexterm>
36457 </para>
36458 <informaltable frame="all">
36459 <tgroup cols="4" colsep="0" rowsep="0">
36460 <colspec colwidth="8*" align="left"/>
36461 <colspec colwidth="6*" align="center"/>
36462 <colspec colwidth="6*" align="center"/>
36463 <colspec colwidth="6*" align="right"/>
36464 <tbody>
36465 <row>
36466 <entry><option>batch_id</option></entry>
36467 <entry>Use: <emphasis>appendfile</emphasis></entry>
36468 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36469 <entry>Default: <emphasis>unset</emphasis></entry>
36470 </row>
36471 </tbody>
36472 </tgroup>
36473 </informaltable>
36474 <para>
36475 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36476 However, batching is automatically disabled for <command>appendfile</command> deliveries that
36477 happen as a result of forwarding or aliasing or other redirection directly to a
36478 file.
36479 </para>
36480 <para>
36481 <indexterm role="option">
36482 <primary><option>batch_max</option></primary>
36483 </indexterm>
36484 </para>
36485 <informaltable frame="all">
36486 <tgroup cols="4" colsep="0" rowsep="0">
36487 <colspec colwidth="8*" align="left"/>
36488 <colspec colwidth="6*" align="center"/>
36489 <colspec colwidth="6*" align="center"/>
36490 <colspec colwidth="6*" align="right"/>
36491 <tbody>
36492 <row>
36493 <entry><option>batch_max</option></entry>
36494 <entry>Use: <emphasis>appendfile</emphasis></entry>
36495 <entry>Type: <emphasis>integer</emphasis></entry>
36496 <entry>Default: <emphasis>1</emphasis></entry>
36497 </row>
36498 </tbody>
36499 </tgroup>
36500 </informaltable>
36501 <para>
36502 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36503 </para>
36504 <para>
36505 <indexterm role="option">
36506 <primary><option>check_group</option></primary>
36507 </indexterm>
36508 </para>
36509 <informaltable frame="all">
36510 <tgroup cols="4" colsep="0" rowsep="0">
36511 <colspec colwidth="8*" align="left"/>
36512 <colspec colwidth="6*" align="center"/>
36513 <colspec colwidth="6*" align="center"/>
36514 <colspec colwidth="6*" align="right"/>
36515 <tbody>
36516 <row>
36517 <entry><option>check_group</option></entry>
36518 <entry>Use: <emphasis>appendfile</emphasis></entry>
36519 <entry>Type: <emphasis>boolean</emphasis></entry>
36520 <entry>Default: <emphasis>false</emphasis></entry>
36521 </row>
36522 </tbody>
36523 </tgroup>
36524 </informaltable>
36525 <para>
36526 When this option is set, the group owner of the file defined by the <option>file</option>
36527 option is checked to see that it is the same as the group under which the
36528 delivery process is running. The default setting is false because the default
36529 file mode is 0600, which means that the group is irrelevant.
36530 </para>
36531 <para>
36532 <indexterm role="option">
36533 <primary><option>check_owner</option></primary>
36534 </indexterm>
36535 </para>
36536 <informaltable frame="all">
36537 <tgroup cols="4" colsep="0" rowsep="0">
36538 <colspec colwidth="8*" align="left"/>
36539 <colspec colwidth="6*" align="center"/>
36540 <colspec colwidth="6*" align="center"/>
36541 <colspec colwidth="6*" align="right"/>
36542 <tbody>
36543 <row>
36544 <entry><option>check_owner</option></entry>
36545 <entry>Use: <emphasis>appendfile</emphasis></entry>
36546 <entry>Type: <emphasis>boolean</emphasis></entry>
36547 <entry>Default: <emphasis>true</emphasis></entry>
36548 </row>
36549 </tbody>
36550 </tgroup>
36551 </informaltable>
36552 <para>
36553 When this option is set, the owner of the file defined by the <option>file</option> option
36554 is checked to ensure that it is the same as the user under which the delivery
36555 process is running.
36556 </para>
36557 <para>
36558 <indexterm role="option">
36559 <primary><option>check_string</option></primary>
36560 </indexterm>
36561 </para>
36562 <informaltable frame="all">
36563 <tgroup cols="4" colsep="0" rowsep="0">
36564 <colspec colwidth="8*" align="left"/>
36565 <colspec colwidth="6*" align="center"/>
36566 <colspec colwidth="6*" align="center"/>
36567 <colspec colwidth="6*" align="right"/>
36568 <tbody>
36569 <row>
36570 <entry><option>check_string</option></entry>
36571 <entry>Use: <emphasis>appendfile</emphasis></entry>
36572 <entry>Type: <emphasis>string</emphasis></entry>
36573 <entry>Default: <emphasis>see below</emphasis></entry>
36574 </row>
36575 </tbody>
36576 </tgroup>
36577 </informaltable>
36578 <para>
36579 <indexterm role="concept">
36580 <primary><quote>From</quote> line</primary>
36581 </indexterm>
36582 As <command>appendfile</command> writes the message, the start of each line is tested for
36583 matching <option>check_string</option>, and if it does, the initial matching characters are
36584 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
36585 a literal string, not a regular expression, and the case of any letters it
36586 contains is significant.
36587 </para>
36588 <para>
36589 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
36590 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
36591 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
36592 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
36593 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
36594 </para>
36595 <para>
36596 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
36597 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
36598 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
36599 if another format is used. For example, to deliver to mailboxes in MMDF format:
36600 <indexterm role="concept">
36601 <primary>MMDF format mailbox</primary>
36602 </indexterm>
36603 <indexterm role="concept">
36604 <primary>mailbox</primary>
36605 <secondary>MMDF format</secondary>
36606 </indexterm>
36607 </para>
36608 <literallayout class="monospaced">
36609 check_string = "\1\1\1\1\n"
36610 escape_string = "\1\1\1\1 \n"
36611 message_prefix = "\1\1\1\1\n"
36612 message_suffix = "\1\1\1\1\n"
36613 </literallayout>
36614 <para>
36615 <indexterm role="option">
36616 <primary><option>create_directory</option></primary>
36617 </indexterm>
36618 </para>
36619 <informaltable frame="all">
36620 <tgroup cols="4" colsep="0" rowsep="0">
36621 <colspec colwidth="8*" align="left"/>
36622 <colspec colwidth="6*" align="center"/>
36623 <colspec colwidth="6*" align="center"/>
36624 <colspec colwidth="6*" align="right"/>
36625 <tbody>
36626 <row>
36627 <entry><option>create_directory</option></entry>
36628 <entry>Use: <emphasis>appendfile</emphasis></entry>
36629 <entry>Type: <emphasis>boolean</emphasis></entry>
36630 <entry>Default: <emphasis>true</emphasis></entry>
36631 </row>
36632 </tbody>
36633 </tgroup>
36634 </informaltable>
36635 <para>
36636 <indexterm role="concept">
36637 <primary>directory creation</primary>
36638 </indexterm>
36639 When this option is true, Exim attempts to create any missing superior
36640 directories for the file that it is about to write. A created directory&#x2019;s mode
36641 is given by the <option>directory_mode</option> option.
36642 </para>
36643 <para>
36644 The group ownership of a newly created directory is highly dependent on the
36645 operating system (and possibly the file system) that is being used. For
36646 example, in Solaris, if the parent directory has the setgid bit set, its group
36647 is propagated to the child; if not, the currently set group is used. However,
36648 in FreeBSD, the parent&#x2019;s group is always used.
36649 </para>
36650 <para>
36651 <indexterm role="option">
36652 <primary><option>create_file</option></primary>
36653 </indexterm>
36654 </para>
36655 <informaltable frame="all">
36656 <tgroup cols="4" colsep="0" rowsep="0">
36657 <colspec colwidth="8*" align="left"/>
36658 <colspec colwidth="6*" align="center"/>
36659 <colspec colwidth="6*" align="center"/>
36660 <colspec colwidth="6*" align="right"/>
36661 <tbody>
36662 <row>
36663 <entry><option>create_file</option></entry>
36664 <entry>Use: <emphasis>appendfile</emphasis></entry>
36665 <entry>Type: <emphasis>string</emphasis></entry>
36666 <entry>Default: <emphasis>anywhere</emphasis></entry>
36667 </row>
36668 </tbody>
36669 </tgroup>
36670 </informaltable>
36671 <para>
36672 This option constrains the location of files and directories that are created
36673 by this transport. It applies to files defined by the <option>file</option> option and
36674 directories defined by the <option>directory</option> option. In the case of maildir
36675 delivery, it applies to the top level directory, not the maildir directories
36676 beneath.
36677 </para>
36678 <para>
36679 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
36680 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
36681 set for the transport. This option is not useful when an explicit file name is
36682 given for normal mailbox deliveries. It is intended for the case when file
36683 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
36684 by an <command>appendfile</command> transport called <option>address_file</option>. See also
36685 <option>file_must_exist</option>.
36686 </para>
36687 <para>
36688 <indexterm role="option">
36689 <primary><option>directory</option></primary>
36690 </indexterm>
36691 </para>
36692 <informaltable frame="all">
36693 <tgroup cols="4" colsep="0" rowsep="0">
36694 <colspec colwidth="8*" align="left"/>
36695 <colspec colwidth="6*" align="center"/>
36696 <colspec colwidth="6*" align="center"/>
36697 <colspec colwidth="6*" align="right"/>
36698 <tbody>
36699 <row>
36700 <entry><option>directory</option></entry>
36701 <entry>Use: <emphasis>appendfile</emphasis></entry>
36702 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36703 <entry>Default: <emphasis>unset</emphasis></entry>
36704 </row>
36705 </tbody>
36706 </tgroup>
36707 </informaltable>
36708 <para>
36709 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
36710 or <option>directory</option> must be set, unless the delivery is the direct result of a
36711 redirection (see section <xref linkend="SECTfildiropt"/>).
36712 </para>
36713 <para>
36714 When <option>directory</option> is set, the string is expanded, and the message is delivered
36715 into a new file or files in or below the given directory, instead of being
36716 appended to a single mailbox file. A number of different formats are provided
36717 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
36718 <xref linkend="SECTopdir"/> for further details of this form of delivery.
36719 </para>
36720 <para>
36721 <indexterm role="option">
36722 <primary><option>directory_file</option></primary>
36723 </indexterm>
36724 </para>
36725 <informaltable frame="all">
36726 <tgroup cols="4" colsep="0" rowsep="0">
36727 <colspec colwidth="8*" align="left"/>
36728 <colspec colwidth="6*" align="center"/>
36729 <colspec colwidth="6*" align="center"/>
36730 <colspec colwidth="6*" align="right"/>
36731 <tbody>
36732 <row>
36733 <entry><option>directory_file</option></entry>
36734 <entry>Use: <emphasis>appendfile</emphasis></entry>
36735 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36736 <entry>Default: <emphasis>see below</emphasis></entry>
36737 </row>
36738 </tbody>
36739 </tgroup>
36740 </informaltable>
36741 <para>
36742 <indexterm role="concept">
36743 <primary>base62</primary>
36744 </indexterm>
36745 <indexterm role="variable">
36746 <primary><varname>$inode</varname></primary>
36747 </indexterm>
36748 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
36749 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
36750 whose name is obtained by expanding this string. The default value is:
36751 </para>
36752 <literallayout class="monospaced">
36753 q${base62:$tod_epoch}-$inode
36754 </literallayout>
36755 <para>
36756 This generates a unique name from the current time, in base 62 form, and the
36757 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
36758 option.
36759 </para>
36760 <para>
36761 <indexterm role="option">
36762 <primary><option>directory_mode</option></primary>
36763 </indexterm>
36764 </para>
36765 <informaltable frame="all">
36766 <tgroup cols="4" colsep="0" rowsep="0">
36767 <colspec colwidth="8*" align="left"/>
36768 <colspec colwidth="6*" align="center"/>
36769 <colspec colwidth="6*" align="center"/>
36770 <colspec colwidth="6*" align="right"/>
36771 <tbody>
36772 <row>
36773 <entry><option>directory_mode</option></entry>
36774 <entry>Use: <emphasis>appendfile</emphasis></entry>
36775 <entry>Type: <emphasis>octal integer</emphasis></entry>
36776 <entry>Default: <emphasis>0700</emphasis></entry>
36777 </row>
36778 </tbody>
36779 </tgroup>
36780 </informaltable>
36781 <para>
36782 If <command>appendfile</command> creates any directories as a result of the
36783 <option>create_directory</option> option, their mode is specified by this option.
36784 </para>
36785 <para>
36786 <indexterm role="option">
36787 <primary><option>escape_string</option></primary>
36788 </indexterm>
36789 </para>
36790 <informaltable frame="all">
36791 <tgroup cols="4" colsep="0" rowsep="0">
36792 <colspec colwidth="8*" align="left"/>
36793 <colspec colwidth="6*" align="center"/>
36794 <colspec colwidth="6*" align="center"/>
36795 <colspec colwidth="6*" align="right"/>
36796 <tbody>
36797 <row>
36798 <entry><option>escape_string</option></entry>
36799 <entry>Use: <emphasis>appendfile</emphasis></entry>
36800 <entry>Type: <emphasis>string</emphasis></entry>
36801 <entry>Default: <emphasis>see description</emphasis></entry>
36802 </row>
36803 </tbody>
36804 </tgroup>
36805 </informaltable>
36806 <para>
36807 See <option>check_string</option> above.
36808 </para>
36809 <para>
36810 <indexterm role="option">
36811 <primary><option>file</option></primary>
36812 </indexterm>
36813 </para>
36814 <informaltable frame="all">
36815 <tgroup cols="4" colsep="0" rowsep="0">
36816 <colspec colwidth="8*" align="left"/>
36817 <colspec colwidth="6*" align="center"/>
36818 <colspec colwidth="6*" align="center"/>
36819 <colspec colwidth="6*" align="right"/>
36820 <tbody>
36821 <row>
36822 <entry><option>file</option></entry>
36823 <entry>Use: <emphasis>appendfile</emphasis></entry>
36824 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36825 <entry>Default: <emphasis>unset</emphasis></entry>
36826 </row>
36827 </tbody>
36828 </tgroup>
36829 </informaltable>
36830 <para>
36831 This option is mutually exclusive with the <option>directory</option> option, but one of
36832 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
36833 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
36834 specifies a single file, to which the message is appended. One or more of
36835 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
36836 <option>file</option>.
36837 </para>
36838 <para>
36839 <indexterm role="concept">
36840 <primary>NFS</primary>
36841 <secondary>lock file</secondary>
36842 </indexterm>
36843 <indexterm role="concept">
36844 <primary>locking files</primary>
36845 </indexterm>
36846 <indexterm role="concept">
36847 <primary>lock files</primary>
36848 </indexterm>
36849 If you are using more than one host to deliver over NFS into the same
36850 mailboxes, you should always use lock files.
36851 </para>
36852 <para>
36853 The string value is expanded for each delivery, and must yield an absolute
36854 path. The most common settings of this option are variations on one of these
36855 examples:
36856 </para>
36857 <literallayout class="monospaced">
36858 file = /var/spool/mail/$local_part
36859 file = /home/$local_part/inbox
36860 file = $home/inbox
36861 </literallayout>
36862 <para>
36863 <indexterm role="concept">
36864 <primary><quote>sticky</quote> bit</primary>
36865 </indexterm>
36866 In the first example, all deliveries are done into the same directory. If Exim
36867 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
36868 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
36869 deliveries to be possible, or alternatively the <option>group</option> option can be used to
36870 run the delivery under a group id which has write access to the directory.
36871 </para>
36872 <para>
36873 <indexterm role="option">
36874 <primary><option>file_format</option></primary>
36875 </indexterm>
36876 </para>
36877 <informaltable frame="all">
36878 <tgroup cols="4" colsep="0" rowsep="0">
36879 <colspec colwidth="8*" align="left"/>
36880 <colspec colwidth="6*" align="center"/>
36881 <colspec colwidth="6*" align="center"/>
36882 <colspec colwidth="6*" align="right"/>
36883 <tbody>
36884 <row>
36885 <entry><option>file_format</option></entry>
36886 <entry>Use: <emphasis>appendfile</emphasis></entry>
36887 <entry>Type: <emphasis>string</emphasis></entry>
36888 <entry>Default: <emphasis>unset</emphasis></entry>
36889 </row>
36890 </tbody>
36891 </tgroup>
36892 </informaltable>
36893 <para>
36894 <indexterm role="concept">
36895 <primary>file</primary>
36896 <secondary>mailbox; checking existing format</secondary>
36897 </indexterm>
36898 This option requests the transport to check the format of an existing file
36899 before adding to it. The check consists of matching a specific string at the
36900 start of the file. The value of the option consists of an even number of
36901 colon-separated strings. The first of each pair is the test string, and the
36902 second is the name of a transport. If the transport associated with a matched
36903 string is not the current transport, control is passed over to the other
36904 transport. For example, suppose the standard <command>local_delivery</command> transport has
36905 this added to it:
36906 </para>
36907 <literallayout class="monospaced">
36908 file_format = "From       : local_delivery :\
36909                \1\1\1\1\n : local_mmdf_delivery"
36910 </literallayout>
36911 <para>
36912 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
36913 a mailbox begins with four binary ones followed by a newline, control is passed
36914 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
36915 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
36916 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
36917 match any string, or if the transport named for a given string is not defined,
36918 delivery is deferred.
36919 </para>
36920 <para>
36921 <indexterm role="option">
36922 <primary><option>file_must_exist</option></primary>
36923 </indexterm>
36924 </para>
36925 <informaltable frame="all">
36926 <tgroup cols="4" colsep="0" rowsep="0">
36927 <colspec colwidth="8*" align="left"/>
36928 <colspec colwidth="6*" align="center"/>
36929 <colspec colwidth="6*" align="center"/>
36930 <colspec colwidth="6*" align="right"/>
36931 <tbody>
36932 <row>
36933 <entry><option>file_must_exist</option></entry>
36934 <entry>Use: <emphasis>appendfile</emphasis></entry>
36935 <entry>Type: <emphasis>boolean</emphasis></entry>
36936 <entry>Default: <emphasis>false</emphasis></entry>
36937 </row>
36938 </tbody>
36939 </tgroup>
36940 </informaltable>
36941 <para>
36942 If this option is true, the file specified by the <option>file</option> option must exist.
36943 A temporary error occurs if it does not, causing delivery to be deferred.
36944 If this option is false, the file is created if it does not exist.
36945 </para>
36946 <para>
36947 <indexterm role="option">
36948 <primary><option>lock_fcntl_timeout</option></primary>
36949 </indexterm>
36950 </para>
36951 <informaltable frame="all">
36952 <tgroup cols="4" colsep="0" rowsep="0">
36953 <colspec colwidth="8*" align="left"/>
36954 <colspec colwidth="6*" align="center"/>
36955 <colspec colwidth="6*" align="center"/>
36956 <colspec colwidth="6*" align="right"/>
36957 <tbody>
36958 <row>
36959 <entry><option>lock_fcntl_timeout</option></entry>
36960 <entry>Use: <emphasis>appendfile</emphasis></entry>
36961 <entry>Type: <emphasis>time</emphasis></entry>
36962 <entry>Default: <emphasis>0s</emphasis></entry>
36963 </row>
36964 </tbody>
36965 </tgroup>
36966 </informaltable>
36967 <para>
36968 <indexterm role="concept">
36969 <primary>timeout</primary>
36970 <secondary>mailbox locking</secondary>
36971 </indexterm>
36972 <indexterm role="concept">
36973 <primary>mailbox</primary>
36974 <secondary>locking, blocking and non-blocking</secondary>
36975 </indexterm>
36976 <indexterm role="concept">
36977 <primary>locking files</primary>
36978 </indexterm>
36979 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
36980 when locking an open mailbox file. If the call fails, the delivery process
36981 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
36982 Non-blocking calls are used so that the file is not kept open during the wait
36983 for the lock; the reason for this is to make it as safe as possible for
36984 deliveries over NFS in the case when processes might be accessing an NFS
36985 mailbox without using a lock file. This should not be done, but
36986 misunderstandings and hence misconfigurations are not unknown.
36987 </para>
36988 <para>
36989 On a busy system, however, the performance of a non-blocking lock approach is
36990 not as good as using a blocking lock with a timeout. In this case, the waiting
36991 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
36992 and can proceed as soon as the previous lock holder releases it.
36993 </para>
36994 <para>
36995 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
36996 timeout, are used. There may still be some retrying: the maximum number of
36997 retries is
36998 </para>
36999 <literallayout class="monospaced">
37000 (lock_retries * lock_interval) / lock_fcntl_timeout
37001 </literallayout>
37002 <para>
37003 rounded up to the next whole number. In other words, the total time during
37004 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
37005 <option>lock_fcntl_timeout</option> is set very large.
37006 </para>
37007 <para>
37008 You should consider setting this option if you are getting a lot of delayed
37009 local deliveries because of errors of the form
37010 </para>
37011 <literallayout class="monospaced">
37012 failed to lock mailbox /some/file (fcntl)
37013 </literallayout>
37014 <para>
37015 <indexterm role="option">
37016 <primary><option>lock_flock_timeout</option></primary>
37017 </indexterm>
37018 </para>
37019 <informaltable frame="all">
37020 <tgroup cols="4" colsep="0" rowsep="0">
37021 <colspec colwidth="8*" align="left"/>
37022 <colspec colwidth="6*" align="center"/>
37023 <colspec colwidth="6*" align="center"/>
37024 <colspec colwidth="6*" align="right"/>
37025 <tbody>
37026 <row>
37027 <entry><option>lock_flock_timeout</option></entry>
37028 <entry>Use: <emphasis>appendfile</emphasis></entry>
37029 <entry>Type: <emphasis>time</emphasis></entry>
37030 <entry>Default: <emphasis>0s</emphasis></entry>
37031 </row>
37032 </tbody>
37033 </tgroup>
37034 </informaltable>
37035 <para>
37036 This timeout applies to file locking when using <function>flock()</function> (see
37037 <option>use_flock</option>); the timeout operates in a similar manner to
37038 <option>lock_fcntl_timeout</option>.
37039 </para>
37040 <para>
37041 <indexterm role="option">
37042 <primary><option>lock_interval</option></primary>
37043 </indexterm>
37044 </para>
37045 <informaltable frame="all">
37046 <tgroup cols="4" colsep="0" rowsep="0">
37047 <colspec colwidth="8*" align="left"/>
37048 <colspec colwidth="6*" align="center"/>
37049 <colspec colwidth="6*" align="center"/>
37050 <colspec colwidth="6*" align="right"/>
37051 <tbody>
37052 <row>
37053 <entry><option>lock_interval</option></entry>
37054 <entry>Use: <emphasis>appendfile</emphasis></entry>
37055 <entry>Type: <emphasis>time</emphasis></entry>
37056 <entry>Default: <emphasis>3s</emphasis></entry>
37057 </row>
37058 </tbody>
37059 </tgroup>
37060 </informaltable>
37061 <para>
37062 This specifies the time to wait between attempts to lock the file. See below
37063 for details of locking.
37064 </para>
37065 <para>
37066 <indexterm role="option">
37067 <primary><option>lock_retries</option></primary>
37068 </indexterm>
37069 </para>
37070 <informaltable frame="all">
37071 <tgroup cols="4" colsep="0" rowsep="0">
37072 <colspec colwidth="8*" align="left"/>
37073 <colspec colwidth="6*" align="center"/>
37074 <colspec colwidth="6*" align="center"/>
37075 <colspec colwidth="6*" align="right"/>
37076 <tbody>
37077 <row>
37078 <entry><option>lock_retries</option></entry>
37079 <entry>Use: <emphasis>appendfile</emphasis></entry>
37080 <entry>Type: <emphasis>integer</emphasis></entry>
37081 <entry>Default: <emphasis>10</emphasis></entry>
37082 </row>
37083 </tbody>
37084 </tgroup>
37085 </informaltable>
37086 <para>
37087 This specifies the maximum number of attempts to lock the file. A value of zero
37088 is treated as 1. See below for details of locking.
37089 </para>
37090 <para>
37091 <indexterm role="option">
37092 <primary><option>lockfile_mode</option></primary>
37093 </indexterm>
37094 </para>
37095 <informaltable frame="all">
37096 <tgroup cols="4" colsep="0" rowsep="0">
37097 <colspec colwidth="8*" align="left"/>
37098 <colspec colwidth="6*" align="center"/>
37099 <colspec colwidth="6*" align="center"/>
37100 <colspec colwidth="6*" align="right"/>
37101 <tbody>
37102 <row>
37103 <entry><option>lockfile_mode</option></entry>
37104 <entry>Use: <emphasis>appendfile</emphasis></entry>
37105 <entry>Type: <emphasis>octal integer</emphasis></entry>
37106 <entry>Default: <emphasis>0600</emphasis></entry>
37107 </row>
37108 </tbody>
37109 </tgroup>
37110 </informaltable>
37111 <para>
37112 This specifies the mode of the created lock file, when a lock file is being
37113 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
37114 </para>
37115 <para>
37116 <indexterm role="option">
37117 <primary><option>lockfile_timeout</option></primary>
37118 </indexterm>
37119 </para>
37120 <informaltable frame="all">
37121 <tgroup cols="4" colsep="0" rowsep="0">
37122 <colspec colwidth="8*" align="left"/>
37123 <colspec colwidth="6*" align="center"/>
37124 <colspec colwidth="6*" align="center"/>
37125 <colspec colwidth="6*" align="right"/>
37126 <tbody>
37127 <row>
37128 <entry><option>lockfile_timeout</option></entry>
37129 <entry>Use: <emphasis>appendfile</emphasis></entry>
37130 <entry>Type: <emphasis>time</emphasis></entry>
37131 <entry>Default: <emphasis>30m</emphasis></entry>
37132 </row>
37133 </tbody>
37134 </tgroup>
37135 </informaltable>
37136 <para>
37137 <indexterm role="concept">
37138 <primary>timeout</primary>
37139 <secondary>mailbox locking</secondary>
37140 </indexterm>
37141 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
37142 exists and is older than this value, it is assumed to have been left behind by
37143 accident, and Exim attempts to remove it.
37144 </para>
37145 <para>
37146 <indexterm role="option">
37147 <primary><option>mailbox_filecount</option></primary>
37148 </indexterm>
37149 </para>
37150 <informaltable frame="all">
37151 <tgroup cols="4" colsep="0" rowsep="0">
37152 <colspec colwidth="8*" align="left"/>
37153 <colspec colwidth="6*" align="center"/>
37154 <colspec colwidth="6*" align="center"/>
37155 <colspec colwidth="6*" align="right"/>
37156 <tbody>
37157 <row>
37158 <entry><option>mailbox_filecount</option></entry>
37159 <entry>Use: <emphasis>appendfile</emphasis></entry>
37160 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37161 <entry>Default: <emphasis>unset</emphasis></entry>
37162 </row>
37163 </tbody>
37164 </tgroup>
37165 </informaltable>
37166 <para>
37167 <indexterm role="concept">
37168 <primary>mailbox</primary>
37169 <secondary>specifying size of</secondary>
37170 </indexterm>
37171 <indexterm role="concept">
37172 <primary>size</primary>
37173 <secondary>of mailbox</secondary>
37174 </indexterm>
37175 If this option is set, it is expanded, and the result is taken as the current
37176 number of files in the mailbox. It must be a decimal number, optionally
37177 followed by K or M. This provides a way of obtaining this information from an
37178 external source that maintains the data.
37179 </para>
37180 <para>
37181 <indexterm role="option">
37182 <primary><option>mailbox_size</option></primary>
37183 </indexterm>
37184 </para>
37185 <informaltable frame="all">
37186 <tgroup cols="4" colsep="0" rowsep="0">
37187 <colspec colwidth="8*" align="left"/>
37188 <colspec colwidth="6*" align="center"/>
37189 <colspec colwidth="6*" align="center"/>
37190 <colspec colwidth="6*" align="right"/>
37191 <tbody>
37192 <row>
37193 <entry><option>mailbox_size</option></entry>
37194 <entry>Use: <emphasis>appendfile</emphasis></entry>
37195 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37196 <entry>Default: <emphasis>unset</emphasis></entry>
37197 </row>
37198 </tbody>
37199 </tgroup>
37200 </informaltable>
37201 <para>
37202 <indexterm role="concept">
37203 <primary>mailbox</primary>
37204 <secondary>specifying size of</secondary>
37205 </indexterm>
37206 <indexterm role="concept">
37207 <primary>size</primary>
37208 <secondary>of mailbox</secondary>
37209 </indexterm>
37210 If this option is set, it is expanded, and the result is taken as the current
37211 size the mailbox. It must be a decimal number, optionally followed by K or M.
37212 This provides a way of obtaining this information from an external source that
37213 maintains the data. This is likely to be helpful for maildir deliveries where
37214 it is computationally expensive to compute the size of a mailbox.
37215 </para>
37216 <para>
37217 <indexterm role="option">
37218 <primary><option>maildir_format</option></primary>
37219 </indexterm>
37220 </para>
37221 <informaltable frame="all">
37222 <tgroup cols="4" colsep="0" rowsep="0">
37223 <colspec colwidth="8*" align="left"/>
37224 <colspec colwidth="6*" align="center"/>
37225 <colspec colwidth="6*" align="center"/>
37226 <colspec colwidth="6*" align="right"/>
37227 <tbody>
37228 <row>
37229 <entry><option>maildir_format</option></entry>
37230 <entry>Use: <emphasis>appendfile</emphasis></entry>
37231 <entry>Type: <emphasis>boolean</emphasis></entry>
37232 <entry>Default: <emphasis>false</emphasis></entry>
37233 </row>
37234 </tbody>
37235 </tgroup>
37236 </informaltable>
37237 <para>
37238 <indexterm role="concept">
37239 <primary>maildir format</primary>
37240 <secondary>specifying</secondary>
37241 </indexterm>
37242 If this option is set with the <option>directory</option> option, the delivery is into a new
37243 file, in the <quote>maildir</quote> format that is used by other mail software. When the
37244 transport is activated directly from a <command>redirect</command> router (for example, the
37245 <command>address_file</command> transport in the default configuration), setting
37246 <option>maildir_format</option> causes the path received from the router to be treated as a
37247 directory, whether or not it ends with <literal>/</literal>. This option is available only if
37248 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
37249 <xref linkend="SECTmaildirdelivery"/> below for further details.
37250 </para>
37251 <para>
37252 <indexterm role="option">
37253 <primary><option>maildir_quota_directory_regex</option></primary>
37254 </indexterm>
37255 </para>
37256 <informaltable frame="all">
37257 <tgroup cols="4" colsep="0" rowsep="0">
37258 <colspec colwidth="8*" align="left"/>
37259 <colspec colwidth="6*" align="center"/>
37260 <colspec colwidth="6*" align="center"/>
37261 <colspec colwidth="6*" align="right"/>
37262 <tbody>
37263 <row>
37264 <entry><option>maildir_quota_directory_regex</option></entry>
37265 <entry>Use: <emphasis>appendfile</emphasis></entry>
37266 <entry>Type: <emphasis>string</emphasis></entry>
37267 <entry>Default: <emphasis>See below</emphasis></entry>
37268 </row>
37269 </tbody>
37270 </tgroup>
37271 </informaltable>
37272 <para>
37273 <indexterm role="concept">
37274 <primary>maildir format</primary>
37275 <secondary>quota; directories included in</secondary>
37276 </indexterm>
37277 <indexterm role="concept">
37278 <primary>quota</primary>
37279 <secondary>maildir; directories included in</secondary>
37280 </indexterm>
37281 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
37282 a regular expression for specifying directories, relative to the quota
37283 directory (see <option>quota_directory</option>), that should be included in the quota
37284 calculation. The default value is:
37285 </para>
37286 <literallayout class="monospaced">
37287 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
37288 </literallayout>
37289 <para>
37290 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
37291 (directories whose names begin with a dot). If you want to exclude the
37292 <filename>Trash</filename>
37293 folder from the count (as some sites do), you need to change this setting to
37294 </para>
37295 <literallayout class="monospaced">
37296 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
37297 </literallayout>
37298 <para>
37299 This uses a negative lookahead in the regular expression to exclude the
37300 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
37301 calculations, quota processing is bypassed for any messages that are delivered
37302 directly into that directory.
37303 </para>
37304 <para>
37305 <indexterm role="option">
37306 <primary><option>maildir_retries</option></primary>
37307 </indexterm>
37308 </para>
37309 <informaltable frame="all">
37310 <tgroup cols="4" colsep="0" rowsep="0">
37311 <colspec colwidth="8*" align="left"/>
37312 <colspec colwidth="6*" align="center"/>
37313 <colspec colwidth="6*" align="center"/>
37314 <colspec colwidth="6*" align="right"/>
37315 <tbody>
37316 <row>
37317 <entry><option>maildir_retries</option></entry>
37318 <entry>Use: <emphasis>appendfile</emphasis></entry>
37319 <entry>Type: <emphasis>integer</emphasis></entry>
37320 <entry>Default: <emphasis>10</emphasis></entry>
37321 </row>
37322 </tbody>
37323 </tgroup>
37324 </informaltable>
37325 <para>
37326 This option specifies the number of times to retry when writing a file in
37327 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
37328 </para>
37329 <para>
37330 <indexterm role="option">
37331 <primary><option>maildir_tag</option></primary>
37332 </indexterm>
37333 </para>
37334 <informaltable frame="all">
37335 <tgroup cols="4" colsep="0" rowsep="0">
37336 <colspec colwidth="8*" align="left"/>
37337 <colspec colwidth="6*" align="center"/>
37338 <colspec colwidth="6*" align="center"/>
37339 <colspec colwidth="6*" align="right"/>
37340 <tbody>
37341 <row>
37342 <entry><option>maildir_tag</option></entry>
37343 <entry>Use: <emphasis>appendfile</emphasis></entry>
37344 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37345 <entry>Default: <emphasis>unset</emphasis></entry>
37346 </row>
37347 </tbody>
37348 </tgroup>
37349 </informaltable>
37350 <para>
37351 This option applies only to deliveries in maildir format, and is described in
37352 section <xref linkend="SECTmaildirdelivery"/> below.
37353 </para>
37354 <para>
37355 <indexterm role="option">
37356 <primary><option>maildir_use_size_file</option></primary>
37357 </indexterm>
37358 </para>
37359 <informaltable frame="all">
37360 <tgroup cols="4" colsep="0" rowsep="0">
37361 <colspec colwidth="8*" align="left"/>
37362 <colspec colwidth="6*" align="center"/>
37363 <colspec colwidth="6*" align="center"/>
37364 <colspec colwidth="6*" align="right"/>
37365 <tbody>
37366 <row>
37367 <entry><option>maildir_use_size_file</option></entry>
37368 <entry>Use: <emphasis>appendfile</emphasis></entry>
37369 <entry>Type: <emphasis>boolean</emphasis></entry>
37370 <entry>Default: <emphasis>false</emphasis></entry>
37371 </row>
37372 </tbody>
37373 </tgroup>
37374 </informaltable>
37375 <para>
37376 <indexterm role="concept">
37377 <primary>maildir format</primary>
37378 <secondary><filename>maildirsize</filename> file</secondary>
37379 </indexterm>
37380 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
37381 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
37382 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
37383 value is zero. See <option>maildir_quota_directory_regex</option> above and section
37384 <xref linkend="SECTmaildirdelivery"/> below for further details.
37385 </para>
37386 <para>
37387 <indexterm role="option">
37388 <primary><option>maildirfolder_create_regex</option></primary>
37389 </indexterm>
37390 </para>
37391 <informaltable frame="all">
37392 <tgroup cols="4" colsep="0" rowsep="0">
37393 <colspec colwidth="8*" align="left"/>
37394 <colspec colwidth="6*" align="center"/>
37395 <colspec colwidth="6*" align="center"/>
37396 <colspec colwidth="6*" align="right"/>
37397 <tbody>
37398 <row>
37399 <entry><option>maildirfolder_create_regex</option></entry>
37400 <entry>Use: <emphasis>appendfile</emphasis></entry>
37401 <entry>Type: <emphasis>string</emphasis></entry>
37402 <entry>Default: <emphasis>unset</emphasis></entry>
37403 </row>
37404 </tbody>
37405 </tgroup>
37406 </informaltable>
37407 <para>
37408 <indexterm role="concept">
37409 <primary>maildir format</primary>
37410 <secondary><filename>maildirfolder</filename> file</secondary>
37411 </indexterm>
37412 <indexterm role="concept">
37413 <primary><filename>maildirfolder</filename>, creating</primary>
37414 </indexterm>
37415 The value of this option is a regular expression. If it is unset, it has no
37416 effect. Otherwise, before a maildir delivery takes place, the pattern is
37417 matched against the name of the maildir directory, that is, the directory
37418 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
37419 delivery. If there is a match, Exim checks for the existence of a file called
37420 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
37421 See section <xref linkend="SECTmaildirdelivery"/> for more details.
37422 </para>
37423 <para>
37424 <indexterm role="option">
37425 <primary><option>mailstore_format</option></primary>
37426 </indexterm>
37427 </para>
37428 <informaltable frame="all">
37429 <tgroup cols="4" colsep="0" rowsep="0">
37430 <colspec colwidth="8*" align="left"/>
37431 <colspec colwidth="6*" align="center"/>
37432 <colspec colwidth="6*" align="center"/>
37433 <colspec colwidth="6*" align="right"/>
37434 <tbody>
37435 <row>
37436 <entry><option>mailstore_format</option></entry>
37437 <entry>Use: <emphasis>appendfile</emphasis></entry>
37438 <entry>Type: <emphasis>boolean</emphasis></entry>
37439 <entry>Default: <emphasis>false</emphasis></entry>
37440 </row>
37441 </tbody>
37442 </tgroup>
37443 </informaltable>
37444 <para>
37445 <indexterm role="concept">
37446 <primary>mailstore format</primary>
37447 <secondary>specifying</secondary>
37448 </indexterm>
37449 If this option is set with the <option>directory</option> option, the delivery is into two
37450 new files in  <quote>mailstore</quote> format. The option is available only if
37451 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
37452 below for further details.
37453 </para>
37454 <para>
37455 <indexterm role="option">
37456 <primary><option>mailstore_prefix</option></primary>
37457 </indexterm>
37458 </para>
37459 <informaltable frame="all">
37460 <tgroup cols="4" colsep="0" rowsep="0">
37461 <colspec colwidth="8*" align="left"/>
37462 <colspec colwidth="6*" align="center"/>
37463 <colspec colwidth="6*" align="center"/>
37464 <colspec colwidth="6*" align="right"/>
37465 <tbody>
37466 <row>
37467 <entry><option>mailstore_prefix</option></entry>
37468 <entry>Use: <emphasis>appendfile</emphasis></entry>
37469 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37470 <entry>Default: <emphasis>unset</emphasis></entry>
37471 </row>
37472 </tbody>
37473 </tgroup>
37474 </informaltable>
37475 <para>
37476 This option applies only to deliveries in mailstore format, and is described in
37477 section <xref linkend="SECTopdir"/> below.
37478 </para>
37479 <para>
37480 <indexterm role="option">
37481 <primary><option>mailstore_suffix</option></primary>
37482 </indexterm>
37483 </para>
37484 <informaltable frame="all">
37485 <tgroup cols="4" colsep="0" rowsep="0">
37486 <colspec colwidth="8*" align="left"/>
37487 <colspec colwidth="6*" align="center"/>
37488 <colspec colwidth="6*" align="center"/>
37489 <colspec colwidth="6*" align="right"/>
37490 <tbody>
37491 <row>
37492 <entry><option>mailstore_suffix</option></entry>
37493 <entry>Use: <emphasis>appendfile</emphasis></entry>
37494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37495 <entry>Default: <emphasis>unset</emphasis></entry>
37496 </row>
37497 </tbody>
37498 </tgroup>
37499 </informaltable>
37500 <para>
37501 This option applies only to deliveries in mailstore format, and is described in
37502 section <xref linkend="SECTopdir"/> below.
37503 </para>
37504 <para>
37505 <indexterm role="option">
37506 <primary><option>mbx_format</option></primary>
37507 </indexterm>
37508 </para>
37509 <informaltable frame="all">
37510 <tgroup cols="4" colsep="0" rowsep="0">
37511 <colspec colwidth="8*" align="left"/>
37512 <colspec colwidth="6*" align="center"/>
37513 <colspec colwidth="6*" align="center"/>
37514 <colspec colwidth="6*" align="right"/>
37515 <tbody>
37516 <row>
37517 <entry><option>mbx_format</option></entry>
37518 <entry>Use: <emphasis>appendfile</emphasis></entry>
37519 <entry>Type: <emphasis>boolean</emphasis></entry>
37520 <entry>Default: <emphasis>false</emphasis></entry>
37521 </row>
37522 </tbody>
37523 </tgroup>
37524 </informaltable>
37525 <para>
37526 <indexterm role="concept">
37527 <primary>locking files</primary>
37528 </indexterm>
37529 <indexterm role="concept">
37530 <primary>file</primary>
37531 <secondary>locking</secondary>
37532 </indexterm>
37533 <indexterm role="concept">
37534 <primary>file</primary>
37535 <secondary>MBX format</secondary>
37536 </indexterm>
37537 <indexterm role="concept">
37538 <primary>MBX format, specifying</primary>
37539 </indexterm>
37540 This option is available only if Exim has been compiled with SUPPORT_MBX
37541 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
37542 the message is appended to the mailbox file in MBX format instead of
37543 traditional Unix format. This format is supported by Pine4 and its associated
37544 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
37545 </para>
37546 <para>
37547 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
37548 automatically changed by the use of <option>mbx_format</option>. They should normally be set
37549 empty when using MBX format, so this option almost always appears in this
37550 combination:
37551 </para>
37552 <literallayout class="monospaced">
37553 mbx_format = true
37554 message_prefix =
37555 message_suffix =
37556 </literallayout>
37557 <para>
37558 If none of the locking options are mentioned in the configuration,
37559 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
37560 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
37561 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
37562 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
37563 should not be used if any program that does not use this form of locking is
37564 going to access the mailbox, nor should it be used if the mailbox file is NFS
37565 mounted, because it works only when the mailbox is accessed from a single host.
37566 </para>
37567 <para>
37568 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
37569 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
37570 (this means for the whole of a Pine or IMAP session), Exim will not be able to
37571 append messages to it.
37572 </para>
37573 <para>
37574 <indexterm role="option">
37575 <primary><option>message_prefix</option></primary>
37576 </indexterm>
37577 </para>
37578 <informaltable frame="all">
37579 <tgroup cols="4" colsep="0" rowsep="0">
37580 <colspec colwidth="8*" align="left"/>
37581 <colspec colwidth="6*" align="center"/>
37582 <colspec colwidth="6*" align="center"/>
37583 <colspec colwidth="6*" align="right"/>
37584 <tbody>
37585 <row>
37586 <entry><option>message_prefix</option></entry>
37587 <entry>Use: <emphasis>appendfile</emphasis></entry>
37588 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37589 <entry>Default: <emphasis>see below</emphasis></entry>
37590 </row>
37591 </tbody>
37592 </tgroup>
37593 </informaltable>
37594 <para>
37595 <indexterm role="concept">
37596 <primary><quote>From</quote> line</primary>
37597 </indexterm>
37598 The string specified here is expanded and output at the start of every message.
37599 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
37600 in which case it is:
37601 </para>
37602 <literallayout class="monospaced">
37603 message_prefix = "From ${if def:return_path{$return_path}\
37604   {MAILER-DAEMON}} $tod_bsdinbox\n"
37605 </literallayout>
37606 <para>
37607 <indexterm role="option">
37608 <primary><option>message_suffix</option></primary>
37609 </indexterm>
37610 </para>
37611 <informaltable frame="all">
37612 <tgroup cols="4" colsep="0" rowsep="0">
37613 <colspec colwidth="8*" align="left"/>
37614 <colspec colwidth="6*" align="center"/>
37615 <colspec colwidth="6*" align="center"/>
37616 <colspec colwidth="6*" align="right"/>
37617 <tbody>
37618 <row>
37619 <entry><option>message_suffix</option></entry>
37620 <entry>Use: <emphasis>appendfile</emphasis></entry>
37621 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37622 <entry>Default: <emphasis>see below</emphasis></entry>
37623 </row>
37624 </tbody>
37625 </tgroup>
37626 </informaltable>
37627 <para>
37628 The string specified here is expanded and output at the end of every message.
37629 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
37630 in which case it is a single newline character. The suffix can be suppressed by
37631 setting
37632 </para>
37633 <literallayout class="monospaced">
37634 message_suffix =
37635 </literallayout>
37636 <para>
37637 <indexterm role="option">
37638 <primary><option>mode</option></primary>
37639 </indexterm>
37640 </para>
37641 <informaltable frame="all">
37642 <tgroup cols="4" colsep="0" rowsep="0">
37643 <colspec colwidth="8*" align="left"/>
37644 <colspec colwidth="6*" align="center"/>
37645 <colspec colwidth="6*" align="center"/>
37646 <colspec colwidth="6*" align="right"/>
37647 <tbody>
37648 <row>
37649 <entry><option>mode</option></entry>
37650 <entry>Use: <emphasis>appendfile</emphasis></entry>
37651 <entry>Type: <emphasis>octal integer</emphasis></entry>
37652 <entry>Default: <emphasis>0600</emphasis></entry>
37653 </row>
37654 </tbody>
37655 </tgroup>
37656 </informaltable>
37657 <para>
37658 If the output file is created, it is given this mode. If it already exists and
37659 has wider permissions, they are reduced to this mode. If it has narrower
37660 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
37661 if the delivery is the result of a <option>save</option> command in a filter file specifying
37662 a particular mode, the mode of the output file is always forced to take that
37663 value, and this option is ignored.
37664 </para>
37665 <para>
37666 <indexterm role="option">
37667 <primary><option>mode_fail_narrower</option></primary>
37668 </indexterm>
37669 </para>
37670 <informaltable frame="all">
37671 <tgroup cols="4" colsep="0" rowsep="0">
37672 <colspec colwidth="8*" align="left"/>
37673 <colspec colwidth="6*" align="center"/>
37674 <colspec colwidth="6*" align="center"/>
37675 <colspec colwidth="6*" align="right"/>
37676 <tbody>
37677 <row>
37678 <entry><option>mode_fail_narrower</option></entry>
37679 <entry>Use: <emphasis>appendfile</emphasis></entry>
37680 <entry>Type: <emphasis>boolean</emphasis></entry>
37681 <entry>Default: <emphasis>true</emphasis></entry>
37682 </row>
37683 </tbody>
37684 </tgroup>
37685 </informaltable>
37686 <para>
37687 This option applies in the case when an existing mailbox file has a narrower
37688 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
37689 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
37690 continues with the delivery attempt, using the existing mode of the file.
37691 </para>
37692 <para>
37693 <indexterm role="option">
37694 <primary><option>notify_comsat</option></primary>
37695 </indexterm>
37696 </para>
37697 <informaltable frame="all">
37698 <tgroup cols="4" colsep="0" rowsep="0">
37699 <colspec colwidth="8*" align="left"/>
37700 <colspec colwidth="6*" align="center"/>
37701 <colspec colwidth="6*" align="center"/>
37702 <colspec colwidth="6*" align="right"/>
37703 <tbody>
37704 <row>
37705 <entry><option>notify_comsat</option></entry>
37706 <entry>Use: <emphasis>appendfile</emphasis></entry>
37707 <entry>Type: <emphasis>boolean</emphasis></entry>
37708 <entry>Default: <emphasis>false</emphasis></entry>
37709 </row>
37710 </tbody>
37711 </tgroup>
37712 </informaltable>
37713 <para>
37714 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
37715 successful delivery to a user mailbox. This is the daemon that notifies logged
37716 on users about incoming mail.
37717 </para>
37718 <para>
37719 <indexterm role="option">
37720 <primary><option>quota</option></primary>
37721 </indexterm>
37722 </para>
37723 <informaltable frame="all">
37724 <tgroup cols="4" colsep="0" rowsep="0">
37725 <colspec colwidth="8*" align="left"/>
37726 <colspec colwidth="6*" align="center"/>
37727 <colspec colwidth="6*" align="center"/>
37728 <colspec colwidth="6*" align="right"/>
37729 <tbody>
37730 <row>
37731 <entry><option>quota</option></entry>
37732 <entry>Use: <emphasis>appendfile</emphasis></entry>
37733 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37734 <entry>Default: <emphasis>unset</emphasis></entry>
37735 </row>
37736 </tbody>
37737 </tgroup>
37738 </informaltable>
37739 <para>
37740 <indexterm role="concept">
37741 <primary>quota</primary>
37742 <secondary>imposed by Exim</secondary>
37743 </indexterm>
37744 This option imposes a limit on the size of the file to which Exim is appending,
37745 or to the total space used in the directory tree when the <option>directory</option> option
37746 is set. In the latter case, computation of the space used is expensive, because
37747 all the files in the directory (and any sub-directories) have to be
37748 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
37749 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
37750 have no shell access to their mailboxes).
37751 </para>
37752 <para>
37753 As there is no interlock against two simultaneous deliveries into a
37754 multi-file mailbox, it is possible for the quota to be overrun in this case.
37755 For single-file mailboxes, of course, an interlock is a necessity.
37756 </para>
37757 <para>
37758 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
37759 may be a lot less than the actual amount of disk space allocated to the file.
37760 If the sizes of a number of files are being added up, the rounding effect can
37761 become quite noticeable, especially on systems that have large block sizes.
37762 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
37763 the obvious value which users understand most easily.
37764 </para>
37765 <para>
37766 The value of the option is expanded, and must then be a numerical value
37767 (decimal point allowed), optionally followed by one of the letters K, M, or G,
37768 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
37769 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
37770 be handled.
37771 </para>
37772 <para>
37773 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
37774 </para>
37775 <para>
37776 The expansion happens while Exim is running as root, before it changes uid for
37777 the delivery. This means that files that are inaccessible to the end user can
37778 be used to hold quota values that are looked up in the expansion. When delivery
37779 fails because this quota is exceeded, the handling of the error is as for
37780 system quota failures.
37781 </para>
37782 <para>
37783 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
37784 mailbox to the specified maximum size, though the value is not accurate to the
37785 last byte, owing to separator lines and additional headers that may get added
37786 during message delivery. When a mailbox is nearly full, large messages may get
37787 refused even though small ones are accepted, because the size of the current
37788 message is added to the quota when the check is made. This behaviour can be
37789 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
37790 for exceeding the quota does not include the current message. Thus, deliveries
37791 continue until the quota has been exceeded; thereafter, no further messages are
37792 delivered. See also <option>quota_warn_threshold</option>.
37793 </para>
37794 <para>
37795 <indexterm role="option">
37796 <primary><option>quota_directory</option></primary>
37797 </indexterm>
37798 </para>
37799 <informaltable frame="all">
37800 <tgroup cols="4" colsep="0" rowsep="0">
37801 <colspec colwidth="8*" align="left"/>
37802 <colspec colwidth="6*" align="center"/>
37803 <colspec colwidth="6*" align="center"/>
37804 <colspec colwidth="6*" align="right"/>
37805 <tbody>
37806 <row>
37807 <entry><option>quota_directory</option></entry>
37808 <entry>Use: <emphasis>appendfile</emphasis></entry>
37809 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37810 <entry>Default: <emphasis>unset</emphasis></entry>
37811 </row>
37812 </tbody>
37813 </tgroup>
37814 </informaltable>
37815 <para>
37816 This option defines the directory to check for quota purposes when delivering
37817 into individual files. The default is the delivery directory, or, if a file
37818 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
37819 delivery directory.
37820 </para>
37821 <para>
37822 <indexterm role="option">
37823 <primary><option>quota_filecount</option></primary>
37824 </indexterm>
37825 </para>
37826 <informaltable frame="all">
37827 <tgroup cols="4" colsep="0" rowsep="0">
37828 <colspec colwidth="8*" align="left"/>
37829 <colspec colwidth="6*" align="center"/>
37830 <colspec colwidth="6*" align="center"/>
37831 <colspec colwidth="6*" align="right"/>
37832 <tbody>
37833 <row>
37834 <entry><option>quota_filecount</option></entry>
37835 <entry>Use: <emphasis>appendfile</emphasis></entry>
37836 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37837 <entry>Default: <emphasis>0</emphasis></entry>
37838 </row>
37839 </tbody>
37840 </tgroup>
37841 </informaltable>
37842 <para>
37843 This option applies when the <option>directory</option> option is set. It limits the total
37844 number of files in the directory (compare the inode limit in system quotas). It
37845 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
37846 failure causes delivery to be deferred. A value of zero is interpreted as
37847 <quote>no quota</quote>.
37848 </para>
37849 <para>
37850 <indexterm role="option">
37851 <primary><option>quota_is_inclusive</option></primary>
37852 </indexterm>
37853 </para>
37854 <informaltable frame="all">
37855 <tgroup cols="4" colsep="0" rowsep="0">
37856 <colspec colwidth="8*" align="left"/>
37857 <colspec colwidth="6*" align="center"/>
37858 <colspec colwidth="6*" align="center"/>
37859 <colspec colwidth="6*" align="right"/>
37860 <tbody>
37861 <row>
37862 <entry><option>quota_is_inclusive</option></entry>
37863 <entry>Use: <emphasis>appendfile</emphasis></entry>
37864 <entry>Type: <emphasis>boolean</emphasis></entry>
37865 <entry>Default: <emphasis>true</emphasis></entry>
37866 </row>
37867 </tbody>
37868 </tgroup>
37869 </informaltable>
37870 <para>
37871 See <option>quota</option> above.
37872 </para>
37873 <para>
37874 <indexterm role="option">
37875 <primary><option>quota_size_regex</option></primary>
37876 </indexterm>
37877 </para>
37878 <informaltable frame="all">
37879 <tgroup cols="4" colsep="0" rowsep="0">
37880 <colspec colwidth="8*" align="left"/>
37881 <colspec colwidth="6*" align="center"/>
37882 <colspec colwidth="6*" align="center"/>
37883 <colspec colwidth="6*" align="right"/>
37884 <tbody>
37885 <row>
37886 <entry><option>quota_size_regex</option></entry>
37887 <entry>Use: <emphasis>appendfile</emphasis></entry>
37888 <entry>Type: <emphasis>string</emphasis></entry>
37889 <entry>Default: <emphasis>unset</emphasis></entry>
37890 </row>
37891 </tbody>
37892 </tgroup>
37893 </informaltable>
37894 <para>
37895 This option applies when one of the delivery modes that writes a separate file
37896 for each message is being used. When Exim wants to find the size of one of
37897 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
37898 If this is set to a regular expression that matches the file name, and it
37899 captures one string, that string is interpreted as a representation of the
37900 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
37901 </para>
37902 <para>
37903 This feature is useful only when users have no shell access to their mailboxes
37904 &ndash; otherwise they could defeat the quota simply by renaming the files. This
37905 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
37906 the file length to the file name. For example:
37907 </para>
37908 <literallayout class="monospaced">
37909 maildir_tag = ,S=$message_size
37910 quota_size_regex = ,S=(\d+)
37911 </literallayout>
37912 <para>
37913 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
37914 number of lines in the message.
37915 </para>
37916 <para>
37917 The regular expression should not assume that the length is at the end of the
37918 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
37919 sometimes add other information onto the ends of message file names.
37920 </para>
37921 <para>
37922 <indexterm role="option">
37923 <primary><option>quota_warn_message</option></primary>
37924 </indexterm>
37925 </para>
37926 <informaltable frame="all">
37927 <tgroup cols="4" colsep="0" rowsep="0">
37928 <colspec colwidth="8*" align="left"/>
37929 <colspec colwidth="6*" align="center"/>
37930 <colspec colwidth="6*" align="center"/>
37931 <colspec colwidth="6*" align="right"/>
37932 <tbody>
37933 <row>
37934 <entry><option>quota_warn_message</option></entry>
37935 <entry>Use: <emphasis>appendfile</emphasis></entry>
37936 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37937 <entry>Default: <emphasis>see below</emphasis></entry>
37938 </row>
37939 </tbody>
37940 </tgroup>
37941 </informaltable>
37942 <para>
37943 See below for the use of this option. If it is not set when
37944 <option>quota_warn_threshold</option> is set, it defaults to
37945 </para>
37946 <literallayout class="monospaced">
37947 quota_warn_message = "\
37948   To: $local_part@$domain\n\
37949   Subject: Your mailbox\n\n\
37950   This message is automatically created \
37951   by mail delivery software.\n\n\
37952   The size of your mailbox has exceeded \
37953   a warning threshold that is\n\
37954   set by the system administrator.\n"
37955 </literallayout>
37956 <para>
37957 <indexterm role="option">
37958 <primary><option>quota_warn_threshold</option></primary>
37959 </indexterm>
37960 </para>
37961 <informaltable frame="all">
37962 <tgroup cols="4" colsep="0" rowsep="0">
37963 <colspec colwidth="8*" align="left"/>
37964 <colspec colwidth="6*" align="center"/>
37965 <colspec colwidth="6*" align="center"/>
37966 <colspec colwidth="6*" align="right"/>
37967 <tbody>
37968 <row>
37969 <entry><option>quota_warn_threshold</option></entry>
37970 <entry>Use: <emphasis>appendfile</emphasis></entry>
37971 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37972 <entry>Default: <emphasis>0</emphasis></entry>
37973 </row>
37974 </tbody>
37975 </tgroup>
37976 </informaltable>
37977 <para>
37978 <indexterm role="concept">
37979 <primary>quota</primary>
37980 <secondary>warning threshold</secondary>
37981 </indexterm>
37982 <indexterm role="concept">
37983 <primary>mailbox</primary>
37984 <secondary>size warning</secondary>
37985 </indexterm>
37986 <indexterm role="concept">
37987 <primary>size</primary>
37988 <secondary>of mailbox</secondary>
37989 </indexterm>
37990 This option is expanded in the same way as <option>quota</option> (see above). If the
37991 resulting value is greater than zero, and delivery of the message causes the
37992 size of the file or total space in the directory tree to cross the given
37993 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
37994 may be specified as a percentage of it by following the value with a percent
37995 sign. For example:
37996 </para>
37997 <literallayout class="monospaced">
37998 quota = 10M
37999 quota_warn_threshold = 75%
38000 </literallayout>
38001 <para>
38002 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
38003 percent sign is ignored.
38004 </para>
38005 <para>
38006 The warning message itself is specified by the <option>quota_warn_message</option> option,
38007 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
38008 warning message. These do not necessarily have to include the recipient(s) of
38009 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
38010 can include any other header lines that you want. If you do not include a
38011 <emphasis>From:</emphasis> line, the default is:
38012 </para>
38013 <literallayout class="monospaced">
38014 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
38015 </literallayout>
38016 <para>
38017 <indexterm role="option">
38018 <primary><option>errors_reply_to</option></primary>
38019 </indexterm>
38020 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
38021 option.
38022 </para>
38023 <para>
38024 The <option>quota</option> option does not have to be set in order to use this option; they
38025 are independent of one another except when the threshold is specified as a
38026 percentage.
38027 </para>
38028 <para>
38029 <indexterm role="option">
38030 <primary><option>use_bsmtp</option></primary>
38031 </indexterm>
38032 </para>
38033 <informaltable frame="all">
38034 <tgroup cols="4" colsep="0" rowsep="0">
38035 <colspec colwidth="8*" align="left"/>
38036 <colspec colwidth="6*" align="center"/>
38037 <colspec colwidth="6*" align="center"/>
38038 <colspec colwidth="6*" align="right"/>
38039 <tbody>
38040 <row>
38041 <entry><option>use_bsmtp</option></entry>
38042 <entry>Use: <emphasis>appendfile</emphasis></entry>
38043 <entry>Type: <emphasis>boolean</emphasis></entry>
38044 <entry>Default: <emphasis>false</emphasis></entry>
38045 </row>
38046 </tbody>
38047 </tgroup>
38048 </informaltable>
38049 <para>
38050 <indexterm role="concept">
38051 <primary>envelope sender</primary>
38052 </indexterm>
38053 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
38054 format, with the envelope sender and recipient(s) included as SMTP commands. If
38055 you want to include a leading HELO command with such messages, you can do
38056 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
38057 for details of batch SMTP.
38058 </para>
38059 <para>
38060 <indexterm role="option">
38061 <primary><option>use_crlf</option></primary>
38062 </indexterm>
38063 </para>
38064 <informaltable frame="all">
38065 <tgroup cols="4" colsep="0" rowsep="0">
38066 <colspec colwidth="8*" align="left"/>
38067 <colspec colwidth="6*" align="center"/>
38068 <colspec colwidth="6*" align="center"/>
38069 <colspec colwidth="6*" align="right"/>
38070 <tbody>
38071 <row>
38072 <entry><option>use_crlf</option></entry>
38073 <entry>Use: <emphasis>appendfile</emphasis></entry>
38074 <entry>Type: <emphasis>boolean</emphasis></entry>
38075 <entry>Default: <emphasis>false</emphasis></entry>
38076 </row>
38077 </tbody>
38078 </tgroup>
38079 </informaltable>
38080 <para>
38081 <indexterm role="concept">
38082 <primary>carriage return</primary>
38083 </indexterm>
38084 <indexterm role="concept">
38085 <primary>linefeed</primary>
38086 </indexterm>
38087 This option causes lines to be terminated with the two-character CRLF sequence
38088 (carriage return, linefeed) instead of just a linefeed character. In the case
38089 of batched SMTP, the byte sequence written to the file is then an exact image
38090 of what would be sent down a real SMTP connection.
38091 </para>
38092 <para>
38093 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
38094 written verbatim, so must contain their own carriage return characters if these
38095 are needed. In cases where these options have non-empty defaults, the values
38096 end with a single linefeed, so they must be changed to end with <literal>\r\n</literal> if
38097 <option>use_crlf</option> is set.
38098 </para>
38099 <para>
38100 <indexterm role="option">
38101 <primary><option>use_fcntl_lock</option></primary>
38102 </indexterm>
38103 </para>
38104 <informaltable frame="all">
38105 <tgroup cols="4" colsep="0" rowsep="0">
38106 <colspec colwidth="8*" align="left"/>
38107 <colspec colwidth="6*" align="center"/>
38108 <colspec colwidth="6*" align="center"/>
38109 <colspec colwidth="6*" align="right"/>
38110 <tbody>
38111 <row>
38112 <entry><option>use_fcntl_lock</option></entry>
38113 <entry>Use: <emphasis>appendfile</emphasis></entry>
38114 <entry>Type: <emphasis>boolean</emphasis></entry>
38115 <entry>Default: <emphasis>see below</emphasis></entry>
38116 </row>
38117 </tbody>
38118 </tgroup>
38119 </informaltable>
38120 <para>
38121 This option controls the use of the <function>fcntl()</function> function to lock a file for
38122 exclusive use when a message is being appended. It is set by default unless
38123 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
38124 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
38125 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
38126 </para>
38127 <para>
38128 <indexterm role="option">
38129 <primary><option>use_flock_lock</option></primary>
38130 </indexterm>
38131 </para>
38132 <informaltable frame="all">
38133 <tgroup cols="4" colsep="0" rowsep="0">
38134 <colspec colwidth="8*" align="left"/>
38135 <colspec colwidth="6*" align="center"/>
38136 <colspec colwidth="6*" align="center"/>
38137 <colspec colwidth="6*" align="right"/>
38138 <tbody>
38139 <row>
38140 <entry><option>use_flock_lock</option></entry>
38141 <entry>Use: <emphasis>appendfile</emphasis></entry>
38142 <entry>Type: <emphasis>boolean</emphasis></entry>
38143 <entry>Default: <emphasis>false</emphasis></entry>
38144 </row>
38145 </tbody>
38146 </tgroup>
38147 </informaltable>
38148 <para>
38149 This option is provided to support the use of <function>flock()</function> for file locking, for
38150 the few situations where it is needed. Most modern operating systems support
38151 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
38152 each other. Exim uses <function>fcntl()</function> locking by default.
38153 </para>
38154 <para>
38155 This option is required only if you are using an operating system where
38156 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
38157 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
38158 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
38159 </para>
38160 <para>
38161 <indexterm role="concept">
38162 <primary>Solaris</primary>
38163 <secondary><function>flock()</function> support</secondary>
38164 </indexterm>
38165 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
38166 have it (and some, I think, provide a not quite right version built on top of
38167 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
38168 the ability to use it, and any attempt to do so will cause a configuration
38169 error.
38170 </para>
38171 <para>
38172 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
38173 is just being mapped onto <function>fcntl()</function> by the OS).
38174 </para>
38175 <para>
38176 <indexterm role="option">
38177 <primary><option>use_lockfile</option></primary>
38178 </indexterm>
38179 </para>
38180 <informaltable frame="all">
38181 <tgroup cols="4" colsep="0" rowsep="0">
38182 <colspec colwidth="8*" align="left"/>
38183 <colspec colwidth="6*" align="center"/>
38184 <colspec colwidth="6*" align="center"/>
38185 <colspec colwidth="6*" align="right"/>
38186 <tbody>
38187 <row>
38188 <entry><option>use_lockfile</option></entry>
38189 <entry>Use: <emphasis>appendfile</emphasis></entry>
38190 <entry>Type: <emphasis>boolean</emphasis></entry>
38191 <entry>Default: <emphasis>see below</emphasis></entry>
38192 </row>
38193 </tbody>
38194 </tgroup>
38195 </informaltable>
38196 <para>
38197 If this option is turned off, Exim does not attempt to create a lock file when
38198 appending to a mailbox file. In this situation, the only locking is by
38199 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
38200 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
38201 <function>fcntl()</function> rather than a lock file, and even then only when you are not
38202 delivering over NFS from more than one host.
38203 </para>
38204 <para>
38205 <indexterm role="concept">
38206 <primary>NFS</primary>
38207 <secondary>lock file</secondary>
38208 </indexterm>
38209 In order to append to an NFS file safely from more than one host, it is
38210 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
38211 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
38212 file corruption.
38213 </para>
38214 <para>
38215 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
38216 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
38217 except when <option>mbx_format</option> is set.
38218 </para>
38219 <para>
38220 <indexterm role="option">
38221 <primary><option>use_mbx_lock</option></primary>
38222 </indexterm>
38223 </para>
38224 <informaltable frame="all">
38225 <tgroup cols="4" colsep="0" rowsep="0">
38226 <colspec colwidth="8*" align="left"/>
38227 <colspec colwidth="6*" align="center"/>
38228 <colspec colwidth="6*" align="center"/>
38229 <colspec colwidth="6*" align="right"/>
38230 <tbody>
38231 <row>
38232 <entry><option>use_mbx_lock</option></entry>
38233 <entry>Use: <emphasis>appendfile</emphasis></entry>
38234 <entry>Type: <emphasis>boolean</emphasis></entry>
38235 <entry>Default: <emphasis>see below</emphasis></entry>
38236 </row>
38237 </tbody>
38238 </tgroup>
38239 </informaltable>
38240 <para>
38241 This option is available only if Exim has been compiled with SUPPORT_MBX
38242 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
38243 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
38244 of the locking options are mentioned in the configuration. The locking rules
38245 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
38246 the IMAP4 and POP daemons that come with it (see the discussion below). The
38247 rules allow for shared access to the mailbox. However, this kind of locking
38248 does not work when the mailbox is NFS mounted.
38249 </para>
38250 <para>
38251 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
38252 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
38253 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
38254 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
38255 </para>
38256 </section>
38257 <section id="SECTopappend">
38258 <title>Operational details for appending</title>
38259 <para>
38260 <indexterm role="concept">
38261 <primary>appending to a file</primary>
38262 </indexterm>
38263 <indexterm role="concept">
38264 <primary>file</primary>
38265 <secondary>appending</secondary>
38266 </indexterm>
38267 Before appending to a file, the following preparations are made:
38268 </para>
38269 <itemizedlist>
38270 <listitem>
38271 <para>
38272 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
38273 return is given.
38274 </para>
38275 </listitem>
38276 <listitem>
38277 <para>
38278 <indexterm role="concept">
38279 <primary>directory creation</primary>
38280 </indexterm>
38281 If any directories on the file&#x2019;s path are missing, Exim creates them if the
38282 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
38283 <option>directory_mode</option> option.
38284 </para>
38285 </listitem>
38286 <listitem>
38287 <para>
38288 If <option>file_format</option> is set, the format of an existing file is checked. If this
38289 indicates that a different transport should be used, control is passed to that
38290 transport.
38291 </para>
38292 </listitem>
38293 <listitem>
38294 <para>
38295 <indexterm role="concept">
38296 <primary>file</primary>
38297 <secondary>locking</secondary>
38298 </indexterm>
38299 <indexterm role="concept">
38300 <primary>locking files</primary>
38301 </indexterm>
38302 <indexterm role="concept">
38303 <primary>NFS</primary>
38304 <secondary>lock file</secondary>
38305 </indexterm>
38306 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
38307 reliably over NFS, as follows:
38308 </para>
38309 <orderedlist numeration="arabic">
38310 <listitem>
38311 <para>
38312 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
38313 current time, primary host name, and process id added, by opening for writing
38314 as a new file. If this fails with an access error, delivery is deferred.
38315 </para>
38316 </listitem>
38317 <listitem>
38318 <para>
38319 Close the hitching post file, and hard link it to the lock file name.
38320 </para>
38321 </listitem>
38322 <listitem>
38323 <para>
38324 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
38325 Unlink the hitching post name.
38326 </para>
38327 </listitem>
38328 <listitem>
38329 <para>
38330 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
38331 then unlink hitching post name. If the number of links is exactly two, creation
38332 of the lock file succeeded but something (for example, an NFS server crash and
38333 restart) caused this fact not to be communicated to the <function>link()</function> call.
38334 </para>
38335 </listitem>
38336 <listitem>
38337 <para>
38338 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
38339 up to <option>lock_retries</option> times. However, since any program that writes to a
38340 mailbox should complete its task very quickly, it is reasonable to time out old
38341 lock files that are normally the result of user agent and system crashes. If an
38342 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
38343 it before trying again.
38344 </para>
38345 </listitem>
38346 </orderedlist>
38347 </listitem>
38348 <listitem>
38349 <para>
38350 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
38351 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
38352 than non-existence, delivery is deferred.
38353 </para>
38354 </listitem>
38355 <listitem>
38356 <para>
38357 <indexterm role="concept">
38358 <primary>symbolic link</primary>
38359 <secondary>to mailbox</secondary>
38360 </indexterm>
38361 <indexterm role="concept">
38362 <primary>mailbox</primary>
38363 <secondary>symbolic link</secondary>
38364 </indexterm>
38365 If the file does exist and is a symbolic link, delivery is deferred, unless the
38366 <option>allow_symlink</option> option is set, in which case the ownership of the link is
38367 checked, and then <function>stat()</function> is called to find out about the real file, which
38368 is then subjected to the checks below. The check on the top-level link
38369 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
38370 directory, though allowing symbolic links in this case is definitely not a good
38371 idea. If there is a chain of symbolic links, the intermediate ones are not
38372 checked.
38373 </para>
38374 </listitem>
38375 <listitem>
38376 <para>
38377 If the file already exists but is not a regular file, or if the file&#x2019;s owner
38378 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
38379 different from the user and group under which the delivery is running,
38380 delivery is deferred.
38381 </para>
38382 </listitem>
38383 <listitem>
38384 <para>
38385 If the file&#x2019;s permissions are more generous than specified, they are reduced.
38386 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
38387 is set false, in which case the delivery is tried using the existing
38388 permissions.
38389 </para>
38390 </listitem>
38391 <listitem>
38392 <para>
38393 The file&#x2019;s inode number is saved, and the file is then opened for appending.
38394 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
38395 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
38396 </para>
38397 </listitem>
38398 <listitem>
38399 <para>
38400 If the file is opened successfully, check that the inode number hasn&#x2019;t
38401 changed, that it is still a regular file, and that the owner and permissions
38402 have not changed. If anything is wrong, defer delivery and freeze the message.
38403 </para>
38404 </listitem>
38405 <listitem>
38406 <para>
38407 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
38408 option is set. Otherwise, check that the file is being created in a permitted
38409 directory if the <option>create_file</option> option is set (deferring on failure), and then
38410 open for writing as a new file, with the O_EXCL and O_CREAT options,
38411 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
38412 set). In this case, which can happen if the link points to a non-existent file,
38413 the file is opened for writing using O_CREAT but not O_EXCL, because
38414 that prevents link following.
38415 </para>
38416 </listitem>
38417 <listitem>
38418 <para>
38419 <indexterm role="concept">
38420 <primary>loop</primary>
38421 <secondary>while file testing</secondary>
38422 </indexterm>
38423 If opening fails because the file exists, obey the tests given above for
38424 existing files. However, to avoid looping in a situation where the file is
38425 being continuously created and destroyed, the exists/not-exists loop is broken
38426 after 10 repetitions, and the message is then frozen.
38427 </para>
38428 </listitem>
38429 <listitem>
38430 <para>
38431 If opening fails with any other error, defer delivery.
38432 </para>
38433 </listitem>
38434 <listitem>
38435 <para>
38436 <indexterm role="concept">
38437 <primary>file</primary>
38438 <secondary>locking</secondary>
38439 </indexterm>
38440 <indexterm role="concept">
38441 <primary>locking files</primary>
38442 </indexterm>
38443 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
38444 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
38445 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
38446 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
38447 file, and an exclusive lock on the file whose name is
38448 </para>
38449 <literallayout class="monospaced">
38450 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
38451 </literallayout>
38452 <para>
38453 using the device and inode numbers of the open mailbox file, in accordance with
38454 the MBX locking rules. This file is created with a mode that is specified by
38455 the <option>lockfile_mode</option> option.
38456 </para>
38457 <para>
38458 If Exim fails to lock the file, there are two possible courses of action,
38459 depending on the value of the locking timeout. This is obtained from
38460 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
38461 </para>
38462 <para>
38463 If the timeout value is zero, the file is closed, Exim waits for
38464 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
38465 to lock it again. This happens up to <option>lock_retries</option> times, after which the
38466 delivery is deferred.
38467 </para>
38468 <para>
38469 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
38470 <function>flock()</function> are used (with the given timeout), so there has already been some
38471 waiting involved by the time locking fails. Nevertheless, Exim does not give up
38472 immediately. It retries up to
38473 </para>
38474 <literallayout class="monospaced">
38475 (lock_retries * lock_interval) / &lt;timeout&gt;
38476 </literallayout>
38477 <para>
38478 times (rounded up).
38479 </para>
38480 </listitem>
38481 </itemizedlist>
38482 <para>
38483 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
38484 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
38485 </para>
38486 </section>
38487 <section id="SECTopdir">
38488 <title>Operational details for delivery to a new file</title>
38489 <para>
38490 <indexterm role="concept">
38491 <primary>delivery</primary>
38492 <secondary>to single file</secondary>
38493 </indexterm>
38494 <indexterm role="concept">
38495 <primary><quote>From</quote> line</primary>
38496 </indexterm>
38497 When the <option>directory</option> option is set instead of <option>file</option>, each message is
38498 delivered into a newly-created file or set of files. When <command>appendfile</command> is
38499 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
38500 <option>directory</option> is normally set, because the path for delivery is supplied by the
38501 router. (See for example, the <command>address_file</command> transport in the default
38502 configuration.) In this case, delivery is to a new file if either the path name
38503 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
38504 </para>
38505 <para>
38506 No locking is required while writing the message to a new file, so the various
38507 locking options of the transport are ignored. The <quote>From</quote> line that by default
38508 separates messages in a single file is not normally needed, nor is the escaping
38509 of message lines that start with <quote>From</quote>, and there is no need to ensure a
38510 newline at the end of each message. Consequently, the default values for
38511 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
38512 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
38513 </para>
38514 <para>
38515 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
38516 the files in the delivery directory by default. However, you can specify a
38517 different directory by setting <option>quota_directory</option>. Also, for maildir
38518 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
38519 </para>
38520 <para>
38521 <indexterm role="concept">
38522 <primary>maildir format</primary>
38523 </indexterm>
38524 <indexterm role="concept">
38525 <primary>mailstore format</primary>
38526 </indexterm>
38527 There are three different ways in which delivery to individual files can be
38528 done, controlled by the settings of the <option>maildir_format</option> and
38529 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
38530 formats is not included in the binary unless SUPPORT_MAILDIR or
38531 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
38532 </para>
38533 <para>
38534 <indexterm role="concept">
38535 <primary>directory creation</primary>
38536 </indexterm>
38537 In all three cases an attempt is made to create the directory and any necessary
38538 sub-directories if they do not exist, provided that the <option>create_directory</option>
38539 option is set (the default). The location of a created directory can be
38540 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
38541 the <option>directory_mode</option> option. If creation fails, or if the
38542 <option>create_directory</option> option is not set when creation is required, delivery is
38543 deferred.
38544 </para>
38545 </section>
38546 <section id="SECTmaildirdelivery">
38547 <title>Maildir delivery</title>
38548 <para>
38549 <indexterm role="concept">
38550 <primary>maildir format</primary>
38551 <secondary>description of</secondary>
38552 </indexterm>
38553 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
38554 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
38555 directory that is defined by the <option>directory</option> option (the <quote>delivery
38556 directory</quote>). If the delivery is successful, the file is renamed into the
38557 <filename>new</filename> subdirectory.
38558 </para>
38559 <para>
38560 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
38561 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
38562 Exim checks that the time-of-day clock has moved on by at least one microsecond
38563 before terminating the delivery process. This guarantees uniqueness for the
38564 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
38565 opening it. If any response other than ENOENT (does not exist) is given,
38566 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
38567 </para>
38568 <para>
38569 Before Exim carries out a maildir delivery, it ensures that subdirectories
38570 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
38571 do not exist, Exim tries to create them and any superior directories in their
38572 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
38573 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
38574 contains matches the delivery directory, Exim also ensures that a file called
38575 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
38576 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
38577 </para>
38578 <para>
38579 These features make it possible to use Exim to create all the necessary files
38580 and directories in a maildir mailbox, including subdirectories for maildir++
38581 folders. Consider this example:
38582 </para>
38583 <literallayout class="monospaced">
38584 maildir_format = true
38585 directory = /var/mail/$local_part\
38586            ${if eq{$local_part_suffix}{}{}\
38587            {/.${substr_1:$local_part_suffix}}}
38588 maildirfolder_create_regex = /\.[^/]+$
38589 </literallayout>
38590 <para>
38591 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
38592 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
38593 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
38594 not match this name, so Exim will not look for or create the file
38595 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
38596 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
38597 </para>
38598 <para>
38599 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
38600 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
38601 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
38602 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
38603 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
38604 </para>
38605 <para>
38606 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
38607 not inadvertently match the toplevel maildir directory, because a
38608 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
38609 </para>
38610 <para>
38611 <indexterm role="concept">
38612 <primary>quota</primary>
38613 <secondary>in maildir delivery</secondary>
38614 </indexterm>
38615 <indexterm role="concept">
38616 <primary>maildir++</primary>
38617 </indexterm>
38618 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
38619 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
38620 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
38621 Exim assumes the directory is a maildir++ folder directory, which is one level
38622 down from the user&#x2019;s top level mailbox directory. This causes it to start at
38623 the parent directory instead of the current directory when calculating the
38624 amount of space used.
38625 </para>
38626 <para>
38627 One problem with delivering into a multi-file mailbox is that it is
38628 computationally expensive to compute the size of the mailbox for quota
38629 checking. Various approaches have been taken to reduce the amount of work
38630 needed. The next two sections describe two of them. A third alternative is to
38631 use some external process for maintaining the size data, and use the expansion
38632 of the <option>mailbox_size</option> option as a way of importing it into Exim.
38633 </para>
38634 </section>
38635 <section id="SECID135">
38636 <title>Using tags to record message sizes</title>
38637 <para>
38638 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
38639 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
38640 tag is added to its name. However, if adding the tag takes the length of the
38641 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
38642 the tag is dropped and the maildir file is created with no tag.
38643 </para>
38644 <para>
38645 <indexterm role="variable">
38646 <primary><varname>$message_size</varname></primary>
38647 </indexterm>
38648 Tags can be used to encode the size of files in their names; see
38649 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
38650 happens after the message has been written. The value of the <varname>$message_size</varname>
38651 variable is set to the number of bytes actually written. If the expansion is
38652 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
38653 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
38654 Non-printing characters in the string are ignored; if the resulting string is
38655 empty, it is ignored. If it starts with an alphanumeric character, a leading
38656 colon is inserted.
38657 </para>
38658 </section>
38659 <section id="SECID136">
38660 <title>Using a maildirsize file</title>
38661 <para>
38662 <indexterm role="concept">
38663 <primary>quota</primary>
38664 <secondary>in maildir delivery</secondary>
38665 </indexterm>
38666 <indexterm role="concept">
38667 <primary>maildir format</primary>
38668 <secondary><filename>maildirsize</filename> file</secondary>
38669 </indexterm>
38670 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
38671 storing quota and message size information in a file called <filename>maildirsize</filename>
38672 within the toplevel maildir directory. If this file does not exist, Exim
38673 creates it, setting the quota from the <option>quota</option> option of the transport. If
38674 the maildir directory itself does not exist, it is created before any attempt
38675 to write a <filename>maildirsize</filename> file.
38676 </para>
38677 <para>
38678 The <filename>maildirsize</filename> file is used to hold information about the sizes of
38679 messages in the maildir, thus speeding up quota calculations. The quota value
38680 in the file is just a cache; if the quota is changed in the transport, the new
38681 value overrides the cached value when the next message is delivered. The cache
38682 is maintained for the benefit of other programs that access the maildir and
38683 need to know the quota.
38684 </para>
38685 <para>
38686 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
38687 file is maintained (with a zero quota setting), but no quota is imposed.
38688 </para>
38689 <para>
38690 A regular expression is available for controlling which directories in the
38691 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
38692 See the description of the <option>maildir_quota_directory_regex</option> option above for
38693 details.
38694 </para>
38695 </section>
38696 <section id="SECID137">
38697 <title>Mailstore delivery</title>
38698 <para>
38699 <indexterm role="concept">
38700 <primary>mailstore format</primary>
38701 <secondary>description of</secondary>
38702 </indexterm>
38703 If the <option>mailstore_format</option> option is true, each message is written as two
38704 files in the given directory. A unique base name is constructed from the
38705 message id and the current delivery process, and the files that are written use
38706 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
38707 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
38708 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
38709 </para>
38710 <para>
38711 During delivery, the envelope is first written to a file with the suffix
38712 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
38713 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
38714 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
38715 file before accessing either of them. An alternative approach is to wait for
38716 the absence of a <filename>.tmp</filename> file.
38717 </para>
38718 <para>
38719 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
38720 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
38721 the sender address on one line, then all the recipient addresses, one per line.
38722 There can be more than one recipient only if the <option>batch_max</option> option is set
38723 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
38724 appended to the file, followed by a newline if it does not end with one.
38725 </para>
38726 <para>
38727 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
38728 failure, it is ignored. Other expansion errors are treated as serious
38729 configuration errors, and delivery is deferred. The variable
38730 <varname>$mailstore_basename</varname> is available for use during these expansions.
38731 </para>
38732 </section>
38733 <section id="SECID138">
38734 <title>Non-special new file delivery</title>
38735 <para>
38736 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
38737 file is created directly in the named directory. For example, when delivering
38738 messages into files in batched SMTP format for later delivery to some host (see
38739 section <xref linkend="SECTbatchSMTP"/>), a setting such as
38740 </para>
38741 <literallayout class="monospaced">
38742 directory = /var/bsmtp/$host
38743 </literallayout>
38744 <para>
38745 might be used. A message is written to a file with a temporary name, which is
38746 then renamed when the delivery is complete. The final name is obtained by
38747 expanding the contents of the <option>directory_file</option> option.
38748 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
38749 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
38750 </para>
38751 </section>
38752 </chapter>
38753
38754 <chapter id="CHID8">
38755 <title>The autoreply transport</title>
38756 <para>
38757 <indexterm role="concept" id="IIDauttra1" class="startofrange">
38758 <primary>transports</primary>
38759 <secondary><command>autoreply</command></secondary>
38760 </indexterm>
38761 <indexterm role="concept" id="IIDauttra2" class="startofrange">
38762 <primary><command>autoreply</command> transport</primary>
38763 </indexterm>
38764 The <command>autoreply</command> transport is not a true transport in that it does not cause
38765 the message to be transmitted. Instead, it generates a new mail message as an
38766 automatic reply to the incoming message. <emphasis>References:</emphasis> and
38767 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
38768 to the rules in RFCs 2822 and 3834, respectively.
38769 </para>
38770 <para>
38771 If the router that passes the message to this transport does not have the
38772 <option>unseen</option> option set, the original message (for the current recipient) is not
38773 delivered anywhere. However, when the <option>unseen</option> option is set on the router
38774 that passes the message to this transport, routing of the address continues, so
38775 another router can set up a normal message delivery.
38776 </para>
38777 <para>
38778 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
38779 <quote>vacation</quote> message being the standard example. However, it can also be run
38780 directly from a router like any other transport. To reduce the possibility of
38781 message cascades, messages created by the <command>autoreply</command> transport always have
38782 empty envelope sender addresses, like bounce messages.
38783 </para>
38784 <para>
38785 The parameters of the message to be sent can be specified in the configuration
38786 by options described below. However, these are used only when the address
38787 passed to the transport does not contain its own reply information. When the
38788 transport is run as a consequence of a
38789 <option>mail</option>
38790 or <option>vacation</option> command in a filter file, the parameters of the message are
38791 supplied by the filter, and passed with the address. The transport&#x2019;s options
38792 that define the message are then ignored (so they are not usually set in this
38793 case). The message is specified entirely by the filter or by the transport; it
38794 is never built from a mixture of options. However, the <option>file_optional</option>,
38795 <option>mode</option>, and <option>return_message</option> options apply in all cases.
38796 </para>
38797 <para>
38798 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
38799 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
38800 gid of the user, and with appropriate current and home directories (see chapter
38801 <xref linkend="CHAPenvironment"/>).
38802 </para>
38803 <para>
38804 There is a subtle difference between routing a message to a <command>pipe</command> transport
38805 that generates some text to be returned to the sender, and routing it to an
38806 <command>autoreply</command> transport. This difference is noticeable only if more than one
38807 address from the same message is so handled. In the case of a pipe, the
38808 separate outputs from the different addresses are gathered up and returned to
38809 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
38810 message is generated for each address that is passed to it.
38811 </para>
38812 <para>
38813 Non-printing characters are not permitted in the header lines generated for the
38814 message that <command>autoreply</command> creates, with the exception of newlines that are
38815 immediately followed by white space. If any non-printing characters are found,
38816 the transport defers.
38817 Whether characters with the top bit set count as printing characters or not is
38818 controlled by the <option>print_topbitchars</option> global option.
38819 </para>
38820 <para>
38821 If any of the generic options for manipulating headers (for example,
38822 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
38823 of the original message that is included in the generated message when
38824 <option>return_message</option> is set. They do not apply to the generated message itself.
38825 </para>
38826 <para>
38827 <indexterm role="variable">
38828 <primary><varname>$sender_address</varname></primary>
38829 </indexterm>
38830 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
38831 the message, indicating that there were no recipients, it does not treat this
38832 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
38833 is empty (because the incoming message is a bounce message) do not cause
38834 problems. They are just discarded.
38835 </para>
38836 <section id="SECID139">
38837 <title>Private options for autoreply</title>
38838 <para>
38839 <indexterm role="concept">
38840 <primary>options</primary>
38841 <secondary><command>autoreply</command> transport</secondary>
38842 </indexterm>
38843 </para>
38844 <para>
38845 <indexterm role="option">
38846 <primary><option>bcc</option></primary>
38847 </indexterm>
38848 </para>
38849 <informaltable frame="all">
38850 <tgroup cols="4" colsep="0" rowsep="0">
38851 <colspec colwidth="8*" align="left"/>
38852 <colspec colwidth="6*" align="center"/>
38853 <colspec colwidth="6*" align="center"/>
38854 <colspec colwidth="6*" align="right"/>
38855 <tbody>
38856 <row>
38857 <entry><option>bcc</option></entry>
38858 <entry>Use: <emphasis>autoreply</emphasis></entry>
38859 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38860 <entry>Default: <emphasis>unset</emphasis></entry>
38861 </row>
38862 </tbody>
38863 </tgroup>
38864 </informaltable>
38865 <para>
38866 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
38867 message when the message is specified by the transport.
38868 </para>
38869 <para>
38870 <indexterm role="option">
38871 <primary><option>cc</option></primary>
38872 </indexterm>
38873 </para>
38874 <informaltable frame="all">
38875 <tgroup cols="4" colsep="0" rowsep="0">
38876 <colspec colwidth="8*" align="left"/>
38877 <colspec colwidth="6*" align="center"/>
38878 <colspec colwidth="6*" align="center"/>
38879 <colspec colwidth="6*" align="right"/>
38880 <tbody>
38881 <row>
38882 <entry><option>cc</option></entry>
38883 <entry>Use: <emphasis>autoreply</emphasis></entry>
38884 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38885 <entry>Default: <emphasis>unset</emphasis></entry>
38886 </row>
38887 </tbody>
38888 </tgroup>
38889 </informaltable>
38890 <para>
38891 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
38892 when the message is specified by the transport.
38893 </para>
38894 <para>
38895 <indexterm role="option">
38896 <primary><option>file</option></primary>
38897 </indexterm>
38898 </para>
38899 <informaltable frame="all">
38900 <tgroup cols="4" colsep="0" rowsep="0">
38901 <colspec colwidth="8*" align="left"/>
38902 <colspec colwidth="6*" align="center"/>
38903 <colspec colwidth="6*" align="center"/>
38904 <colspec colwidth="6*" align="right"/>
38905 <tbody>
38906 <row>
38907 <entry><option>file</option></entry>
38908 <entry>Use: <emphasis>autoreply</emphasis></entry>
38909 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38910 <entry>Default: <emphasis>unset</emphasis></entry>
38911 </row>
38912 </tbody>
38913 </tgroup>
38914 </informaltable>
38915 <para>
38916 The contents of the file are sent as the body of the message when the message
38917 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
38918 string comes first.
38919 </para>
38920 <para>
38921 <indexterm role="option">
38922 <primary><option>file_expand</option></primary>
38923 </indexterm>
38924 </para>
38925 <informaltable frame="all">
38926 <tgroup cols="4" colsep="0" rowsep="0">
38927 <colspec colwidth="8*" align="left"/>
38928 <colspec colwidth="6*" align="center"/>
38929 <colspec colwidth="6*" align="center"/>
38930 <colspec colwidth="6*" align="right"/>
38931 <tbody>
38932 <row>
38933 <entry><option>file_expand</option></entry>
38934 <entry>Use: <emphasis>autoreply</emphasis></entry>
38935 <entry>Type: <emphasis>boolean</emphasis></entry>
38936 <entry>Default: <emphasis>false</emphasis></entry>
38937 </row>
38938 </tbody>
38939 </tgroup>
38940 </informaltable>
38941 <para>
38942 If this is set, the contents of the file named by the <option>file</option> option are
38943 subjected to string expansion as they are added to the message.
38944 </para>
38945 <para>
38946 <indexterm role="option">
38947 <primary><option>file_optional</option></primary>
38948 </indexterm>
38949 </para>
38950 <informaltable frame="all">
38951 <tgroup cols="4" colsep="0" rowsep="0">
38952 <colspec colwidth="8*" align="left"/>
38953 <colspec colwidth="6*" align="center"/>
38954 <colspec colwidth="6*" align="center"/>
38955 <colspec colwidth="6*" align="right"/>
38956 <tbody>
38957 <row>
38958 <entry><option>file_optional</option></entry>
38959 <entry>Use: <emphasis>autoreply</emphasis></entry>
38960 <entry>Type: <emphasis>boolean</emphasis></entry>
38961 <entry>Default: <emphasis>false</emphasis></entry>
38962 </row>
38963 </tbody>
38964 </tgroup>
38965 </informaltable>
38966 <para>
38967 If this option is true, no error is generated if the file named by the <option>file</option>
38968 option or passed with the address does not exist or cannot be read.
38969 </para>
38970 <para>
38971 <indexterm role="option">
38972 <primary><option>from</option></primary>
38973 </indexterm>
38974 </para>
38975 <informaltable frame="all">
38976 <tgroup cols="4" colsep="0" rowsep="0">
38977 <colspec colwidth="8*" align="left"/>
38978 <colspec colwidth="6*" align="center"/>
38979 <colspec colwidth="6*" align="center"/>
38980 <colspec colwidth="6*" align="right"/>
38981 <tbody>
38982 <row>
38983 <entry><option>from</option></entry>
38984 <entry>Use: <emphasis>autoreply</emphasis></entry>
38985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38986 <entry>Default: <emphasis>unset</emphasis></entry>
38987 </row>
38988 </tbody>
38989 </tgroup>
38990 </informaltable>
38991 <para>
38992 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
38993 specified by the transport.
38994 </para>
38995 <para>
38996 <indexterm role="option">
38997 <primary><option>headers</option></primary>
38998 </indexterm>
38999 </para>
39000 <informaltable frame="all">
39001 <tgroup cols="4" colsep="0" rowsep="0">
39002 <colspec colwidth="8*" align="left"/>
39003 <colspec colwidth="6*" align="center"/>
39004 <colspec colwidth="6*" align="center"/>
39005 <colspec colwidth="6*" align="right"/>
39006 <tbody>
39007 <row>
39008 <entry><option>headers</option></entry>
39009 <entry>Use: <emphasis>autoreply</emphasis></entry>
39010 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39011 <entry>Default: <emphasis>unset</emphasis></entry>
39012 </row>
39013 </tbody>
39014 </tgroup>
39015 </informaltable>
39016 <para>
39017 This specifies additional RFC 2822 headers that are to be added to the message
39018 when the message is specified by the transport. Several can be given by using
39019 <quote>\n</quote> to separate them. There is no check on the format.
39020 </para>
39021 <para>
39022 <indexterm role="option">
39023 <primary><option>log</option></primary>
39024 </indexterm>
39025 </para>
39026 <informaltable frame="all">
39027 <tgroup cols="4" colsep="0" rowsep="0">
39028 <colspec colwidth="8*" align="left"/>
39029 <colspec colwidth="6*" align="center"/>
39030 <colspec colwidth="6*" align="center"/>
39031 <colspec colwidth="6*" align="right"/>
39032 <tbody>
39033 <row>
39034 <entry><option>log</option></entry>
39035 <entry>Use: <emphasis>autoreply</emphasis></entry>
39036 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39037 <entry>Default: <emphasis>unset</emphasis></entry>
39038 </row>
39039 </tbody>
39040 </tgroup>
39041 </informaltable>
39042 <para>
39043 This option names a file in which a record of every message sent is logged when
39044 the message is specified by the transport.
39045 </para>
39046 <para>
39047 <indexterm role="option">
39048 <primary><option>mode</option></primary>
39049 </indexterm>
39050 </para>
39051 <informaltable frame="all">
39052 <tgroup cols="4" colsep="0" rowsep="0">
39053 <colspec colwidth="8*" align="left"/>
39054 <colspec colwidth="6*" align="center"/>
39055 <colspec colwidth="6*" align="center"/>
39056 <colspec colwidth="6*" align="right"/>
39057 <tbody>
39058 <row>
39059 <entry><option>mode</option></entry>
39060 <entry>Use: <emphasis>autoreply</emphasis></entry>
39061 <entry>Type: <emphasis>octal integer</emphasis></entry>
39062 <entry>Default: <emphasis>0600</emphasis></entry>
39063 </row>
39064 </tbody>
39065 </tgroup>
39066 </informaltable>
39067 <para>
39068 If either the log file or the <quote>once</quote> file has to be created, this mode is
39069 used.
39070 </para>
39071 <para>
39072 <indexterm role="option">
39073 <primary><option>never_mail</option></primary>
39074 </indexterm>
39075 </para>
39076 <informaltable frame="all">
39077 <tgroup cols="4" colsep="0" rowsep="0">
39078 <colspec colwidth="8*" align="left"/>
39079 <colspec colwidth="6*" align="center"/>
39080 <colspec colwidth="6*" align="center"/>
39081 <colspec colwidth="6*" align="right"/>
39082 <tbody>
39083 <row>
39084 <entry><option>never_mail</option></entry>
39085 <entry>Use: <emphasis>autoreply</emphasis></entry>
39086 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
39087 <entry>Default: <emphasis>unset</emphasis></entry>
39088 </row>
39089 </tbody>
39090 </tgroup>
39091 </informaltable>
39092 <para>
39093 If any run of the transport creates a message with a recipient that matches any
39094 item in the list, that recipient is quietly discarded. If all recipients are
39095 discarded, no message is created. This applies both when the recipients are
39096 generated by a filter and when they are specified in the transport.
39097 </para>
39098 <para>
39099 <indexterm role="option">
39100 <primary><option>once</option></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="6*" align="center"/>
39107 <colspec colwidth="6*" align="center"/>
39108 <colspec colwidth="6*" align="right"/>
39109 <tbody>
39110 <row>
39111 <entry><option>once</option></entry>
39112 <entry>Use: <emphasis>autoreply</emphasis></entry>
39113 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39114 <entry>Default: <emphasis>unset</emphasis></entry>
39115 </row>
39116 </tbody>
39117 </tgroup>
39118 </informaltable>
39119 <para>
39120 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
39121 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
39122 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
39123 </para>
39124 <para>
39125 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
39126 By default, if <option>once</option> is set to a non-empty file name, the message
39127 is not sent if a potential recipient is already listed in the database.
39128 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
39129 message is sent if that much time has elapsed since a message was last sent to
39130 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
39131 prevents a message from being sent a second time &ndash; in this case, zero means
39132 infinity.
39133 </para>
39134 <para>
39135 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
39136 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
39137 greater than zero, it changes the way Exim implements the <option>once</option> option.
39138 Instead of using a DBM file to record every recipient it sends to, it uses a
39139 regular file, whose size will never get larger than the given value.
39140 </para>
39141 <para>
39142 In the file, Exim keeps a linear list of recipient addresses and the times at
39143 which they were sent messages. If the file is full when a new address needs to
39144 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
39145 means that a given recipient may receive multiple messages, but at
39146 unpredictable intervals that depend on the rate of turnover of addresses in the
39147 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
39148 </para>
39149 <para>
39150 <indexterm role="option">
39151 <primary><option>once_file_size</option></primary>
39152 </indexterm>
39153 </para>
39154 <informaltable frame="all">
39155 <tgroup cols="4" colsep="0" rowsep="0">
39156 <colspec colwidth="8*" align="left"/>
39157 <colspec colwidth="6*" align="center"/>
39158 <colspec colwidth="6*" align="center"/>
39159 <colspec colwidth="6*" align="right"/>
39160 <tbody>
39161 <row>
39162 <entry><option>once_file_size</option></entry>
39163 <entry>Use: <emphasis>autoreply</emphasis></entry>
39164 <entry>Type: <emphasis>integer</emphasis></entry>
39165 <entry>Default: <emphasis>0</emphasis></entry>
39166 </row>
39167 </tbody>
39168 </tgroup>
39169 </informaltable>
39170 <para>
39171 See <option>once</option> above.
39172 </para>
39173 <para>
39174 <indexterm role="option">
39175 <primary><option>once_repeat</option></primary>
39176 </indexterm>
39177 </para>
39178 <informaltable frame="all">
39179 <tgroup cols="4" colsep="0" rowsep="0">
39180 <colspec colwidth="8*" align="left"/>
39181 <colspec colwidth="6*" align="center"/>
39182 <colspec colwidth="6*" align="center"/>
39183 <colspec colwidth="6*" align="right"/>
39184 <tbody>
39185 <row>
39186 <entry><option>once_repeat</option></entry>
39187 <entry>Use: <emphasis>autoreply</emphasis></entry>
39188 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
39189 <entry>Default: <emphasis>0s</emphasis></entry>
39190 </row>
39191 </tbody>
39192 </tgroup>
39193 </informaltable>
39194 <para>
39195 See <option>once</option> above.
39196 After expansion, the value of this option must be a valid time value.
39197 </para>
39198 <para>
39199 <indexterm role="option">
39200 <primary><option>reply_to</option></primary>
39201 </indexterm>
39202 </para>
39203 <informaltable frame="all">
39204 <tgroup cols="4" colsep="0" rowsep="0">
39205 <colspec colwidth="8*" align="left"/>
39206 <colspec colwidth="6*" align="center"/>
39207 <colspec colwidth="6*" align="center"/>
39208 <colspec colwidth="6*" align="right"/>
39209 <tbody>
39210 <row>
39211 <entry><option>reply_to</option></entry>
39212 <entry>Use: <emphasis>autoreply</emphasis></entry>
39213 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39214 <entry>Default: <emphasis>unset</emphasis></entry>
39215 </row>
39216 </tbody>
39217 </tgroup>
39218 </informaltable>
39219 <para>
39220 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
39221 specified by the transport.
39222 </para>
39223 <para>
39224 <indexterm role="option">
39225 <primary><option>return_message</option></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="6*" align="center"/>
39232 <colspec colwidth="6*" align="center"/>
39233 <colspec colwidth="6*" align="right"/>
39234 <tbody>
39235 <row>
39236 <entry><option>return_message</option></entry>
39237 <entry>Use: <emphasis>autoreply</emphasis></entry>
39238 <entry>Type: <emphasis>boolean</emphasis></entry>
39239 <entry>Default: <emphasis>false</emphasis></entry>
39240 </row>
39241 </tbody>
39242 </tgroup>
39243 </informaltable>
39244 <para>
39245 If this is set, a copy of the original message is returned with the new
39246 message, subject to the maximum size set in the <option>return_size_limit</option> global
39247 configuration option.
39248 </para>
39249 <para>
39250 <indexterm role="option">
39251 <primary><option>subject</option></primary>
39252 </indexterm>
39253 </para>
39254 <informaltable frame="all">
39255 <tgroup cols="4" colsep="0" rowsep="0">
39256 <colspec colwidth="8*" align="left"/>
39257 <colspec colwidth="6*" align="center"/>
39258 <colspec colwidth="6*" align="center"/>
39259 <colspec colwidth="6*" align="right"/>
39260 <tbody>
39261 <row>
39262 <entry><option>subject</option></entry>
39263 <entry>Use: <emphasis>autoreply</emphasis></entry>
39264 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39265 <entry>Default: <emphasis>unset</emphasis></entry>
39266 </row>
39267 </tbody>
39268 </tgroup>
39269 </informaltable>
39270 <para>
39271 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
39272 specified by the transport. It is tempting to quote the original subject in
39273 automatic responses. For example:
39274 </para>
39275 <literallayout class="monospaced">
39276 subject = Re: $h_subject:
39277 </literallayout>
39278 <para>
39279 There is a danger in doing this, however. It may allow a third party to
39280 subscribe your users to an opt-in mailing list, provided that the list accepts
39281 bounce messages as subscription confirmations. Well-managed lists require a
39282 non-bounce message to confirm a subscription, so the danger is relatively
39283 small.
39284 </para>
39285 <para>
39286 <indexterm role="option">
39287 <primary><option>text</option></primary>
39288 </indexterm>
39289 </para>
39290 <informaltable frame="all">
39291 <tgroup cols="4" colsep="0" rowsep="0">
39292 <colspec colwidth="8*" align="left"/>
39293 <colspec colwidth="6*" align="center"/>
39294 <colspec colwidth="6*" align="center"/>
39295 <colspec colwidth="6*" align="right"/>
39296 <tbody>
39297 <row>
39298 <entry><option>text</option></entry>
39299 <entry>Use: <emphasis>autoreply</emphasis></entry>
39300 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39301 <entry>Default: <emphasis>unset</emphasis></entry>
39302 </row>
39303 </tbody>
39304 </tgroup>
39305 </informaltable>
39306 <para>
39307 This specifies a single string to be used as the body of the message when the
39308 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
39309 the text comes first.
39310 </para>
39311 <para>
39312 <indexterm role="option">
39313 <primary><option>to</option></primary>
39314 </indexterm>
39315 </para>
39316 <informaltable frame="all">
39317 <tgroup cols="4" colsep="0" rowsep="0">
39318 <colspec colwidth="8*" align="left"/>
39319 <colspec colwidth="6*" align="center"/>
39320 <colspec colwidth="6*" align="center"/>
39321 <colspec colwidth="6*" align="right"/>
39322 <tbody>
39323 <row>
39324 <entry><option>to</option></entry>
39325 <entry>Use: <emphasis>autoreply</emphasis></entry>
39326 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39327 <entry>Default: <emphasis>unset</emphasis></entry>
39328 </row>
39329 </tbody>
39330 </tgroup>
39331 </informaltable>
39332 <para>
39333 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
39334 when the message is specified by the transport.
39335 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
39336 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
39337 </para>
39338 </section>
39339 </chapter>
39340
39341 <chapter id="CHAPLMTP">
39342 <title>The lmtp transport</title>
39343 <para>
39344 <indexterm role="concept">
39345 <primary>transports</primary>
39346 <secondary><command>lmtp</command></secondary>
39347 </indexterm>
39348 <indexterm role="concept">
39349 <primary><command>lmtp</command> transport</primary>
39350 </indexterm>
39351 <indexterm role="concept">
39352 <primary>LMTP</primary>
39353 <secondary>over a pipe</secondary>
39354 </indexterm>
39355 <indexterm role="concept">
39356 <primary>LMTP</primary>
39357 <secondary>over a socket</secondary>
39358 </indexterm>
39359 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
39360 specified command
39361 or by interacting with a Unix domain socket.
39362 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
39363 transports. Exim also has support for using LMTP over TCP/IP; this is
39364 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
39365 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
39366 has it commented out. You need to ensure that
39367 </para>
39368 <literallayout class="monospaced">
39369 TRANSPORT_LMTP=yes
39370 </literallayout>
39371 <para>
39372 <indexterm role="concept">
39373 <primary>options</primary>
39374 <secondary><command>lmtp</command> transport</secondary>
39375 </indexterm>
39376 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
39377 included in the Exim binary. The private options of the <command>lmtp</command> transport are
39378 as follows:
39379 </para>
39380 <para>
39381 <indexterm role="option">
39382 <primary><option>batch_id</option></primary>
39383 </indexterm>
39384 </para>
39385 <informaltable frame="all">
39386 <tgroup cols="4" colsep="0" rowsep="0">
39387 <colspec colwidth="8*" align="left"/>
39388 <colspec colwidth="6*" align="center"/>
39389 <colspec colwidth="6*" align="center"/>
39390 <colspec colwidth="6*" align="right"/>
39391 <tbody>
39392 <row>
39393 <entry><option>batch_id</option></entry>
39394 <entry>Use: <emphasis>lmtp</emphasis></entry>
39395 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39396 <entry>Default: <emphasis>unset</emphasis></entry>
39397 </row>
39398 </tbody>
39399 </tgroup>
39400 </informaltable>
39401 <para>
39402 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39403 </para>
39404 <para>
39405 <indexterm role="option">
39406 <primary><option>batch_max</option></primary>
39407 </indexterm>
39408 </para>
39409 <informaltable frame="all">
39410 <tgroup cols="4" colsep="0" rowsep="0">
39411 <colspec colwidth="8*" align="left"/>
39412 <colspec colwidth="6*" align="center"/>
39413 <colspec colwidth="6*" align="center"/>
39414 <colspec colwidth="6*" align="right"/>
39415 <tbody>
39416 <row>
39417 <entry><option>batch_max</option></entry>
39418 <entry>Use: <emphasis>lmtp</emphasis></entry>
39419 <entry>Type: <emphasis>integer</emphasis></entry>
39420 <entry>Default: <emphasis>1</emphasis></entry>
39421 </row>
39422 </tbody>
39423 </tgroup>
39424 </informaltable>
39425 <para>
39426 This limits the number of addresses that can be handled in a single delivery.
39427 Most LMTP servers can handle several addresses at once, so it is normally a
39428 good idea to increase this value. See the description of local delivery
39429 batching in chapter <xref linkend="CHAPbatching"/>.
39430 </para>
39431 <para>
39432 <indexterm role="option">
39433 <primary><option>command</option></primary>
39434 </indexterm>
39435 </para>
39436 <informaltable frame="all">
39437 <tgroup cols="4" colsep="0" rowsep="0">
39438 <colspec colwidth="8*" align="left"/>
39439 <colspec colwidth="6*" align="center"/>
39440 <colspec colwidth="6*" align="center"/>
39441 <colspec colwidth="6*" align="right"/>
39442 <tbody>
39443 <row>
39444 <entry><option>command</option></entry>
39445 <entry>Use: <emphasis>lmtp</emphasis></entry>
39446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39447 <entry>Default: <emphasis>unset</emphasis></entry>
39448 </row>
39449 </tbody>
39450 </tgroup>
39451 </informaltable>
39452 <para>
39453 This option must be set if <option>socket</option> is not set. The string is a command which
39454 is run in a separate process. It is split up into a command name and list of
39455 arguments, each of which is separately expanded (so expansion cannot change the
39456 number of arguments). The command is run directly, not via a shell. The message
39457 is passed to the new process using the standard input and output to operate the
39458 LMTP protocol.
39459 </para>
39460 <para>
39461 <indexterm role="option">
39462 <primary><option>ignore_quota</option></primary>
39463 </indexterm>
39464 </para>
39465 <informaltable frame="all">
39466 <tgroup cols="4" colsep="0" rowsep="0">
39467 <colspec colwidth="8*" align="left"/>
39468 <colspec colwidth="6*" align="center"/>
39469 <colspec colwidth="6*" align="center"/>
39470 <colspec colwidth="6*" align="right"/>
39471 <tbody>
39472 <row>
39473 <entry><option>ignore_quota</option></entry>
39474 <entry>Use: <emphasis>lmtp</emphasis></entry>
39475 <entry>Type: <emphasis>boolean</emphasis></entry>
39476 <entry>Default: <emphasis>false</emphasis></entry>
39477 </row>
39478 </tbody>
39479 </tgroup>
39480 </informaltable>
39481 <para>
39482 <indexterm role="concept">
39483 <primary>LMTP</primary>
39484 <secondary>ignoring quota errors</secondary>
39485 </indexterm>
39486 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
39487 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
39488 in its response to the LHLO command.
39489 </para>
39490 <para>
39491 <indexterm role="option">
39492 <primary><option>socket</option></primary>
39493 </indexterm>
39494 </para>
39495 <informaltable frame="all">
39496 <tgroup cols="4" colsep="0" rowsep="0">
39497 <colspec colwidth="8*" align="left"/>
39498 <colspec colwidth="6*" align="center"/>
39499 <colspec colwidth="6*" align="center"/>
39500 <colspec colwidth="6*" align="right"/>
39501 <tbody>
39502 <row>
39503 <entry><option>socket</option></entry>
39504 <entry>Use: <emphasis>lmtp</emphasis></entry>
39505 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39506 <entry>Default: <emphasis>unset</emphasis></entry>
39507 </row>
39508 </tbody>
39509 </tgroup>
39510 </informaltable>
39511 <para>
39512 This option must be set if <option>command</option> is not set. The result of expansion must
39513 be the name of a Unix domain socket. The transport connects to the socket and
39514 delivers the message to it using the LMTP protocol.
39515 </para>
39516 <para>
39517 <indexterm role="option">
39518 <primary><option>timeout</option></primary>
39519 </indexterm>
39520 </para>
39521 <informaltable frame="all">
39522 <tgroup cols="4" colsep="0" rowsep="0">
39523 <colspec colwidth="8*" align="left"/>
39524 <colspec colwidth="6*" align="center"/>
39525 <colspec colwidth="6*" align="center"/>
39526 <colspec colwidth="6*" align="right"/>
39527 <tbody>
39528 <row>
39529 <entry><option>timeout</option></entry>
39530 <entry>Use: <emphasis>lmtp</emphasis></entry>
39531 <entry>Type: <emphasis>time</emphasis></entry>
39532 <entry>Default: <emphasis>5m</emphasis></entry>
39533 </row>
39534 </tbody>
39535 </tgroup>
39536 </informaltable>
39537 <para>
39538 The transport is aborted if the created process or Unix domain socket does not
39539 respond to LMTP commands or message input within this timeout. Here is an
39540 example of a typical LMTP transport:
39541 </para>
39542 <literallayout class="monospaced">
39543 lmtp:
39544   driver = lmtp
39545   command = /some/local/lmtp/delivery/program
39546   batch_max = 20
39547   user = exim
39548 </literallayout>
39549 <para>
39550 This delivers up to 20 addresses at a time, in a mixture of domains if
39551 necessary, running as the user <emphasis>exim</emphasis>.
39552 </para>
39553 </chapter>
39554
39555 <chapter id="CHAPpipetransport">
39556 <title>The pipe transport</title>
39557 <para>
39558 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
39559 <primary>transports</primary>
39560 <secondary><command>pipe</command></secondary>
39561 </indexterm>
39562 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
39563 <primary><command>pipe</command> transport</primary>
39564 </indexterm>
39565 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
39566 running in another process. One example is the use of <command>pipe</command> as a
39567 pseudo-remote transport for passing messages to some other delivery mechanism
39568 (such as UUCP). Another is the use by individual users to automatically process
39569 their incoming messages. The <command>pipe</command> transport can be used in one of the
39570 following ways:
39571 </para>
39572 <itemizedlist>
39573 <listitem>
39574 <para>
39575 <indexterm role="variable">
39576 <primary><varname>$local_part</varname></primary>
39577 </indexterm>
39578 A router routes one address to a transport in the normal way, and the
39579 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
39580 contains the local part of the address (as usual), and the command that is run
39581 is specified by the <option>command</option> option on the transport.
39582 </para>
39583 </listitem>
39584 <listitem>
39585 <para>
39586 <indexterm role="variable">
39587 <primary><varname>$pipe_addresses</varname></primary>
39588 </indexterm>
39589 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
39590 transport can handle more than one address in a single run. In this case, when
39591 more than one address is routed to the transport, <varname>$local_part</varname> is not set
39592 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
39593 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
39594 that are routed to the transport.
39595 </para>
39596 </listitem>
39597 <listitem>
39598 <para>
39599 <indexterm role="variable">
39600 <primary><varname>$address_pipe</varname></primary>
39601 </indexterm>
39602 A router redirects an address directly to a pipe command (for example, from an
39603 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
39604 pipe command, and the <option>command</option> option on the transport is ignored. If only
39605 one address is being transported (<option>batch_max</option> is not greater than one, or
39606 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
39607 the local part that was redirected.
39608 </para>
39609 </listitem>
39610 </itemizedlist>
39611 <para>
39612 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
39613 deliver messages over pipes using the LMTP interactive protocol. This is
39614 implemented by the <command>lmtp</command> transport.
39615 </para>
39616 <para>
39617 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
39618 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
39619 other cases, the uid and gid have to be specified explicitly, either on the
39620 transport or on the router that handles the address. Current and <quote>home</quote>
39621 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
39622 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
39623 for a discussion of local delivery batching.
39624 </para>
39625 <section id="SECID140">
39626 <title>Concurrent delivery</title>
39627 <para>
39628 If two messages arrive at almost the same time, and both are routed to a pipe
39629 delivery, the two pipe transports may be run concurrently. You must ensure that
39630 any pipe commands you set up are robust against this happening. If the commands
39631 write to a file, the <option>exim_lock</option> utility might be of use.
39632 </para>
39633 </section>
39634 <section id="SECID141">
39635 <title>Returned status and data</title>
39636 <para>
39637 <indexterm role="concept">
39638 <primary><command>pipe</command> transport</primary>
39639 <secondary>returned data</secondary>
39640 </indexterm>
39641 If the command exits with a non-zero return code, the delivery is deemed to
39642 have failed, unless either the <option>ignore_status</option> option is set (in which case
39643 the return code is treated as zero), or the return code is one of those listed
39644 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
39645 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
39646 logged, but are not included in the bounce message, which merely contains
39647 <quote>local delivery failed</quote>.
39648 </para>
39649 <para>
39650 If the return code is greater than 128 and the command being run is a shell
39651 script, it normally means that the script was terminated by a signal whose
39652 value is the return code minus 128.
39653 </para>
39654 <para>
39655 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
39656 return code is set to 127. This is the value that a shell returns if it is
39657 asked to run a non-existent command. The wording for the log line suggests that
39658 a non-existent command may be the problem.
39659 </para>
39660 <para>
39661 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
39662 set and the command produces any output on its standard output or standard
39663 error streams, the command is considered to have failed, even if it gave a zero
39664 return code or if <option>ignore_status</option> is set. The output from the command is
39665 included as part of the bounce message. The <option>return_fail_output</option> option is
39666 similar, except that output is returned only when the command exits with a
39667 failure return code, that is, a value other than zero or a code that matches
39668 <option>temp_errors</option>.
39669 </para>
39670 </section>
39671 <section id="SECThowcommandrun">
39672 <title>How the command is run</title>
39673 <para>
39674 <indexterm role="concept">
39675 <primary><command>pipe</command> transport</primary>
39676 <secondary>path for command</secondary>
39677 </indexterm>
39678 The command line is (by default) broken down into a command name and arguments
39679 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
39680 <option>restrict_to_path</option> options can be used to restrict the commands that may be
39681 run.
39682 </para>
39683 <para>
39684 <indexterm role="concept">
39685 <primary>quoting</primary>
39686 <secondary>in pipe command</secondary>
39687 </indexterm>
39688 Unquoted arguments are delimited by white space. If an argument appears in
39689 double quotes, backslash is interpreted as an escape character in the usual
39690 way. If an argument appears in single quotes, no escaping is done.
39691 </para>
39692 <para>
39693 String expansion is applied to the command line except when it comes from a
39694 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
39695 expansion is applied to each argument in turn rather than to the whole line.
39696 For this reason, any string expansion item that contains white space must be
39697 quoted so as to be contained within a single argument. A setting such as
39698 </para>
39699 <literallayout class="monospaced">
39700 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
39701 </literallayout>
39702 <para>
39703 will not work, because the expansion item gets split between several
39704 arguments. You have to write
39705 </para>
39706 <literallayout class="monospaced">
39707 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
39708 </literallayout>
39709 <para>
39710 to ensure that it is all in one argument. The expansion is done in this way,
39711 argument by argument, so that the number of arguments cannot be changed as a
39712 result of expansion, and quotes or backslashes in inserted variables do not
39713 interact with external quoting. However, this leads to problems if you want to
39714 generate multiple arguments (or the command name plus arguments) from a single
39715 expansion. In this situation, the simplest solution is to use a shell. For
39716 example:
39717 </para>
39718 <literallayout class="monospaced">
39719 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
39720 </literallayout>
39721 <para>
39722 <indexterm role="concept">
39723 <primary>transport</primary>
39724 <secondary>filter</secondary>
39725 </indexterm>
39726 <indexterm role="concept">
39727 <primary>filter</primary>
39728 <secondary>transport filter</secondary>
39729 </indexterm>
39730 <indexterm role="variable">
39731 <primary><varname>$pipe_addresses</varname></primary>
39732 </indexterm>
39733 Special handling takes place when an argument consists of precisely the text
39734 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
39735 place this string is recognized is when it appears as an argument for a pipe or
39736 transport filter command. It causes each address that is being handled to be
39737 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
39738 avoids any problems with spaces or shell metacharacters, and is of use when a
39739 <command>pipe</command> transport is handling groups of addresses in a batch.
39740 </para>
39741 <para>
39742 After splitting up into arguments and expansion, the resulting command is run
39743 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
39744 message that is being delivered is supplied on the standard input, and the
39745 standard output and standard error are both connected to a single pipe that is
39746 read by Exim. The <option>max_output</option> option controls how much output the command
39747 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
39748 control what is done with it.
39749 </para>
39750 <para>
39751 Not running the command under a shell (by default) lessens the security risks
39752 in cases when a command from a user&#x2019;s filter file is built out of data that was
39753 taken from an incoming message. If a shell is required, it can of course be
39754 explicitly specified as the command to be run. However, there are circumstances
39755 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
39756 under a shell and cannot easily be modified. To allow for these cases, there is
39757 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
39758 works. Instead of breaking up the command line as just described, it expands it
39759 as a single string and passes the result to <filename>/bin/sh</filename>. The
39760 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
39761 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
39762 </para>
39763 </section>
39764 <section id="SECTpipeenv">
39765 <title>Environment variables</title>
39766 <para>
39767 <indexterm role="concept">
39768 <primary><command>pipe</command> transport</primary>
39769 <secondary>environment for command</secondary>
39770 </indexterm>
39771 <indexterm role="concept">
39772 <primary>environment for pipe transport</primary>
39773 </indexterm>
39774 The environment variables listed below are set up when the command is invoked.
39775 This list is a compromise for maximum compatibility with other MTAs. Note that
39776 the <option>environment</option> option can be used to add additional variables to this
39777 environment.
39778 </para>
39779 <literallayout>
39780 <literal>DOMAIN            </literal>   the domain of the address
39781 <literal>HOME              </literal>   the home directory, if set
39782 <literal>HOST              </literal>   the host name when called from a router (see below)
39783 <literal>LOCAL_PART        </literal>   see below
39784 <literal>LOCAL_PART_PREFIX </literal>   see below
39785 <literal>LOCAL_PART_SUFFIX </literal>   see below
39786 <literal>LOGNAME           </literal>   see below
39787 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
39788 <literal>PATH              </literal>   as specified by the <option>path</option> option below
39789 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
39790 <literal>RECIPIENT         </literal>   the complete recipient address
39791 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
39792 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
39793 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
39794 <literal>USER              </literal>   see below
39795 </literallayout>
39796 <para>
39797 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
39798 router, LOCAL_PART is set to the local part of the address. When it is
39799 called as a result of a forward or alias expansion, LOCAL_PART is set to
39800 the local part of the address that was expanded. In both cases, any affixes are
39801 removed from the local part, and made available in LOCAL_PART_PREFIX and
39802 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
39803 same value as LOCAL_PART for compatibility with other MTAs.
39804 </para>
39805 <para>
39806 <indexterm role="concept">
39807 <primary>HOST</primary>
39808 </indexterm>
39809 HOST is set only when a <command>pipe</command> transport is called from a router that
39810 associates hosts with an address, typically when using <command>pipe</command> as a
39811 pseudo-remote transport. HOST is set to the first host name specified by
39812 the router.
39813 </para>
39814 <para>
39815 <indexterm role="concept">
39816 <primary>HOME</primary>
39817 </indexterm>
39818 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
39819 for the HOME environment variable. Otherwise, a home directory may be set
39820 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
39821 user&#x2019;s home directory if <option>check_local_user</option> is set.
39822 </para>
39823 </section>
39824 <section id="SECID142">
39825 <title>Private options for pipe</title>
39826 <para>
39827 <indexterm role="concept">
39828 <primary>options</primary>
39829 <secondary><command>pipe</command> transport</secondary>
39830 </indexterm>
39831 </para>
39832 <para>
39833 <indexterm role="option">
39834 <primary><option>allow_commands</option></primary>
39835 </indexterm>
39836 </para>
39837 <informaltable frame="all">
39838 <tgroup cols="4" colsep="0" rowsep="0">
39839 <colspec colwidth="8*" align="left"/>
39840 <colspec colwidth="6*" align="center"/>
39841 <colspec colwidth="6*" align="center"/>
39842 <colspec colwidth="6*" align="right"/>
39843 <tbody>
39844 <row>
39845 <entry><option>allow_commands</option></entry>
39846 <entry>Use: <emphasis>pipe</emphasis></entry>
39847 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
39848 <entry>Default: <emphasis>unset</emphasis></entry>
39849 </row>
39850 </tbody>
39851 </tgroup>
39852 </informaltable>
39853 <para>
39854 <indexterm role="concept">
39855 <primary><command>pipe</command> transport</primary>
39856 <secondary>permitted commands</secondary>
39857 </indexterm>
39858 The string is expanded, and is then interpreted as a colon-separated list of
39859 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
39860 permitted are those in the <option>allow_commands</option> list. They need not be absolute
39861 paths; the <option>path</option> option is still used for relative paths. If
39862 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
39863 in the <option>allow_commands</option> list, or a name without any slashes that is found on
39864 the path. In other words, if neither <option>allow_commands</option> nor
39865 <option>restrict_to_path</option> is set, there is no restriction on the command, but
39866 otherwise only commands that are permitted by one or the other are allowed. For
39867 example, if
39868 </para>
39869 <literallayout class="monospaced">
39870 allow_commands = /usr/bin/vacation
39871 </literallayout>
39872 <para>
39873 and <option>restrict_to_path</option> is not set, the only permitted command is
39874 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
39875 <option>use_shell</option> is set.
39876 </para>
39877 <para>
39878 <indexterm role="option">
39879 <primary><option>batch_id</option></primary>
39880 </indexterm>
39881 </para>
39882 <informaltable frame="all">
39883 <tgroup cols="4" colsep="0" rowsep="0">
39884 <colspec colwidth="8*" align="left"/>
39885 <colspec colwidth="6*" align="center"/>
39886 <colspec colwidth="6*" align="center"/>
39887 <colspec colwidth="6*" align="right"/>
39888 <tbody>
39889 <row>
39890 <entry><option>batch_id</option></entry>
39891 <entry>Use: <emphasis>pipe</emphasis></entry>
39892 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39893 <entry>Default: <emphasis>unset</emphasis></entry>
39894 </row>
39895 </tbody>
39896 </tgroup>
39897 </informaltable>
39898 <para>
39899 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39900 </para>
39901 <para>
39902 <indexterm role="option">
39903 <primary><option>batch_max</option></primary>
39904 </indexterm>
39905 </para>
39906 <informaltable frame="all">
39907 <tgroup cols="4" colsep="0" rowsep="0">
39908 <colspec colwidth="8*" align="left"/>
39909 <colspec colwidth="6*" align="center"/>
39910 <colspec colwidth="6*" align="center"/>
39911 <colspec colwidth="6*" align="right"/>
39912 <tbody>
39913 <row>
39914 <entry><option>batch_max</option></entry>
39915 <entry>Use: <emphasis>pipe</emphasis></entry>
39916 <entry>Type: <emphasis>integer</emphasis></entry>
39917 <entry>Default: <emphasis>1</emphasis></entry>
39918 </row>
39919 </tbody>
39920 </tgroup>
39921 </informaltable>
39922 <para>
39923 This limits the number of addresses that can be handled in a single delivery.
39924 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39925 </para>
39926 <para>
39927 <indexterm role="option">
39928 <primary><option>check_string</option></primary>
39929 </indexterm>
39930 </para>
39931 <informaltable frame="all">
39932 <tgroup cols="4" colsep="0" rowsep="0">
39933 <colspec colwidth="8*" align="left"/>
39934 <colspec colwidth="6*" align="center"/>
39935 <colspec colwidth="6*" align="center"/>
39936 <colspec colwidth="6*" align="right"/>
39937 <tbody>
39938 <row>
39939 <entry><option>check_string</option></entry>
39940 <entry>Use: <emphasis>pipe</emphasis></entry>
39941 <entry>Type: <emphasis>string</emphasis></entry>
39942 <entry>Default: <emphasis>unset</emphasis></entry>
39943 </row>
39944 </tbody>
39945 </tgroup>
39946 </informaltable>
39947 <para>
39948 As <command>pipe</command> writes the message, the start of each line is tested for matching
39949 <option>check_string</option>, and if it does, the initial matching characters are replaced
39950 by the contents of <option>escape_string</option>, provided both are set. The value of
39951 <option>check_string</option> is a literal string, not a regular expression, and the case of
39952 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
39953 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
39954 the SMTP escaping protocol. Any settings made in the configuration file are
39955 ignored.
39956 </para>
39957 <para>
39958 <indexterm role="option">
39959 <primary><option>command</option></primary>
39960 </indexterm>
39961 </para>
39962 <informaltable frame="all">
39963 <tgroup cols="4" colsep="0" rowsep="0">
39964 <colspec colwidth="8*" align="left"/>
39965 <colspec colwidth="6*" align="center"/>
39966 <colspec colwidth="6*" align="center"/>
39967 <colspec colwidth="6*" align="right"/>
39968 <tbody>
39969 <row>
39970 <entry><option>command</option></entry>
39971 <entry>Use: <emphasis>pipe</emphasis></entry>
39972 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39973 <entry>Default: <emphasis>unset</emphasis></entry>
39974 </row>
39975 </tbody>
39976 </tgroup>
39977 </informaltable>
39978 <para>
39979 This option need not be set when <command>pipe</command> is being used to deliver to pipes
39980 obtained directly from address redirections. In other cases, the option must be
39981 set, to provide a command to be run. It need not yield an absolute path (see
39982 the <option>path</option> option below). The command is split up into separate arguments by
39983 Exim, and each argument is separately expanded, as described in section
39984 <xref linkend="SECThowcommandrun"/> above.
39985 </para>
39986 <para>
39987 <indexterm role="option">
39988 <primary><option>environment</option></primary>
39989 </indexterm>
39990 </para>
39991 <informaltable frame="all">
39992 <tgroup cols="4" colsep="0" rowsep="0">
39993 <colspec colwidth="8*" align="left"/>
39994 <colspec colwidth="6*" align="center"/>
39995 <colspec colwidth="6*" align="center"/>
39996 <colspec colwidth="6*" align="right"/>
39997 <tbody>
39998 <row>
39999 <entry><option>environment</option></entry>
40000 <entry>Use: <emphasis>pipe</emphasis></entry>
40001 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40002 <entry>Default: <emphasis>unset</emphasis></entry>
40003 </row>
40004 </tbody>
40005 </tgroup>
40006 </informaltable>
40007 <para>
40008 <indexterm role="concept">
40009 <primary><command>pipe</command> transport</primary>
40010 <secondary>environment for command</secondary>
40011 </indexterm>
40012 <indexterm role="concept">
40013 <primary>environment for <command>pipe</command> transport</primary>
40014 </indexterm>
40015 This option is used to add additional variables to the environment in which the
40016 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
40017 a string which is expanded, and then interpreted as a colon-separated list of
40018 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
40019 </para>
40020 <para>
40021 <indexterm role="option">
40022 <primary><option>escape_string</option></primary>
40023 </indexterm>
40024 </para>
40025 <informaltable frame="all">
40026 <tgroup cols="4" colsep="0" rowsep="0">
40027 <colspec colwidth="8*" align="left"/>
40028 <colspec colwidth="6*" align="center"/>
40029 <colspec colwidth="6*" align="center"/>
40030 <colspec colwidth="6*" align="right"/>
40031 <tbody>
40032 <row>
40033 <entry><option>escape_string</option></entry>
40034 <entry>Use: <emphasis>pipe</emphasis></entry>
40035 <entry>Type: <emphasis>string</emphasis></entry>
40036 <entry>Default: <emphasis>unset</emphasis></entry>
40037 </row>
40038 </tbody>
40039 </tgroup>
40040 </informaltable>
40041 <para>
40042 See <option>check_string</option> above.
40043 </para>
40044 <para>
40045 <indexterm role="option">
40046 <primary><option>freeze_exec_fail</option></primary>
40047 </indexterm>
40048 </para>
40049 <informaltable frame="all">
40050 <tgroup cols="4" colsep="0" rowsep="0">
40051 <colspec colwidth="8*" align="left"/>
40052 <colspec colwidth="6*" align="center"/>
40053 <colspec colwidth="6*" align="center"/>
40054 <colspec colwidth="6*" align="right"/>
40055 <tbody>
40056 <row>
40057 <entry><option>freeze_exec_fail</option></entry>
40058 <entry>Use: <emphasis>pipe</emphasis></entry>
40059 <entry>Type: <emphasis>boolean</emphasis></entry>
40060 <entry>Default: <emphasis>false</emphasis></entry>
40061 </row>
40062 </tbody>
40063 </tgroup>
40064 </informaltable>
40065 <para>
40066 <indexterm role="concept">
40067 <primary>exec failure</primary>
40068 </indexterm>
40069 <indexterm role="concept">
40070 <primary>failure of exec</primary>
40071 </indexterm>
40072 <indexterm role="concept">
40073 <primary><command>pipe</command> transport</primary>
40074 <secondary>failure of exec</secondary>
40075 </indexterm>
40076 Failure to exec the command in a pipe transport is by default treated like
40077 any other failure while running the command. However, if <option>freeze_exec_fail</option>
40078 is set, failure to exec is treated specially, and causes the message to be
40079 frozen, whatever the setting of <option>ignore_status</option>.
40080 </para>
40081 <para>
40082 <indexterm role="option">
40083 <primary><option>ignore_status</option></primary>
40084 </indexterm>
40085 </para>
40086 <informaltable frame="all">
40087 <tgroup cols="4" colsep="0" rowsep="0">
40088 <colspec colwidth="8*" align="left"/>
40089 <colspec colwidth="6*" align="center"/>
40090 <colspec colwidth="6*" align="center"/>
40091 <colspec colwidth="6*" align="right"/>
40092 <tbody>
40093 <row>
40094 <entry><option>ignore_status</option></entry>
40095 <entry>Use: <emphasis>pipe</emphasis></entry>
40096 <entry>Type: <emphasis>boolean</emphasis></entry>
40097 <entry>Default: <emphasis>false</emphasis></entry>
40098 </row>
40099 </tbody>
40100 </tgroup>
40101 </informaltable>
40102 <para>
40103 If this option is true, the status returned by the subprocess that is set up to
40104 run the command is ignored, and Exim behaves as if zero had been returned.
40105 Otherwise, a non-zero status or termination by signal causes an error return
40106 from the transport unless the status value is one of those listed in
40107 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
40108 </para>
40109 <para>
40110 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
40111 See the <option>timeout_defer</option> option for how timeouts are handled.
40112 </para>
40113 <para>
40114 <indexterm role="option">
40115 <primary><option>log_defer_output</option></primary>
40116 </indexterm>
40117 </para>
40118 <informaltable frame="all">
40119 <tgroup cols="4" colsep="0" rowsep="0">
40120 <colspec colwidth="8*" align="left"/>
40121 <colspec colwidth="6*" align="center"/>
40122 <colspec colwidth="6*" align="center"/>
40123 <colspec colwidth="6*" align="right"/>
40124 <tbody>
40125 <row>
40126 <entry><option>log_defer_output</option></entry>
40127 <entry>Use: <emphasis>pipe</emphasis></entry>
40128 <entry>Type: <emphasis>boolean</emphasis></entry>
40129 <entry>Default: <emphasis>false</emphasis></entry>
40130 </row>
40131 </tbody>
40132 </tgroup>
40133 </informaltable>
40134 <para>
40135 <indexterm role="concept">
40136 <primary><command>pipe</command> transport</primary>
40137 <secondary>logging output</secondary>
40138 </indexterm>
40139 If this option is set, and the status returned by the command is
40140 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
40141 and any output was produced, the first line of it is written to the main log.
40142 </para>
40143 <para>
40144 <indexterm role="option">
40145 <primary><option>log_fail_output</option></primary>
40146 </indexterm>
40147 </para>
40148 <informaltable frame="all">
40149 <tgroup cols="4" colsep="0" rowsep="0">
40150 <colspec colwidth="8*" align="left"/>
40151 <colspec colwidth="6*" align="center"/>
40152 <colspec colwidth="6*" align="center"/>
40153 <colspec colwidth="6*" align="right"/>
40154 <tbody>
40155 <row>
40156 <entry><option>log_fail_output</option></entry>
40157 <entry>Use: <emphasis>pipe</emphasis></entry>
40158 <entry>Type: <emphasis>boolean</emphasis></entry>
40159 <entry>Default: <emphasis>false</emphasis></entry>
40160 </row>
40161 </tbody>
40162 </tgroup>
40163 </informaltable>
40164 <para>
40165 If this option is set, and the command returns any output, and also ends with a
40166 return code that is neither zero nor one of the return codes listed in
40167 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
40168 written to the main log. This option and <option>log_output</option> are mutually exclusive.
40169 Only one of them may be set.
40170 </para>
40171 <para>
40172 <indexterm role="option">
40173 <primary><option>log_output</option></primary>
40174 </indexterm>
40175 </para>
40176 <informaltable frame="all">
40177 <tgroup cols="4" colsep="0" rowsep="0">
40178 <colspec colwidth="8*" align="left"/>
40179 <colspec colwidth="6*" align="center"/>
40180 <colspec colwidth="6*" align="center"/>
40181 <colspec colwidth="6*" align="right"/>
40182 <tbody>
40183 <row>
40184 <entry><option>log_output</option></entry>
40185 <entry>Use: <emphasis>pipe</emphasis></entry>
40186 <entry>Type: <emphasis>boolean</emphasis></entry>
40187 <entry>Default: <emphasis>false</emphasis></entry>
40188 </row>
40189 </tbody>
40190 </tgroup>
40191 </informaltable>
40192 <para>
40193 If this option is set and the command returns any output, the first line of
40194 output is written to the main log, whatever the return code. This option and
40195 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
40196 </para>
40197 <para>
40198 <indexterm role="option">
40199 <primary><option>max_output</option></primary>
40200 </indexterm>
40201 </para>
40202 <informaltable frame="all">
40203 <tgroup cols="4" colsep="0" rowsep="0">
40204 <colspec colwidth="8*" align="left"/>
40205 <colspec colwidth="6*" align="center"/>
40206 <colspec colwidth="6*" align="center"/>
40207 <colspec colwidth="6*" align="right"/>
40208 <tbody>
40209 <row>
40210 <entry><option>max_output</option></entry>
40211 <entry>Use: <emphasis>pipe</emphasis></entry>
40212 <entry>Type: <emphasis>integer</emphasis></entry>
40213 <entry>Default: <emphasis>20K</emphasis></entry>
40214 </row>
40215 </tbody>
40216 </tgroup>
40217 </informaltable>
40218 <para>
40219 This specifies the maximum amount of output that the command may produce on its
40220 standard output and standard error file combined. If the limit is exceeded, the
40221 process running the command is killed. This is intended as a safety measure to
40222 catch runaway processes. The limit is applied independently of the settings of
40223 the options that control what is done with such output (for example,
40224 <option>return_output</option>). Because of buffering effects, the amount of output may
40225 exceed the limit by a small amount before Exim notices.
40226 </para>
40227 <para>
40228 <indexterm role="option">
40229 <primary><option>message_prefix</option></primary>
40230 </indexterm>
40231 </para>
40232 <informaltable frame="all">
40233 <tgroup cols="4" colsep="0" rowsep="0">
40234 <colspec colwidth="8*" align="left"/>
40235 <colspec colwidth="6*" align="center"/>
40236 <colspec colwidth="6*" align="center"/>
40237 <colspec colwidth="6*" align="right"/>
40238 <tbody>
40239 <row>
40240 <entry><option>message_prefix</option></entry>
40241 <entry>Use: <emphasis>pipe</emphasis></entry>
40242 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40243 <entry>Default: <emphasis>see below</emphasis></entry>
40244 </row>
40245 </tbody>
40246 </tgroup>
40247 </informaltable>
40248 <para>
40249 The string specified here is expanded and output at the start of every message.
40250 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
40251 </para>
40252 <literallayout class="monospaced">
40253 message_prefix = \
40254   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
40255   ${tod_bsdinbox}\n
40256 </literallayout>
40257 <para>
40258 <indexterm role="concept">
40259 <primary>Cyrus</primary>
40260 </indexterm>
40261 <indexterm role="concept">
40262 <primary><option>tmail</option></primary>
40263 </indexterm>
40264 <indexterm role="concept">
40265 <primary><quote>From</quote> line</primary>
40266 </indexterm>
40267 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
40268 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
40269 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
40270 setting
40271 </para>
40272 <literallayout class="monospaced">
40273 message_prefix =
40274 </literallayout>
40275 <para>
40276 <indexterm role="option">
40277 <primary><option>message_suffix</option></primary>
40278 </indexterm>
40279 </para>
40280 <informaltable frame="all">
40281 <tgroup cols="4" colsep="0" rowsep="0">
40282 <colspec colwidth="8*" align="left"/>
40283 <colspec colwidth="6*" align="center"/>
40284 <colspec colwidth="6*" align="center"/>
40285 <colspec colwidth="6*" align="right"/>
40286 <tbody>
40287 <row>
40288 <entry><option>message_suffix</option></entry>
40289 <entry>Use: <emphasis>pipe</emphasis></entry>
40290 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40291 <entry>Default: <emphasis>see below</emphasis></entry>
40292 </row>
40293 </tbody>
40294 </tgroup>
40295 </informaltable>
40296 <para>
40297 The string specified here is expanded and output at the end of every message.
40298 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
40299 The suffix can be suppressed by setting
40300 </para>
40301 <literallayout class="monospaced">
40302 message_suffix =
40303 </literallayout>
40304 <para>
40305 <indexterm role="option">
40306 <primary><option>path</option></primary>
40307 </indexterm>
40308 </para>
40309 <informaltable frame="all">
40310 <tgroup cols="4" colsep="0" rowsep="0">
40311 <colspec colwidth="8*" align="left"/>
40312 <colspec colwidth="6*" align="center"/>
40313 <colspec colwidth="6*" align="center"/>
40314 <colspec colwidth="6*" align="right"/>
40315 <tbody>
40316 <row>
40317 <entry><option>path</option></entry>
40318 <entry>Use: <emphasis>pipe</emphasis></entry>
40319 <entry>Type: <emphasis>string</emphasis></entry>
40320 <entry>Default: <emphasis>see below</emphasis></entry>
40321 </row>
40322 </tbody>
40323 </tgroup>
40324 </informaltable>
40325 <para>
40326 This option specifies the string that is set up in the PATH environment
40327 variable of the subprocess. The default is:
40328 </para>
40329 <literallayout class="monospaced">
40330 /bin:/usr/bin
40331 </literallayout>
40332 <para>
40333 If the <option>command</option> option does not yield an absolute path name, the command is
40334 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
40335 apply to a command specified as a transport filter.
40336 </para>
40337 <para>
40338 <indexterm role="option">
40339 <primary><option>pipe_as_creator</option></primary>
40340 </indexterm>
40341 </para>
40342 <informaltable frame="all">
40343 <tgroup cols="4" colsep="0" rowsep="0">
40344 <colspec colwidth="8*" align="left"/>
40345 <colspec colwidth="6*" align="center"/>
40346 <colspec colwidth="6*" align="center"/>
40347 <colspec colwidth="6*" align="right"/>
40348 <tbody>
40349 <row>
40350 <entry><option>pipe_as_creator</option></entry>
40351 <entry>Use: <emphasis>pipe</emphasis></entry>
40352 <entry>Type: <emphasis>boolean</emphasis></entry>
40353 <entry>Default: <emphasis>false</emphasis></entry>
40354 </row>
40355 </tbody>
40356 </tgroup>
40357 </informaltable>
40358 <para>
40359 <indexterm role="concept">
40360 <primary>uid (user id)</primary>
40361 <secondary>local delivery</secondary>
40362 </indexterm>
40363 If the generic <option>user</option> option is not set and this option is true, the delivery
40364 process is run under the uid that was in force when Exim was originally called
40365 to accept the message. If the group id is not otherwise set (via the generic
40366 <option>group</option> option), the gid that was in force when Exim was originally called to
40367 accept the message is used.
40368 </para>
40369 <para>
40370 <indexterm role="option">
40371 <primary><option>restrict_to_path</option></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="6*" align="center"/>
40378 <colspec colwidth="6*" align="center"/>
40379 <colspec colwidth="6*" align="right"/>
40380 <tbody>
40381 <row>
40382 <entry><option>restrict_to_path</option></entry>
40383 <entry>Use: <emphasis>pipe</emphasis></entry>
40384 <entry>Type: <emphasis>boolean</emphasis></entry>
40385 <entry>Default: <emphasis>false</emphasis></entry>
40386 </row>
40387 </tbody>
40388 </tgroup>
40389 </informaltable>
40390 <para>
40391 When this option is set, any command name not listed in <option>allow_commands</option> must
40392 contain no slashes. The command is searched for only in the directories listed
40393 in the <option>path</option> option. This option is intended for use in the case when a pipe
40394 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
40395 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
40396 </para>
40397 <para>
40398 <indexterm role="option">
40399 <primary><option>return_fail_output</option></primary>
40400 </indexterm>
40401 </para>
40402 <informaltable frame="all">
40403 <tgroup cols="4" colsep="0" rowsep="0">
40404 <colspec colwidth="8*" align="left"/>
40405 <colspec colwidth="6*" align="center"/>
40406 <colspec colwidth="6*" align="center"/>
40407 <colspec colwidth="6*" align="right"/>
40408 <tbody>
40409 <row>
40410 <entry><option>return_fail_output</option></entry>
40411 <entry>Use: <emphasis>pipe</emphasis></entry>
40412 <entry>Type: <emphasis>boolean</emphasis></entry>
40413 <entry>Default: <emphasis>false</emphasis></entry>
40414 </row>
40415 </tbody>
40416 </tgroup>
40417 </informaltable>
40418 <para>
40419 If this option is true, and the command produced any output and ended with a
40420 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
40421 is, the delivery failed), the output is returned in the bounce message.
40422 However, if the message has a null sender (that is, it is itself a bounce
40423 message), output from the command is discarded. This option and
40424 <option>return_output</option> are mutually exclusive. Only one of them may be set.
40425 </para>
40426 <para>
40427 <indexterm role="option">
40428 <primary><option>return_output</option></primary>
40429 </indexterm>
40430 </para>
40431 <informaltable frame="all">
40432 <tgroup cols="4" colsep="0" rowsep="0">
40433 <colspec colwidth="8*" align="left"/>
40434 <colspec colwidth="6*" align="center"/>
40435 <colspec colwidth="6*" align="center"/>
40436 <colspec colwidth="6*" align="right"/>
40437 <tbody>
40438 <row>
40439 <entry><option>return_output</option></entry>
40440 <entry>Use: <emphasis>pipe</emphasis></entry>
40441 <entry>Type: <emphasis>boolean</emphasis></entry>
40442 <entry>Default: <emphasis>false</emphasis></entry>
40443 </row>
40444 </tbody>
40445 </tgroup>
40446 </informaltable>
40447 <para>
40448 If this option is true, and the command produced any output, the delivery is
40449 deemed to have failed whatever the return code from the command, and the output
40450 is returned in the bounce message. Otherwise, the output is just discarded.
40451 However, if the message has a null sender (that is, it is a bounce message),
40452 output from the command is always discarded, whatever the setting of this
40453 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
40454 of them may be set.
40455 </para>
40456 <para>
40457 <indexterm role="option">
40458 <primary><option>temp_errors</option></primary>
40459 </indexterm>
40460 </para>
40461 <informaltable frame="all">
40462 <tgroup cols="4" colsep="0" rowsep="0">
40463 <colspec colwidth="8*" align="left"/>
40464 <colspec colwidth="6*" align="center"/>
40465 <colspec colwidth="6*" align="center"/>
40466 <colspec colwidth="6*" align="right"/>
40467 <tbody>
40468 <row>
40469 <entry><option>temp_errors</option></entry>
40470 <entry>Use: <emphasis>pipe</emphasis></entry>
40471 <entry>Type: <emphasis>string list</emphasis></entry>
40472 <entry>Default: <emphasis>see below</emphasis></entry>
40473 </row>
40474 </tbody>
40475 </tgroup>
40476 </informaltable>
40477 <para>
40478 <indexterm role="concept">
40479 <primary><command>pipe</command> transport</primary>
40480 <secondary>temporary failure</secondary>
40481 </indexterm>
40482 This option contains either a colon-separated list of numbers, or a single
40483 asterisk. If <option>ignore_status</option> is false
40484 and <option>return_output</option> is not set,
40485 and the command exits with a non-zero return code, the failure is treated as
40486 temporary and the delivery is deferred if the return code matches one of the
40487 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
40488 codes are treated as permanent errors. The default setting contains the codes
40489 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
40490 compiled on a system that does not define these macros, it assumes values of 75
40491 and 73, respectively.
40492 </para>
40493 <para>
40494 <indexterm role="option">
40495 <primary><option>timeout</option></primary>
40496 </indexterm>
40497 </para>
40498 <informaltable frame="all">
40499 <tgroup cols="4" colsep="0" rowsep="0">
40500 <colspec colwidth="8*" align="left"/>
40501 <colspec colwidth="6*" align="center"/>
40502 <colspec colwidth="6*" align="center"/>
40503 <colspec colwidth="6*" align="right"/>
40504 <tbody>
40505 <row>
40506 <entry><option>timeout</option></entry>
40507 <entry>Use: <emphasis>pipe</emphasis></entry>
40508 <entry>Type: <emphasis>time</emphasis></entry>
40509 <entry>Default: <emphasis>1h</emphasis></entry>
40510 </row>
40511 </tbody>
40512 </tgroup>
40513 </informaltable>
40514 <para>
40515 If the command fails to complete within this time, it is killed. This normally
40516 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
40517 specifies no timeout. In order to ensure that any subprocesses created by the
40518 command are also killed, Exim makes the initial process a process group leader,
40519 and kills the whole process group on a timeout. However, this can be defeated
40520 if one of the processes starts a new process group.
40521 </para>
40522 <para>
40523 <indexterm role="option">
40524 <primary><option>timeout_defer</option></primary>
40525 </indexterm>
40526 </para>
40527 <informaltable frame="all">
40528 <tgroup cols="4" colsep="0" rowsep="0">
40529 <colspec colwidth="8*" align="left"/>
40530 <colspec colwidth="6*" align="center"/>
40531 <colspec colwidth="6*" align="center"/>
40532 <colspec colwidth="6*" align="right"/>
40533 <tbody>
40534 <row>
40535 <entry><option>timeout_defer</option></entry>
40536 <entry>Use: <emphasis>pipe</emphasis></entry>
40537 <entry>Type: <emphasis>boolean</emphasis></entry>
40538 <entry>Default: <emphasis>false</emphasis></entry>
40539 </row>
40540 </tbody>
40541 </tgroup>
40542 </informaltable>
40543 <para>
40544 A timeout in a <command>pipe</command> transport, either in the command that the transport
40545 runs, or in a transport filter that is associated with it, is by default
40546 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
40547 is set true, both kinds of timeout become temporary errors, causing the
40548 delivery to be deferred.
40549 </para>
40550 <para>
40551 <indexterm role="option">
40552 <primary><option>umask</option></primary>
40553 </indexterm>
40554 </para>
40555 <informaltable frame="all">
40556 <tgroup cols="4" colsep="0" rowsep="0">
40557 <colspec colwidth="8*" align="left"/>
40558 <colspec colwidth="6*" align="center"/>
40559 <colspec colwidth="6*" align="center"/>
40560 <colspec colwidth="6*" align="right"/>
40561 <tbody>
40562 <row>
40563 <entry><option>umask</option></entry>
40564 <entry>Use: <emphasis>pipe</emphasis></entry>
40565 <entry>Type: <emphasis>octal integer</emphasis></entry>
40566 <entry>Default: <emphasis>022</emphasis></entry>
40567 </row>
40568 </tbody>
40569 </tgroup>
40570 </informaltable>
40571 <para>
40572 This specifies the umask setting for the subprocess that runs the command.
40573 </para>
40574 <para>
40575 <indexterm role="option">
40576 <primary><option>use_bsmtp</option></primary>
40577 </indexterm>
40578 </para>
40579 <informaltable frame="all">
40580 <tgroup cols="4" colsep="0" rowsep="0">
40581 <colspec colwidth="8*" align="left"/>
40582 <colspec colwidth="6*" align="center"/>
40583 <colspec colwidth="6*" align="center"/>
40584 <colspec colwidth="6*" align="right"/>
40585 <tbody>
40586 <row>
40587 <entry><option>use_bsmtp</option></entry>
40588 <entry>Use: <emphasis>pipe</emphasis></entry>
40589 <entry>Type: <emphasis>boolean</emphasis></entry>
40590 <entry>Default: <emphasis>false</emphasis></entry>
40591 </row>
40592 </tbody>
40593 </tgroup>
40594 </informaltable>
40595 <para>
40596 <indexterm role="concept">
40597 <primary>envelope sender</primary>
40598 </indexterm>
40599 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
40600 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
40601 commands. If you want to include a leading HELO command with such messages,
40602 you can do so by setting the <option>message_prefix</option> option. See section
40603 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
40604 </para>
40605 <para>
40606 <indexterm role="option">
40607 <primary><option>use_classresources</option></primary>
40608 </indexterm>
40609 </para>
40610 <informaltable frame="all">
40611 <tgroup cols="4" colsep="0" rowsep="0">
40612 <colspec colwidth="8*" align="left"/>
40613 <colspec colwidth="6*" align="center"/>
40614 <colspec colwidth="6*" align="center"/>
40615 <colspec colwidth="6*" align="right"/>
40616 <tbody>
40617 <row>
40618 <entry><option>use_classresources</option></entry>
40619 <entry>Use: <emphasis>pipe</emphasis></entry>
40620 <entry>Type: <emphasis>boolean</emphasis></entry>
40621 <entry>Default: <emphasis>false</emphasis></entry>
40622 </row>
40623 </tbody>
40624 </tgroup>
40625 </informaltable>
40626 <para>
40627 <indexterm role="concept">
40628 <primary>class resources (BSD)</primary>
40629 </indexterm>
40630 This option is available only when Exim is running on FreeBSD, NetBSD, or
40631 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
40632 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
40633 limits for the uid under which the pipe is to run are obtained from the login
40634 class database.
40635 </para>
40636 <para>
40637 <indexterm role="option">
40638 <primary><option>use_crlf</option></primary>
40639 </indexterm>
40640 </para>
40641 <informaltable frame="all">
40642 <tgroup cols="4" colsep="0" rowsep="0">
40643 <colspec colwidth="8*" align="left"/>
40644 <colspec colwidth="6*" align="center"/>
40645 <colspec colwidth="6*" align="center"/>
40646 <colspec colwidth="6*" align="right"/>
40647 <tbody>
40648 <row>
40649 <entry><option>use_crlf</option></entry>
40650 <entry>Use: <emphasis>pipe</emphasis></entry>
40651 <entry>Type: <emphasis>boolean</emphasis></entry>
40652 <entry>Default: <emphasis>false</emphasis></entry>
40653 </row>
40654 </tbody>
40655 </tgroup>
40656 </informaltable>
40657 <para>
40658 <indexterm role="concept">
40659 <primary>carriage return</primary>
40660 </indexterm>
40661 <indexterm role="concept">
40662 <primary>linefeed</primary>
40663 </indexterm>
40664 This option causes lines to be terminated with the two-character CRLF sequence
40665 (carriage return, linefeed) instead of just a linefeed character. In the case
40666 of batched SMTP, the byte sequence written to the pipe is then an exact image
40667 of what would be sent down a real SMTP connection.
40668 </para>
40669 <para>
40670 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
40671 written verbatim, so must contain their own carriage return characters if these
40672 are needed. Since the default values for both <option>message_prefix</option> and
40673 <option>message_suffix</option> end with a single linefeed, their values must be changed to
40674 end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
40675 </para>
40676 <para>
40677 <indexterm role="option">
40678 <primary><option>use_shell</option></primary>
40679 </indexterm>
40680 </para>
40681 <informaltable frame="all">
40682 <tgroup cols="4" colsep="0" rowsep="0">
40683 <colspec colwidth="8*" align="left"/>
40684 <colspec colwidth="6*" align="center"/>
40685 <colspec colwidth="6*" align="center"/>
40686 <colspec colwidth="6*" align="right"/>
40687 <tbody>
40688 <row>
40689 <entry><option>use_shell</option></entry>
40690 <entry>Use: <emphasis>pipe</emphasis></entry>
40691 <entry>Type: <emphasis>boolean</emphasis></entry>
40692 <entry>Default: <emphasis>false</emphasis></entry>
40693 </row>
40694 </tbody>
40695 </tgroup>
40696 </informaltable>
40697 <para>
40698 <indexterm role="variable">
40699 <primary><varname>$pipe_addresses</varname></primary>
40700 </indexterm>
40701 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
40702 instead of being run directly from the transport, as described in section
40703 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
40704 where the command is expected to be run under a shell and cannot easily be
40705 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
40706 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
40707 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
40708 its <option>-c</option> option.
40709 </para>
40710 </section>
40711 <section id="SECID143">
40712 <title>Using an external local delivery agent</title>
40713 <para>
40714 <indexterm role="concept">
40715 <primary>local delivery</primary>
40716 <secondary>using an external agent</secondary>
40717 </indexterm>
40718 <indexterm role="concept">
40719 <primary><emphasis>procmail</emphasis></primary>
40720 </indexterm>
40721 <indexterm role="concept">
40722 <primary>external local delivery</primary>
40723 </indexterm>
40724 <indexterm role="concept">
40725 <primary>delivery</primary>
40726 <secondary><emphasis>procmail</emphasis></secondary>
40727 </indexterm>
40728 <indexterm role="concept">
40729 <primary>delivery</primary>
40730 <secondary>by external agent</secondary>
40731 </indexterm>
40732 The <command>pipe</command> transport can be used to pass all messages that require local
40733 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
40734 this, care must be taken to ensure that the pipe is run under an appropriate
40735 uid and gid. In some configurations one wants this to be a uid that is trusted
40736 by the delivery agent to supply the correct sender of the message. It may be
40737 necessary to recompile or reconfigure the delivery agent so that it trusts an
40738 appropriate user. The following is an example transport and router
40739 configuration for <option>procmail</option>:
40740 </para>
40741 <literallayout class="monospaced">
40742 # transport
40743 procmail_pipe:
40744   driver = pipe
40745   command = /usr/local/bin/procmail -d $local_part
40746   return_path_add
40747   delivery_date_add
40748   envelope_to_add
40749   check_string = "From "
40750   escape_string = "&gt;From "
40751   user = $local_part
40752   group = mail
40753
40754 # router
40755 procmail:
40756   driver = accept
40757   check_local_user
40758   transport = procmail_pipe
40759 </literallayout>
40760 <para>
40761 In this example, the pipe is run as the local user, but with the group set to
40762 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
40763 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
40764 user to supply a correct sender address. If you do not specify either a
40765 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
40766 home directory is the user&#x2019;s home directory by default.
40767 </para>
40768 <para>
40769 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
40770 </para>
40771 <literallayout class="monospaced">
40772 IFS=" "
40773 </literallayout>
40774 <para>
40775 as shown in some <option>procmail</option> documentation, because Exim does not by default
40776 use a shell to run pipe commands.
40777 </para>
40778 <para>
40779 <indexterm role="concept">
40780 <primary>Cyrus</primary>
40781 </indexterm>
40782 The next example shows a transport and a router for a system where local
40783 deliveries are handled by the Cyrus IMAP server.
40784 </para>
40785 <literallayout class="monospaced">
40786 # transport
40787 local_delivery_cyrus:
40788   driver = pipe
40789   command = /usr/cyrus/bin/deliver \
40790             -m ${substr_1:$local_part_suffix} -- $local_part
40791   user = cyrus
40792   group = mail
40793   return_output
40794   log_output
40795   message_prefix =
40796   message_suffix =
40797
40798 # router
40799 local_user_cyrus:
40800   driver = accept
40801   check_local_user
40802   local_part_suffix = .*
40803   transport = local_delivery_cyrus
40804 </literallayout>
40805 <para>
40806 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
40807 <option>return_output</option> to cause any text written by Cyrus to be returned to the
40808 sender.
40809 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
40810 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
40811 </para>
40812 </section>
40813 </chapter>
40814
40815 <chapter id="CHAPsmtptrans">
40816 <title>The smtp transport</title>
40817 <para>
40818 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
40819 <primary>transports</primary>
40820 <secondary><command>smtp</command></secondary>
40821 </indexterm>
40822 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
40823 <primary><command>smtp</command> transport</primary>
40824 </indexterm>
40825 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
40826 or LMTP protocol. The list of hosts to try can either be taken from the address
40827 that is being processed (having been set up by the router), or specified
40828 explicitly for the transport. Timeout and retry processing (see chapter
40829 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
40830 </para>
40831 <section id="SECID144">
40832 <title>Multiple messages on a single connection</title>
40833 <para>
40834 The sending of multiple messages over a single TCP/IP connection can arise in
40835 two ways:
40836 </para>
40837 <itemizedlist>
40838 <listitem>
40839 <para>
40840 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
40841 routed to the same host, more than one copy of the message has to be sent to
40842 that host. In this situation, multiple copies may be sent in a single run of
40843 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
40844 does when it has too many addresses to send in one message also depends on the
40845 value of the global <option>remote_max_parallel</option> option. Details are given in
40846 section <xref linkend="SECToutSMTPTCP"/>.)
40847 </para>
40848 </listitem>
40849 <listitem>
40850 <para>
40851 <indexterm role="concept">
40852 <primary>hints database</primary>
40853 <secondary>remembering routing</secondary>
40854 </indexterm>
40855 When a message has been successfully delivered over a TCP/IP connection, Exim
40856 looks in its hints database to see if there are any other messages awaiting a
40857 connection to the same host. If there are, a new delivery process is started
40858 for one of them, and the current TCP/IP connection is passed on to it. The new
40859 process may in turn send multiple copies and possibly create yet another
40860 process.
40861 </para>
40862 </listitem>
40863 </itemizedlist>
40864 <para>
40865 For each copy sent over the same TCP/IP connection, a sequence counter is
40866 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
40867 no further messages are sent over that connection.
40868 </para>
40869 </section>
40870 <section id="SECID145">
40871 <title>Use of the $host variable</title>
40872 <para>
40873 <indexterm role="variable">
40874 <primary><varname>$host</varname></primary>
40875 </indexterm>
40876 <indexterm role="variable">
40877 <primary><varname>$host_address</varname></primary>
40878 </indexterm>
40879 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
40880 <varname>$host_address</varname> are the name and IP address of the first host on the host list
40881 passed by the router. However, when the transport is about to connect to a
40882 specific host, and while it is connected to that host, <varname>$host</varname> and
40883 <varname>$host_address</varname> are set to the values for that host. These are the values
40884 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
40885 <option>serialize_hosts</option>, and the various TLS options are expanded.
40886 </para>
40887 </section>
40888 <section id="SECID146">
40889 <title>Private options for smtp</title>
40890 <para>
40891 <indexterm role="concept">
40892 <primary>options</primary>
40893 <secondary><command>smtp</command> transport</secondary>
40894 </indexterm>
40895 The private options of the <command>smtp</command> transport are as follows:
40896 </para>
40897 <para>
40898 <indexterm role="option">
40899 <primary><option>address_retry_include_sender</option></primary>
40900 </indexterm>
40901 </para>
40902 <informaltable frame="all">
40903 <tgroup cols="4" colsep="0" rowsep="0">
40904 <colspec colwidth="8*" align="left"/>
40905 <colspec colwidth="6*" align="center"/>
40906 <colspec colwidth="6*" align="center"/>
40907 <colspec colwidth="6*" align="right"/>
40908 <tbody>
40909 <row>
40910 <entry><option>address_retry_include_sender</option></entry>
40911 <entry>Use: <emphasis>smtp</emphasis></entry>
40912 <entry>Type: <emphasis>boolean</emphasis></entry>
40913 <entry>Default: <emphasis>true</emphasis></entry>
40914 </row>
40915 </tbody>
40916 </tgroup>
40917 </informaltable>
40918 <para>
40919 <indexterm role="concept">
40920 <primary>4<emphasis>xx</emphasis> responses</primary>
40921 <secondary>retrying after</secondary>
40922 </indexterm>
40923 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
40924 is the combination of sender and recipient that is delayed in subsequent queue
40925 runs until the retry time is reached. You can delay the recipient without
40926 reference to the sender (which is what earlier versions of Exim did), by
40927 setting <option>address_retry_include_sender</option> false. However, this can lead to
40928 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
40929 </para>
40930 <para>
40931 <indexterm role="option">
40932 <primary><option>allow_localhost</option></primary>
40933 </indexterm>
40934 </para>
40935 <informaltable frame="all">
40936 <tgroup cols="4" colsep="0" rowsep="0">
40937 <colspec colwidth="8*" align="left"/>
40938 <colspec colwidth="6*" align="center"/>
40939 <colspec colwidth="6*" align="center"/>
40940 <colspec colwidth="6*" align="right"/>
40941 <tbody>
40942 <row>
40943 <entry><option>allow_localhost</option></entry>
40944 <entry>Use: <emphasis>smtp</emphasis></entry>
40945 <entry>Type: <emphasis>boolean</emphasis></entry>
40946 <entry>Default: <emphasis>false</emphasis></entry>
40947 </row>
40948 </tbody>
40949 </tgroup>
40950 </informaltable>
40951 <para>
40952 <indexterm role="concept">
40953 <primary>local host</primary>
40954 <secondary>sending to</secondary>
40955 </indexterm>
40956 <indexterm role="concept">
40957 <primary>fallback</primary>
40958 <secondary>hosts specified on transport</secondary>
40959 </indexterm>
40960 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
40961 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
40962 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
40963 the delivery anyway. This should be used only in special cases when the
40964 configuration ensures that no looping will result (for example, a differently
40965 configured Exim is listening on the port to which the message is sent).
40966 </para>
40967 <para>
40968 <indexterm role="option">
40969 <primary><option>authenticated_sender</option></primary>
40970 </indexterm>
40971 </para>
40972 <informaltable frame="all">
40973 <tgroup cols="4" colsep="0" rowsep="0">
40974 <colspec colwidth="8*" align="left"/>
40975 <colspec colwidth="6*" align="center"/>
40976 <colspec colwidth="6*" align="center"/>
40977 <colspec colwidth="6*" align="right"/>
40978 <tbody>
40979 <row>
40980 <entry><option>authenticated_sender</option></entry>
40981 <entry>Use: <emphasis>smtp</emphasis></entry>
40982 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40983 <entry>Default: <emphasis>unset</emphasis></entry>
40984 </row>
40985 </tbody>
40986 </tgroup>
40987 </informaltable>
40988 <para>
40989 <indexterm role="concept">
40990 <primary>Cyrus</primary>
40991 </indexterm>
40992 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
40993 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
40994 overriding any existing authenticated sender value. If the string expansion is
40995 forced to fail, the option is ignored. Other expansion failures cause delivery
40996 to be deferred. If the result of expansion is an empty string, that is also
40997 ignored.
40998 </para>
40999 <para>
41000 If the SMTP session is not authenticated, the expansion of
41001 <option>authenticated_sender</option> still happens (and can cause the delivery to be
41002 deferred if it fails), but no AUTH= item is added to MAIL commands
41003 unless <option>authenticated_sender_force</option> is true.
41004 </para>
41005 <para>
41006 This option allows you to use the <command>smtp</command> transport in LMTP mode to
41007 deliver mail to Cyrus IMAP and provide the proper local part as the
41008 <quote>authenticated sender</quote>, via a setting such as:
41009 </para>
41010 <literallayout class="monospaced">
41011 authenticated_sender = $local_part
41012 </literallayout>
41013 <para>
41014 This removes the need for IMAP subfolders to be assigned special ACLs to
41015 allow direct delivery to those subfolders.
41016 </para>
41017 <para>
41018 Because of expected uses such as that just described for Cyrus (when no
41019 domain is involved), there is no checking on the syntax of the provided
41020 value.
41021 </para>
41022 <para>
41023 <indexterm role="option">
41024 <primary><option>authenticated_sender_force</option></primary>
41025 </indexterm>
41026 </para>
41027 <informaltable frame="all">
41028 <tgroup cols="4" colsep="0" rowsep="0">
41029 <colspec colwidth="8*" align="left"/>
41030 <colspec colwidth="6*" align="center"/>
41031 <colspec colwidth="6*" align="center"/>
41032 <colspec colwidth="6*" align="right"/>
41033 <tbody>
41034 <row>
41035 <entry><option>authenticated_sender_force</option></entry>
41036 <entry>Use: <emphasis>smtp</emphasis></entry>
41037 <entry>Type: <emphasis>boolean</emphasis></entry>
41038 <entry>Default: <emphasis>false</emphasis></entry>
41039 </row>
41040 </tbody>
41041 </tgroup>
41042 </informaltable>
41043 <para>
41044 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
41045 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
41046 authenticated as a client.
41047 </para>
41048 <para>
41049 <indexterm role="option">
41050 <primary><option>command_timeout</option></primary>
41051 </indexterm>
41052 </para>
41053 <informaltable frame="all">
41054 <tgroup cols="4" colsep="0" rowsep="0">
41055 <colspec colwidth="8*" align="left"/>
41056 <colspec colwidth="6*" align="center"/>
41057 <colspec colwidth="6*" align="center"/>
41058 <colspec colwidth="6*" align="right"/>
41059 <tbody>
41060 <row>
41061 <entry><option>command_timeout</option></entry>
41062 <entry>Use: <emphasis>smtp</emphasis></entry>
41063 <entry>Type: <emphasis>time</emphasis></entry>
41064 <entry>Default: <emphasis>5m</emphasis></entry>
41065 </row>
41066 </tbody>
41067 </tgroup>
41068 </informaltable>
41069 <para>
41070 This sets a timeout for receiving a response to an SMTP command that has been
41071 sent out. It is also used when waiting for the initial banner line from the
41072 remote host. Its value must not be zero.
41073 </para>
41074 <para>
41075 <indexterm role="option">
41076 <primary><option>connect_timeout</option></primary>
41077 </indexterm>
41078 </para>
41079 <informaltable frame="all">
41080 <tgroup cols="4" colsep="0" rowsep="0">
41081 <colspec colwidth="8*" align="left"/>
41082 <colspec colwidth="6*" align="center"/>
41083 <colspec colwidth="6*" align="center"/>
41084 <colspec colwidth="6*" align="right"/>
41085 <tbody>
41086 <row>
41087 <entry><option>connect_timeout</option></entry>
41088 <entry>Use: <emphasis>smtp</emphasis></entry>
41089 <entry>Type: <emphasis>time</emphasis></entry>
41090 <entry>Default: <emphasis>5m</emphasis></entry>
41091 </row>
41092 </tbody>
41093 </tgroup>
41094 </informaltable>
41095 <para>
41096 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
41097 to a remote host. A setting of zero allows the system timeout (typically
41098 several minutes) to act. To have any effect, the value of this option must be
41099 less than the system timeout. However, it has been observed that on some
41100 systems there is no system timeout, which is why the default value for this
41101 option is 5 minutes, a value recommended by RFC 1123.
41102 </para>
41103 <para>
41104 <indexterm role="option">
41105 <primary><option>connection_max_messages</option></primary>
41106 </indexterm>
41107 </para>
41108 <informaltable frame="all">
41109 <tgroup cols="4" colsep="0" rowsep="0">
41110 <colspec colwidth="8*" align="left"/>
41111 <colspec colwidth="6*" align="center"/>
41112 <colspec colwidth="6*" align="center"/>
41113 <colspec colwidth="6*" align="right"/>
41114 <tbody>
41115 <row>
41116 <entry><option>connection_max_messages</option></entry>
41117 <entry>Use: <emphasis>smtp</emphasis></entry>
41118 <entry>Type: <emphasis>integer</emphasis></entry>
41119 <entry>Default: <emphasis>500</emphasis></entry>
41120 </row>
41121 </tbody>
41122 </tgroup>
41123 </informaltable>
41124 <para>
41125 <indexterm role="concept">
41126 <primary>SMTP</primary>
41127 <secondary>passed connection</secondary>
41128 </indexterm>
41129 <indexterm role="concept">
41130 <primary>SMTP</primary>
41131 <secondary>multiple deliveries</secondary>
41132 </indexterm>
41133 <indexterm role="concept">
41134 <primary>multiple SMTP deliveries</primary>
41135 </indexterm>
41136 This controls the maximum number of separate message deliveries that are sent
41137 over a single TCP/IP connection. If the value is zero, there is no limit.
41138 For testing purposes, this value can be overridden by the <option>-oB</option> command line
41139 option.
41140 </para>
41141 <para>
41142 <indexterm role="option">
41143 <primary><option>data_timeout</option></primary>
41144 </indexterm>
41145 </para>
41146 <informaltable frame="all">
41147 <tgroup cols="4" colsep="0" rowsep="0">
41148 <colspec colwidth="8*" align="left"/>
41149 <colspec colwidth="6*" align="center"/>
41150 <colspec colwidth="6*" align="center"/>
41151 <colspec colwidth="6*" align="right"/>
41152 <tbody>
41153 <row>
41154 <entry><option>data_timeout</option></entry>
41155 <entry>Use: <emphasis>smtp</emphasis></entry>
41156 <entry>Type: <emphasis>time</emphasis></entry>
41157 <entry>Default: <emphasis>5m</emphasis></entry>
41158 </row>
41159 </tbody>
41160 </tgroup>
41161 </informaltable>
41162 <para>
41163 This sets a timeout for the transmission of each block in the data portion of
41164 the message. As a result, the overall timeout for a message depends on the size
41165 of the message. Its value must not be zero. See also <option>final_timeout</option>.
41166 </para>
41167 <para>
41168 <indexterm role="option">
41169 <primary><option>delay_after_cutoff</option></primary>
41170 </indexterm>
41171 </para>
41172 <informaltable frame="all">
41173 <tgroup cols="4" colsep="0" rowsep="0">
41174 <colspec colwidth="8*" align="left"/>
41175 <colspec colwidth="6*" align="center"/>
41176 <colspec colwidth="6*" align="center"/>
41177 <colspec colwidth="6*" align="right"/>
41178 <tbody>
41179 <row>
41180 <entry><option>delay_after_cutoff</option></entry>
41181 <entry>Use: <emphasis>smtp</emphasis></entry>
41182 <entry>Type: <emphasis>boolean</emphasis></entry>
41183 <entry>Default: <emphasis>true</emphasis></entry>
41184 </row>
41185 </tbody>
41186 </tgroup>
41187 </informaltable>
41188 <para>
41189 This option controls what happens when all remote IP addresses for a given
41190 domain have been inaccessible for so long that they have passed their retry
41191 cutoff times.
41192 </para>
41193 <para>
41194 In the default state, if the next retry time has not been reached for any of
41195 them, the address is bounced without trying any deliveries. In other words,
41196 Exim delays retrying an IP address after the final cutoff time until a new
41197 retry time is reached, and can therefore bounce an address without ever trying
41198 a delivery, when machines have been down for a long time. Some people are
41199 unhappy at this prospect, so...
41200 </para>
41201 <para>
41202 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
41203 addresses are past their final cutoff time, Exim tries to deliver to those
41204 IP addresses that have not been tried since the message arrived. If there are
41205 none, of if they all fail, the address is bounced. In other words, it does not
41206 delay when a new message arrives, but immediately tries those expired IP
41207 addresses that haven&#x2019;t been tried since the message arrived. If there is a
41208 continuous stream of messages for the dead hosts, unsetting
41209 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
41210 to them.
41211 </para>
41212 <para>
41213 <indexterm role="option">
41214 <primary><option>dns_qualify_single</option></primary>
41215 </indexterm>
41216 </para>
41217 <informaltable frame="all">
41218 <tgroup cols="4" colsep="0" rowsep="0">
41219 <colspec colwidth="8*" align="left"/>
41220 <colspec colwidth="6*" align="center"/>
41221 <colspec colwidth="6*" align="center"/>
41222 <colspec colwidth="6*" align="right"/>
41223 <tbody>
41224 <row>
41225 <entry><option>dns_qualify_single</option></entry>
41226 <entry>Use: <emphasis>smtp</emphasis></entry>
41227 <entry>Type: <emphasis>boolean</emphasis></entry>
41228 <entry>Default: <emphasis>true</emphasis></entry>
41229 </row>
41230 </tbody>
41231 </tgroup>
41232 </informaltable>
41233 <para>
41234 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
41235 and the <option>gethostbyname</option> option is false,
41236 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
41237 in chapter <xref linkend="CHAPdnslookup"/> for more details.
41238 </para>
41239 <para>
41240 <indexterm role="option">
41241 <primary><option>dns_search_parents</option></primary>
41242 </indexterm>
41243 </para>
41244 <informaltable frame="all">
41245 <tgroup cols="4" colsep="0" rowsep="0">
41246 <colspec colwidth="8*" align="left"/>
41247 <colspec colwidth="6*" align="center"/>
41248 <colspec colwidth="6*" align="center"/>
41249 <colspec colwidth="6*" align="right"/>
41250 <tbody>
41251 <row>
41252 <entry><option>dns_search_parents</option></entry>
41253 <entry>Use: <emphasis>smtp</emphasis></entry>
41254 <entry>Type: <emphasis>boolean</emphasis></entry>
41255 <entry>Default: <emphasis>false</emphasis></entry>
41256 </row>
41257 </tbody>
41258 </tgroup>
41259 </informaltable>
41260 <para>
41261 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
41262 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
41263 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
41264 details.
41265 </para>
41266 <para>
41267 <indexterm role="option">
41268 <primary><option>fallback_hosts</option></primary>
41269 </indexterm>
41270 </para>
41271 <informaltable frame="all">
41272 <tgroup cols="4" colsep="0" rowsep="0">
41273 <colspec colwidth="8*" align="left"/>
41274 <colspec colwidth="6*" align="center"/>
41275 <colspec colwidth="6*" align="center"/>
41276 <colspec colwidth="6*" align="right"/>
41277 <tbody>
41278 <row>
41279 <entry><option>fallback_hosts</option></entry>
41280 <entry>Use: <emphasis>smtp</emphasis></entry>
41281 <entry>Type: <emphasis>string list</emphasis></entry>
41282 <entry>Default: <emphasis>unset</emphasis></entry>
41283 </row>
41284 </tbody>
41285 </tgroup>
41286 </informaltable>
41287 <para>
41288 <indexterm role="concept">
41289 <primary>fallback</primary>
41290 <secondary>hosts specified on transport</secondary>
41291 </indexterm>
41292 String expansion is not applied to this option. The argument must be a
41293 colon-separated list of host names or IP addresses, optionally also including
41294 port numbers, though the separator can be changed, as described in section
41295 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
41296 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
41297 in section <xref linkend="SECTformatonehostitem"/>.
41298 </para>
41299 <para>
41300 Fallback hosts can also be specified on routers, which associate them with the
41301 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
41302 <option>fallback_hosts</option> specified on the transport is used only if the address does
41303 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
41304 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
41305 However, <option>hosts_randomize</option> does apply to fallback host lists.
41306 </para>
41307 <para>
41308 If Exim is unable to deliver to any of the hosts for a particular address, and
41309 the errors are not permanent rejections, the address is put on a separate
41310 transport queue with its host list replaced by the fallback hosts, unless the
41311 address was routed via MX records and the current host was in the original MX
41312 list. In that situation, the fallback host list is not used.
41313 </para>
41314 <para>
41315 Once normal deliveries are complete, the fallback queue is delivered by
41316 re-running the same transports with the new host lists. If several failing
41317 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
41318 copy of the message is sent.
41319 </para>
41320 <para>
41321 The resolution of the host names on the fallback list is controlled by the
41322 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
41323 both to cases when the host list comes with the address and when it is taken
41324 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
41325 fails</quote> facility.
41326 </para>
41327 <para>
41328 <indexterm role="option">
41329 <primary><option>final_timeout</option></primary>
41330 </indexterm>
41331 </para>
41332 <informaltable frame="all">
41333 <tgroup cols="4" colsep="0" rowsep="0">
41334 <colspec colwidth="8*" align="left"/>
41335 <colspec colwidth="6*" align="center"/>
41336 <colspec colwidth="6*" align="center"/>
41337 <colspec colwidth="6*" align="right"/>
41338 <tbody>
41339 <row>
41340 <entry><option>final_timeout</option></entry>
41341 <entry>Use: <emphasis>smtp</emphasis></entry>
41342 <entry>Type: <emphasis>time</emphasis></entry>
41343 <entry>Default: <emphasis>10m</emphasis></entry>
41344 </row>
41345 </tbody>
41346 </tgroup>
41347 </informaltable>
41348 <para>
41349 This is the timeout that applies while waiting for the response to the final
41350 line containing just <quote>.</quote> that terminates a message. Its value must not be
41351 zero.
41352 </para>
41353 <para>
41354 <indexterm role="option">
41355 <primary><option>gethostbyname</option></primary>
41356 </indexterm>
41357 </para>
41358 <informaltable frame="all">
41359 <tgroup cols="4" colsep="0" rowsep="0">
41360 <colspec colwidth="8*" align="left"/>
41361 <colspec colwidth="6*" align="center"/>
41362 <colspec colwidth="6*" align="center"/>
41363 <colspec colwidth="6*" align="right"/>
41364 <tbody>
41365 <row>
41366 <entry><option>gethostbyname</option></entry>
41367 <entry>Use: <emphasis>smtp</emphasis></entry>
41368 <entry>Type: <emphasis>boolean</emphasis></entry>
41369 <entry>Default: <emphasis>false</emphasis></entry>
41370 </row>
41371 </tbody>
41372 </tgroup>
41373 </informaltable>
41374 <para>
41375 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
41376 being used, names are looked up using <function>gethostbyname()</function>
41377 (or <function>getipnodebyname()</function> when available)
41378 instead of using the DNS. Of course, that function may in fact use the DNS, but
41379 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
41380 </para>
41381 <para revisionflag="changed">
41382 <indexterm role="option">
41383 <primary><option>gnutls_require_kx</option></primary>
41384 </indexterm>
41385 </para>
41386 <informaltable frame="all" revisionflag="changed">
41387 <tgroup cols="4" colsep="0" rowsep="0">
41388 <colspec colwidth="8*" align="left"/>
41389 <colspec colwidth="6*" align="center"/>
41390 <colspec colwidth="6*" align="center"/>
41391 <colspec colwidth="6*" align="right"/>
41392 <tbody>
41393 <row>
41394 <entry><option>gnutls_require_kx</option></entry>
41395 <entry>Use: <emphasis>main</emphasis></entry>
41396 <entry>Type: <emphasis>string</emphasis></entry>
41397 <entry>Default: <emphasis>unset</emphasis></entry>
41398 </row>
41399 </tbody>
41400 </tgroup>
41401 </informaltable>
41402 <para revisionflag="changed">
41403 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
41404 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41405 </para>
41406 <para revisionflag="changed">
41407 <indexterm role="option">
41408 <primary><option>gnutls_require_mac</option></primary>
41409 </indexterm>
41410 </para>
41411 <informaltable frame="all" revisionflag="changed">
41412 <tgroup cols="4" colsep="0" rowsep="0">
41413 <colspec colwidth="8*" align="left"/>
41414 <colspec colwidth="6*" align="center"/>
41415 <colspec colwidth="6*" align="center"/>
41416 <colspec colwidth="6*" align="right"/>
41417 <tbody>
41418 <row>
41419 <entry><option>gnutls_require_mac</option></entry>
41420 <entry>Use: <emphasis>main</emphasis></entry>
41421 <entry>Type: <emphasis>string</emphasis></entry>
41422 <entry>Default: <emphasis>unset</emphasis></entry>
41423 </row>
41424 </tbody>
41425 </tgroup>
41426 </informaltable>
41427 <para revisionflag="changed">
41428 This option controls the MAC algorithms when GnuTLS is used in an Exim
41429 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41430 </para>
41431 <para revisionflag="changed">
41432 <indexterm role="option">
41433 <primary><option>gnutls_require_protocols</option></primary>
41434 </indexterm>
41435 </para>
41436 <informaltable frame="all" revisionflag="changed">
41437 <tgroup cols="4" colsep="0" rowsep="0">
41438 <colspec colwidth="8*" align="left"/>
41439 <colspec colwidth="6*" align="center"/>
41440 <colspec colwidth="6*" align="center"/>
41441 <colspec colwidth="6*" align="right"/>
41442 <tbody>
41443 <row>
41444 <entry><option>gnutls_require_protocols</option></entry>
41445 <entry>Use: <emphasis>main</emphasis></entry>
41446 <entry>Type: <emphasis>string</emphasis></entry>
41447 <entry>Default: <emphasis>unset</emphasis></entry>
41448 </row>
41449 </tbody>
41450 </tgroup>
41451 </informaltable>
41452 <para revisionflag="changed">
41453 This option controls the protocols when GnuTLS is used in an Exim
41454 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41455 </para>
41456 <para revisionflag="changed">
41457 <indexterm role="option">
41458 <primary><option>helo_data</option></primary>
41459 </indexterm>
41460 </para>
41461 <informaltable frame="all" revisionflag="changed">
41462 <tgroup cols="4" colsep="0" rowsep="0">
41463 <colspec colwidth="8*" align="left"/>
41464 <colspec colwidth="6*" align="center"/>
41465 <colspec colwidth="6*" align="center"/>
41466 <colspec colwidth="6*" align="right"/>
41467 <tbody>
41468 <row>
41469 <entry><option>helo_data</option></entry>
41470 <entry>Use: <emphasis>smtp</emphasis></entry>
41471 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41472 <entry>Default: <emphasis>see below</emphasis></entry>
41473 </row>
41474 </tbody>
41475 </tgroup>
41476 </informaltable>
41477 <para revisionflag="changed">
41478 <indexterm role="concept">
41479 <primary>HELO</primary>
41480 <secondary>argument, setting</secondary>
41481 </indexterm>
41482 <indexterm role="concept">
41483 <primary>EHLO</primary>
41484 <secondary>argument, setting</secondary>
41485 </indexterm>
41486 <indexterm role="concept">
41487 <primary>LHLO argument setting</primary>
41488 </indexterm>
41489 The value of this option is expanded after a connection to a another host has
41490 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
41491 command that starts the outgoing SMTP or LMTP session. The default value of the
41492 option is:
41493 </para>
41494 <literallayout class="monospaced" revisionflag="changed">
41495 $primary_hostname
41496 </literallayout>
41497 <para revisionflag="changed">
41498 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
41499 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
41500 <varname>$sending_port</varname> are set to the local IP address and port number that are being
41501 used. These variables can be therefore used to generate different values for
41502 different servers or different local IP addresses. For example, if you want the
41503 string that is used for <option>helo_data</option> to be obtained by a DNS lookup of the
41504 outgoing interface address, you could use this:
41505 </para>
41506 <literallayout class="monospaced" revisionflag="changed">
41507 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
41508   {$primary_hostname}}
41509 </literallayout>
41510 <para revisionflag="changed">
41511 The use of <option>helo_data</option> applies both to sending messages and when doing
41512 callouts.
41513 </para>
41514 <para>
41515 <indexterm role="option">
41516 <primary><option>hosts</option></primary>
41517 </indexterm>
41518 </para>
41519 <informaltable frame="all">
41520 <tgroup cols="4" colsep="0" rowsep="0">
41521 <colspec colwidth="8*" align="left"/>
41522 <colspec colwidth="6*" align="center"/>
41523 <colspec colwidth="6*" align="center"/>
41524 <colspec colwidth="6*" align="right"/>
41525 <tbody>
41526 <row>
41527 <entry><option>hosts</option></entry>
41528 <entry>Use: <emphasis>smtp</emphasis></entry>
41529 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
41530 <entry>Default: <emphasis>unset</emphasis></entry>
41531 </row>
41532 </tbody>
41533 </tgroup>
41534 </informaltable>
41535 <para>
41536 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
41537 finds the hosts by looking up the address domain in the DNS, or by
41538 <command>manualroute</command>, which has lists of hosts in its configuration. However,
41539 email addresses can be passed to the <command>smtp</command> transport by any router, and not
41540 all of them can provide an associated list of hosts.
41541 </para>
41542 <para>
41543 The <option>hosts</option> option specifies a list of hosts to be used if the address being
41544 processed does not have any hosts associated with it. The hosts specified by
41545 <option>hosts</option> are also used, whether or not the address has its own hosts, if
41546 <option>hosts_override</option> is set.
41547 </para>
41548 <para>
41549 The string is first expanded, before being interpreted as a colon-separated
41550 list of host names or IP addresses, possibly including port numbers. The
41551 separator may be changed to something other than colon, as described in section
41552 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
41553 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
41554 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
41555 of the <command>manualroute</command> router is not available here.
41556 </para>
41557 <para>
41558 If the expansion fails, delivery is deferred. Unless the failure was caused by
41559 the inability to complete a lookup, the error is logged to the panic log as
41560 well as the main log. Host names are looked up either by searching directly for
41561 address records in the DNS or by calling <function>gethostbyname()</function> (or
41562 <function>getipnodebyname()</function> when available), depending on the setting of the
41563 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
41564 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
41565 address are used.
41566 </para>
41567 <para>
41568 During delivery, the hosts are tried in order, subject to their retry status,
41569 unless <option>hosts_randomize</option> is set.
41570 </para>
41571 <para>
41572 <indexterm role="option">
41573 <primary><option>hosts_avoid_esmtp</option></primary>
41574 </indexterm>
41575 </para>
41576 <informaltable frame="all">
41577 <tgroup cols="4" colsep="0" rowsep="0">
41578 <colspec colwidth="8*" align="left"/>
41579 <colspec colwidth="6*" align="center"/>
41580 <colspec colwidth="6*" align="center"/>
41581 <colspec colwidth="6*" align="right"/>
41582 <tbody>
41583 <row>
41584 <entry><option>hosts_avoid_esmtp</option></entry>
41585 <entry>Use: <emphasis>smtp</emphasis></entry>
41586 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41587 <entry>Default: <emphasis>unset</emphasis></entry>
41588 </row>
41589 </tbody>
41590 </tgroup>
41591 </informaltable>
41592 <para>
41593 <indexterm role="concept">
41594 <primary>ESMTP, avoiding use of</primary>
41595 </indexterm>
41596 <indexterm role="concept">
41597 <primary>HELO</primary>
41598 <secondary>forcing use of</secondary>
41599 </indexterm>
41600 <indexterm role="concept">
41601 <primary>EHLO</primary>
41602 <secondary>avoiding use of</secondary>
41603 </indexterm>
41604 <indexterm role="concept">
41605 <primary>PIPELINING</primary>
41606 <secondary>avoiding the use of</secondary>
41607 </indexterm>
41608 This option is for use with broken hosts that announce ESMTP facilities (for
41609 example, PIPELINING) and then fail to implement them properly. When a host
41610 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
41611 start of the SMTP session. This means that it cannot use any of the ESMTP
41612 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
41613 </para>
41614 <para revisionflag="changed">
41615 <indexterm role="option">
41616 <primary><option>hosts_avoid_pipelining</option></primary>
41617 </indexterm>
41618 </para>
41619 <informaltable frame="all" revisionflag="changed">
41620 <tgroup cols="4" colsep="0" rowsep="0">
41621 <colspec colwidth="8*" align="left"/>
41622 <colspec colwidth="6*" align="center"/>
41623 <colspec colwidth="6*" align="center"/>
41624 <colspec colwidth="6*" align="right"/>
41625 <tbody>
41626 <row>
41627 <entry><option>hosts_avoid_pipelining</option></entry>
41628 <entry>Use: <emphasis>smtp</emphasis></entry>
41629 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41630 <entry>Default: <emphasis>unset</emphasis></entry>
41631 </row>
41632 </tbody>
41633 </tgroup>
41634 </informaltable>
41635 <para revisionflag="changed">
41636 <indexterm role="concept">
41637 <primary>PIPELINING</primary>
41638 <secondary>avoiding the use of</secondary>
41639 </indexterm>
41640 Exim will not use the SMTP PIPELINING extension when delivering to any host
41641 that matches this list, even if the server host advertises PIPELINING support.
41642 </para>
41643 <para>
41644 <indexterm role="option">
41645 <primary><option>hosts_avoid_tls</option></primary>
41646 </indexterm>
41647 </para>
41648 <informaltable frame="all">
41649 <tgroup cols="4" colsep="0" rowsep="0">
41650 <colspec colwidth="8*" align="left"/>
41651 <colspec colwidth="6*" align="center"/>
41652 <colspec colwidth="6*" align="center"/>
41653 <colspec colwidth="6*" align="right"/>
41654 <tbody>
41655 <row>
41656 <entry><option>hosts_avoid_tls</option></entry>
41657 <entry>Use: <emphasis>smtp</emphasis></entry>
41658 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41659 <entry>Default: <emphasis>unset</emphasis></entry>
41660 </row>
41661 </tbody>
41662 </tgroup>
41663 </informaltable>
41664 <para>
41665 <indexterm role="concept">
41666 <primary>TLS</primary>
41667 <secondary>avoiding for certain hosts</secondary>
41668 </indexterm>
41669 Exim will not try to start a TLS session when delivering to any host that
41670 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41671 </para>
41672 <para>
41673 <indexterm role="option">
41674 <primary><option>hosts_max_try</option></primary>
41675 </indexterm>
41676 </para>
41677 <informaltable frame="all">
41678 <tgroup cols="4" colsep="0" rowsep="0">
41679 <colspec colwidth="8*" align="left"/>
41680 <colspec colwidth="6*" align="center"/>
41681 <colspec colwidth="6*" align="center"/>
41682 <colspec colwidth="6*" align="right"/>
41683 <tbody>
41684 <row>
41685 <entry><option>hosts_max_try</option></entry>
41686 <entry>Use: <emphasis>smtp</emphasis></entry>
41687 <entry>Type: <emphasis>integer</emphasis></entry>
41688 <entry>Default: <emphasis>5</emphasis></entry>
41689 </row>
41690 </tbody>
41691 </tgroup>
41692 </informaltable>
41693 <para>
41694 <indexterm role="concept">
41695 <primary>host</primary>
41696 <secondary>maximum number to try</secondary>
41697 </indexterm>
41698 <indexterm role="concept">
41699 <primary>limit</primary>
41700 <secondary>number of hosts tried</secondary>
41701 </indexterm>
41702 <indexterm role="concept">
41703 <primary>limit</primary>
41704 <secondary>number of MX tried</secondary>
41705 </indexterm>
41706 <indexterm role="concept">
41707 <primary>MX record</primary>
41708 <secondary>maximum tried</secondary>
41709 </indexterm>
41710 This option limits the number of IP addresses that are tried for any one
41711 delivery in cases where there are temporary delivery errors. Section
41712 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
41713 </para>
41714 <para>
41715 <indexterm role="option">
41716 <primary><option>hosts_max_try_hardlimit</option></primary>
41717 </indexterm>
41718 </para>
41719 <informaltable frame="all">
41720 <tgroup cols="4" colsep="0" rowsep="0">
41721 <colspec colwidth="8*" align="left"/>
41722 <colspec colwidth="6*" align="center"/>
41723 <colspec colwidth="6*" align="center"/>
41724 <colspec colwidth="6*" align="right"/>
41725 <tbody>
41726 <row>
41727 <entry><option>hosts_max_try_hardlimit</option></entry>
41728 <entry>Use: <emphasis>smtp</emphasis></entry>
41729 <entry>Type: <emphasis>integer</emphasis></entry>
41730 <entry>Default: <emphasis>50</emphasis></entry>
41731 </row>
41732 </tbody>
41733 </tgroup>
41734 </informaltable>
41735 <para>
41736 This is an additional check on the maximum number of IP addresses that Exim
41737 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
41738 why it exists.
41739 </para>
41740 <para>
41741 <indexterm role="option">
41742 <primary><option>hosts_nopass_tls</option></primary>
41743 </indexterm>
41744 </para>
41745 <informaltable frame="all">
41746 <tgroup cols="4" colsep="0" rowsep="0">
41747 <colspec colwidth="8*" align="left"/>
41748 <colspec colwidth="6*" align="center"/>
41749 <colspec colwidth="6*" align="center"/>
41750 <colspec colwidth="6*" align="right"/>
41751 <tbody>
41752 <row>
41753 <entry><option>hosts_nopass_tls</option></entry>
41754 <entry>Use: <emphasis>smtp</emphasis></entry>
41755 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41756 <entry>Default: <emphasis>unset</emphasis></entry>
41757 </row>
41758 </tbody>
41759 </tgroup>
41760 </informaltable>
41761 <para>
41762 <indexterm role="concept">
41763 <primary>TLS</primary>
41764 <secondary>passing connection</secondary>
41765 </indexterm>
41766 <indexterm role="concept">
41767 <primary>multiple SMTP deliveries</primary>
41768 </indexterm>
41769 <indexterm role="concept">
41770 <primary>TLS</primary>
41771 <secondary>multiple message deliveries</secondary>
41772 </indexterm>
41773 For any host that matches this list, a connection on which a TLS session has
41774 been started will not be passed to a new delivery process for sending another
41775 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
41776 explanation of when this might be needed.
41777 </para>
41778 <para>
41779 <indexterm role="option">
41780 <primary><option>hosts_override</option></primary>
41781 </indexterm>
41782 </para>
41783 <informaltable frame="all">
41784 <tgroup cols="4" colsep="0" rowsep="0">
41785 <colspec colwidth="8*" align="left"/>
41786 <colspec colwidth="6*" align="center"/>
41787 <colspec colwidth="6*" align="center"/>
41788 <colspec colwidth="6*" align="right"/>
41789 <tbody>
41790 <row>
41791 <entry><option>hosts_override</option></entry>
41792 <entry>Use: <emphasis>smtp</emphasis></entry>
41793 <entry>Type: <emphasis>boolean</emphasis></entry>
41794 <entry>Default: <emphasis>false</emphasis></entry>
41795 </row>
41796 </tbody>
41797 </tgroup>
41798 </informaltable>
41799 <para>
41800 If this option is set and the <option>hosts</option> option is also set, any hosts that are
41801 attached to the address are ignored, and instead the hosts specified by the
41802 <option>hosts</option> option are always used. This option does not apply to
41803 <option>fallback_hosts</option>.
41804 </para>
41805 <para>
41806 <indexterm role="option">
41807 <primary><option>hosts_randomize</option></primary>
41808 </indexterm>
41809 </para>
41810 <informaltable frame="all">
41811 <tgroup cols="4" colsep="0" rowsep="0">
41812 <colspec colwidth="8*" align="left"/>
41813 <colspec colwidth="6*" align="center"/>
41814 <colspec colwidth="6*" align="center"/>
41815 <colspec colwidth="6*" align="right"/>
41816 <tbody>
41817 <row>
41818 <entry><option>hosts_randomize</option></entry>
41819 <entry>Use: <emphasis>smtp</emphasis></entry>
41820 <entry>Type: <emphasis>boolean</emphasis></entry>
41821 <entry>Default: <emphasis>false</emphasis></entry>
41822 </row>
41823 </tbody>
41824 </tgroup>
41825 </informaltable>
41826 <para>
41827 <indexterm role="concept">
41828 <primary>randomized host list</primary>
41829 </indexterm>
41830 <indexterm role="concept">
41831 <primary>host</primary>
41832 <secondary>list of; randomized</secondary>
41833 </indexterm>
41834 <indexterm role="concept">
41835 <primary>fallback</primary>
41836 <secondary>randomized hosts</secondary>
41837 </indexterm>
41838 If this option is set, and either the list of hosts is taken from the
41839 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
41840 were not obtained from MX records (this includes fallback hosts from the
41841 router), and were not randomized by the router, the order of trying the hosts
41842 is randomized each time the transport runs. Randomizing the order of a host
41843 list can be used to do crude load sharing.
41844 </para>
41845 <para>
41846 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
41847 order is separately randomized. This makes it possible to set up MX-like
41848 behaviour. The boundaries between groups are indicated by an item that is just
41849 <literal>+</literal> in the host list. For example:
41850 </para>
41851 <literallayout class="monospaced">
41852 hosts = host1:host2:host3:+:host4:host5
41853 </literallayout>
41854 <para>
41855 The order of the first three hosts and the order of the last two hosts is
41856 randomized for each use, but the first three always end up before the last two.
41857 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
41858 </para>
41859 <para>
41860 <indexterm role="option">
41861 <primary><option>hosts_require_auth</option></primary>
41862 </indexterm>
41863 </para>
41864 <informaltable frame="all">
41865 <tgroup cols="4" colsep="0" rowsep="0">
41866 <colspec colwidth="8*" align="left"/>
41867 <colspec colwidth="6*" align="center"/>
41868 <colspec colwidth="6*" align="center"/>
41869 <colspec colwidth="6*" align="right"/>
41870 <tbody>
41871 <row>
41872 <entry><option>hosts_require_auth</option></entry>
41873 <entry>Use: <emphasis>smtp</emphasis></entry>
41874 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41875 <entry>Default: <emphasis>unset</emphasis></entry>
41876 </row>
41877 </tbody>
41878 </tgroup>
41879 </informaltable>
41880 <para>
41881 <indexterm role="concept">
41882 <primary>authentication</primary>
41883 <secondary>required by client</secondary>
41884 </indexterm>
41885 This option provides a list of servers for which authentication must succeed
41886 before Exim will try to transfer a message. If authentication fails for
41887 servers which are not in this list, Exim tries to send unauthenticated. If
41888 authentication fails for one of these servers, delivery is deferred. This
41889 temporary error is detectable in the retry rules, so it can be turned into a
41890 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
41891 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41892 </para>
41893 <para>
41894 <indexterm role="option">
41895 <primary><option>hosts_require_tls</option></primary>
41896 </indexterm>
41897 </para>
41898 <informaltable frame="all">
41899 <tgroup cols="4" colsep="0" rowsep="0">
41900 <colspec colwidth="8*" align="left"/>
41901 <colspec colwidth="6*" align="center"/>
41902 <colspec colwidth="6*" align="center"/>
41903 <colspec colwidth="6*" align="right"/>
41904 <tbody>
41905 <row>
41906 <entry><option>hosts_require_tls</option></entry>
41907 <entry>Use: <emphasis>smtp</emphasis></entry>
41908 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41909 <entry>Default: <emphasis>unset</emphasis></entry>
41910 </row>
41911 </tbody>
41912 </tgroup>
41913 </informaltable>
41914 <para>
41915 <indexterm role="concept">
41916 <primary>TLS</primary>
41917 <secondary>requiring for certain servers</secondary>
41918 </indexterm>
41919 Exim will insist on using a TLS session when delivering to any host that
41920 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41921 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
41922 incoming messages, use an appropriate ACL.
41923 </para>
41924 <para>
41925 <indexterm role="option">
41926 <primary><option>hosts_try_auth</option></primary>
41927 </indexterm>
41928 </para>
41929 <informaltable frame="all">
41930 <tgroup cols="4" colsep="0" rowsep="0">
41931 <colspec colwidth="8*" align="left"/>
41932 <colspec colwidth="6*" align="center"/>
41933 <colspec colwidth="6*" align="center"/>
41934 <colspec colwidth="6*" align="right"/>
41935 <tbody>
41936 <row>
41937 <entry><option>hosts_try_auth</option></entry>
41938 <entry>Use: <emphasis>smtp</emphasis></entry>
41939 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41940 <entry>Default: <emphasis>unset</emphasis></entry>
41941 </row>
41942 </tbody>
41943 </tgroup>
41944 </informaltable>
41945 <para>
41946 <indexterm role="concept">
41947 <primary>authentication</primary>
41948 <secondary>optional in client</secondary>
41949 </indexterm>
41950 This option provides a list of servers to which, provided they announce
41951 authentication support, Exim will attempt to authenticate as a client when it
41952 connects. If authentication fails, Exim will try to transfer the message
41953 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
41954 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41955 </para>
41956 <para>
41957 <indexterm role="option">
41958 <primary><option>interface</option></primary>
41959 </indexterm>
41960 </para>
41961 <informaltable frame="all">
41962 <tgroup cols="4" colsep="0" rowsep="0">
41963 <colspec colwidth="8*" align="left"/>
41964 <colspec colwidth="6*" align="center"/>
41965 <colspec colwidth="6*" align="center"/>
41966 <colspec colwidth="6*" align="right"/>
41967 <tbody>
41968 <row>
41969 <entry><option>interface</option></entry>
41970 <entry>Use: <emphasis>smtp</emphasis></entry>
41971 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
41972 <entry>Default: <emphasis>unset</emphasis></entry>
41973 </row>
41974 </tbody>
41975 </tgroup>
41976 </informaltable>
41977 <para>
41978 <indexterm role="concept">
41979 <primary>bind IP address</primary>
41980 </indexterm>
41981 <indexterm role="concept">
41982 <primary>IP address</primary>
41983 <secondary>binding</secondary>
41984 </indexterm>
41985 <indexterm role="variable">
41986 <primary><varname>$host</varname></primary>
41987 </indexterm>
41988 <indexterm role="variable">
41989 <primary><varname>$host_address</varname></primary>
41990 </indexterm>
41991 This option specifies which interface to bind to when making an outgoing SMTP
41992 call. <emphasis role="bold">Note:</emphasis> Do not confuse this with the interface address that was used
41993 when a message was received, which is in <varname>$received_ip_address</varname>, formerly
41994 known as <varname>$interface_address</varname>. The name was changed to minimize confusion with
41995 the outgoing interface address. There is no variable that contains an outgoing
41996 interface address because, unless it is set by this option, its value is
41997 unknown.
41998 </para>
41999 <para>
42000 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
42001 <varname>$host_address</varname> refer to the host to which a connection is about to be made
42002 during the expansion of the string. Forced expansion failure, or an empty
42003 string result causes the option to be ignored. Otherwise, after expansion, the
42004 string must be a list of IP addresses, colon-separated by default, but the
42005 separator can be changed in the usual way. For example:
42006 </para>
42007 <literallayout class="monospaced">
42008 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
42009 </literallayout>
42010 <para>
42011 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
42012 connection. If none of them are the correct type, the option is ignored. If
42013 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
42014 interface to use if the host has more than one.
42015 </para>
42016 <para>
42017 <indexterm role="option">
42018 <primary><option>keepalive</option></primary>
42019 </indexterm>
42020 </para>
42021 <informaltable frame="all">
42022 <tgroup cols="4" colsep="0" rowsep="0">
42023 <colspec colwidth="8*" align="left"/>
42024 <colspec colwidth="6*" align="center"/>
42025 <colspec colwidth="6*" align="center"/>
42026 <colspec colwidth="6*" align="right"/>
42027 <tbody>
42028 <row>
42029 <entry><option>keepalive</option></entry>
42030 <entry>Use: <emphasis>smtp</emphasis></entry>
42031 <entry>Type: <emphasis>boolean</emphasis></entry>
42032 <entry>Default: <emphasis>true</emphasis></entry>
42033 </row>
42034 </tbody>
42035 </tgroup>
42036 </informaltable>
42037 <para>
42038 <indexterm role="concept">
42039 <primary>keepalive</primary>
42040 <secondary>on outgoing connection</secondary>
42041 </indexterm>
42042 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
42043 connections. When set, it causes the kernel to probe idle connections
42044 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
42045 of the connection should send a acknowledgment if the connection is still okay
42046 or a reset if the connection has been aborted. The reason for doing this is
42047 that it has the beneficial effect of freeing up certain types of connection
42048 that can get stuck when the remote host is disconnected without tidying up the
42049 TCP/IP call properly. The keepalive mechanism takes several hours to detect
42050 unreachable hosts.
42051 </para>
42052 <para>
42053 <indexterm role="option">
42054 <primary><option>lmtp_ignore_quota</option></primary>
42055 </indexterm>
42056 </para>
42057 <informaltable frame="all">
42058 <tgroup cols="4" colsep="0" rowsep="0">
42059 <colspec colwidth="8*" align="left"/>
42060 <colspec colwidth="6*" align="center"/>
42061 <colspec colwidth="6*" align="center"/>
42062 <colspec colwidth="6*" align="right"/>
42063 <tbody>
42064 <row>
42065 <entry><option>lmtp_ignore_quota</option></entry>
42066 <entry>Use: <emphasis>smtp</emphasis></entry>
42067 <entry>Type: <emphasis>boolean</emphasis></entry>
42068 <entry>Default: <emphasis>false</emphasis></entry>
42069 </row>
42070 </tbody>
42071 </tgroup>
42072 </informaltable>
42073 <para>
42074 <indexterm role="concept">
42075 <primary>LMTP</primary>
42076 <secondary>ignoring quota errors</secondary>
42077 </indexterm>
42078 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
42079 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
42080 has advertised support for IGNOREQUOTA in its response to the LHLO command.
42081 </para>
42082 <para>
42083 <indexterm role="option">
42084 <primary><option>max_rcpt</option></primary>
42085 </indexterm>
42086 </para>
42087 <informaltable frame="all">
42088 <tgroup cols="4" colsep="0" rowsep="0">
42089 <colspec colwidth="8*" align="left"/>
42090 <colspec colwidth="6*" align="center"/>
42091 <colspec colwidth="6*" align="center"/>
42092 <colspec colwidth="6*" align="right"/>
42093 <tbody>
42094 <row>
42095 <entry><option>max_rcpt</option></entry>
42096 <entry>Use: <emphasis>smtp</emphasis></entry>
42097 <entry>Type: <emphasis>integer</emphasis></entry>
42098 <entry>Default: <emphasis>100</emphasis></entry>
42099 </row>
42100 </tbody>
42101 </tgroup>
42102 </informaltable>
42103 <para>
42104 <indexterm role="concept">
42105 <primary>RCPT</primary>
42106 <secondary>maximum number of outgoing</secondary>
42107 </indexterm>
42108 This option limits the number of RCPT commands that are sent in a single
42109 SMTP message transaction. Each set of addresses is treated independently, and
42110 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
42111 permits this.
42112 </para>
42113 <para>
42114 <indexterm role="option">
42115 <primary><option>multi_domain</option></primary>
42116 </indexterm>
42117 </para>
42118 <informaltable frame="all">
42119 <tgroup cols="4" colsep="0" rowsep="0">
42120 <colspec colwidth="8*" align="left"/>
42121 <colspec colwidth="6*" align="center"/>
42122 <colspec colwidth="6*" align="center"/>
42123 <colspec colwidth="6*" align="right"/>
42124 <tbody>
42125 <row>
42126 <entry><option>multi_domain</option></entry>
42127 <entry>Use: <emphasis>smtp</emphasis></entry>
42128 <entry>Type: <emphasis>boolean</emphasis></entry>
42129 <entry>Default: <emphasis>true</emphasis></entry>
42130 </row>
42131 </tbody>
42132 </tgroup>
42133 </informaltable>
42134 <para>
42135 <indexterm role="variable">
42136 <primary><varname>$domain</varname></primary>
42137 </indexterm>
42138 When this option is set, the <command>smtp</command> transport can handle a number of
42139 addresses containing a mixture of different domains provided they all resolve
42140 to the same list of hosts. Turning the option off restricts the transport to
42141 handling only one domain at a time. This is useful if you want to use
42142 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
42143 is a single domain involved in a remote delivery.
42144 </para>
42145 <para>
42146 <indexterm role="option">
42147 <primary><option>port</option></primary>
42148 </indexterm>
42149 </para>
42150 <informaltable frame="all">
42151 <tgroup cols="4" colsep="0" rowsep="0">
42152 <colspec colwidth="8*" align="left"/>
42153 <colspec colwidth="6*" align="center"/>
42154 <colspec colwidth="6*" align="center"/>
42155 <colspec colwidth="6*" align="right"/>
42156 <tbody>
42157 <row>
42158 <entry><option>port</option></entry>
42159 <entry>Use: <emphasis>smtp</emphasis></entry>
42160 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42161 <entry>Default: <emphasis>see below</emphasis></entry>
42162 </row>
42163 </tbody>
42164 </tgroup>
42165 </informaltable>
42166 <para>
42167 <indexterm role="concept">
42168 <primary>port</primary>
42169 <secondary>sending TCP/IP</secondary>
42170 </indexterm>
42171 <indexterm role="concept">
42172 <primary>TCP/IP</primary>
42173 <secondary>setting outgoing port</secondary>
42174 </indexterm>
42175 This option specifies the TCP/IP port on the server to which Exim connects.
42176 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
42177 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
42178 The name was changed to minimize confusion with the outgoing port. There is no
42179 variable that contains an outgoing port.
42180 </para>
42181 <para>
42182 If the value of this option begins with a digit it is taken as a port number;
42183 otherwise it is looked up using <function>getservbyname()</function>. The default value is
42184 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
42185 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
42186 is deferred.
42187 </para>
42188 <para>
42189 <indexterm role="option">
42190 <primary><option>protocol</option></primary>
42191 </indexterm>
42192 </para>
42193 <informaltable frame="all">
42194 <tgroup cols="4" colsep="0" rowsep="0">
42195 <colspec colwidth="8*" align="left"/>
42196 <colspec colwidth="6*" align="center"/>
42197 <colspec colwidth="6*" align="center"/>
42198 <colspec colwidth="6*" align="right"/>
42199 <tbody>
42200 <row>
42201 <entry><option>protocol</option></entry>
42202 <entry>Use: <emphasis>smtp</emphasis></entry>
42203 <entry>Type: <emphasis>string</emphasis></entry>
42204 <entry>Default: <emphasis>smtp</emphasis></entry>
42205 </row>
42206 </tbody>
42207 </tgroup>
42208 </informaltable>
42209 <para>
42210 <indexterm role="concept">
42211 <primary>LMTP</primary>
42212 <secondary>over TCP/IP</secondary>
42213 </indexterm>
42214 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
42215 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
42216 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
42217 deliveries into closed message stores. Exim also has support for running LMTP
42218 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
42219 </para>
42220 <para>
42221 <indexterm role="option">
42222 <primary><option>retry_include_ip_address</option></primary>
42223 </indexterm>
42224 </para>
42225 <informaltable frame="all">
42226 <tgroup cols="4" colsep="0" rowsep="0">
42227 <colspec colwidth="8*" align="left"/>
42228 <colspec colwidth="6*" align="center"/>
42229 <colspec colwidth="6*" align="center"/>
42230 <colspec colwidth="6*" align="right"/>
42231 <tbody>
42232 <row>
42233 <entry><option>retry_include_ip_address</option></entry>
42234 <entry>Use: <emphasis>smtp</emphasis></entry>
42235 <entry>Type: <emphasis>boolean</emphasis></entry>
42236 <entry>Default: <emphasis>true</emphasis></entry>
42237 </row>
42238 </tbody>
42239 </tgroup>
42240 </informaltable>
42241 <para>
42242 Exim normally includes both the host name and the IP address in the key it
42243 constructs for indexing retry data after a temporary delivery failure. This
42244 means that when one of several IP addresses for a host is failing, it gets
42245 tried periodically (controlled by the retry rules), but use of the other IP
42246 addresses is not affected.
42247 </para>
42248 <para>
42249 However, in some dialup environments hosts are assigned a different IP address
42250 each time they connect. In this situation the use of the IP address as part of
42251 the retry key leads to undesirable behaviour. Setting this option false causes
42252 Exim to use only the host name. This should normally be done on a separate
42253 instance of the <command>smtp</command> transport, set up specially to handle the dialup
42254 hosts.
42255 </para>
42256 <para>
42257 <indexterm role="option">
42258 <primary><option>serialize_hosts</option></primary>
42259 </indexterm>
42260 </para>
42261 <informaltable frame="all">
42262 <tgroup cols="4" colsep="0" rowsep="0">
42263 <colspec colwidth="8*" align="left"/>
42264 <colspec colwidth="6*" align="center"/>
42265 <colspec colwidth="6*" align="center"/>
42266 <colspec colwidth="6*" align="right"/>
42267 <tbody>
42268 <row>
42269 <entry><option>serialize_hosts</option></entry>
42270 <entry>Use: <emphasis>smtp</emphasis></entry>
42271 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42272 <entry>Default: <emphasis>unset</emphasis></entry>
42273 </row>
42274 </tbody>
42275 </tgroup>
42276 </informaltable>
42277 <para>
42278 <indexterm role="concept">
42279 <primary>serializing connections</primary>
42280 </indexterm>
42281 <indexterm role="concept">
42282 <primary>host</primary>
42283 <secondary>serializing connections</secondary>
42284 </indexterm>
42285 Because Exim operates in a distributed manner, if several messages for the same
42286 host arrive at around the same time, more than one simultaneous connection to
42287 the remote host can occur. This is not usually a problem except when there is a
42288 slow link between the hosts. In that situation it may be helpful to restrict
42289 Exim to one connection at a time. This can be done by setting
42290 <option>serialize_hosts</option> to match the relevant hosts.
42291 </para>
42292 <para>
42293 <indexterm role="concept">
42294 <primary>hints database</primary>
42295 <secondary>serializing deliveries to a host</secondary>
42296 </indexterm>
42297 Exim implements serialization by means of a hints database in which a record is
42298 written whenever a process connects to one of the restricted hosts. The record
42299 is deleted when the connection is completed. Obviously there is scope for
42300 records to get left lying around if there is a system or program crash. To
42301 guard against this, Exim ignores any records that are more than six hours old.
42302 </para>
42303 <para>
42304 If you set up this kind of serialization, you should also arrange to delete the
42305 relevant hints database whenever your system reboots. The names of the files
42306 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
42307 may be one or two files, depending on the type of DBM in use. The same files
42308 are used for ETRN serialization.
42309 </para>
42310 <para>
42311 <indexterm role="option">
42312 <primary><option>size_addition</option></primary>
42313 </indexterm>
42314 </para>
42315 <informaltable frame="all">
42316 <tgroup cols="4" colsep="0" rowsep="0">
42317 <colspec colwidth="8*" align="left"/>
42318 <colspec colwidth="6*" align="center"/>
42319 <colspec colwidth="6*" align="center"/>
42320 <colspec colwidth="6*" align="right"/>
42321 <tbody>
42322 <row>
42323 <entry><option>size_addition</option></entry>
42324 <entry>Use: <emphasis>smtp</emphasis></entry>
42325 <entry>Type: <emphasis>integer</emphasis></entry>
42326 <entry>Default: <emphasis>1024</emphasis></entry>
42327 </row>
42328 </tbody>
42329 </tgroup>
42330 </informaltable>
42331 <para>
42332 <indexterm role="concept">
42333 <primary>SMTP</primary>
42334 <secondary>SIZE</secondary>
42335 </indexterm>
42336 <indexterm role="concept">
42337 <primary>message</primary>
42338 <secondary>size issue for transport filter</secondary>
42339 </indexterm>
42340 <indexterm role="concept">
42341 <primary>size</primary>
42342 <secondary>of message</secondary>
42343 </indexterm>
42344 <indexterm role="concept">
42345 <primary>transport</primary>
42346 <secondary>filter</secondary>
42347 </indexterm>
42348 <indexterm role="concept">
42349 <primary>filter</primary>
42350 <secondary>transport filter</secondary>
42351 </indexterm>
42352 If a remote SMTP server indicates that it supports the SIZE option of the
42353 MAIL command, Exim uses this to pass over the message size at the start of
42354 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
42355 sends, to allow for headers and other text that may be added during delivery by
42356 configuration options or in a transport filter. It may be necessary to increase
42357 this if a lot of text is added to messages.
42358 </para>
42359 <para>
42360 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
42361 the use of the SIZE option altogether.
42362 </para>
42363 <para>
42364 <indexterm role="option">
42365 <primary><option>tls_certificate</option></primary>
42366 </indexterm>
42367 </para>
42368 <informaltable frame="all">
42369 <tgroup cols="4" colsep="0" rowsep="0">
42370 <colspec colwidth="8*" align="left"/>
42371 <colspec colwidth="6*" align="center"/>
42372 <colspec colwidth="6*" align="center"/>
42373 <colspec colwidth="6*" align="right"/>
42374 <tbody>
42375 <row>
42376 <entry><option>tls_certificate</option></entry>
42377 <entry>Use: <emphasis>smtp</emphasis></entry>
42378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42379 <entry>Default: <emphasis>unset</emphasis></entry>
42380 </row>
42381 </tbody>
42382 </tgroup>
42383 </informaltable>
42384 <para>
42385 <indexterm role="concept">
42386 <primary>TLS</primary>
42387 <secondary>client certificate, location of</secondary>
42388 </indexterm>
42389 <indexterm role="concept">
42390 <primary>certificate</primary>
42391 <secondary>client, location of</secondary>
42392 </indexterm>
42393 <indexterm role="variable">
42394 <primary><varname>$host</varname></primary>
42395 </indexterm>
42396 <indexterm role="variable">
42397 <primary><varname>$host_address</varname></primary>
42398 </indexterm>
42399 The value of this option must be the absolute path to a file which contains the
42400 client&#x2019;s certificate, for possible use when sending a message over an encrypted
42401 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
42402 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
42403 details of TLS.
42404 </para>
42405 <para>
42406 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
42407 certificate when sending messages as a client. The global option of the same
42408 name specifies the certificate for Exim as a server; it is not automatically
42409 assumed that the same certificate should be used when Exim is operating as a
42410 client.
42411 </para>
42412 <para>
42413 <indexterm role="option">
42414 <primary><option>tls_crl</option></primary>
42415 </indexterm>
42416 </para>
42417 <informaltable frame="all">
42418 <tgroup cols="4" colsep="0" rowsep="0">
42419 <colspec colwidth="8*" align="left"/>
42420 <colspec colwidth="6*" align="center"/>
42421 <colspec colwidth="6*" align="center"/>
42422 <colspec colwidth="6*" align="right"/>
42423 <tbody>
42424 <row>
42425 <entry><option>tls_crl</option></entry>
42426 <entry>Use: <emphasis>smtp</emphasis></entry>
42427 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42428 <entry>Default: <emphasis>unset</emphasis></entry>
42429 </row>
42430 </tbody>
42431 </tgroup>
42432 </informaltable>
42433 <para>
42434 <indexterm role="concept">
42435 <primary>TLS</primary>
42436 <secondary>client certificate revocation list</secondary>
42437 </indexterm>
42438 <indexterm role="concept">
42439 <primary>certificate</primary>
42440 <secondary>revocation list for client</secondary>
42441 </indexterm>
42442 This option specifies a certificate revocation list. The expanded value must
42443 be the name of a file that contains a CRL in PEM format.
42444 </para>
42445 <para>
42446 <indexterm role="option">
42447 <primary><option>tls_privatekey</option></primary>
42448 </indexterm>
42449 </para>
42450 <informaltable frame="all">
42451 <tgroup cols="4" colsep="0" rowsep="0">
42452 <colspec colwidth="8*" align="left"/>
42453 <colspec colwidth="6*" align="center"/>
42454 <colspec colwidth="6*" align="center"/>
42455 <colspec colwidth="6*" align="right"/>
42456 <tbody>
42457 <row>
42458 <entry><option>tls_privatekey</option></entry>
42459 <entry>Use: <emphasis>smtp</emphasis></entry>
42460 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42461 <entry>Default: <emphasis>unset</emphasis></entry>
42462 </row>
42463 </tbody>
42464 </tgroup>
42465 </informaltable>
42466 <para>
42467 <indexterm role="concept">
42468 <primary>TLS</primary>
42469 <secondary>client private key, location of</secondary>
42470 </indexterm>
42471 <indexterm role="variable">
42472 <primary><varname>$host</varname></primary>
42473 </indexterm>
42474 <indexterm role="variable">
42475 <primary><varname>$host_address</varname></primary>
42476 </indexterm>
42477 The value of this option must be the absolute path to a file which contains the
42478 client&#x2019;s private key. This is used when sending a message over an encrypted
42479 connection using a client certificate. The values of <varname>$host</varname> and
42480 <varname>$host_address</varname> are set to the name and address of the server during the
42481 expansion. If this option is unset, or the expansion is forced to fail, or the
42482 result is an empty string, the private key is assumed to be in the same file as
42483 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42484 </para>
42485 <para>
42486 <indexterm role="option">
42487 <primary><option>tls_require_ciphers</option></primary>
42488 </indexterm>
42489 </para>
42490 <informaltable frame="all">
42491 <tgroup cols="4" colsep="0" rowsep="0">
42492 <colspec colwidth="8*" align="left"/>
42493 <colspec colwidth="6*" align="center"/>
42494 <colspec colwidth="6*" align="center"/>
42495 <colspec colwidth="6*" align="right"/>
42496 <tbody>
42497 <row>
42498 <entry><option>tls_require_ciphers</option></entry>
42499 <entry>Use: <emphasis>smtp</emphasis></entry>
42500 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42501 <entry>Default: <emphasis>unset</emphasis></entry>
42502 </row>
42503 </tbody>
42504 </tgroup>
42505 </informaltable>
42506 <para>
42507 <indexterm role="concept">
42508 <primary>TLS</primary>
42509 <secondary>requiring specific ciphers</secondary>
42510 </indexterm>
42511 <indexterm role="concept">
42512 <primary>cipher</primary>
42513 <secondary>requiring specific</secondary>
42514 </indexterm>
42515 <indexterm role="variable">
42516 <primary><varname>$host</varname></primary>
42517 </indexterm>
42518 <indexterm role="variable">
42519 <primary><varname>$host_address</varname></primary>
42520 </indexterm>
42521 The value of this option must be a list of permitted cipher suites, for use
42522 when setting up an outgoing encrypted connection. (There is a global option of
42523 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
42524 <varname>$host_address</varname> are set to the name and address of the server during the
42525 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
42526 is used in different ways by OpenSSL and GnuTLS (see sections
42527 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
42528 ciphers is a preference order.
42529 </para>
42530 <para>
42531 <indexterm role="option">
42532 <primary><option>tls_tempfail_tryclear</option></primary>
42533 </indexterm>
42534 </para>
42535 <informaltable frame="all">
42536 <tgroup cols="4" colsep="0" rowsep="0">
42537 <colspec colwidth="8*" align="left"/>
42538 <colspec colwidth="6*" align="center"/>
42539 <colspec colwidth="6*" align="center"/>
42540 <colspec colwidth="6*" align="right"/>
42541 <tbody>
42542 <row>
42543 <entry><option>tls_tempfail_tryclear</option></entry>
42544 <entry>Use: <emphasis>smtp</emphasis></entry>
42545 <entry>Type: <emphasis>boolean</emphasis></entry>
42546 <entry>Default: <emphasis>true</emphasis></entry>
42547 </row>
42548 </tbody>
42549 </tgroup>
42550 </informaltable>
42551 <para>
42552 <indexterm role="concept">
42553 <primary>4<emphasis>xx</emphasis> responses</primary>
42554 <secondary>to STARTTLS</secondary>
42555 </indexterm>
42556 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
42557 setting up a TLS session, this option determines whether or not Exim should try
42558 to deliver the message unencrypted. If it is set false, delivery to the
42559 current host is deferred; if there are other hosts, they are tried. If this
42560 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
42561 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
42562 TLS negotiation fails, Exim closes the current connection (because it is in an
42563 unknown state), opens a new one to the same host, and then tries the delivery
42564 in clear.
42565 </para>
42566 <para>
42567 <indexterm role="option">
42568 <primary><option>tls_verify_certificates</option></primary>
42569 </indexterm>
42570 </para>
42571 <informaltable frame="all">
42572 <tgroup cols="4" colsep="0" rowsep="0">
42573 <colspec colwidth="8*" align="left"/>
42574 <colspec colwidth="6*" align="center"/>
42575 <colspec colwidth="6*" align="center"/>
42576 <colspec colwidth="6*" align="right"/>
42577 <tbody>
42578 <row>
42579 <entry><option>tls_verify_certificates</option></entry>
42580 <entry>Use: <emphasis>smtp</emphasis></entry>
42581 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42582 <entry>Default: <emphasis>unset</emphasis></entry>
42583 </row>
42584 </tbody>
42585 </tgroup>
42586 </informaltable>
42587 <para>
42588 <indexterm role="concept">
42589 <primary>TLS</primary>
42590 <secondary>server certificate verification</secondary>
42591 </indexterm>
42592 <indexterm role="concept">
42593 <primary>certificate</primary>
42594 <secondary>verification of server</secondary>
42595 </indexterm>
42596 <indexterm role="variable">
42597 <primary><varname>$host</varname></primary>
42598 </indexterm>
42599 <indexterm role="variable">
42600 <primary><varname>$host_address</varname></primary>
42601 </indexterm>
42602 The value of this option must be the absolute path to a file containing
42603 permitted server certificates, for use when setting up an encrypted connection.
42604 Alternatively, if you are using OpenSSL, you can set
42605 <option>tls_verify_certificates</option> to the name of a directory containing certificate
42606 files. This does not work with GnuTLS; the option must be set to the name of a
42607 single file if you are using GnuTLS. The values of <varname>$host</varname> and
42608 <varname>$host_address</varname> are set to the name and address of the server during the
42609 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42610 </para>
42611 </section>
42612 <section id="SECTvalhosmax">
42613 <title>How the limits for the number of hosts to try are used</title>
42614 <para>
42615 <indexterm role="concept">
42616 <primary>host</primary>
42617 <secondary>maximum number to try</secondary>
42618 </indexterm>
42619 <indexterm role="concept">
42620 <primary>limit</primary>
42621 <secondary>hosts; maximum number tried</secondary>
42622 </indexterm>
42623 There are two options that are concerned with the number of hosts that are
42624 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
42625 <option>hosts_max_try_hardlimit</option>.
42626 </para>
42627 <para>
42628 The <option>hosts_max_try</option> option limits the number of hosts that are tried
42629 for a single delivery. However, despite the term <quote>host</quote> in its name, the
42630 option actually applies to each IP address independently. In other words, a
42631 multihomed host is treated as several independent hosts, just as it is for
42632 retrying.
42633 </para>
42634 <para>
42635 Many of the larger ISPs have multiple MX records which often point to
42636 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
42637 created as a result of routing one of these domains.
42638 </para>
42639 <para>
42640 Trying every single IP address on such a long list does not seem sensible; if
42641 several at the top of the list fail, it is reasonable to assume there is some
42642 problem that is likely to affect all of them. Roughly speaking, the value of
42643 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
42644 delivery. However, the logic cannot be quite that simple.
42645 </para>
42646 <para>
42647 Firstly, IP addresses that are skipped because their retry times have not
42648 arrived do not count, and in addition, addresses that are past their retry
42649 limits are also not counted, even when they are tried. This means that when
42650 some IP addresses are past their retry limits, more than the value of
42651 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
42652 that all IP addresses are considered before timing out an email address (but
42653 see below for an exception).
42654 </para>
42655 <para>
42656 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
42657 list to see if there is a subsequent host with a different (higher valued) MX.
42658 If there is, that host is considered next, and the current IP address is used
42659 but not counted. This behaviour helps in the case of a domain with a retry rule
42660 that hardly ever delays any hosts, as is now explained:
42661 </para>
42662 <para>
42663 Consider the case of a long list of hosts with one MX value, and a few with a
42664 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
42665 hosts at the top of the list are tried at first. With the default retry rule,
42666 which specifies increasing retry times, the higher MX hosts are eventually
42667 tried when those at the top of the list are skipped because they have not
42668 reached their retry times.
42669 </para>
42670 <para>
42671 However, it is common practice to put a fixed short retry time on domains for
42672 large ISPs, on the grounds that their servers are rarely down for very long.
42673 Unfortunately, these are exactly the domains that tend to resolve to long lists
42674 of hosts. The short retry time means that the lowest MX hosts are tried every
42675 time. The attempts may be in a different order because of random sorting, but
42676 without the special MX check, the higher MX hosts would never be tried until
42677 all the lower MX hosts had timed out (which might be several days), because
42678 there are always some lower MX hosts that have reached their retry times. With
42679 the special check, Exim considers at least one IP address from each MX value at
42680 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
42681 reached.
42682 </para>
42683 <para>
42684 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
42685 particular, Exim normally eventually tries all the IP addresses before timing
42686 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
42687 reasonable thing to do. Recently, however, some lunatic DNS configurations have
42688 been set up with hundreds of IP addresses for some domains. It can
42689 take a very long time indeed for an address to time out in these cases.
42690 </para>
42691 <para>
42692 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
42693 Exim never tries more than this number of IP addresses; if it hits this limit
42694 and they are all timed out, the email address is bounced, even though not all
42695 possible IP addresses have been tried.
42696 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
42697 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
42698 </para>
42699 </section>
42700 </chapter>
42701
42702 <chapter id="CHAPrewrite">
42703 <title>Address rewriting</title>
42704 <para>
42705 <indexterm role="concept" id="IIDaddrew" class="startofrange">
42706 <primary>rewriting</primary>
42707 <secondary>addresses</secondary>
42708 </indexterm>
42709 There are some circumstances in which Exim automatically rewrites domains in
42710 addresses. The two most common are when an address is given without a domain
42711 (referred to as an <quote>unqualified address</quote>) or when an address contains an
42712 abbreviated domain that is expanded by DNS lookup.
42713 </para>
42714 <para>
42715 Unqualified envelope addresses are accepted only for locally submitted
42716 messages, or for messages that are received from hosts matching
42717 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
42718 appropriate. Unqualified addresses in header lines are qualified if they are in
42719 locally submitted messages, or messages from hosts that are permitted to send
42720 unqualified envelope addresses. Otherwise, unqualified addresses in header
42721 lines are neither qualified nor rewritten.
42722 </para>
42723 <para>
42724 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
42725 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
42726 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
42727 do this. The new RFCs do not contain this suggestion.
42728 </para>
42729 <section id="SECID147">
42730 <title>Explicitly configured address rewriting</title>
42731 <para>
42732 This chapter describes the rewriting rules that can be used in the
42733 main rewrite section of the configuration file, and also in the generic
42734 <option>headers_rewrite</option> option that can be set on any transport.
42735 </para>
42736 <para>
42737 Some people believe that configured address rewriting is a Mortal Sin.
42738 Others believe that life is not possible without it. Exim provides the
42739 facility; you do not have to use it.
42740 </para>
42741 <para>
42742 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
42743 configuration file are applied to addresses in incoming messages, both envelope
42744 addresses and addresses in header lines. Each rule specifies the types of
42745 address to which it applies.
42746 </para>
42747 <para>
42748 Whether or not addresses in header lines are rewritten depends on the origin of
42749 the headers and the type of rewriting. Global rewriting, that is, rewriting
42750 rules from the rewrite section of the configuration file, is applied only to
42751 those headers that were received with the message. Header lines that are added
42752 by ACLs or by a system filter or by individual routers or transports (which
42753 are specific to individual recipient addresses) are not rewritten by the global
42754 rules.
42755 </para>
42756 <para>
42757 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
42758 applies all headers except those added by routers and transports. That is, as
42759 well as the headers that were received with the message, it also applies to
42760 headers that were added by an ACL or a system filter.
42761 </para>
42762 <para>
42763 In general, rewriting addresses from your own system or domain has some
42764 legitimacy. Rewriting other addresses should be done only with great care and
42765 in special circumstances. The author of Exim believes that rewriting should be
42766 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
42767 Although it can sometimes be used as a routing tool, this is very strongly
42768 discouraged.
42769 </para>
42770 <para>
42771 There are two commonly encountered circumstances where rewriting is used, as
42772 illustrated by these examples:
42773 </para>
42774 <itemizedlist>
42775 <listitem>
42776 <para>
42777 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
42778 exchange mail with each other behind a firewall, but there is only a single
42779 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
42780 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
42781 </para>
42782 </listitem>
42783 <listitem>
42784 <para>
42785 A host rewrites the local parts of its own users so that, for example,
42786 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
42787 </para>
42788 </listitem>
42789 </itemizedlist>
42790 </section>
42791 <section id="SECID148">
42792 <title>When does rewriting happen?</title>
42793 <para>
42794 <indexterm role="concept">
42795 <primary>rewriting</primary>
42796 <secondary>timing of</secondary>
42797 </indexterm>
42798 <indexterm role="concept">
42799 <primary>access control lists (ACLs)</primary>
42800 <secondary>rewriting addresses in</secondary>
42801 </indexterm>
42802 Configured address rewriting can take place at several different stages of a
42803 message&#x2019;s processing.
42804 </para>
42805 <para>
42806 <indexterm role="variable">
42807 <primary><varname>$sender_address</varname></primary>
42808 </indexterm>
42809 At the start of an ACL for MAIL, the sender address may have been rewritten
42810 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
42811 ordinary rewrite rules have yet been applied. If, however, the sender address
42812 is verified in the ACL, it is rewritten before verification, and remains
42813 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
42814 rewritten address. This also applies if sender verification happens in a
42815 RCPT ACL. Otherwise, when the sender address is not verified, it is
42816 rewritten as soon as a message&#x2019;s header lines have been received.
42817 </para>
42818 <para>
42819 <indexterm role="variable">
42820 <primary><varname>$domain</varname></primary>
42821 </indexterm>
42822 <indexterm role="variable">
42823 <primary><varname>$local_part</varname></primary>
42824 </indexterm>
42825 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
42826 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
42827 rewrite rules have yet been applied to it. However, the behaviour is different
42828 from the sender address when a recipient is verified. The address is rewritten
42829 for the verification, but the rewriting is not remembered at this stage. The
42830 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
42831 as they were before (that is, they contain the unrewritten &ndash; except for
42832 SMTP-time rewriting &ndash; address).
42833 </para>
42834 <para>
42835 As soon as a message&#x2019;s header lines have been received, all the envelope
42836 recipient addresses are permanently rewritten, and rewriting is also applied to
42837 the addresses in the header lines (if configured). This happens before adding
42838 any header lines that were specified in MAIL or RCPT ACLs, and
42839 <indexterm role="concept">
42840 <primary><function>local_scan()</function> function</primary>
42841 <secondary>address rewriting; timing of</secondary>
42842 </indexterm>
42843 before the DATA ACL and <function>local_scan()</function> functions are run.
42844 </para>
42845 <para>
42846 When an address is being routed, either for delivery or for verification,
42847 rewriting is applied immediately to child addresses that are generated by
42848 redirection, unless <option>no_rewrite</option> is set on the router.
42849 </para>
42850 <para>
42851 <indexterm role="concept">
42852 <primary>envelope sender</primary>
42853 <secondary>rewriting at transport time</secondary>
42854 </indexterm>
42855 <indexterm role="concept">
42856 <primary>rewriting</primary>
42857 <secondary>at transport time</secondary>
42858 </indexterm>
42859 <indexterm role="concept">
42860 <primary>header lines</primary>
42861 <secondary>rewriting at transport time</secondary>
42862 </indexterm>
42863 At transport time, additional rewriting of addresses in header lines can be
42864 specified by setting the generic <option>headers_rewrite</option> option on a transport.
42865 This option contains rules that are identical in form to those in the rewrite
42866 section of the configuration file. They are applied to the original message
42867 header lines and any that were added by ACLs or a system filter. They are not
42868 applied to header lines that are added by routers or the transport.
42869 </para>
42870 <para>
42871 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
42872 transport option. However, it is not possible to rewrite envelope recipients at
42873 transport time.
42874 </para>
42875 </section>
42876 <section id="SECID149">
42877 <title>Testing the rewriting rules that apply on input</title>
42878 <para>
42879 <indexterm role="concept">
42880 <primary>rewriting</primary>
42881 <secondary>testing</secondary>
42882 </indexterm>
42883 <indexterm role="concept">
42884 <primary>testing</primary>
42885 <secondary>rewriting</secondary>
42886 </indexterm>
42887 Exim&#x2019;s input rewriting configuration appears in a part of the run time
42888 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
42889 <option>-brw</option> command line option. This takes an address (which can be a full RFC
42890 2822 address) as its argument. The output is a list of how the address would be
42891 transformed by the rewriting rules for each of the different places it might
42892 appear in an incoming message, that is, for each different header and for the
42893 envelope sender and recipient fields. For example,
42894 </para>
42895 <literallayout class="monospaced">
42896 exim -brw ph10@exim.workshop.example
42897 </literallayout>
42898 <para>
42899 might produce the output
42900 </para>
42901 <literallayout class="monospaced">
42902 sender: Philip.Hazel@exim.workshop.example
42903 from: Philip.Hazel@exim.workshop.example
42904 to: ph10@exim.workshop.example
42905 cc: ph10@exim.workshop.example
42906 bcc: ph10@exim.workshop.example
42907 reply-to: Philip.Hazel@exim.workshop.example
42908 env-from: Philip.Hazel@exim.workshop.example
42909 env-to: ph10@exim.workshop.example
42910 </literallayout>
42911 <para>
42912 which shows that rewriting has been set up for that address when used in any of
42913 the source fields, but not when it appears as a recipient address. At the
42914 present time, there is no equivalent way of testing rewriting rules that are
42915 set for a particular transport.
42916 </para>
42917 </section>
42918 <section id="SECID150">
42919 <title>Rewriting rules</title>
42920 <para>
42921 <indexterm role="concept">
42922 <primary>rewriting</primary>
42923 <secondary>rules</secondary>
42924 </indexterm>
42925 The rewrite section of the configuration file consists of lines of rewriting
42926 rules in the form
42927 </para>
42928 <literallayout>
42929 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
42930 </literallayout>
42931 <para>
42932 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
42933 transport option are given as a colon-separated list. Each item in the list
42934 takes the same form as a line in the main rewriting configuration (except that
42935 any colons must be doubled, of course).
42936 </para>
42937 <para>
42938 The formats of source patterns and replacement strings are described below.
42939 Each is terminated by white space, unless enclosed in double quotes, in which
42940 case normal quoting conventions apply inside the quotes. The flags are single
42941 characters which may appear in any order. Spaces and tabs between them are
42942 ignored.
42943 </para>
42944 <para>
42945 For each address that could potentially be rewritten, the rules are scanned in
42946 order, and replacements for the address from earlier rules can themselves be
42947 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
42948 </para>
42949 <para>
42950 The order in which addresses are rewritten is undefined, may change between
42951 releases, and must not be relied on, with one exception: when a message is
42952 received, the envelope sender is always rewritten first, before any header
42953 lines are rewritten. For example, the replacement string for a rewrite of an
42954 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
42955 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
42956 that the envelope sender has already been rewritten.
42957 </para>
42958 <para>
42959 <indexterm role="variable">
42960 <primary><varname>$domain</varname></primary>
42961 </indexterm>
42962 <indexterm role="variable">
42963 <primary><varname>$local_part</varname></primary>
42964 </indexterm>
42965 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
42966 string to refer to the address that is being rewritten. Note that lookup-driven
42967 rewriting can be done by a rule of the form
42968 </para>
42969 <literallayout class="monospaced">
42970 *@*   ${lookup ...
42971 </literallayout>
42972 <para>
42973 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
42974 refer to the address that is being rewritten.
42975 </para>
42976 </section>
42977 <section id="SECID151">
42978 <title>Rewriting patterns</title>
42979 <para>
42980 <indexterm role="concept">
42981 <primary>rewriting</primary>
42982 <secondary>patterns</secondary>
42983 </indexterm>
42984 <indexterm role="concept">
42985 <primary>address list</primary>
42986 <secondary>in a rewriting pattern</secondary>
42987 </indexterm>
42988 The source pattern in a rewriting rule is any item which may appear in an
42989 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
42990 single-item address list, which means that it is expanded before being tested
42991 against the address. As always, if you use a regular expression as a pattern,
42992 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
42993 facility to suppress string expansion within the regular expression.
42994 </para>
42995 <para>
42996 Domains in patterns should be given in lower case. Local parts in patterns are
42997 case-sensitive. If you want to do case-insensitive matching of local parts, you
42998 can use a regular expression that starts with <literal>^(?i)</literal>.
42999 </para>
43000 <para>
43001 <indexterm role="concept">
43002 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43003 <secondary>in rewriting rules</secondary>
43004 </indexterm>
43005 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
43006 depending on the type of match which occurred. These can be used in the
43007 replacement string to insert portions of the incoming address. <varname>$0</varname> always
43008 refers to the complete incoming address. When a regular expression is used, the
43009 numerical variables are set from its capturing subexpressions. For other types
43010 of pattern they are set as follows:
43011 </para>
43012 <itemizedlist>
43013 <listitem>
43014 <para>
43015 If a local part or domain starts with an asterisk, the numerical variables
43016 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
43017 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
43018 pattern
43019 </para>
43020 <literallayout class="monospaced">
43021 *queen@*.fict.example
43022 </literallayout>
43023 <para>
43024 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
43025 </para>
43026 <literallayout class="monospaced">
43027 $0 = hearts-queen@wonderland.fict.example
43028 $1 = hearts-
43029 $2 = wonderland
43030 </literallayout>
43031 <para>
43032 Note that if the local part does not start with an asterisk, but the domain
43033 does, it is <varname>$1</varname> that contains the wild part of the domain.
43034 </para>
43035 </listitem>
43036 <listitem>
43037 <para>
43038 If the domain part of the pattern is a partial lookup, the wild and fixed parts
43039 of the domain are placed in the next available numerical variables. Suppose,
43040 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
43041 rewriting rule of the form
43042 </para>
43043 <literallayout>
43044 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
43045 </literallayout>
43046 <para>
43047 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
43048 </para>
43049 <literallayout class="monospaced">
43050 $1 = foo
43051 $2 = bar
43052 $3 = baz.example
43053 </literallayout>
43054 <para>
43055 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
43056 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
43057 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
43058 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
43059 whole domain. For non-partial domain lookups, no numerical variables are set.
43060 </para>
43061 </listitem>
43062 </itemizedlist>
43063 </section>
43064 <section id="SECID152">
43065 <title>Rewriting replacements</title>
43066 <para>
43067 <indexterm role="concept">
43068 <primary>rewriting</primary>
43069 <secondary>replacements</secondary>
43070 </indexterm>
43071 If the replacement string for a rule is a single asterisk, addresses that
43072 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
43073 rewriting rules are scanned. For example,
43074 </para>
43075 <literallayout class="monospaced">
43076 hatta@lookingglass.fict.example  *  f
43077 </literallayout>
43078 <para>
43079 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
43080 <emphasis>From:</emphasis> headers.
43081 </para>
43082 <para>
43083 <indexterm role="variable">
43084 <primary><varname>$domain</varname></primary>
43085 </indexterm>
43086 <indexterm role="variable">
43087 <primary><varname>$local_part</varname></primary>
43088 </indexterm>
43089 If the replacement string is not a single asterisk, it is expanded, and must
43090 yield a fully qualified address. Within the expansion, the variables
43091 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
43092 Any letters they contain retain their original case &ndash; they are not lower
43093 cased. The numerical variables are set up according to the type of pattern that
43094 matched the address, as described above. If the expansion is forced to fail by
43095 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
43096 current rule is abandoned, but subsequent rules may take effect. Any other
43097 expansion failure causes the entire rewriting operation to be abandoned, and an
43098 entry written to the panic log.
43099 </para>
43100 </section>
43101 <section id="SECID153">
43102 <title>Rewriting flags</title>
43103 <para>
43104 There are three different kinds of flag that may appear on rewriting rules:
43105 </para>
43106 <itemizedlist>
43107 <listitem>
43108 <para>
43109 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
43110 c, f, h, r, s, t.
43111 </para>
43112 </listitem>
43113 <listitem>
43114 <para>
43115 A flag that specifies rewriting at SMTP time: S.
43116 </para>
43117 </listitem>
43118 <listitem>
43119 <para>
43120 Flags that control the rewriting process: Q, q, R, w.
43121 </para>
43122 </listitem>
43123 </itemizedlist>
43124 <para>
43125 For rules that are part of the <option>headers_rewrite</option> generic transport option,
43126 E, F, T, and S are not permitted.
43127 </para>
43128 </section>
43129 <section id="SECID154">
43130 <title>Flags specifying which headers and envelope addresses to rewrite</title>
43131 <para>
43132 <indexterm role="concept">
43133 <primary>rewriting</primary>
43134 <secondary>flags</secondary>
43135 </indexterm>
43136 If none of the following flag letters, nor the <quote>S</quote> flag (see section
43137 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
43138 and to both the sender and recipient fields of the envelope, whereas a
43139 transport-time rewriting rule just applies to all headers. Otherwise, the
43140 rewriting rule is skipped unless the relevant addresses are being processed.
43141 </para>
43142 <literallayout>
43143 <literal>E</literal>       rewrite all envelope fields
43144 <literal>F</literal>       rewrite the envelope From field
43145 <literal>T</literal>       rewrite the envelope To field
43146 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
43147 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
43148 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
43149 <literal>h</literal>       rewrite all headers
43150 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
43151 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
43152 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
43153 </literallayout>
43154 <para>
43155 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
43156 restrict this to special known cases in your own domains.
43157 </para>
43158 </section>
43159 <section id="SECTrewriteS">
43160 <title>The SMTP-time rewriting flag</title>
43161 <para>
43162 <indexterm role="concept">
43163 <primary>SMTP</primary>
43164 <secondary>rewriting malformed addresses</secondary>
43165 </indexterm>
43166 <indexterm role="concept">
43167 <primary>RCPT</primary>
43168 <secondary>rewriting argument of</secondary>
43169 </indexterm>
43170 <indexterm role="concept">
43171 <primary>MAIL</primary>
43172 <secondary>rewriting argument of</secondary>
43173 </indexterm>
43174 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
43175 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
43176 before any other processing; even before syntax checking. The pattern is
43177 required to be a regular expression, and it is matched against the whole of the
43178 data for the command, including any surrounding angle brackets.
43179 </para>
43180 <para>
43181 <indexterm role="variable">
43182 <primary><varname>$domain</varname></primary>
43183 </indexterm>
43184 <indexterm role="variable">
43185 <primary><varname>$local_part</varname></primary>
43186 </indexterm>
43187 This form of rewrite rule allows for the handling of addresses that are not
43188 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
43189 input). Because the input is not required to be a syntactically valid address,
43190 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
43191 expansion of the replacement string. The result of rewriting replaces the
43192 original address in the MAIL or RCPT command.
43193 </para>
43194 </section>
43195 <section id="SECID155">
43196 <title>Flags controlling the rewriting process</title>
43197 <para>
43198 There are four flags which control the way the rewriting process works. These
43199 take effect only when a rule is invoked, that is, when the address is of the
43200 correct type (matches the flags) and matches the pattern:
43201 </para>
43202 <itemizedlist>
43203 <listitem>
43204 <para>
43205 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
43206 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
43207 absence of <quote>Q</quote> the rewritten address must always include a domain.
43208 </para>
43209 </listitem>
43210 <listitem>
43211 <para>
43212 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
43213 even if no rewriting actually takes place because of a <quote>fail</quote> in the
43214 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
43215 (does not match the flags) or does not match the pattern.
43216 </para>
43217 </listitem>
43218 <listitem>
43219 <para>
43220 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
43221 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
43222 rewriting once it fails to match (after at least one successful rewrite).
43223 </para>
43224 </listitem>
43225 <listitem>
43226 <para>
43227 <indexterm role="concept">
43228 <primary>rewriting</primary>
43229 <secondary>whole addresses</secondary>
43230 </indexterm>
43231 When an address in a header is rewritten, the rewriting normally applies only
43232 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
43233 left unchanged. For example, rewriting might change
43234 </para>
43235 <literallayout class="monospaced">
43236 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
43237 </literallayout>
43238 <para>
43239 into
43240 </para>
43241 <literallayout class="monospaced">
43242 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
43243 </literallayout>
43244 <para>
43245 <indexterm role="concept">
43246 <primary>RFC 2047</primary>
43247 </indexterm>
43248 Sometimes there is a need to replace the whole address item, and this can be
43249 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
43250 causes an address in a header line to be rewritten, the entire address is
43251 replaced, not just the working part. The replacement must be a complete RFC
43252 2822 address, including the angle brackets if necessary. If text outside angle
43253 brackets contains a character whose value is greater than 126 or less than 32
43254 (except for tab), the text is encoded according to RFC 2047. The character set
43255 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
43256 </para>
43257 <para>
43258 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
43259 rewritten, all but the working part of the replacement address is discarded.
43260 </para>
43261 </listitem>
43262 </itemizedlist>
43263 </section>
43264 <section id="SECID156">
43265 <title>Rewriting examples</title>
43266 <para>
43267 Here is an example of the two common rewriting paradigms:
43268 </para>
43269 <literallayout class="monospaced">
43270 *@*.hitch.fict.example  $1@hitch.fict.example
43271 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
43272                      {$value}fail}@hitch.fict.example bctfrF
43273 </literallayout>
43274 <para>
43275 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
43276 the string expansion to fail if the lookup does not succeed. In this context it
43277 has the effect of leaving the original address unchanged, but Exim goes on to
43278 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
43279 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
43280 explicitly, which would cause the rewritten address to be the same as before,
43281 at the cost of a small bit of processing. Not supplying either of these is an
43282 error, since the rewritten address would then contain no local part.
43283 </para>
43284 <para>
43285 The first example above replaces the domain with a superior, more general
43286 domain. This may not be desirable for certain local parts. If the rule
43287 </para>
43288 <literallayout class="monospaced">
43289 root@*.hitch.fict.example  *
43290 </literallayout>
43291 <para>
43292 were inserted before the first rule, rewriting would be suppressed for the
43293 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
43294 </para>
43295 <para>
43296 Rewriting can be made conditional on a number of tests, by making use of
43297 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
43298 messages that originate outside the local host:
43299 </para>
43300 <literallayout class="monospaced">
43301 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
43302                          {$1@hitch.fict.example}fail}"
43303 </literallayout>
43304 <para>
43305 The replacement string is quoted in this example because it contains white
43306 space.
43307 </para>
43308 <para>
43309 <indexterm role="concept">
43310 <primary>rewriting</primary>
43311 <secondary>bang paths</secondary>
43312 </indexterm>
43313 <indexterm role="concept">
43314 <primary>bang paths</primary>
43315 <secondary>rewriting</secondary>
43316 </indexterm>
43317 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
43318 an address it treats it as an unqualified local part which it qualifies with
43319 the local qualification domain (if the source of the message is local or if the
43320 remote host is permitted to send unqualified addresses). Rewriting can
43321 sometimes be used to handle simple bang paths with a fixed number of
43322 components. For example, the rule
43323 </para>
43324 <literallayout class="monospaced">
43325 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
43326 </literallayout>
43327 <para>
43328 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
43329 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
43330 a global rewriting rule for envelope addresses. It can provide a backdoor
43331 method for using your system as a relay, because the incoming addresses appear
43332 to be local. If the bang path addresses are received via SMTP, it is safer to
43333 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
43334 can be done on the rewritten addresses.
43335 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
43336 </para>
43337 </section>
43338 </chapter>
43339
43340 <chapter id="CHAPretry">
43341 <title>Retry configuration</title>
43342 <para>
43343 <indexterm role="concept" id="IIDretconf1" class="startofrange">
43344 <primary>retry</primary>
43345 <secondary>configuration, description of</secondary>
43346 </indexterm>
43347 <indexterm role="concept" id="IIDregconf2" class="startofrange">
43348 <primary>configuration file</primary>
43349 <secondary>retry section</secondary>
43350 </indexterm>
43351 The <quote>retry</quote> section of the run time configuration file contains a list of
43352 retry rules that control how often Exim tries to deliver messages that cannot
43353 be delivered at the first attempt. If there are no retry rules, temporary
43354 errors are treated as permanent. The <option>-brt</option> command line option can be used
43355 to test which retry rule will be used for a given address, domain and error.
43356 </para>
43357 <para>
43358 The most common cause of retries is temporary failure to deliver to a remote
43359 host because the host is down, or inaccessible because of a network problem.
43360 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
43361 address) basis, not on a per-message basis. Thus, if one message has recently
43362 been delayed, delivery of a new message to the same host is not immediately
43363 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
43364 log selector is set, the message
43365 <indexterm role="concept">
43366 <primary>retry</primary>
43367 <secondary>time not reached</secondary>
43368 </indexterm>
43369 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
43370 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
43371 the handling of errors during remote deliveries.
43372 </para>
43373 <para>
43374 Retry processing applies to routing as well as to delivering, except as covered
43375 in the next paragraph. The retry rules do not distinguish between these
43376 actions. It is not possible, for example, to specify different behaviour for
43377 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
43378 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
43379 added complication, so did not implement it. However, although they share the
43380 same retry rule, the actual retry times for routing and transporting a given
43381 domain are maintained independently.
43382 </para>
43383 <para>
43384 When a delivery is not part of a queue run (typically an immediate delivery on
43385 receipt of a message), the routers are always run, and local deliveries are
43386 always attempted, even if retry times are set for them. This makes for better
43387 behaviour if one particular message is causing problems (for example, causing
43388 quota overflow, or provoking an error in a filter file). If such a delivery
43389 suffers a temporary failure, the retry data is updated as normal, and
43390 subsequent delivery attempts from queue runs occur only when the retry time for
43391 the local address is reached.
43392 </para>
43393 <section id="SECID157">
43394 <title>Changing retry rules</title>
43395 <para>
43396 If you change the retry rules in your configuration, you should consider
43397 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
43398 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
43399 always safe; that is why they are called <quote>hints</quote>.
43400 </para>
43401 <para>
43402 The hints retry data contains suggested retry times based on the previous
43403 rules. In the case of a long-running problem with a remote host, it might
43404 record the fact that the host has timed out. If your new rules increase the
43405 timeout time for such a host, you should definitely remove the old retry data
43406 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
43407 messages that it should now be retaining.
43408 </para>
43409 </section>
43410 <section id="SECID158">
43411 <title>Format of retry rules</title>
43412 <para>
43413 <indexterm role="concept">
43414 <primary>retry</primary>
43415 <secondary>rules</secondary>
43416 </indexterm>
43417 Each retry rule occupies one line and consists of three or four parts,
43418 separated by white space: a pattern, an error name, an optional list of sender
43419 addresses, and a list of retry parameters. The pattern and sender lists must be
43420 enclosed in double quotes if they contain white space. The rules are searched
43421 in order until one is found where the pattern, error name, and sender list (if
43422 present) match the failing host or address, the error that occurred, and the
43423 message&#x2019;s sender, respectively.
43424 </para>
43425 <para>
43426 The pattern is any single item that may appear in an address list (see section
43427 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
43428 which means that it is expanded before being tested against the address that
43429 has been delayed. A negated address list item is permitted. Address
43430 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
43431 which makes it possible for many retry rules to start with just a domain. For
43432 example,
43433 </para>
43434 <literallayout class="monospaced">
43435 lookingglass.fict.example        *  F,24h,30m;
43436 </literallayout>
43437 <para>
43438 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
43439 whereas
43440 </para>
43441 <literallayout class="monospaced">
43442 alice@lookingglass.fict.example  *  F,24h,30m;
43443 </literallayout>
43444 <para>
43445 applies only to temporary failures involving the local part <option>alice</option>.
43446 In practice, almost all rules start with a domain name pattern without a local
43447 part.
43448 </para>
43449 <para>
43450 <indexterm role="concept">
43451 <primary>regular expressions</primary>
43452 <secondary>in retry rules</secondary>
43453 </indexterm>
43454 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
43455 must match a complete address, not just a domain, because that is how regular
43456 expressions work in address lists.
43457 </para>
43458 <literallayout>
43459 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
43460 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
43461 </literallayout>
43462 </section>
43463 <section id="SECID159">
43464 <title>Choosing which retry rule to use for address errors</title>
43465 <para>
43466 When Exim is looking for a retry rule after a routing attempt has failed (for
43467 example, after a DNS timeout), each line in the retry configuration is tested
43468 against the complete address only if <option>retry_use_local_part</option> is set for the
43469 router. Otherwise, only the domain is used, except when matching against a
43470 regular expression, when the local part of the address is replaced with <quote>*</quote>.
43471 A domain on its own can match a domain pattern, or a pattern that starts with
43472 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
43473 <option>check_local_user</option> is true, and false for other routers.
43474 </para>
43475 <para>
43476 Similarly, when Exim is looking for a retry rule after a local delivery has
43477 failed (for example, after a mailbox full error), each line in the retry
43478 configuration is tested against the complete address only if
43479 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
43480 local transports).
43481 </para>
43482 <para>
43483 <indexterm role="concept">
43484 <primary>4<emphasis>xx</emphasis> responses</primary>
43485 <secondary>retry rules for</secondary>
43486 </indexterm>
43487 However, when Exim is looking for a retry rule after a remote delivery attempt
43488 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
43489 whole address is always used as the key when searching the retry rules. The
43490 rule that is found is used to create a retry time for the combination of the
43491 failing address and the message&#x2019;s sender. It is the combination of sender and
43492 recipient that is delayed in subsequent queue runs until its retry time is
43493 reached. You can delay the recipient without regard to the sender by setting
43494 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
43495 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
43496 commands.
43497 </para>
43498 </section>
43499 <section id="SECID160">
43500 <title>Choosing which retry rule to use for host and message errors</title>
43501 <para>
43502 For a temporary error that is not related to an individual address (for
43503 example, a connection timeout), each line in the retry configuration is checked
43504 twice. First, the name of the remote host is used as a domain name (preceded by
43505 <quote>*@</quote> when matching a regular expression). If this does not match the line,
43506 the domain from the email address is tried in a similar fashion. For example,
43507 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
43508 </para>
43509 <literallayout class="monospaced">
43510 a.b.c.example  MX  5  x.y.z.example
43511                MX  6  p.q.r.example
43512                MX  7  m.n.o.example
43513 </literallayout>
43514 <para>
43515 and the retry rules are
43516 </para>
43517 <literallayout class="monospaced">
43518 p.q.r.example    *      F,24h,30m;
43519 a.b.c.example    *      F,4d,45m;
43520 </literallayout>
43521 <para>
43522 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
43523 first rule matches neither the host nor the domain, so Exim looks at the second
43524 rule. This does not match the host, but it does match the domain, so it is used
43525 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
43526 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
43527 first retry rule is used, because it matches the host.
43528 </para>
43529 <para>
43530 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
43531 first rule to determine retry times, but for all the other hosts for the domain
43532 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
43533 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
43534 </para>
43535 <para>
43536 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
43537 However, if a message is routed directly to an IP address without the use of a
43538 host name, for example, if a <command>manualroute</command> router contains a setting such as:
43539 </para>
43540 <literallayout class="monospaced">
43541 route_list = *.a.example  192.168.34.23
43542 </literallayout>
43543 <para>
43544 then the <quote>host name</quote> that is used when searching for a retry rule is the
43545 textual form of the IP address.
43546 </para>
43547 </section>
43548 <section id="SECID161">
43549 <title>Retry rules for specific errors</title>
43550 <para>
43551 <indexterm role="concept">
43552 <primary>retry</primary>
43553 <secondary>specific errors; specifying</secondary>
43554 </indexterm>
43555 The second field in a retry rule is the name of a particular error, or an
43556 asterisk, which matches any error. The errors that can be tested for are:
43557 </para>
43558 <variablelist>
43559 <varlistentry>
43560 <term><option>auth_failed</option></term>
43561 <listitem>
43562 <para>
43563 Authentication failed when trying to send to a host in the
43564 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
43565 </para>
43566 </listitem></varlistentry>
43567 <varlistentry>
43568 <term><option>data_4xx</option></term>
43569 <listitem>
43570 <para>
43571 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
43572 after the command, or after sending the message&#x2019;s data.
43573 </para>
43574 </listitem></varlistentry>
43575 <varlistentry>
43576 <term><option>mail_4xx</option></term>
43577 <listitem>
43578 <para>
43579 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
43580 </para>
43581 </listitem></varlistentry>
43582 <varlistentry>
43583 <term><option>rcpt_4xx</option></term>
43584 <listitem>
43585 <para>
43586 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
43587 </para>
43588 </listitem></varlistentry>
43589 </variablelist>
43590 <para>
43591 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
43592 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
43593 recognize 452 errors given to RCPT commands for addresses in a certain domain,
43594 and have retries every ten minutes with a one-hour timeout, you could set up a
43595 retry rule of this form:
43596 </para>
43597 <literallayout class="monospaced">
43598 the.domain.name  rcpt_452   F,1h,10m
43599 </literallayout>
43600 <para>
43601 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
43602 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
43603 </para>
43604 <variablelist>
43605 <varlistentry>
43606 <term><option>lost_connection</option></term>
43607 <listitem>
43608 <para>
43609 A server unexpectedly closed the SMTP connection. There may, of course,
43610 legitimate reasons for this (host died, network died), but if it repeats a lot
43611 for the same host, it indicates something odd.
43612 </para>
43613 </listitem></varlistentry>
43614 <varlistentry>
43615 <term><option>refused_MX</option></term>
43616 <listitem>
43617 <para>
43618 A connection to a host obtained from an MX record was refused.
43619 </para>
43620 </listitem></varlistentry>
43621 <varlistentry>
43622 <term><option>refused_A</option></term>
43623 <listitem>
43624 <para>
43625 A connection to a host not obtained from an MX record was refused.
43626 </para>
43627 </listitem></varlistentry>
43628 <varlistentry>
43629 <term><option>refused</option></term>
43630 <listitem>
43631 <para>
43632 A connection was refused.
43633 </para>
43634 </listitem></varlistentry>
43635 <varlistentry>
43636 <term><option>timeout_connect_MX</option></term>
43637 <listitem>
43638 <para>
43639 A connection attempt to a host obtained from an MX record timed out.
43640 </para>
43641 </listitem></varlistentry>
43642 <varlistentry>
43643 <term><option>timeout_connect_A</option></term>
43644 <listitem>
43645 <para>
43646 A connection attempt to a host not obtained from an MX record timed out.
43647 </para>
43648 </listitem></varlistentry>
43649 <varlistentry>
43650 <term><option>timeout_connect</option></term>
43651 <listitem>
43652 <para>
43653 A connection attempt timed out.
43654 </para>
43655 </listitem></varlistentry>
43656 <varlistentry>
43657 <term><option>timeout_MX</option></term>
43658 <listitem>
43659 <para>
43660 There was a timeout while connecting or during an SMTP session with a host
43661 obtained from an MX record.
43662 </para>
43663 </listitem></varlistentry>
43664 <varlistentry>
43665 <term><option>timeout_A</option></term>
43666 <listitem>
43667 <para>
43668 There was a timeout while connecting or during an SMTP session with a host not
43669 obtained from an MX record.
43670 </para>
43671 </listitem></varlistentry>
43672 <varlistentry>
43673 <term><option>timeout</option></term>
43674 <listitem>
43675 <para>
43676 There was a timeout while connecting or during an SMTP session.
43677 </para>
43678 </listitem></varlistentry>
43679 <varlistentry>
43680 <term><option>tls_required</option></term>
43681 <listitem>
43682 <para>
43683 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
43684 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
43685 to STARTTLS, or there was a problem setting up the TLS connection.
43686 </para>
43687 </listitem></varlistentry>
43688 <varlistentry>
43689 <term><option>quota</option></term>
43690 <listitem>
43691 <para>
43692 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
43693 transport.
43694 </para>
43695 </listitem></varlistentry>
43696 <varlistentry>
43697 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
43698 <listitem>
43699 <para>
43700 <indexterm role="concept">
43701 <primary>quota</primary>
43702 <secondary>error testing in retry rule</secondary>
43703 </indexterm>
43704 <indexterm role="concept">
43705 <primary>retry</primary>
43706 <secondary>quota error testing</secondary>
43707 </indexterm>
43708 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
43709 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
43710 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
43711 for four days.
43712 </para>
43713 </listitem></varlistentry>
43714 </variablelist>
43715 <para>
43716 <indexterm role="concept">
43717 <primary>mailbox</primary>
43718 <secondary>time of last read</secondary>
43719 </indexterm>
43720 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
43721 timeouts when the mailbox is full and is not being read by its owner. Ideally,
43722 it should be based on the last time that the user accessed the mailbox.
43723 However, it is not always possible to determine this. Exim uses the following
43724 heuristic rules:
43725 </para>
43726 <itemizedlist>
43727 <listitem>
43728 <para>
43729 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
43730 used. As no new messages are being delivered (because the mailbox is over
43731 quota), Exim does not access the file, so this is the time of last user access.
43732 </para>
43733 </listitem>
43734 <listitem>
43735 <para>
43736 <indexterm role="concept">
43737 <primary>maildir format</primary>
43738 <secondary>time of last read</secondary>
43739 </indexterm>
43740 For a maildir delivery, the time of last modification of the <filename>new</filename>
43741 subdirectory is used. As the mailbox is over quota, no new files are created in
43742 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
43743 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
43744 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
43745 time that is used is therefore the last time that the user read a new message.
43746 </para>
43747 </listitem>
43748 <listitem>
43749 <para>
43750 For other kinds of multi-file mailbox, the time of last access cannot be
43751 obtained, so a retry rule that uses this type of error field is never matched.
43752 </para>
43753 </listitem>
43754 </itemizedlist>
43755 <para>
43756 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
43757 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
43758 when a local delivery is deferred because a partition is full (the ENOSPC
43759 error).
43760 </para>
43761 </section>
43762 <section id="SECID162">
43763 <title>Retry rules for specified senders</title>
43764 <para>
43765 <indexterm role="concept">
43766 <primary>retry</primary>
43767 <secondary>rules; sender-specific</secondary>
43768 </indexterm>
43769 You can specify retry rules that apply only when the failing message has a
43770 specific sender. In particular, this can be used to define retry rules that
43771 apply only to bounce messages. The third item in a retry rule can be of this
43772 form:
43773 </para>
43774 <literallayout>
43775 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
43776 </literallayout>
43777 <para>
43778 The retry timings themselves are then the fourth item. For example:
43779 </para>
43780 <literallayout class="monospaced">
43781 *   rcpt_4xx   senders=:   F,1h,30m
43782 </literallayout>
43783 <para>
43784 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
43785 host. If the address list contains white space, it must be enclosed in quotes.
43786 For example:
43787 </para>
43788 <literallayout class="monospaced">
43789 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
43790 </literallayout>
43791 <para>
43792 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
43793 (which do not depend on the recipient). The reason is that the sender is used
43794 only to match the retry rule. Once the rule has been found for a host error,
43795 its contents are used to set a retry time for the host, and this will apply to
43796 all messages, not just those with specific senders.
43797 </para>
43798 <para>
43799 When testing retry rules using <option>-brt</option>, you can supply a sender using the
43800 <option>-f</option> command line option, like this:
43801 </para>
43802 <literallayout class="monospaced">
43803 exim -f "" -brt user@dom.ain
43804 </literallayout>
43805 <para>
43806 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
43807 list is never matched.
43808 </para>
43809 </section>
43810 <section id="SECID163">
43811 <title>Retry parameters</title>
43812 <para>
43813 <indexterm role="concept">
43814 <primary>retry</primary>
43815 <secondary>parameters in rules</secondary>
43816 </indexterm>
43817 The third (or fourth, if a senders list is present) field in a retry rule is a
43818 sequence of retry parameter sets, separated by semicolons. Each set consists of
43819 </para>
43820 <literallayout>
43821 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
43822 </literallayout>
43823 <para>
43824 The letter identifies the algorithm for computing a new retry time; the cutoff
43825 time is the time beyond which this algorithm no longer applies, and the
43826 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
43827 time that the first failure for the domain (combined with the local part if
43828 relevant) was detected, not from the time the message was received.
43829 </para>
43830 <para>
43831 <indexterm role="concept">
43832 <primary>retry</primary>
43833 <secondary>algorithms</secondary>
43834 </indexterm>
43835 <indexterm role="concept">
43836 <primary>retry</primary>
43837 <secondary>fixed intervals</secondary>
43838 </indexterm>
43839 <indexterm role="concept">
43840 <primary>retry</primary>
43841 <secondary>increasing intervals</secondary>
43842 </indexterm>
43843 <indexterm role="concept">
43844 <primary>retry</primary>
43845 <secondary>random intervals</secondary>
43846 </indexterm>
43847 The available algorithms are:
43848 </para>
43849 <itemizedlist>
43850 <listitem>
43851 <para>
43852 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
43853 the interval.
43854 </para>
43855 </listitem>
43856 <listitem>
43857 <para>
43858 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
43859 specifies a starting value for the interval, and the second a multiplier, which
43860 is used to increase the size of the interval at each retry.
43861 </para>
43862 </listitem>
43863 <listitem>
43864 <para>
43865 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
43866 retry, the previous interval is multiplied by the factor in order to get a
43867 maximum for the next interval. The minimum interval is the first argument of
43868 the parameter, and an actual interval is chosen randomly between them. Such a
43869 rule has been found to be helpful in cluster configurations when all the
43870 members of the cluster restart at once, and may therefore synchronize their
43871 queue processing times.
43872 </para>
43873 </listitem>
43874 </itemizedlist>
43875 <para>
43876 When computing the next retry time, the algorithm definitions are scanned in
43877 order until one whose cutoff time has not yet passed is reached. This is then
43878 used to compute a new retry time that is later than the current time. In the
43879 case of fixed interval retries, this simply means adding the interval to the
43880 current time. For geometrically increasing intervals, retry intervals are
43881 computed from the rule&#x2019;s parameters until one that is greater than the previous
43882 interval is found. The main configuration variable
43883 <indexterm role="concept">
43884 <primary>limit</primary>
43885 <secondary>retry interval</secondary>
43886 </indexterm>
43887 <indexterm role="concept">
43888 <primary>retry</primary>
43889 <secondary>interval, maximum</secondary>
43890 </indexterm>
43891 <indexterm role="option">
43892 <primary><option>retry_interval_max</option></primary>
43893 </indexterm>
43894 <option>retry_interval_max</option> limits the maximum interval between retries. It
43895 cannot be set greater than <literal>24h</literal>, which is its default value.
43896 </para>
43897 <para>
43898 A single remote domain may have a number of hosts associated with it, and each
43899 host may have more than one IP address. Retry algorithms are selected on the
43900 basis of the domain name, but are applied to each IP address independently. If,
43901 for example, a host has two IP addresses and one is unusable, Exim will
43902 generate retry times for it and will not try to use it until its next retry
43903 time comes. Thus the good IP address is likely to be tried first most of the
43904 time.
43905 </para>
43906 <para>
43907 <indexterm role="concept">
43908 <primary>hints database</primary>
43909 <secondary>use for retrying</secondary>
43910 </indexterm>
43911 Retry times are hints rather than promises. Exim does not make any attempt to
43912 run deliveries exactly at the computed times. Instead, a queue runner process
43913 starts delivery processes for delayed messages periodically, and these attempt
43914 new deliveries only for those addresses that have passed their next retry time.
43915 If a new message arrives for a deferred address, an immediate delivery attempt
43916 occurs only if the address has passed its retry time. In the absence of new
43917 messages, the minimum time between retries is the interval between queue runner
43918 processes. There is not much point in setting retry times of five minutes if
43919 your queue runners happen only once an hour, unless there are a significant
43920 number of incoming messages (which might be the case on a system that is
43921 sending everything to a smart host, for example).
43922 </para>
43923 <para>
43924 The data in the retry hints database can be inspected by using the
43925 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
43926 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
43927 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
43928 are for the hosts associated with a particular mail domain, and also for local
43929 deliveries that have been deferred.
43930 </para>
43931 </section>
43932 <section id="SECID164">
43933 <title>Retry rule examples</title>
43934 <para>
43935 Here are some example retry rules:
43936 </para>
43937 <literallayout class="monospaced">
43938 alice@wonderland.fict.example quota_5d  F,7d,3h
43939 wonderland.fict.example       quota_5d
43940 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
43941 lookingglass.fict.example     *         F,24h,30m;
43942 *                 refused_A   F,2h,20m;
43943 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
43944 </literallayout>
43945 <para>
43946 The first rule sets up special handling for mail to
43947 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
43948 mailbox has not been read for at least 5 days. Retries continue every three
43949 hours for 7 days. The second rule handles over-quota errors for all other local
43950 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
43951 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
43952 fail are bounced immediately if the mailbox has not been read for at least 5
43953 days.
43954 </para>
43955 <para>
43956 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
43957 happen every 15 minutes for an hour, then with geometrically increasing
43958 intervals until two days have passed since a delivery first failed. After the
43959 first hour there is a delay of one hour, then two hours, then four hours, and
43960 so on (this is a rather extreme example).
43961 </para>
43962 <para>
43963 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
43964 They happen every 30 minutes for 24 hours only. The remaining two rules handle
43965 all other domains, with special action for connection refusal from hosts that
43966 were not obtained from an MX record.
43967 </para>
43968 <para>
43969 The final rule in a retry configuration should always have asterisks in the
43970 first two fields so as to provide a general catch-all for any addresses that do
43971 not have their own special handling. This example tries every 15 minutes for 2
43972 hours, then with intervals starting at one hour and increasing by a factor of
43973 1.5 up to 16 hours, then every 8 hours up to 5 days.
43974 </para>
43975 </section>
43976 <section id="SECID165">
43977 <title>Timeout of retry data</title>
43978 <para>
43979 <indexterm role="concept">
43980 <primary>timeout</primary>
43981 <secondary>of retry data</secondary>
43982 </indexterm>
43983 <indexterm role="option">
43984 <primary><option>retry_data_expire</option></primary>
43985 </indexterm>
43986 <indexterm role="concept">
43987 <primary>hints database</primary>
43988 <secondary>data expiry</secondary>
43989 </indexterm>
43990 <indexterm role="concept">
43991 <primary>retry</primary>
43992 <secondary>timeout of data</secondary>
43993 </indexterm>
43994 Exim timestamps the data that it writes to its retry hints database. When it
43995 consults the data during a delivery it ignores any that is older than the value
43996 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
43997 been tried for 7 days, Exim will try to deliver to it immediately a message
43998 arrives, and if that fails, it will calculate a retry time as if it were
43999 failing for the first time.
44000 </para>
44001 <para>
44002 This improves the behaviour for messages routed to rarely-used hosts such as MX
44003 backups. If such a host was down at one time, and happens to be down again when
44004 Exim tries a month later, using the old retry data would imply that it had been
44005 down all the time, which is not a justified assumption.
44006 </para>
44007 <para>
44008 If a host really is permanently dead, this behaviour causes a burst of retries
44009 every now and again, but only if messages routed to it are rare. If there is a
44010 message at least once every 7 days the retry data never expires.
44011 </para>
44012 </section>
44013 <section id="SECID166">
44014 <title>Long-term failures</title>
44015 <para>
44016 <indexterm role="concept">
44017 <primary>delivery failure, long-term</primary>
44018 </indexterm>
44019 <indexterm role="concept">
44020 <primary>retry</primary>
44021 <secondary>after long-term failure</secondary>
44022 </indexterm>
44023 Special processing happens when an email address has been failing for so long
44024 that the cutoff time for the last algorithm is reached. For example, using the
44025 default retry rule:
44026 </para>
44027 <literallayout class="monospaced">
44028 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
44029 </literallayout>
44030 <para>
44031 the cutoff time is four days. Reaching the retry cutoff is independent of how
44032 long any specific message has been failing; it is the length of continuous
44033 failure for the recipient address that counts.
44034 </para>
44035 <para>
44036 When the cutoff time is reached for a local delivery, or for all the IP
44037 addresses associated with a remote delivery, a subsequent delivery failure
44038 causes Exim to give up on the address, and a bounce message is generated.
44039 In order to cater for new messages that use the failing address, a next retry
44040 time is still computed from the final algorithm, and is used as follows:
44041 </para>
44042 <para>
44043 For local deliveries, one delivery attempt is always made for any subsequent
44044 messages. If this delivery fails, the address fails immediately. The
44045 post-cutoff retry time is not used.
44046 </para>
44047 <para>
44048 If the delivery is remote, there are two possibilities, controlled by the
44049 <indexterm role="option">
44050 <primary><option>delay_after_cutoff</option></primary>
44051 </indexterm>
44052 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
44053 default. Until the post-cutoff retry time for one of the IP addresses is
44054 reached, the failing email address is bounced immediately, without a delivery
44055 attempt taking place. After that time, one new delivery attempt is made to
44056 those IP addresses that are past their retry times, and if that still fails,
44057 the address is bounced and new retry times are computed.
44058 </para>
44059 <para>
44060 In other words, when all the hosts for a given email address have been failing
44061 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
44062 times is reached. Then it tries once, and bounces if that attempt fails. This
44063 behaviour ensures that few resources are wasted in repeatedly trying to deliver
44064 to a broken destination, but if the host does recover, Exim will eventually
44065 notice.
44066 </para>
44067 <para>
44068 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44069 addresses are past their final cutoff time, Exim tries to deliver to those IP
44070 addresses that have not been tried since the message arrived. If there are
44071 no suitable IP addresses, or if they all fail, the address is bounced. In other
44072 words, it does not delay when a new message arrives, but tries the expired
44073 addresses immediately, unless they have been tried since the message arrived.
44074 If there is a continuous stream of messages for the failing domains, setting
44075 <option>delay_after_cutoff</option> false means that there will be many more attempts to
44076 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
44077 true.
44078 </para>
44079 </section>
44080 <section id="SECID167">
44081 <title>Deliveries that work intermittently</title>
44082 <para>
44083 <indexterm role="concept">
44084 <primary>retry</primary>
44085 <secondary>intermittently working deliveries</secondary>
44086 </indexterm>
44087 Some additional logic is needed to cope with cases where a host is
44088 intermittently available, or when a message has some attribute that prevents
44089 its delivery when others to the same address get through. In this situation,
44090 because some messages are successfully delivered, the <quote>retry clock</quote> for the
44091 host or address keeps getting reset by the successful deliveries, and so
44092 failing messages remain on the queue for ever because the cutoff time is never
44093 reached.
44094 </para>
44095 <para>
44096 Two exceptional actions are applied to prevent this happening. The first
44097 applies to errors that are related to a message rather than a remote host.
44098 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
44099 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
44100 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
44101 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
44102 is used when scanning the retry rules to decide when to try next and when to
44103 time out the address.
44104 </para>
44105 <para>
44106 The exceptional second action applies in all cases. If a message has been on
44107 the queue for longer than the cutoff time of any applicable retry rule for a
44108 given address, a delivery is attempted for that address, even if it is not yet
44109 time, and if this delivery fails, the address is timed out. A new retry time is
44110 not computed in this case, so that other messages for the same address are
44111 considered immediately.
44112 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
44113 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
44114 </para>
44115 </section>
44116 </chapter>
44117
44118 <chapter id="CHAPSMTPAUTH">
44119 <title>SMTP authentication</title>
44120 <para>
44121 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
44122 <primary>SMTP</primary>
44123 <secondary>authentication configuration</secondary>
44124 </indexterm>
44125 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
44126 <primary>authentication</primary>
44127 </indexterm>
44128 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
44129 with SMTP authentication. This facility is an extension to the SMTP protocol,
44130 described in RFC 2554, which allows a client SMTP host to authenticate itself
44131 to a server. This is a common way for a server to recognize clients that are
44132 permitted to use it as a relay. SMTP authentication is not of relevance to the
44133 transfer of mail between servers that have no managerial connection with each
44134 other.
44135 </para>
44136 <para>
44137 <indexterm role="concept">
44138 <primary>AUTH</primary>
44139 <secondary>description of</secondary>
44140 </indexterm>
44141 Very briefly, the way SMTP authentication works is as follows:
44142 </para>
44143 <itemizedlist>
44144 <listitem>
44145 <para>
44146 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
44147 the client&#x2019;s EHLO command.
44148 </para>
44149 </listitem>
44150 <listitem>
44151 <para>
44152 The client issues an AUTH command, naming a specific mechanism. The command
44153 may, optionally, contain some authentication data.
44154 </para>
44155 </listitem>
44156 <listitem>
44157 <para>
44158 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
44159 appropriate responses. In simple authentication mechanisms, the challenges are
44160 just prompts for user names and passwords. The server does not have to issue
44161 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
44162 with the AUTH command.
44163 </para>
44164 </listitem>
44165 <listitem>
44166 <para>
44167 The server either accepts or denies authentication.
44168 </para>
44169 </listitem>
44170 <listitem>
44171 <para>
44172 If authentication succeeds, the client may optionally make use of the AUTH
44173 option on the MAIL command to pass an authenticated sender in subsequent
44174 mail transactions. Authentication lasts for the remainder of the SMTP
44175 connection.
44176 </para>
44177 </listitem>
44178 <listitem>
44179 <para>
44180 If authentication fails, the client may give up, or it may try a different
44181 authentication mechanism, or it may try transferring mail over the
44182 unauthenticated connection.
44183 </para>
44184 </listitem>
44185 </itemizedlist>
44186 <para>
44187 If you are setting up a client, and want to know which authentication
44188 mechanisms the server supports, you can use Telnet to connect to port 25 (the
44189 SMTP port) on the server, and issue an EHLO command. The response to this
44190 includes the list of supported mechanisms. For example:
44191 </para>
44192 <literallayout>
44193 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
44194 <literal>Trying 192.168.34.25...</literal>
44195 <literal>Connected to server.example.</literal>
44196 <literal>Escape character is '^]'.</literal>
44197 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
44198 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
44199 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
44200 <literal>250-SIZE 52428800</literal>
44201 <literal>250-PIPELINING</literal>
44202 <literal>250-AUTH PLAIN</literal>
44203 <literal>250 HELP</literal>
44204 </literallayout>
44205 <para>
44206 The second-last line of this example output shows that the server supports
44207 authentication using the PLAIN mechanism. In Exim, the different authentication
44208 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
44209 routers and transports, which authenticators are included in the binary is
44210 controlled by build-time definitions. The following are currently available,
44211 included by setting
44212 </para>
44213 <literallayout class="monospaced">
44214 AUTH_CRAM_MD5=yes
44215 AUTH_CYRUS_SASL=yes
44216 AUTH_PLAINTEXT=yes
44217 AUTH_SPA=yes
44218 </literallayout>
44219 <para>
44220 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
44221 authentication mechanism (RFC 2195), and the second provides an interface to
44222 the Cyrus SASL authentication library. The third can be configured to support
44223 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
44224 not formally documented, but used by several MUAs. The fourth authenticator
44225 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
44226 </para>
44227 <para>
44228 The authenticators are configured using the same syntax as other drivers (see
44229 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
44230 authentication section need be present in the configuration file. Each
44231 authenticator can in principle have both server and client functions. When Exim
44232 is receiving SMTP mail, it is acting as a server; when it is sending out
44233 messages over SMTP, it is acting as a client. Authenticator configuration
44234 options are provided for use in both these circumstances.
44235 </para>
44236 <para>
44237 To make it clear which options apply to which situation, the prefixes
44238 <option>server_</option> and <option>client_</option> are used on option names that are specific to
44239 either the server or the client function, respectively. Server and client
44240 functions are disabled if none of their options are set. If an authenticator is
44241 to be used for both server and client functions, a single definition, using
44242 both sets of options, is required. For example:
44243 </para>
44244 <literallayout class="monospaced">
44245 cram:
44246   driver = cram_md5
44247   public_name = CRAM-MD5
44248   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
44249   client_name = ph10
44250   client_secret = secret2
44251 </literallayout>
44252 <para>
44253 The <option>server_</option> option is used when Exim is acting as a server, and the
44254 <option>client_</option> options when it is acting as a client.
44255 </para>
44256 <para>
44257 Descriptions of the individual authenticators are given in subsequent chapters.
44258 The remainder of this chapter covers the generic options for the
44259 authenticators, followed by general discussion of the way authentication works
44260 in Exim.
44261 </para>
44262 <section id="SECID168">
44263 <title>Generic options for authenticators</title>
44264 <para>
44265 <indexterm role="concept">
44266 <primary>authentication</primary>
44267 <secondary>generic options</secondary>
44268 </indexterm>
44269 <indexterm role="concept">
44270 <primary>options</primary>
44271 <secondary>generic; for authenticators</secondary>
44272 </indexterm>
44273 </para>
44274 <para>
44275 <indexterm role="option">
44276 <primary><option>driver</option></primary>
44277 </indexterm>
44278 </para>
44279 <informaltable frame="all">
44280 <tgroup cols="4" colsep="0" rowsep="0">
44281 <colspec colwidth="8*" align="left"/>
44282 <colspec colwidth="6*" align="center"/>
44283 <colspec colwidth="6*" align="center"/>
44284 <colspec colwidth="6*" align="right"/>
44285 <tbody>
44286 <row>
44287 <entry><option>driver</option></entry>
44288 <entry>Use: <emphasis>authenticators</emphasis></entry>
44289 <entry>Type: <emphasis>string</emphasis></entry>
44290 <entry>Default: <emphasis>unset</emphasis></entry>
44291 </row>
44292 </tbody>
44293 </tgroup>
44294 </informaltable>
44295 <para>
44296 This option must always be set. It specifies which of the available
44297 authenticators is to be used.
44298 </para>
44299 <para>
44300 <indexterm role="option">
44301 <primary><option>public_name</option></primary>
44302 </indexterm>
44303 </para>
44304 <informaltable frame="all">
44305 <tgroup cols="4" colsep="0" rowsep="0">
44306 <colspec colwidth="8*" align="left"/>
44307 <colspec colwidth="6*" align="center"/>
44308 <colspec colwidth="6*" align="center"/>
44309 <colspec colwidth="6*" align="right"/>
44310 <tbody>
44311 <row>
44312 <entry><option>public_name</option></entry>
44313 <entry>Use: <emphasis>authenticators</emphasis></entry>
44314 <entry>Type: <emphasis>string</emphasis></entry>
44315 <entry>Default: <emphasis>unset</emphasis></entry>
44316 </row>
44317 </tbody>
44318 </tgroup>
44319 </informaltable>
44320 <para>
44321 This option specifies the name of the authentication mechanism that the driver
44322 implements, and by which it is known to the outside world. These names should
44323 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
44324 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
44325 defaults to the driver&#x2019;s instance name.
44326 </para>
44327 <para>
44328 <indexterm role="option">
44329 <primary><option>server_advertise_condition</option></primary>
44330 </indexterm>
44331 </para>
44332 <informaltable frame="all">
44333 <tgroup cols="4" colsep="0" rowsep="0">
44334 <colspec colwidth="8*" align="left"/>
44335 <colspec colwidth="6*" align="center"/>
44336 <colspec colwidth="6*" align="center"/>
44337 <colspec colwidth="6*" align="right"/>
44338 <tbody>
44339 <row>
44340 <entry><option>server_advertise_condition</option></entry>
44341 <entry>Use: <emphasis>authenticators</emphasis></entry>
44342 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44343 <entry>Default: <emphasis>unset</emphasis></entry>
44344 </row>
44345 </tbody>
44346 </tgroup>
44347 </informaltable>
44348 <para>
44349 When a server is about to advertise an authentication mechanism, the condition
44350 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
44351 mechanism is not advertised.
44352 If the expansion fails, the mechanism is not advertised. If the failure was not
44353 forced, and was not caused by a lookup defer, the incident is logged.
44354 See section <xref linkend="SECTauthexiser"/> below for further discussion.
44355 </para>
44356 <para>
44357 <indexterm role="option">
44358 <primary><option>server_condition</option></primary>
44359 </indexterm>
44360 </para>
44361 <informaltable frame="all">
44362 <tgroup cols="4" colsep="0" rowsep="0">
44363 <colspec colwidth="8*" align="left"/>
44364 <colspec colwidth="6*" align="center"/>
44365 <colspec colwidth="6*" align="center"/>
44366 <colspec colwidth="6*" align="right"/>
44367 <tbody>
44368 <row>
44369 <entry><option>server_condition</option></entry>
44370 <entry>Use: <emphasis>authenticators</emphasis></entry>
44371 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44372 <entry>Default: <emphasis>unset</emphasis></entry>
44373 </row>
44374 </tbody>
44375 </tgroup>
44376 </informaltable>
44377 <para>
44378 This option must be set for a <option>plaintext</option> server authenticator, where it
44379 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
44380 for details.
44381 </para>
44382 <para>
44383 For the other authenticators, <option>server_condition</option> can be used as an additional
44384 authentication or authorization mechanism that is applied after the other
44385 authenticator conditions succeed. If it is set, it is expanded when the
44386 authenticator would otherwise return a success code. If the expansion is forced
44387 to fail, authentication fails. Any other expansion failure causes a temporary
44388 error code to be returned. If the result of a successful expansion is an empty
44389 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
44390 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
44391 other result, a temporary error code is returned, with the expanded string as
44392 the error text.
44393 </para>
44394 <para>
44395 <indexterm role="option">
44396 <primary><option>server_debug_print</option></primary>
44397 </indexterm>
44398 </para>
44399 <informaltable frame="all">
44400 <tgroup cols="4" colsep="0" rowsep="0">
44401 <colspec colwidth="8*" align="left"/>
44402 <colspec colwidth="6*" align="center"/>
44403 <colspec colwidth="6*" align="center"/>
44404 <colspec colwidth="6*" align="right"/>
44405 <tbody>
44406 <row>
44407 <entry><option>server_debug_print</option></entry>
44408 <entry>Use: <emphasis>authenticators</emphasis></entry>
44409 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44410 <entry>Default: <emphasis>unset</emphasis></entry>
44411 </row>
44412 </tbody>
44413 </tgroup>
44414 </informaltable>
44415 <para>
44416 If this option is set and authentication debugging is enabled (see the <option>-d</option>
44417 command line option), the string is expanded and included in the debugging
44418 output when the authenticator is run as a server. This can help with checking
44419 out the values of variables.
44420 If expansion of the string fails, the error message is written to the debugging
44421 output, and Exim carries on processing.
44422 </para>
44423 <para>
44424 <indexterm role="option">
44425 <primary><option>server_set_id</option></primary>
44426 </indexterm>
44427 </para>
44428 <informaltable frame="all">
44429 <tgroup cols="4" colsep="0" rowsep="0">
44430 <colspec colwidth="8*" align="left"/>
44431 <colspec colwidth="6*" align="center"/>
44432 <colspec colwidth="6*" align="center"/>
44433 <colspec colwidth="6*" align="right"/>
44434 <tbody>
44435 <row>
44436 <entry><option>server_set_id</option></entry>
44437 <entry>Use: <emphasis>authenticators</emphasis></entry>
44438 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44439 <entry>Default: <emphasis>unset</emphasis></entry>
44440 </row>
44441 </tbody>
44442 </tgroup>
44443 </informaltable>
44444 <para>
44445 <indexterm role="variable">
44446 <primary><varname>$authenticated_id</varname></primary>
44447 </indexterm>
44448 When an Exim server successfully authenticates a client, this string is
44449 expanded using data from the authentication, and preserved for any incoming
44450 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
44451 lines for incoming messages. For example, a user/password authenticator
44452 configuration might preserve the user name that was used to authenticate, and
44453 refer to it subsequently during delivery of the message.
44454 If expansion fails, the option is ignored.
44455 </para>
44456 <para>
44457 <indexterm role="option">
44458 <primary><option>server_mail_auth_condition</option></primary>
44459 </indexterm>
44460 </para>
44461 <informaltable frame="all">
44462 <tgroup cols="4" colsep="0" rowsep="0">
44463 <colspec colwidth="8*" align="left"/>
44464 <colspec colwidth="6*" align="center"/>
44465 <colspec colwidth="6*" align="center"/>
44466 <colspec colwidth="6*" align="right"/>
44467 <tbody>
44468 <row>
44469 <entry><option>server_mail_auth_condition</option></entry>
44470 <entry>Use: <emphasis>authenticators</emphasis></entry>
44471 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44472 <entry>Default: <emphasis>unset</emphasis></entry>
44473 </row>
44474 </tbody>
44475 </tgroup>
44476 </informaltable>
44477 <para>
44478 This option allows a server to discard authenticated sender addresses supplied
44479 as part of MAIL commands in SMTP connections that are authenticated by the
44480 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
44481 as part of the authentication process; instead its (unexpanded) value is
44482 remembered for later use.
44483 How it is used is described in the following section.
44484 </para>
44485 </section>
44486 <section id="SECTauthparamail">
44487 <title>The AUTH parameter on MAIL commands</title>
44488 <para>
44489 <indexterm role="concept">
44490 <primary>authentication</primary>
44491 <secondary>sender; authenticated</secondary>
44492 </indexterm>
44493 <indexterm role="concept">
44494 <primary>AUTH</primary>
44495 <secondary>on MAIL command</secondary>
44496 </indexterm>
44497 When a client supplied an AUTH= item on a MAIL command, Exim applies
44498 the following checks before accepting it as the authenticated sender of the
44499 message:
44500 </para>
44501 <itemizedlist>
44502 <listitem>
44503 <para>
44504 If the connection is not using extended SMTP (that is, HELO was used rather
44505 than EHLO), the use of AUTH= is a syntax error.
44506 </para>
44507 </listitem>
44508 <listitem>
44509 <para>
44510 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
44511 </para>
44512 </listitem>
44513 <listitem>
44514 <para>
44515 <indexterm role="variable">
44516 <primary><varname>$authenticated_sender</varname></primary>
44517 </indexterm>
44518 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
44519 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
44520 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
44521 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
44522 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
44523 given for the MAIL command.
44524 </para>
44525 </listitem>
44526 <listitem>
44527 <para>
44528 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
44529 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
44530 authenticated.
44531 </para>
44532 </listitem>
44533 <listitem>
44534 <para>
44535 If the AUTH= value was accepted by either of the two previous rules, and
44536 the client has authenticated, and the authenticator has a setting for the
44537 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
44538 valued that was saved from the authenticator is expanded. If the expansion
44539 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
44540 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
44541 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
44542 message.
44543 </para>
44544 </listitem>
44545 </itemizedlist>
44546 <para>
44547 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
44548 hosts to which Exim authenticates as a client. Do not confuse this value with
44549 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
44550 process, and which is not usually a complete email address.
44551 </para>
44552 <para>
44553 <indexterm role="variable">
44554 <primary><varname>$sender_address</varname></primary>
44555 </indexterm>
44556 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
44557 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
44558 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
44559 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
44560 ACL is run.
44561 </para>
44562 </section>
44563 <section id="SECTauthexiser">
44564 <title>Authentication on an Exim server</title>
44565 <para>
44566 <indexterm role="concept">
44567 <primary>authentication</primary>
44568 <secondary>on an Exim server</secondary>
44569 </indexterm>
44570 When Exim receives an EHLO command, it advertises the public names of those
44571 authenticators that are configured as servers, subject to the following
44572 conditions:
44573 </para>
44574 <itemizedlist>
44575 <listitem>
44576 <para>
44577 The client host must match <option>auth_advertise_hosts</option> (default *).
44578 </para>
44579 </listitem>
44580 <listitem>
44581 <para>
44582 It the <option>server_advertise_condition</option> option is set, its expansion must not
44583 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
44584 </para>
44585 </listitem>
44586 </itemizedlist>
44587 <para>
44588 The order in which the authenticators are defined controls the order in which
44589 the mechanisms are advertised.
44590 </para>
44591 <para>
44592 Some mail clients (for example, some versions of Netscape) require the user to
44593 provide a name and password for authentication whenever AUTH is advertised,
44594 even though authentication may not in fact be needed (for example, Exim may be
44595 set up to allow unconditional relaying from the client by an IP address check).
44596 You can make such clients more friendly by not advertising AUTH to them.
44597 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
44598 that runs for RCPT) to relay without authentication, you should set
44599 </para>
44600 <literallayout class="monospaced">
44601 auth_advertise_hosts = ! 10.9.8.0/24
44602 </literallayout>
44603 <para>
44604 so that no authentication mechanisms are advertised to them.
44605 </para>
44606 <para>
44607 The <option>server_advertise_condition</option> controls the advertisement of individual
44608 authentication mechanisms. For example, it can be used to restrict the
44609 advertisement of a particular mechanism to encrypted connections, by a setting
44610 such as:
44611 </para>
44612 <literallayout class="monospaced">
44613 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
44614 </literallayout>
44615 <para>
44616 <indexterm role="variable">
44617 <primary><varname>$tls_cipher</varname></primary>
44618 </indexterm>
44619 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
44620 yields <quote>yes</quote>, which allows the advertisement to happen.
44621 </para>
44622 <para>
44623 When an Exim server receives an AUTH command from a client, it rejects it
44624 immediately if AUTH was not advertised in response to an earlier EHLO
44625 command. This is the case if
44626 </para>
44627 <itemizedlist>
44628 <listitem>
44629 <para>
44630 The client host does not match <option>auth_advertise_hosts</option>; or
44631 </para>
44632 </listitem>
44633 <listitem>
44634 <para>
44635 No authenticators are configured with server options; or
44636 </para>
44637 </listitem>
44638 <listitem>
44639 <para>
44640 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
44641 server authenticators.
44642 </para>
44643 </listitem>
44644 </itemizedlist>
44645 <para>
44646 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
44647 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
44648 AUTH is accepted from any client host.
44649 </para>
44650 <para>
44651 If AUTH is not rejected by the ACL, Exim searches its configuration for a
44652 server authentication mechanism that was advertised in response to EHLO and
44653 that matches the one named in the AUTH command. If it finds one, it runs
44654 the appropriate authentication protocol, and authentication either succeeds or
44655 fails. If there is no matching advertised mechanism, the AUTH command is
44656 rejected with a 504 error.
44657 </para>
44658 <para>
44659 <indexterm role="variable">
44660 <primary><varname>$received_protocol</varname></primary>
44661 </indexterm>
44662 <indexterm role="variable">
44663 <primary><varname>$sender_host_authenticated</varname></primary>
44664 </indexterm>
44665 When a message is received from an authenticated host, the value of
44666 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
44667 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
44668 public name) of the authenticator driver that successfully authenticated the
44669 client from which the message was received. This variable is empty if there was
44670 no successful authentication.
44671 </para>
44672 </section>
44673 <section id="SECID169">
44674 <title>Testing server authentication</title>
44675 <para>
44676 <indexterm role="concept">
44677 <primary>authentication</primary>
44678 <secondary>testing a server</secondary>
44679 </indexterm>
44680 <indexterm role="concept">
44681 <primary>AUTH</primary>
44682 <secondary>testing a server</secondary>
44683 </indexterm>
44684 <indexterm role="concept">
44685 <primary>base64 encoding</primary>
44686 <secondary>creating authentication test data</secondary>
44687 </indexterm>
44688 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
44689 configurations. The data for the AUTH command has to be sent using base64
44690 encoding. A quick way to produce such data for testing is the following Perl
44691 script:
44692 </para>
44693 <literallayout class="monospaced">
44694 use MIME::Base64;
44695 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
44696 </literallayout>
44697 <para>
44698 <indexterm role="concept">
44699 <primary>binary zero</primary>
44700 <secondary>in authentication data</secondary>
44701 </indexterm>
44702 This interprets its argument as a Perl string, and then encodes it. The
44703 interpretation as a Perl string allows binary zeros, which are required for
44704 some kinds of authentication, to be included in the data. For example, a
44705 command line to run this script on such data might be
44706 </para>
44707 <literallayout class="monospaced">
44708 encode '\0user\0password'
44709 </literallayout>
44710 <para>
44711 Note the use of single quotes to prevent the shell interpreting the
44712 backslashes, so that they can be interpreted by Perl to specify characters
44713 whose code value is zero.
44714 </para>
44715 <para>
44716 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
44717 digit, you must use three zeros instead of one after the leading backslash. If
44718 you do not, the octal digit that starts your string will be incorrectly
44719 interpreted as part of the code for the first character.
44720 </para>
44721 <para>
44722 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
44723 specially, you must use a Perl escape to prevent them being misinterpreted. For
44724 example, a command such as
44725 </para>
44726 <literallayout class="monospaced">
44727 encode '\0user@domain.com\0pas$$word'
44728 </literallayout>
44729 <para>
44730 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
44731 </para>
44732 <para>
44733 If you have the <option>mimencode</option> command installed, another way to do produce
44734 base64-encoded strings is to run the command
44735 </para>
44736 <literallayout class="monospaced">
44737 echo -e -n `\0user\0password' | mimencode
44738 </literallayout>
44739 <para>
44740 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
44741 in the argument, and the <option>-n</option> option specifies no newline at the end of its
44742 output. However, not all versions of <option>echo</option> recognize these options, so you
44743 should check your version before relying on this suggestion.
44744 </para>
44745 </section>
44746 <section id="SECID170">
44747 <title>Authentication by an Exim client</title>
44748 <para>
44749 <indexterm role="concept">
44750 <primary>authentication</primary>
44751 <secondary>on an Exim client</secondary>
44752 </indexterm>
44753 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
44754 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
44755 announces support for authentication, and the host matches an entry in either
44756 of these options, Exim (as a client) tries to authenticate as follows:
44757 </para>
44758 <itemizedlist>
44759 <listitem>
44760 <para revisionflag="changed">
44761 For each authenticator that is configured as a client, in the order in which
44762 they are defined in the configuration, it searches the authentication
44763 mechanisms announced by the server for one whose name matches the public name
44764 of the authenticator.
44765 </para>
44766 </listitem>
44767 <listitem>
44768 <para>
44769 <indexterm role="variable">
44770 <primary><varname>$host</varname></primary>
44771 </indexterm>
44772 <indexterm role="variable">
44773 <primary><varname>$host_address</varname></primary>
44774 </indexterm>
44775 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
44776 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
44777 that the client might do. They are set to the server&#x2019;s name and IP address. If
44778 any expansion is forced to fail, the authentication attempt is abandoned, and
44779 Exim moves on to the next authenticator. Otherwise an expansion failure causes
44780 delivery to be deferred.
44781 </para>
44782 </listitem>
44783 <listitem>
44784 <para>
44785 If the result of the authentication attempt is a temporary error or a timeout,
44786 Exim abandons trying to send the message to the host for the moment. It will
44787 try again later. If there are any backup hosts available, they are tried in the
44788 usual way.
44789 </para>
44790 </listitem>
44791 <listitem>
44792 <para>
44793 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
44794 carries on searching the list of authenticators and tries another one if
44795 possible. If all authentication attempts give permanent errors, or if there are
44796 no attempts because no mechanisms match (or option expansions force failure),
44797 what happens depends on whether the host matches <option>hosts_require_auth</option> or
44798 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
44799 delivery is deferred. The error can be detected in the retry rules, and thereby
44800 turned into a permanent error if you wish. In the second case, Exim tries to
44801 deliver the message unauthenticated.
44802 </para>
44803 </listitem>
44804 </itemizedlist>
44805 <para>
44806 <indexterm role="concept">
44807 <primary>AUTH</primary>
44808 <secondary>on MAIL command</secondary>
44809 </indexterm>
44810 When Exim has authenticated itself to a remote server, it adds the AUTH
44811 parameter to the MAIL commands it sends, if it has an authenticated sender for
44812 the message. If the message came from a remote host, the authenticated sender
44813 is the one that was receiving on an incoming MAIL command, provided that the
44814 incoming connection was authenticated and the <option>server_mail_auth</option> condition
44815 allowed the authenticated sender to be retained. If a local process calls Exim
44816 to send a message, the sender address that is built from the login name and
44817 <option>qualify_domain</option> is treated as authenticated. However, if the
44818 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
44819 the authenticated sender that was received with the message.
44820 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
44821 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
44822 </para>
44823 </section>
44824 </chapter>
44825
44826 <chapter id="CHAPplaintext">
44827 <title>The plaintext authenticator</title>
44828 <para>
44829 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
44830 <primary><command>plaintext</command> authenticator</primary>
44831 </indexterm>
44832 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
44833 <primary>authenticators</primary>
44834 <secondary><command>plaintext</command></secondary>
44835 </indexterm>
44836 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
44837 LOGIN authentication mechanisms, both of which transfer authentication data as
44838 plain (unencrypted) text (though base64 encoded). The use of plain text is a
44839 security risk; you are strongly advised to insist on the use of SMTP encryption
44840 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
44841 use unencrypted plain text, you should not use the same passwords for SMTP
44842 connections as you do for login accounts.
44843 </para>
44844 <section id="SECID171">
44845 <title>Plaintext options</title>
44846 <para>
44847 <indexterm role="concept">
44848 <primary>options</primary>
44849 <secondary><command>plaintext</command> authenticator (server)</secondary>
44850 </indexterm>
44851 When configured as a server, <command>plaintext</command> uses the following options:
44852 </para>
44853 <para>
44854 <indexterm role="option">
44855 <primary><option>server_condition</option></primary>
44856 </indexterm>
44857 </para>
44858 <informaltable frame="all">
44859 <tgroup cols="4" colsep="0" rowsep="0">
44860 <colspec colwidth="8*" align="left"/>
44861 <colspec colwidth="6*" align="center"/>
44862 <colspec colwidth="6*" align="center"/>
44863 <colspec colwidth="6*" align="right"/>
44864 <tbody>
44865 <row>
44866 <entry><option>server_condition</option></entry>
44867 <entry>Use: <emphasis>authenticators</emphasis></entry>
44868 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44869 <entry>Default: <emphasis>unset</emphasis></entry>
44870 </row>
44871 </tbody>
44872 </tgroup>
44873 </informaltable>
44874 <para>
44875 This is actually a global authentication option, but it must be set in order to
44876 configure the <command>plaintext</command> driver as a server. Its use is described below.
44877 </para>
44878 <para>
44879 <indexterm role="option">
44880 <primary><option>server_prompts</option></primary>
44881 </indexterm>
44882 </para>
44883 <informaltable frame="all">
44884 <tgroup cols="4" colsep="0" rowsep="0">
44885 <colspec colwidth="8*" align="left"/>
44886 <colspec colwidth="6*" align="center"/>
44887 <colspec colwidth="6*" align="center"/>
44888 <colspec colwidth="6*" align="right"/>
44889 <tbody>
44890 <row>
44891 <entry><option>server_prompts</option></entry>
44892 <entry>Use: <emphasis>plaintext</emphasis></entry>
44893 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44894 <entry>Default: <emphasis>unset</emphasis></entry>
44895 </row>
44896 </tbody>
44897 </tgroup>
44898 </informaltable>
44899 <para>
44900 The contents of this option, after expansion, must be a colon-separated list of
44901 prompt strings. If expansion fails, a temporary authentication rejection is
44902 given.
44903 </para>
44904 </section>
44905 <section id="SECTplainserver">
44906 <title>Using plaintext in a server</title>
44907 <para>
44908 <indexterm role="concept">
44909 <primary>AUTH</primary>
44910 <secondary>in <command>plaintext</command> authenticator</secondary>
44911 </indexterm>
44912 <indexterm role="concept">
44913 <primary>binary zero</primary>
44914 <secondary>in <command>plaintext</command> authenticator</secondary>
44915 </indexterm>
44916 <indexterm role="concept">
44917 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44918 <secondary>in <command>plaintext</command> authenticator</secondary>
44919 </indexterm>
44920 <indexterm role="variable">
44921 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
44922 </indexterm>
44923 <indexterm role="concept">
44924 <primary>base64 encoding</primary>
44925 <secondary>in <command>plaintext</command> authenticator</secondary>
44926 </indexterm>
44927 </para>
44928 <para>
44929 When running as a server, <command>plaintext</command> performs the authentication test by
44930 expanding a string. The data sent by the client with the AUTH command, or in
44931 response to subsequent prompts, is base64 encoded, and so may contain any byte
44932 values when decoded. If any data is supplied with the command, it is treated as
44933 a list of strings, separated by NULs (binary zeros), the first three of which
44934 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
44935 (neither LOGIN nor PLAIN uses more than three strings).
44936 </para>
44937 <para>
44938 For compatibility with previous releases of Exim, the values are also placed in
44939 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
44940 variables for this purpose is now deprecated, as it can lead to confusion in
44941 string expansions that also use them for other things.
44942 </para>
44943 <para>
44944 If there are more strings in <option>server_prompts</option> than the number of strings
44945 supplied with the AUTH command, the remaining prompts are used to obtain more
44946 data. Each response from the client may be a list of NUL-separated strings.
44947 </para>
44948 <para>
44949 <indexterm role="variable">
44950 <primary><varname>$authenticated_id</varname></primary>
44951 </indexterm>
44952 Once a sufficient number of data strings have been received,
44953 <option>server_condition</option> is expanded. If the expansion is forced to fail,
44954 authentication fails. Any other expansion failure causes a temporary error code
44955 to be returned. If the result of a successful expansion is an empty string,
44956 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
44957 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
44958 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
44959 For any other result, a temporary error code is returned, with the expanded
44960 string as the error text.
44961 </para>
44962 <para>
44963 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
44964 password, be sure to make the authentication fail if the user is unknown.
44965 There are good and bad examples at the end of the next section.
44966 </para>
44967 </section>
44968 <section id="SECID172">
44969 <title>The PLAIN authentication mechanism</title>
44970 <para>
44971 <indexterm role="concept">
44972 <primary>PLAIN authentication mechanism</primary>
44973 </indexterm>
44974 <indexterm role="concept">
44975 <primary>authentication</primary>
44976 <secondary>PLAIN mechanism</secondary>
44977 </indexterm>
44978 <indexterm role="concept">
44979 <primary>binary zero</primary>
44980 <secondary>in <command>plaintext</command> authenticator</secondary>
44981 </indexterm>
44982 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
44983 sent as one item of data (that is, one combined string containing two NUL
44984 separators). The data is sent either as part of the AUTH command, or
44985 subsequently in response to an empty prompt from the server.
44986 </para>
44987 <para>
44988 The second and third strings are a user name and a corresponding password.
44989 Using a single fixed user name and password as an example, this could be
44990 configured as follows:
44991 </para>
44992 <literallayout class="monospaced">
44993 fixed_plain:
44994   driver = plaintext
44995   public_name = PLAIN
44996   server_prompts = :
44997   server_condition = \
44998     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
44999   server_set_id = $auth2
45000 </literallayout>
45001 <para>
45002 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
45003 are exactly what we want here, so they need not be specified. Obviously, if the
45004 password contains expansion-significant characters such as dollar, backslash,
45005 or closing brace, they have to be escaped.
45006 </para>
45007 <para>
45008 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
45009 the end of a string list are ignored). If all the data comes as part of the
45010 AUTH command, as is commonly the case, the prompt is not used. This
45011 authenticator is advertised in the response to EHLO as
45012 </para>
45013 <literallayout class="monospaced">
45014 250-AUTH PLAIN
45015 </literallayout>
45016 <para>
45017 and a client host can authenticate itself by sending the command
45018 </para>
45019 <literallayout class="monospaced">
45020 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
45021 </literallayout>
45022 <para>
45023 As this contains three strings (more than the number of prompts), no further
45024 data is required from the client. Alternatively, the client may just send
45025 </para>
45026 <literallayout class="monospaced">
45027 AUTH PLAIN
45028 </literallayout>
45029 <para>
45030 to initiate authentication, in which case the server replies with an empty
45031 prompt. The client must respond with the combined data string.
45032 </para>
45033 <para>
45034 The data string is base64 encoded, as required by the RFC. This example,
45035 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;
45036 represents a zero byte. This is split up into three strings, the first of which
45037 is empty. The <option>server_condition</option> option in the authenticator checks that the
45038 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
45039 </para>
45040 <para>
45041 Having just one fixed user name and password, as in this example, is not very
45042 realistic, though for a small organization with only a handful of
45043 authenticating clients it could make sense.
45044 </para>
45045 <para>
45046 A more sophisticated instance of this authenticator could use the user name in
45047 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
45048 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
45049 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
45050 This is an incorrect example:
45051 </para>
45052 <literallayout class="monospaced">
45053 server_condition = \
45054   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
45055 </literallayout>
45056 <para>
45057 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
45058 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
45059 incorrect? It works fine for existing users, but consider what happens if a
45060 non-existent user name is given. The lookup fails, but as no success/failure
45061 strings are given for the lookup, it yields an empty string. Thus, to defeat
45062 the authentication, all a client has to do is to supply a non-existent user
45063 name and an empty password. The correct way of writing this test is:
45064 </para>
45065 <literallayout class="monospaced">
45066 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
45067   {${if eq{$value}{$auth3}}} {false}}
45068 </literallayout>
45069 <para>
45070 In this case, if the lookup succeeds, the result is checked; if the lookup
45071 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
45072 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
45073 always fails if its second argument is empty. However, the second way of
45074 writing the test makes the logic clearer.
45075 </para>
45076 </section>
45077 <section id="SECID173">
45078 <title>The LOGIN authentication mechanism</title>
45079 <para>
45080 <indexterm role="concept">
45081 <primary>LOGIN authentication mechanism</primary>
45082 </indexterm>
45083 <indexterm role="concept">
45084 <primary>authentication</primary>
45085 <secondary>LOGIN mechanism</secondary>
45086 </indexterm>
45087 The LOGIN authentication mechanism is not documented in any RFC, but is in use
45088 in a number of programs. No data is sent with the AUTH command. Instead, a
45089 user name and password are supplied separately, in response to prompts. The
45090 plaintext authenticator can be configured to support this as in this example:
45091 </para>
45092 <literallayout class="monospaced">
45093 fixed_login:
45094   driver = plaintext
45095   public_name = LOGIN
45096   server_prompts = User Name : Password
45097   server_condition = \
45098     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
45099   server_set_id = $auth1
45100 </literallayout>
45101 <para>
45102 Because of the way plaintext operates, this authenticator accepts data supplied
45103 with the AUTH command (in contravention of the specification of LOGIN), but
45104 if the client does not supply it (as is the case for LOGIN clients), the prompt
45105 strings are used to obtain two data items.
45106 </para>
45107 <para>
45108 Some clients are very particular about the precise text of the prompts. For
45109 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
45110 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
45111 strings. It uses the <option>ldapauth</option> expansion condition to check the user
45112 name and password by binding to an LDAP server:
45113 </para>
45114 <literallayout class="monospaced">
45115 login:
45116   driver = plaintext
45117   public_name = LOGIN
45118   server_prompts = Username:: : Password::
45119   server_condition = ${if ldapauth \
45120     {user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
45121     pass=${quote:$auth2} \
45122     ldap://ldap.example.org/}}
45123   server_set_id = uid=$auth1,ou=people,o=example.org
45124 </literallayout>
45125 <para>
45126 Note the use of the <option>quote_ldap_dn</option> operator to correctly quote the DN for
45127 authentication. However, the basic <option>quote</option> operator, rather than any of the
45128 LDAP quoting operators, is the correct one to use for the password, because
45129 quoting is needed only to make the password conform to the Exim syntax. At the
45130 LDAP level, the password is an uninterpreted string.
45131 </para>
45132 </section>
45133 <section id="SECID174">
45134 <title>Support for different kinds of authentication</title>
45135 <para>
45136 A number of string expansion features are provided for the purpose of
45137 interfacing to different ways of user authentication. These include checking
45138 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
45139 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
45140 <xref linkend="SECTexpcond"/>.
45141 </para>
45142 </section>
45143 <section id="SECID175">
45144 <title>Using plaintext in a client</title>
45145 <para>
45146 <indexterm role="concept">
45147 <primary>options</primary>
45148 <secondary><command>plaintext</command> authenticator (client)</secondary>
45149 </indexterm>
45150 The <command>plaintext</command> authenticator has two client options:
45151 </para>
45152 <para>
45153 <indexterm role="option">
45154 <primary><option>client_ignore_invalid_base64</option></primary>
45155 </indexterm>
45156 </para>
45157 <informaltable frame="all">
45158 <tgroup cols="4" colsep="0" rowsep="0">
45159 <colspec colwidth="8*" align="left"/>
45160 <colspec colwidth="6*" align="center"/>
45161 <colspec colwidth="6*" align="center"/>
45162 <colspec colwidth="6*" align="right"/>
45163 <tbody>
45164 <row>
45165 <entry><option>client_ignore_invalid_base64</option></entry>
45166 <entry>Use: <emphasis>plaintext</emphasis></entry>
45167 <entry>Type: <emphasis>boolean</emphasis></entry>
45168 <entry>Default: <emphasis>false</emphasis></entry>
45169 </row>
45170 </tbody>
45171 </tgroup>
45172 </informaltable>
45173 <para>
45174 If the client receives a server prompt that is not a valid base64 string,
45175 authentication is abandoned by default. However, if this option is set true,
45176 the error in the challenge is ignored and the client sends the response as
45177 usual.
45178 </para>
45179 <para>
45180 <indexterm role="option">
45181 <primary><option>client_send</option></primary>
45182 </indexterm>
45183 </para>
45184 <informaltable frame="all">
45185 <tgroup cols="4" colsep="0" rowsep="0">
45186 <colspec colwidth="8*" align="left"/>
45187 <colspec colwidth="6*" align="center"/>
45188 <colspec colwidth="6*" align="center"/>
45189 <colspec colwidth="6*" align="right"/>
45190 <tbody>
45191 <row>
45192 <entry><option>client_send</option></entry>
45193 <entry>Use: <emphasis>plaintext</emphasis></entry>
45194 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45195 <entry>Default: <emphasis>unset</emphasis></entry>
45196 </row>
45197 </tbody>
45198 </tgroup>
45199 </informaltable>
45200 <para>
45201 The string is a colon-separated list of authentication data strings. Each
45202 string is independently expanded before being sent to the server. The first
45203 string is sent with the AUTH command; any more strings are sent in response
45204 to prompts from the server. Before each string is expanded, the value of the
45205 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
45206 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
45207 way. Thus, the prompt that is received in response to sending the first string
45208 (with the AUTH command) can be used in the expansion of the second string, and
45209 so on. If an invalid base64 string is received when
45210 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
45211 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
45212 </para>
45213 <para>
45214 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
45215 splitting takes priority and happens first.
45216 </para>
45217 <para>
45218 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
45219 the data, further processing is applied to each string before it is sent. If
45220 there are any single circumflex characters in the string, they are converted to
45221 NULs. Should an actual circumflex be required as data, it must be doubled in
45222 the string.
45223 </para>
45224 <para>
45225 This is an example of a client configuration that implements the PLAIN
45226 authentication mechanism with a fixed user name and password:
45227 </para>
45228 <literallayout class="monospaced">
45229 fixed_plain:
45230   driver = plaintext
45231   public_name = PLAIN
45232   client_send = ^username^mysecret
45233 </literallayout>
45234 <para>
45235 The lack of colons means that the entire text is sent with the AUTH
45236 command, with the circumflex characters converted to NULs. A similar example
45237 that uses the LOGIN mechanism is:
45238 </para>
45239 <literallayout class="monospaced">
45240 fixed_login:
45241   driver = plaintext
45242   public_name = LOGIN
45243   client_send = : username : mysecret
45244 </literallayout>
45245 <para>
45246 The initial colon means that the first string is empty, so no data is sent with
45247 the AUTH command itself. The remaining strings are sent in response to
45248 prompts.
45249 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
45250 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
45251 </para>
45252 </section>
45253 </chapter>
45254
45255 <chapter id="CHID9">
45256 <title>The cram_md5 authenticator</title>
45257 <para>
45258 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
45259 <primary><command>cram_md5</command> authenticator</primary>
45260 </indexterm>
45261 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
45262 <primary>authenticators</primary>
45263 <secondary><command>cram_md5</command></secondary>
45264 </indexterm>
45265 <indexterm role="concept">
45266 <primary>CRAM-MD5 authentication mechanism</primary>
45267 </indexterm>
45268 <indexterm role="concept">
45269 <primary>authentication</primary>
45270 <secondary>CRAM-MD5 mechanism</secondary>
45271 </indexterm>
45272 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
45273 sends a challenge string to the client, and the response consists of a user
45274 name and the CRAM-MD5 digest of the challenge string combined with a secret
45275 string (password) which is known to both server and client. Thus, the secret
45276 is not sent over the network as plain text, which makes this authenticator more
45277 secure than <command>plaintext</command>. However, the downside is that the secret has to be
45278 available in plain text at either end.
45279 </para>
45280 <section id="SECID176">
45281 <title>Using cram_md5 as a server</title>
45282 <para>
45283 <indexterm role="concept">
45284 <primary>options</primary>
45285 <secondary><command>cram_md5</command> authenticator (server)</secondary>
45286 </indexterm>
45287 This authenticator has one server option, which must be set to configure the
45288 authenticator as a server:
45289 </para>
45290 <para>
45291 <indexterm role="option">
45292 <primary><option>server_secret</option></primary>
45293 </indexterm>
45294 </para>
45295 <informaltable frame="all">
45296 <tgroup cols="4" colsep="0" rowsep="0">
45297 <colspec colwidth="8*" align="left"/>
45298 <colspec colwidth="6*" align="center"/>
45299 <colspec colwidth="6*" align="center"/>
45300 <colspec colwidth="6*" align="right"/>
45301 <tbody>
45302 <row>
45303 <entry><option>server_secret</option></entry>
45304 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45305 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45306 <entry>Default: <emphasis>unset</emphasis></entry>
45307 </row>
45308 </tbody>
45309 </tgroup>
45310 </informaltable>
45311 <para>
45312 <indexterm role="concept">
45313 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45314 <secondary>in <command>cram_md5</command> authenticator</secondary>
45315 </indexterm>
45316 When the server receives the client&#x2019;s response, the user name is placed in
45317 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
45318 obtain the password for that user. The server then computes the CRAM-MD5 digest
45319 that the client should have sent, and checks that it received the correct
45320 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
45321 fails. If the expansion fails for some other reason, a temporary error code is
45322 returned to the client.
45323 </para>
45324 <para>
45325 For compatibility with previous releases of Exim, the user name is also placed
45326 in <varname>$1</varname>. However, the use of this variables for this purpose is now
45327 deprecated, as it can lead to confusion in string expansions that also use
45328 numeric variables for other things.
45329 </para>
45330 <para>
45331 For example, the following authenticator checks that the user name given by the
45332 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
45333 user name, authentication fails.
45334 </para>
45335 <literallayout class="monospaced">
45336 fixed_cram:
45337   driver = cram_md5
45338   public_name = CRAM-MD5
45339   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
45340   server_set_id = $auth1
45341 </literallayout>
45342 <para>
45343 <indexterm role="variable">
45344 <primary><varname>$authenticated_id</varname></primary>
45345 </indexterm>
45346 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
45347 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
45348 secret string in a file, using the user name as the key. For example:
45349 </para>
45350 <literallayout class="monospaced">
45351 lookup_cram:
45352   driver = cram_md5
45353   public_name = CRAM-MD5
45354   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
45355                   {$value}fail}
45356   server_set_id = $auth1
45357 </literallayout>
45358 <para>
45359 Note that this expansion explicitly forces failure if the lookup fails
45360 because <varname>$auth1</varname> contains an unknown user name.
45361 </para>
45362 </section>
45363 <section id="SECID177">
45364 <title>Using cram_md5 as a client</title>
45365 <para>
45366 <indexterm role="concept">
45367 <primary>options</primary>
45368 <secondary><command>cram_md5</command> authenticator (client)</secondary>
45369 </indexterm>
45370 When used as a client, the <command>cram_md5</command> authenticator has two options:
45371 </para>
45372 <para>
45373 <indexterm role="option">
45374 <primary><option>client_name</option></primary>
45375 </indexterm>
45376 </para>
45377 <informaltable frame="all">
45378 <tgroup cols="4" colsep="0" rowsep="0">
45379 <colspec colwidth="8*" align="left"/>
45380 <colspec colwidth="6*" align="center"/>
45381 <colspec colwidth="6*" align="center"/>
45382 <colspec colwidth="6*" align="right"/>
45383 <tbody>
45384 <row>
45385 <entry><option>client_name</option></entry>
45386 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45387 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45388 <entry>Default: <emphasis>the primary host name</emphasis></entry>
45389 </row>
45390 </tbody>
45391 </tgroup>
45392 </informaltable>
45393 <para>
45394 This string is expanded, and the result used as the user name data when
45395 computing the response to the server&#x2019;s challenge.
45396 </para>
45397 <para>
45398 <indexterm role="option">
45399 <primary><option>client_secret</option></primary>
45400 </indexterm>
45401 </para>
45402 <informaltable frame="all">
45403 <tgroup cols="4" colsep="0" rowsep="0">
45404 <colspec colwidth="8*" align="left"/>
45405 <colspec colwidth="6*" align="center"/>
45406 <colspec colwidth="6*" align="center"/>
45407 <colspec colwidth="6*" align="right"/>
45408 <tbody>
45409 <row>
45410 <entry><option>client_secret</option></entry>
45411 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45412 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45413 <entry>Default: <emphasis>unset</emphasis></entry>
45414 </row>
45415 </tbody>
45416 </tgroup>
45417 </informaltable>
45418 <para>
45419 This option must be set for the authenticator to work as a client. Its value is
45420 expanded and the result used as the secret string when computing the response.
45421 </para>
45422 <para>
45423 <indexterm role="variable">
45424 <primary><varname>$host</varname></primary>
45425 </indexterm>
45426 <indexterm role="variable">
45427 <primary><varname>$host_address</varname></primary>
45428 </indexterm>
45429 Different user names and secrets can be used for different servers by referring
45430 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
45431 expansion string is treated as an indication that this authenticator is not
45432 prepared to handle this case. Exim moves on to the next configured client
45433 authenticator. Any other expansion failure causes Exim to give up trying to
45434 send the message to the current server.
45435 </para>
45436 <para>
45437 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
45438 strings, is:
45439 </para>
45440 <literallayout class="monospaced">
45441 fixed_cram:
45442   driver = cram_md5
45443   public_name = CRAM-MD5
45444   client_name = ph10
45445   client_secret = secret
45446 </literallayout>
45447 <para>
45448 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
45449 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
45450 </para>
45451 </section>
45452 </chapter>
45453
45454 <chapter id="CHID10">
45455 <title>The cyrus_sasl authenticator</title>
45456 <para>
45457 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
45458 <primary><command>cyrus_sasl</command> authenticator</primary>
45459 </indexterm>
45460 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
45461 <primary>authenticators</primary>
45462 <secondary><command>cyrus_sasl</command></secondary>
45463 </indexterm>
45464 <indexterm role="concept">
45465 <primary>Cyrus</primary>
45466 <secondary>SASL library</secondary>
45467 </indexterm>
45468 <indexterm role="concept">
45469 <primary>Kerberos</primary>
45470 </indexterm>
45471 The code for this authenticator was provided by Matthew Byng-Maddick of A L
45472 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
45473 </para>
45474 <para>
45475 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
45476 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
45477 Layer</quote>). This library supports a number of authentication mechanisms,
45478 including PLAIN and LOGIN, but also several others that Exim does not support
45479 directly. In particular, there is support for Kerberos authentication.
45480 </para>
45481 <para>
45482 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
45483 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
45484 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
45485 name of the driver to determine which mechanism to support.
45486 </para>
45487 <para>
45488 Where access to some kind of secret file is required, for example in GSSAPI
45489 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
45490 user, and that the Cyrus SASL library has no way of escalating privileges
45491 by default. You may also find you need to set environment variables,
45492 depending on the driver you are using.
45493 </para>
45494 <para>
45495 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
45496 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
45497 Kerberos, note that because of limitations in the GSSAPI interface,
45498 changing the server keytab might need to be communicated down to the Kerberos
45499 layer independently. The mechanism for doing so is dependent upon the Kerberos
45500 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
45501 may be set to point to an alternative keytab file. Exim will pass this
45502 variable through from its own inherited environment when started as root or the
45503 Exim user. The keytab file needs to be readable by the Exim user.
45504 </para>
45505 <section id="SECID178">
45506 <title>Using cyrus_sasl as a server</title>
45507 <para>
45508 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
45509 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
45510 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
45511 use of this variable for this purpose is now deprecated, as it can lead to
45512 confusion in string expansions that also use numeric variables for other
45513 things.
45514 </para>
45515 <para>
45516 <indexterm role="option">
45517 <primary><option>server_hostname</option></primary>
45518 </indexterm>
45519 </para>
45520 <informaltable frame="all">
45521 <tgroup cols="4" colsep="0" rowsep="0">
45522 <colspec colwidth="8*" align="left"/>
45523 <colspec colwidth="6*" align="center"/>
45524 <colspec colwidth="6*" align="center"/>
45525 <colspec colwidth="6*" align="right"/>
45526 <tbody>
45527 <row>
45528 <entry><option>server_hostname</option></entry>
45529 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45530 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45531 <entry>Default: <emphasis>see below</emphasis></entry>
45532 </row>
45533 </tbody>
45534 </tgroup>
45535 </informaltable>
45536 <para>
45537 This option selects the hostname that is used when communicating with the
45538 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
45539 SASL plug-in what it does with this data.
45540 </para>
45541 <para>
45542 <indexterm role="option">
45543 <primary><option>server_mech</option></primary>
45544 </indexterm>
45545 </para>
45546 <informaltable frame="all">
45547 <tgroup cols="4" colsep="0" rowsep="0">
45548 <colspec colwidth="8*" align="left"/>
45549 <colspec colwidth="6*" align="center"/>
45550 <colspec colwidth="6*" align="center"/>
45551 <colspec colwidth="6*" align="right"/>
45552 <tbody>
45553 <row>
45554 <entry><option>server_mech</option></entry>
45555 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45556 <entry>Type: <emphasis>string</emphasis></entry>
45557 <entry>Default: <emphasis>see below</emphasis></entry>
45558 </row>
45559 </tbody>
45560 </tgroup>
45561 </informaltable>
45562 <para>
45563 This option selects the authentication mechanism this driver should use. The
45564 default is the value of the generic <option>public_name</option> option. This option allows
45565 you to use a different underlying mechanism from the advertised name. For
45566 example:
45567 </para>
45568 <literallayout class="monospaced">
45569 sasl:
45570   driver = cyrus_sasl
45571   public_name = X-ANYTHING
45572   server_mech = CRAM-MD5
45573   server_set_id = $auth1
45574 </literallayout>
45575 <para>
45576 <indexterm role="option">
45577 <primary><option>server_realm</option></primary>
45578 </indexterm>
45579 </para>
45580 <informaltable frame="all">
45581 <tgroup cols="4" colsep="0" rowsep="0">
45582 <colspec colwidth="8*" align="left"/>
45583 <colspec colwidth="6*" align="center"/>
45584 <colspec colwidth="6*" align="center"/>
45585 <colspec colwidth="6*" align="right"/>
45586 <tbody>
45587 <row>
45588 <entry><option>server_realm</option></entry>
45589 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45590 <entry>Type: <emphasis>string</emphasis></entry>
45591 <entry>Default: <emphasis>unset</emphasis></entry>
45592 </row>
45593 </tbody>
45594 </tgroup>
45595 </informaltable>
45596 <para>
45597 This specifies the SASL realm that the server claims to be in.
45598 </para>
45599 <para>
45600 <indexterm role="option">
45601 <primary><option>server_service</option></primary>
45602 </indexterm>
45603 </para>
45604 <informaltable frame="all">
45605 <tgroup cols="4" colsep="0" rowsep="0">
45606 <colspec colwidth="8*" align="left"/>
45607 <colspec colwidth="6*" align="center"/>
45608 <colspec colwidth="6*" align="center"/>
45609 <colspec colwidth="6*" align="right"/>
45610 <tbody>
45611 <row>
45612 <entry><option>server_service</option></entry>
45613 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45614 <entry>Type: <emphasis>string</emphasis></entry>
45615 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
45616 </row>
45617 </tbody>
45618 </tgroup>
45619 </informaltable>
45620 <para>
45621 This is the SASL service that the server claims to implement.
45622 </para>
45623 <para>
45624 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
45625 private options. All you need to do is to specify an appropriate mechanism as
45626 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
45627 PLAIN, you could have two authenticators as follows:
45628 </para>
45629 <literallayout class="monospaced">
45630 sasl_cram_md5:
45631   driver = cyrus_sasl
45632   public_name = CRAM-MD5
45633   server_set_id = $auth1
45634
45635 sasl_plain:
45636   driver = cyrus_sasl
45637   public_name = PLAIN
45638   server_set_id = $auth1
45639 </literallayout>
45640 <para>
45641 Cyrus SASL does implement the LOGIN authentication method, even though it is
45642 not a standard method. It is disabled by default in the source distribution,
45643 but it is present in many binary distributions.
45644 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
45645 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
45646 </para>
45647 </section>
45648 </chapter>
45649
45650 <chapter id="CHAPdovecot">
45651 <title>The dovecot authenticator</title>
45652 <para>
45653 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
45654 <primary><command>dovecot</command> authenticator</primary>
45655 </indexterm>
45656 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
45657 <primary>authenticators</primary>
45658 <secondary><command>dovecot</command></secondary>
45659 </indexterm>
45660 This authenticator is an interface to the authentication facility of the
45661 Dovecot POP/IMAP server, which can support a number of authentication methods.
45662 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
45663 to use the same mechanisms for SMTP authentication. This is a server
45664 authenticator only. There is only one option:
45665 </para>
45666 <para>
45667 <indexterm role="option">
45668 <primary><option>server_socket</option></primary>
45669 </indexterm>
45670 </para>
45671 <informaltable frame="all">
45672 <tgroup cols="4" colsep="0" rowsep="0">
45673 <colspec colwidth="8*" align="left"/>
45674 <colspec colwidth="6*" align="center"/>
45675 <colspec colwidth="6*" align="center"/>
45676 <colspec colwidth="6*" align="right"/>
45677 <tbody>
45678 <row>
45679 <entry><option>server_socket</option></entry>
45680 <entry>Use: <emphasis>dovecot</emphasis></entry>
45681 <entry>Type: <emphasis>string</emphasis></entry>
45682 <entry>Default: <emphasis>unset</emphasis></entry>
45683 </row>
45684 </tbody>
45685 </tgroup>
45686 </informaltable>
45687 <para>
45688 This option must specify the socket that is the interface to Dovecot
45689 authentication. The <option>public_name</option> option must specify an authentication
45690 mechanism that Dovecot is configured to support. You can have several
45691 authenticators for different mechanisms. For example:
45692 </para>
45693 <literallayout class="monospaced">
45694 dovecot_plain:
45695   driver = dovecot
45696   public_name = PLAIN
45697   server_socket = /var/run/dovecot/auth-client
45698   server_setid = $auth1
45699
45700 dovecot_ntlm:
45701   driver = dovecot
45702   public_name = NTLM
45703   server_socket = /var/run/dovecot/auth-client
45704   server_setid = $auth1
45705 </literallayout>
45706 <para>
45707 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
45708 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
45709 option is passed in the Dovecot authentication command. If, for a TLS
45710 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
45711 option is passed. <phrase revisionflag="changed">When authentication succeeds, the identity of the user
45712 who authenticated is placed in <varname>$auth1</varname>.</phrase>
45713 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
45714 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
45715 </para>
45716 </chapter>
45717
45718 <chapter id="CHAPspa">
45719 <title>The spa authenticator</title>
45720 <para>
45721 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
45722 <primary><command>spa</command> authenticator</primary>
45723 </indexterm>
45724 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
45725 <primary>authenticators</primary>
45726 <secondary><command>spa</command></secondary>
45727 </indexterm>
45728 <indexterm role="concept">
45729 <primary>authentication</primary>
45730 <secondary>Microsoft Secure Password</secondary>
45731 </indexterm>
45732 <indexterm role="concept">
45733 <primary>authentication</primary>
45734 <secondary>NTLM</secondary>
45735 </indexterm>
45736 <indexterm role="concept">
45737 <primary>Microsoft Secure Password Authentication</primary>
45738 </indexterm>
45739 <indexterm role="concept">
45740 <primary>NTLM authentication</primary>
45741 </indexterm>
45742 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
45743 Password Authentication</emphasis> mechanism,
45744 which is also sometimes known as NTLM (NT LanMan). The code for client side of
45745 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
45746 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
45747 server side was subsequently contributed by Tom Kistner. The mechanism works as
45748 follows:
45749 </para>
45750 <itemizedlist>
45751 <listitem>
45752 <para>
45753 After the AUTH command has been accepted, the client sends an SPA
45754 authentication request based on the user name and optional domain.
45755 </para>
45756 </listitem>
45757 <listitem>
45758 <para>
45759 The server sends back a challenge.
45760 </para>
45761 </listitem>
45762 <listitem>
45763 <para>
45764 The client builds a challenge response which makes use of the user&#x2019;s password
45765 and sends it to the server, which then accepts or rejects it.
45766 </para>
45767 </listitem>
45768 </itemizedlist>
45769 <para>
45770 Encryption is used to protect the password in transit.
45771 </para>
45772 <section id="SECID179">
45773 <title>Using spa as a server</title>
45774 <para>
45775 <indexterm role="concept">
45776 <primary>options</primary>
45777 <secondary><command>spa</command> authenticator (server)</secondary>
45778 </indexterm>
45779 The <command>spa</command> authenticator has just one server option:
45780 </para>
45781 <para>
45782 <indexterm role="option">
45783 <primary><option>server_password</option></primary>
45784 </indexterm>
45785 </para>
45786 <informaltable frame="all">
45787 <tgroup cols="4" colsep="0" rowsep="0">
45788 <colspec colwidth="8*" align="left"/>
45789 <colspec colwidth="6*" align="center"/>
45790 <colspec colwidth="6*" align="center"/>
45791 <colspec colwidth="6*" align="right"/>
45792 <tbody>
45793 <row>
45794 <entry><option>server_password</option></entry>
45795 <entry>Use: <emphasis>spa</emphasis></entry>
45796 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45797 <entry>Default: <emphasis>unset</emphasis></entry>
45798 </row>
45799 </tbody>
45800 </tgroup>
45801 </informaltable>
45802 <para>
45803 <indexterm role="concept">
45804 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45805 <secondary>in <command>spa</command> authenticator</secondary>
45806 </indexterm>
45807 This option is expanded, and the result must be the cleartext password for the
45808 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
45809 compatibility with previous releases of Exim, the user name is also placed in
45810 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
45811 it can lead to confusion in string expansions that also use numeric variables
45812 for other things. For example:
45813 </para>
45814 <literallayout class="monospaced">
45815 spa:
45816   driver = spa
45817   public_name = NTLM
45818   server_password = \
45819     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
45820 </literallayout>
45821 <para>
45822 If the expansion is forced to fail, authentication fails. Any other expansion
45823 failure causes a temporary error code to be returned.
45824 </para>
45825 </section>
45826 <section id="SECID180">
45827 <title>Using spa as a client</title>
45828 <para>
45829 <indexterm role="concept">
45830 <primary>options</primary>
45831 <secondary><command>spa</command> authenticator (client)</secondary>
45832 </indexterm>
45833 The <command>spa</command> authenticator has the following client options:
45834 </para>
45835 <para>
45836 <indexterm role="option">
45837 <primary><option>client_domain</option></primary>
45838 </indexterm>
45839 </para>
45840 <informaltable frame="all">
45841 <tgroup cols="4" colsep="0" rowsep="0">
45842 <colspec colwidth="8*" align="left"/>
45843 <colspec colwidth="6*" align="center"/>
45844 <colspec colwidth="6*" align="center"/>
45845 <colspec colwidth="6*" align="right"/>
45846 <tbody>
45847 <row>
45848 <entry><option>client_domain</option></entry>
45849 <entry>Use: <emphasis>spa</emphasis></entry>
45850 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45851 <entry>Default: <emphasis>unset</emphasis></entry>
45852 </row>
45853 </tbody>
45854 </tgroup>
45855 </informaltable>
45856 <para>
45857 This option specifies an optional domain for the authentication.
45858 </para>
45859 <para>
45860 <indexterm role="option">
45861 <primary><option>client_password</option></primary>
45862 </indexterm>
45863 </para>
45864 <informaltable frame="all">
45865 <tgroup cols="4" colsep="0" rowsep="0">
45866 <colspec colwidth="8*" align="left"/>
45867 <colspec colwidth="6*" align="center"/>
45868 <colspec colwidth="6*" align="center"/>
45869 <colspec colwidth="6*" align="right"/>
45870 <tbody>
45871 <row>
45872 <entry><option>client_password</option></entry>
45873 <entry>Use: <emphasis>spa</emphasis></entry>
45874 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45875 <entry>Default: <emphasis>unset</emphasis></entry>
45876 </row>
45877 </tbody>
45878 </tgroup>
45879 </informaltable>
45880 <para>
45881 This option specifies the user&#x2019;s password, and must be set.
45882 </para>
45883 <para>
45884 <indexterm role="option">
45885 <primary><option>client_username</option></primary>
45886 </indexterm>
45887 </para>
45888 <informaltable frame="all">
45889 <tgroup cols="4" colsep="0" rowsep="0">
45890 <colspec colwidth="8*" align="left"/>
45891 <colspec colwidth="6*" align="center"/>
45892 <colspec colwidth="6*" align="center"/>
45893 <colspec colwidth="6*" align="right"/>
45894 <tbody>
45895 <row>
45896 <entry><option>client_username</option></entry>
45897 <entry>Use: <emphasis>spa</emphasis></entry>
45898 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45899 <entry>Default: <emphasis>unset</emphasis></entry>
45900 </row>
45901 </tbody>
45902 </tgroup>
45903 </informaltable>
45904 <para>
45905 This option specifies the user name, and must be set. Here is an example of a
45906 configuration of this authenticator for use with the mail servers at
45907 <emphasis>msn.com</emphasis>:
45908 </para>
45909 <literallayout class="monospaced">
45910 msn:
45911   driver = spa
45912   public_name = MSN
45913   client_username = msn/msn_username
45914   client_password = msn_plaintext_password
45915   client_domain = DOMAIN_OR_UNSET
45916 </literallayout>
45917 <para>
45918 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
45919 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
45920 </para>
45921 </section>
45922 </chapter>
45923
45924 <chapter id="CHAPTLS">
45925 <title>Encrypted SMTP connections using TLS/SSL</title>
45926 <titleabbrev>Encrypted SMTP connections</titleabbrev>
45927 <para>
45928 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
45929 <primary>encryption</primary>
45930 <secondary>on SMTP connection</secondary>
45931 </indexterm>
45932 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
45933 <primary>SMTP</primary>
45934 <secondary>encryption</secondary>
45935 </indexterm>
45936 <indexterm role="concept">
45937 <primary>TLS</primary>
45938 <secondary>on SMTP connection</secondary>
45939 </indexterm>
45940 <indexterm role="concept">
45941 <primary>OpenSSL</primary>
45942 </indexterm>
45943 <indexterm role="concept">
45944 <primary>GnuTLS</primary>
45945 </indexterm>
45946 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
45947 Sockets Layer), is implemented by making use of the OpenSSL library or the
45948 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
45949 cryptographic code in the Exim distribution itself for implementing TLS. In
45950 order to use this feature you must install OpenSSL or GnuTLS, and then build a
45951 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
45952 You also need to understand the basic concepts of encryption at a managerial
45953 level, and in particular, the way that public keys, private keys, and
45954 certificates are used.
45955 </para>
45956 <para>
45957 RFC 3207 defines how SMTP connections can make use of encryption. Once a
45958 connection is established, the client issues a STARTTLS command. If the
45959 server accepts this, the client and the server negotiate an encryption
45960 mechanism. If the negotiation succeeds, the data that subsequently passes
45961 between them is encrypted.
45962 </para>
45963 <para>
45964 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
45965 and if so, what cipher suite is in use, whether the client supplied a
45966 certificate, and whether or not that certificate was verified. This makes it
45967 possible for an Exim server to deny or accept certain commands based on the
45968 encryption state.
45969 </para>
45970 <para>
45971 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
45972 disrupt TLS connections. You need to turn off SMTP scanning for these products
45973 in order to get TLS to work.
45974 </para>
45975 <section id="SECID284">
45976 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
45977 <para>
45978 <indexterm role="concept">
45979 <primary>ssmtp protocol</primary>
45980 </indexterm>
45981 <indexterm role="concept">
45982 <primary>smtps protocol</primary>
45983 </indexterm>
45984 <indexterm role="concept">
45985 <primary>SMTP</primary>
45986 <secondary>ssmtp protocol</secondary>
45987 </indexterm>
45988 <indexterm role="concept">
45989 <primary>SMTP</primary>
45990 <secondary>smtps protocol</secondary>
45991 </indexterm>
45992 Early implementations of encrypted SMTP used a different TCP port from normal
45993 SMTP, and expected an encryption negotiation to start immediately, instead of
45994 waiting for a STARTTLS command from the client using the standard SMTP
45995 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
45996 allocated for this purpose.
45997 </para>
45998 <para>
45999 This approach was abandoned when encrypted SMTP was standardized, but there are
46000 still some legacy clients that use it. Exim supports these clients by means of
46001 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
46002 numbers; the most common use is expected to be:
46003 </para>
46004 <literallayout class="monospaced">
46005 tls_on_connect_ports = 465
46006 </literallayout>
46007 <para>
46008 The port numbers specified by this option apply to all SMTP connections, both
46009 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
46010 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
46011 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
46012 an extra port &ndash; rather, it specifies different behaviour on a port that is
46013 defined elsewhere.
46014 </para>
46015 <para>
46016 There is also a <option>-tls-on-connect</option> command line option. This overrides
46017 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
46018 </para>
46019 </section>
46020 <section id="SECTopenvsgnu">
46021 <title>OpenSSL vs GnuTLS</title>
46022 <para>
46023 <indexterm role="concept">
46024 <primary>TLS</primary>
46025 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
46026 </indexterm>
46027 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
46028 followed later, when the first versions of GnuTLS were released. To build Exim
46029 to use GnuTLS, you need to set
46030 </para>
46031 <literallayout class="monospaced">
46032 USE_GNUTLS=yes
46033 </literallayout>
46034 <para>
46035 in Local/Makefile, in addition to
46036 </para>
46037 <literallayout class="monospaced">
46038 SUPPORT_TLS=yes
46039 </literallayout>
46040 <para>
46041 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
46042 include files and libraries for GnuTLS can be found.
46043 </para>
46044 <para>
46045 There are some differences in usage when using GnuTLS instead of OpenSSL:
46046 </para>
46047 <itemizedlist>
46048 <listitem>
46049 <para>
46050 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
46051 name of a directory (for OpenSSL it can be either).
46052 </para>
46053 </listitem>
46054 <listitem>
46055 <para>
46056 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
46057 facility for varying its Diffie-Hellman parameters. I understand that this has
46058 changed, but Exim has not been updated to provide this facility.
46059 </para>
46060 </listitem>
46061 <listitem>
46062 <para>
46063 <indexterm role="variable">
46064 <primary><varname>$tls_peerdn</varname></primary>
46065 </indexterm>
46066 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
46067 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
46068 affects the value of the <varname>$tls_peerdn</varname> variable.
46069 </para>
46070 </listitem>
46071 <listitem>
46072 <para>
46073 OpenSSL identifies cipher suites using hyphens as separators, for example:
46074 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
46075 more, OpenSSL complains if underscores are present in a cipher list. To make
46076 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
46077 underscores for GnuTLS when processing lists of cipher suites in the
46078 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
46079 option).
46080 </para>
46081 </listitem>
46082 <listitem>
46083 <para>
46084 The <option>tls_require_ciphers</option> options operate differently, as described in the
46085 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
46086 </para>
46087 </listitem>
46088 </itemizedlist>
46089 </section>
46090 <section id="SECID181">
46091 <title>GnuTLS parameter computation</title>
46092 <para>
46093 GnuTLS uses RSA and D-H parameters that may take a substantial amount of time
46094 to compute. It is unreasonable to re-compute them for every TLS session.
46095 Therefore, Exim keeps this data in a file in its spool directory, called
46096 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
46097 its owner. Every Exim process that start up GnuTLS reads the RSA and D-H
46098 parameters from this file. If the file does not exist, the first Exim process
46099 that needs it computes the data and writes it to a temporary file which is
46100 renamed once it is complete. It does not matter if several Exim processes do
46101 this simultaneously (apart from wasting a few resources). Once a file is in
46102 place, new Exim processes immediately start using it.
46103 </para>
46104 <para>
46105 For maximum security, the parameters that are stored in this file should be
46106 recalculated periodically, the frequency depending on your paranoia level.
46107 Arranging this is easy in principle; just delete the file when you want new
46108 values to be computed. However, there may be a problem. The calculation of new
46109 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
46110 If the system is not very active, <filename>/dev/random</filename> may delay returning data
46111 until enough randomness (entropy) is available. This may cause Exim to hang for
46112 a substantial amount of time, causing timeouts on incoming connections.
46113 </para>
46114 <para>
46115 The solution is to generate the parameters externally to Exim. They are stored
46116 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
46117 externally using the <command>certtool</command> command that is part of GnuTLS.
46118 </para>
46119 <para>
46120 To replace the parameters with new ones, instead of deleting the file
46121 and letting Exim re-create it, you can generate new parameters using
46122 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
46123 renaming. The relevant commands are something like this:
46124 </para>
46125 <literallayout class="monospaced">
46126 # rm -f new-params
46127 # touch new-params
46128 # chown exim:exim new-params
46129 # chmod 0400 new-params
46130 # certtool --generate-privkey --bits 512 &gt;new-params
46131 # echo "" &gt;&gt;new-params
46132 # certtool --generate-dh-params --bits 1024 &gt;&gt; new-params
46133 # mv new-params gnutls-params
46134 </literallayout>
46135 <para>
46136 If Exim never has to generate the parameters itself, the possibility of
46137 stalling is removed.
46138 </para>
46139 </section>
46140 <section id="SECTreqciphssl">
46141 <title>Requiring specific ciphers in OpenSSL</title>
46142 <para>
46143 <indexterm role="concept">
46144 <primary>TLS</primary>
46145 <secondary>requiring specific ciphers (OpenSSL)</secondary>
46146 </indexterm>
46147 <indexterm role="option">
46148 <primary><option>tls_require_ciphers</option></primary>
46149 <secondary>OpenSSL</secondary>
46150 </indexterm>
46151 There is a function in the OpenSSL library that can be passed a list of cipher
46152 suites before the cipher negotiation takes place. This specifies which ciphers
46153 are acceptable. The list is colon separated and may contain names like
46154 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
46155 directly to this function call. The following quotation from the OpenSSL
46156 documentation specifies what forms of item are allowed in the cipher string:
46157 </para>
46158 <itemizedlist>
46159 <listitem>
46160 <para>
46161 It can consist of a single cipher suite such as RC4-SHA.
46162 </para>
46163 </listitem>
46164 <listitem>
46165 <para>
46166 It can represent a list of cipher suites containing a certain algorithm,
46167 or cipher suites of a certain type. For example SHA1 represents all
46168 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
46169 SSL v3 algorithms.
46170 </para>
46171 </listitem>
46172 <listitem>
46173 <para>
46174 Lists of cipher suites can be combined in a single cipher string using
46175 the + character. This is used as a logical and operation. For example
46176 SHA1+DES represents all cipher suites containing the SHA1 and the DES
46177 algorithms.
46178 </para>
46179 </listitem>
46180 </itemizedlist>
46181 <para>
46182 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
46183 <literal>-</literal> or <literal>+</literal>.
46184 </para>
46185 <itemizedlist>
46186 <listitem>
46187 <para>
46188 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
46189 ciphers deleted can never reappear in the list even if they are explicitly
46190 stated.
46191 </para>
46192 </listitem>
46193 <listitem>
46194 <para>
46195 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
46196 of the ciphers can be added again by later options.
46197 </para>
46198 </listitem>
46199 <listitem>
46200 <para>
46201 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
46202 option does not add any new ciphers; it just moves matching existing ones.
46203 </para>
46204 </listitem>
46205 </itemizedlist>
46206 <para>
46207 If none of these characters is present, the string is interpreted as
46208 a list of ciphers to be appended to the current preference list. If the list
46209 includes any ciphers already present they will be ignored: that is, they will
46210 not be moved to the end of the list.
46211 </para>
46212 </section>
46213 <section id="SECTreqciphgnu" revisionflag="changed">
46214 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
46215 <para revisionflag="changed">
46216 <indexterm role="concept">
46217 <primary>GnuTLS</primary>
46218 <secondary>specifying parameters for</secondary>
46219 </indexterm>
46220 <indexterm role="concept">
46221 <primary>TLS</primary>
46222 <secondary>specifying ciphers (GnuTLS)</secondary>
46223 </indexterm>
46224 <indexterm role="concept">
46225 <primary>TLS</primary>
46226 <secondary>specifying key exchange methods (GnuTLS)</secondary>
46227 </indexterm>
46228 <indexterm role="concept">
46229 <primary>TLS</primary>
46230 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
46231 </indexterm>
46232 <indexterm role="concept">
46233 <primary>TLS</primary>
46234 <secondary>specifying protocols (GnuTLS)</secondary>
46235 </indexterm>
46236 <indexterm role="option">
46237 <primary><option>tls_require_ciphers</option></primary>
46238 <secondary>GnuTLS</secondary>
46239 </indexterm>
46240 The GnuTLS library allows the caller to specify separate lists of permitted key
46241 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
46242 Unfortunately, these lists are numerical, and the library does not have a
46243 function for turning names into numbers. Consequently, lists of recognized
46244 names have to be built into the application. The permitted key exchange
46245 methods, ciphers, and MAC algorithms may be used in any combination to form a
46246 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
46247 passed to its control function.
46248 </para>
46249 <para revisionflag="changed">
46250 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
46251 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
46252 option controls only the cipher algorithms. Exim searches each item in the
46253 list for the name of an available algorithm. For example, if the list
46254 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
46255 the same as if just AES were given.
46256 </para>
46257 <para revisionflag="changed">
46258 <indexterm role="option">
46259 <primary><option>gnutls_require_kx</option></primary>
46260 </indexterm>
46261 <indexterm role="option">
46262 <primary><option>gnutls_require_mac</option></primary>
46263 </indexterm>
46264 <indexterm role="option">
46265 <primary><option>gnutls_require_protocols</option></primary>
46266 </indexterm>
46267 There are additional options called <option>gnutls_require_kx</option>,
46268 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
46269 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
46270 These options are ignored if OpenSSL is in use.
46271 </para>
46272 <para revisionflag="changed">
46273 All four options are available as global options, controlling how Exim
46274 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
46275 how Exim behaves as a client. All the values are string expanded. After
46276 expansion, the values must be colon-separated lists, though the separator
46277 can be changed in the usual way.
46278 </para>
46279 <para revisionflag="changed">
46280 Each of the four lists starts out with a default set of algorithms. If the
46281 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
46282 default items are deleted. In this case, only those that are explicitly
46283 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
46284 exclamation mark, the defaults are left on the list.
46285 </para>
46286 <para revisionflag="changed">
46287 Then, any item that starts with an exclamation mark causes the relevant
46288 entry to be removed from the list, and any item that does not start with an
46289 exclamation mark causes a new entry to be added to the list. Unrecognized
46290 items in the list are ignored. Thus:
46291 </para>
46292 <literallayout class="monospaced" revisionflag="changed">
46293 tls_require_ciphers = !ARCFOUR
46294 </literallayout>
46295 <para revisionflag="changed">
46296 allows all the defaults except ARCFOUR, whereas
46297 </para>
46298 <literallayout class="monospaced" revisionflag="changed">
46299 tls_require_ciphers = AES : 3DES
46300 </literallayout>
46301 <para revisionflag="changed">
46302 allows only cipher suites that use AES or 3DES.
46303 </para>
46304 <para revisionflag="changed">
46305 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
46306 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
46307 the preceding). The default list does not contain all of these; it just has
46308 AES_256, AES_128, 3DES, and ARCFOUR_128.
46309 </para>
46310 <para revisionflag="changed">
46311 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
46312 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
46313 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
46314 </para>
46315 <para revisionflag="changed">
46316 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
46317 MD5. The default list contains SHA, MD5.
46318 </para>
46319 <para revisionflag="changed">
46320 For <option>gnutls_require_protocols</option>, the recognized names are TLS1 and SSL3.
46321 The default list contains TLS1, SSL3.
46322 </para>
46323 <para revisionflag="changed">
46324 In a server, the order of items in these lists is unimportant. The server
46325 advertises the availability of all the relevant cipher suites. However, in a
46326 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
46327 order for the cipher algorithms. The first one in the client&#x2019;s list that is
46328 also advertised by the server is tried first. The default order is as listed
46329 above.
46330 </para>
46331 </section>
46332 <section id="SECID182">
46333 <title>Configuring an Exim server to use TLS</title>
46334 <para>
46335 <indexterm role="concept">
46336 <primary>TLS</primary>
46337 <secondary>configuring an Exim server</secondary>
46338 </indexterm>
46339 When Exim has been built with TLS support, it advertises the availability of
46340 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
46341 but not to any others. The default value of this option is unset, which means
46342 that STARTTLS is not advertised at all. This default is chosen because you
46343 need to set some other options in order to make TLS available, and also it is
46344 sensible for systems that want to use TLS only as a client.
46345 </para>
46346 <para>
46347 If a client issues a STARTTLS command and there is some configuration
46348 problem in the server, the command is rejected with a 454 error. If the client
46349 persists in trying to issue SMTP commands, all except QUIT are rejected
46350 with the error
46351 </para>
46352 <literallayout class="monospaced">
46353 554 Security failure
46354 </literallayout>
46355 <para>
46356 If a STARTTLS command is issued within an existing TLS session, it is
46357 rejected with a 554 error code.
46358 </para>
46359 <para>
46360 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
46361 match some hosts. You can, of course, set it to * to match all hosts.
46362 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
46363 without some further configuration at the server end.
46364 </para>
46365 <para>
46366 It is rumoured that all existing clients that support TLS/SSL use RSA
46367 encryption. To make this work you need to set, in the server,
46368 </para>
46369 <literallayout class="monospaced">
46370 tls_certificate = /some/file/name
46371 tls_privatekey = /some/file/name
46372 </literallayout>
46373 <para>
46374 These options are, in fact, expanded strings, so you can make them depend on
46375 the identity of the client that is connected if you wish. The first file
46376 contains the server&#x2019;s X509 certificate, and the second contains the private key
46377 that goes with it. These files need to be readable by the Exim user, and must
46378 always be given as full path names. They can be the same file if both the
46379 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
46380 set, or if its expansion is forced to fail or results in an empty string, this
46381 is assumed to be the case. The certificate file may also contain intermediate
46382 certificates that need to be sent to the client to enable it to authenticate
46383 the server&#x2019;s certificate.
46384 </para>
46385 <para>
46386 If you do not understand about certificates and keys, please try to find a
46387 source of this background information, which is not Exim-specific. (There are a
46388 few comments below in section <xref linkend="SECTcerandall"/>.)
46389 </para>
46390 <para>
46391 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
46392 they apply only in the case of a server. If you need to use a certificate in an
46393 Exim client, you must set the options of the same names in an <command>smtp</command>
46394 transport.
46395 </para>
46396 <para>
46397 With just these options, an Exim server will be able to use TLS. It does not
46398 require the client to have a certificate (but see below for how to insist on
46399 this). There is one other option that may be needed in other situations. If
46400 </para>
46401 <literallayout class="monospaced">
46402 tls_dhparam = /some/file/name
46403 </literallayout>
46404 <para>
46405 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
46406 with the parameters contained in the file. This increases the set of cipher
46407 suites that the server supports. See the command
46408 </para>
46409 <literallayout class="monospaced">
46410 openssl dhparam
46411 </literallayout>
46412 <para>
46413 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
46414 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
46415 </para>
46416 <para>
46417 The strings supplied for these three options are expanded every time a client
46418 host connects. It is therefore possible to use different certificates and keys
46419 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
46420 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
46421 forced to fail, Exim behaves as if the option is not set.
46422 </para>
46423 <para>
46424 <indexterm role="concept">
46425 <primary>cipher</primary>
46426 <secondary>logging</secondary>
46427 </indexterm>
46428 <indexterm role="concept">
46429 <primary>log</primary>
46430 <secondary>TLS cipher</secondary>
46431 </indexterm>
46432 <indexterm role="variable">
46433 <primary><varname>$tls_cipher</varname></primary>
46434 </indexterm>
46435 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
46436 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
46437 incoming message (by default &ndash; you can, of course, change this), and it is
46438 also included in the log line that records a message&#x2019;s arrival, keyed by
46439 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
46440 condition can be used to test for specific cipher suites in ACLs.
46441 </para>
46442 <para>
46443 The ACLs that run for subsequent SMTP commands can check the name of the cipher
46444 suite and vary their actions accordingly. The cipher suite names are those used
46445 by OpenSSL. These may differ from the names used elsewhere. For example,
46446 OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other contexts
46447 is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL
46448 documentation for more details.
46449 </para>
46450 </section>
46451 <section id="SECID183">
46452 <title>Requesting and verifying client certificates</title>
46453 <para>
46454 <indexterm role="concept">
46455 <primary>certificate</primary>
46456 <secondary>verification of client</secondary>
46457 </indexterm>
46458 <indexterm role="concept">
46459 <primary>TLS</primary>
46460 <secondary>client certificate verification</secondary>
46461 </indexterm>
46462 If you want an Exim server to request a certificate when negotiating a TLS
46463 session with a client, you must set either <option>tls_verify_hosts</option> or
46464 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
46465 apply to all TLS connections. For any host that matches one of these options,
46466 Exim requests a certificate as part of the setup of the TLS session. The
46467 contents of the certificate are verified by comparing it with a list of
46468 expected certificates. These must be available in a file or,
46469 for OpenSSL only (not GnuTLS), a directory, identified by
46470 <option>tls_verify_certificates</option>.
46471 </para>
46472 <para>
46473 A file can contain multiple certificates, concatenated end to end. If a
46474 directory is used
46475 (OpenSSL only),
46476 each certificate must be in a separate file, with a name (or a symbolic link)
46477 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
46478 certificate. You can compute the relevant hash by running the command
46479 </para>
46480 <literallayout class="monospaced">
46481 openssl x509 -hash -noout -in /cert/file
46482 </literallayout>
46483 <para>
46484 where <filename>/cert/file</filename> contains a single certificate.
46485 </para>
46486 <para>
46487 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
46488 what happens if the client does not supply a certificate, or if the certificate
46489 does not match any of the certificates in the collection named by
46490 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
46491 attempt to set up a TLS session is aborted, and the incoming connection is
46492 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
46493 session continues. ACLs that run for subsequent SMTP commands can detect the
46494 fact that no certificate was verified, and vary their actions accordingly. For
46495 example, you can insist on a certificate before accepting a message for
46496 relaying, but not when the message is destined for local delivery.
46497 </para>
46498 <para>
46499 <indexterm role="variable">
46500 <primary><varname>$tls_peerdn</varname></primary>
46501 </indexterm>
46502 When a client supplies a certificate (whether it verifies or not), the value of
46503 the Distinguished Name of the certificate is made available in the variable
46504 <varname>$tls_peerdn</varname> during subsequent processing of the message.
46505 </para>
46506 <para>
46507 <indexterm role="concept">
46508 <primary>log</primary>
46509 <secondary>distinguished name</secondary>
46510 </indexterm>
46511 Because it is often a long text string, it is not included in the log line or
46512 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
46513 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
46514 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
46515 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
46516 </para>
46517 </section>
46518 <section id="SECID184">
46519 <title>Revoked certificates</title>
46520 <para>
46521 <indexterm role="concept">
46522 <primary>TLS</primary>
46523 <secondary>revoked certificates</secondary>
46524 </indexterm>
46525 <indexterm role="concept">
46526 <primary>revocation list</primary>
46527 </indexterm>
46528 <indexterm role="concept">
46529 <primary>certificate</primary>
46530 <secondary>revocation list</secondary>
46531 </indexterm>
46532 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
46533 certificates are revoked. If you have such a list, you can pass it to an Exim
46534 server using the global option called <option>tls_crl</option> and to an Exim client using
46535 an identically named option for the <command>smtp</command> transport. In each case, the value
46536 of the option is expanded and must then be the name of a file that contains a
46537 CRL in PEM format.
46538 </para>
46539 </section>
46540 <section id="SECID185">
46541 <title>Configuring an Exim client to use TLS</title>
46542 <para>
46543 <indexterm role="concept">
46544 <primary>cipher</primary>
46545 <secondary>logging</secondary>
46546 </indexterm>
46547 <indexterm role="concept">
46548 <primary>log</primary>
46549 <secondary>TLS cipher</secondary>
46550 </indexterm>
46551 <indexterm role="concept">
46552 <primary>log</primary>
46553 <secondary>distinguished name</secondary>
46554 </indexterm>
46555 <indexterm role="concept">
46556 <primary>TLS</primary>
46557 <secondary>configuring an Exim client</secondary>
46558 </indexterm>
46559 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
46560 deliveries as well as to incoming, the latter one causing logging of the
46561 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
46562 within the <command>smtp</command> transport.
46563 </para>
46564 <para>
46565 It is not necessary to set any options to have TLS work in the <command>smtp</command>
46566 transport. If Exim is built with TLS support, and TLS is advertised by a
46567 server, the <command>smtp</command> transport always tries to start a TLS session. However,
46568 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
46569 transport) to a list of server hosts for which TLS should not be used.
46570 </para>
46571 <para>
46572 If you do not want Exim to attempt to send messages unencrypted when an attempt
46573 to set up an encrypted connection fails in any way, you can set
46574 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
46575 those hosts, delivery is always deferred if an encrypted connection cannot be
46576 set up. If there are any other hosts for the address, they are tried in the
46577 usual way.
46578 </para>
46579 <para>
46580 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
46581 the message unencrypted. It always does this if the response to STARTTLS is
46582 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
46583 session after a success response code, what happens is controlled by the
46584 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
46585 delivery to this host is deferred, and other hosts (if available) are tried. If
46586 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
46587 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
46588 negotiation fails, Exim closes the current connection (because it is in an
46589 unknown state), opens a new one to the same host, and then tries the delivery
46590 unencrypted.
46591 </para>
46592 <para>
46593 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
46594 transport provide the client with a certificate, which is passed to the server
46595 if it requests it. If the server is Exim, it will request a certificate only if
46596 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client. <emphasis role="bold">Note</emphasis>:
46597 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
46598 is operating as a client. Exim does not assume that a server certificate (set
46599 by the global options of the same name) should also be used when operating as a
46600 client.
46601 </para>
46602 <para>
46603 If <option>tls_verify_certificates</option> is set, it must name a file or,
46604 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
46605 expected server certificates. The client verifies the server&#x2019;s certificate
46606 against this collection, taking into account any revoked certificates that are
46607 in the list defined by <option>tls_crl</option>.
46608 </para>
46609 <para>
46610 If
46611 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
46612 list of permitted cipher suites. If either of these checks fails, delivery to
46613 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
46614 alternative hosts, if any.
46615 </para>
46616 <para>
46617 <indexterm role="variable">
46618 <primary><varname>$host</varname></primary>
46619 </indexterm>
46620 <indexterm role="variable">
46621 <primary><varname>$host_address</varname></primary>
46622 </indexterm>
46623 All the TLS options in the <command>smtp</command> transport are expanded before use, with
46624 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
46625 which the client is connected. Forced failure of an expansion causes Exim to
46626 behave as if the relevant option were unset.
46627 </para>
46628 </section>
46629 <section id="SECTmulmessam">
46630 <title>Multiple messages on the same encrypted TCP/IP connection</title>
46631 <para>
46632 <indexterm role="concept">
46633 <primary>multiple SMTP deliveries with TLS</primary>
46634 </indexterm>
46635 <indexterm role="concept">
46636 <primary>TLS</primary>
46637 <secondary>multiple message deliveries</secondary>
46638 </indexterm>
46639 Exim sends multiple messages down the same TCP/IP connection by starting up
46640 an entirely new delivery process for each message, passing the socket from
46641 one process to the next. This implementation does not fit well with the use
46642 of TLS, because there is quite a lot of state information associated with a TLS
46643 connection, not just a socket identification. Passing all the state information
46644 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
46645 session before passing the socket to a new process. The new process may then
46646 try to start a new TLS session, and if successful, may try to re-authenticate
46647 if AUTH is in use, before sending the next message.
46648 </para>
46649 <para>
46650 The RFC is not clear as to whether or not an SMTP session continues in clear
46651 after TLS has been shut down, or whether TLS may be restarted again later, as
46652 just described. However, if the server is Exim, this shutdown and
46653 reinitialization works. It is not known which (if any) other servers operate
46654 successfully if the client closes a TLS session and continues with unencrypted
46655 SMTP, but there are certainly some that do not work. For such servers, Exim
46656 should not pass the socket to another process, because the failure of the
46657 subsequent attempt to use it would cause Exim to record a temporary host error,
46658 and delay other deliveries to that host.
46659 </para>
46660 <para>
46661 To test for this case, Exim sends an EHLO command to the server after
46662 closing down the TLS session. If this fails in any way, the connection is
46663 closed instead of being passed to a new delivery process, but no retry
46664 information is recorded.
46665 </para>
46666 <para>
46667 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
46668 <command>smtp</command> transport to match those hosts for which Exim should not pass
46669 connections to new processes if TLS has been used.
46670 </para>
46671 </section>
46672 <section id="SECTcerandall">
46673 <title>Certificates and all that</title>
46674 <para>
46675 <indexterm role="concept">
46676 <primary>certificate</primary>
46677 <secondary>references to discussion</secondary>
46678 </indexterm>
46679 In order to understand fully how TLS works, you need to know about
46680 certificates, certificate signing, and certificate authorities. This is not the
46681 place to give a tutorial, especially as I do not know very much about it
46682 myself. Some helpful introduction can be found in the FAQ for the SSL addition
46683 to Apache, currently at
46684 </para>
46685 <literallayout>
46686 <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>
46687 </literallayout>
46688 <para>
46689 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
46690 links to further files.
46691 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
46692 0-201-61598-3), contains both introductory and more in-depth descriptions.
46693 Some sample programs taken from the book are available from
46694 </para>
46695 <literallayout>
46696 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
46697 </literallayout>
46698 </section>
46699 <section id="SECID186">
46700 <title>Certificate chains</title>
46701 <para>
46702 The file named by <option>tls_certificate</option> may contain more than one
46703 certificate. This is useful in the case where the certificate that is being
46704 sent is validated by an intermediate certificate which the other end does
46705 not have. Multiple certificates must be in the correct order in the file.
46706 First the host&#x2019;s certificate itself, then the first intermediate
46707 certificate to validate the issuer of the host certificate, then the next
46708 intermediate certificate to validate the issuer of the first intermediate
46709 certificate, and so on, until finally (optionally) the root certificate.
46710 The root certificate must already be trusted by the recipient for
46711 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
46712 root certificate along with the rest makes it available for the user to
46713 install if the receiving end is a client MUA that can interact with a user.
46714 </para>
46715 </section>
46716 <section id="SECID187">
46717 <title>Self-signed certificates</title>
46718 <para>
46719 <indexterm role="concept">
46720 <primary>certificate</primary>
46721 <secondary>self-signed</secondary>
46722 </indexterm>
46723 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
46724 with OpenSSL, like this:
46725 </para>
46726 <literallayout class="monospaced">
46727 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
46728             -days 9999 -nodes
46729 </literallayout>
46730 <para>
46731 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
46732 delimited and so can be identified independently. The <option>-days</option> option
46733 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
46734 important: if you do not set it, the key is encrypted with a passphrase
46735 that you are prompted for, and any use that is made of the key causes more
46736 prompting for the passphrase. This is not helpful if you are going to use
46737 this certificate and key in an MTA, where prompting is not possible.
46738 </para>
46739 <para>
46740 A self-signed certificate made in this way is sufficient for testing, and
46741 may be adequate for all your requirements if you are mainly interested in
46742 encrypting transfers, and not in secure identification.
46743 </para>
46744 <para>
46745 However, many clients require that the certificate presented by the server be a
46746 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
46747 certificate. In this situation, the self-signed certificate described above
46748 must be installed on the client host as a trusted root <emphasis>certification
46749 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
46750 signed with that self-signed certificate.
46751 </para>
46752 <para>
46753 For information on creating self-signed CA certificates and using them to sign
46754 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
46755 Open-source PKI book, available online at
46756 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
46757 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
46758 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
46759 </para>
46760 </section>
46761 </chapter>
46762
46763 <chapter id="CHAPACL">
46764 <title>Access control lists</title>
46765 <para>
46766 <indexterm role="concept" id="IIDacl" class="startofrange">
46767 <primary>access control lists (ACLs)</primary>
46768 <secondary>description</secondary>
46769 </indexterm>
46770 <indexterm role="concept">
46771 <primary>control of incoming mail</primary>
46772 </indexterm>
46773 <indexterm role="concept">
46774 <primary>message</primary>
46775 <secondary>controlling incoming</secondary>
46776 </indexterm>
46777 <indexterm role="concept">
46778 <primary>policy control</primary>
46779 <secondary>access control lists</secondary>
46780 </indexterm>
46781 Access Control Lists (ACLs) are defined in a separate section of the run time
46782 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
46783 name, terminated by a colon. Here is a complete ACL section that contains just
46784 one very small ACL:
46785 </para>
46786 <literallayout class="monospaced">
46787 begin acl
46788 small_acl:
46789   accept   hosts = one.host.only
46790 </literallayout>
46791 <para>
46792 You can have as many lists as you like in the ACL section, and the order in
46793 which they appear does not matter. The lists are self-terminating.
46794 </para>
46795 <para>
46796 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
46797 certain SMTP commands. This applies both to incoming TCP/IP connections, and
46798 when a local process submits a message using SMTP by specifying the <option>-bs</option>
46799 option. The most common use is for controlling which recipients are accepted
46800 in incoming messages. In addition, you can define an ACL that is used to check
46801 local non-SMTP messages. The default configuration file contains an example of
46802 a realistic ACL for checking RCPT commands. This is discussed in chapter
46803 <xref linkend="CHAPdefconfil"/>.
46804 </para>
46805 <section id="SECID188">
46806 <title>Testing ACLs</title>
46807 <para>
46808 The <option>-bh</option> command line option provides a way of testing your ACL
46809 configuration locally by running a fake SMTP session with which you interact.
46810 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
46811 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
46812 </para>
46813 </section>
46814 <section id="SECID189">
46815 <title>Specifying when ACLs are used</title>
46816 <para>
46817 <indexterm role="concept">
46818 <primary>access control lists (ACLs)</primary>
46819 <secondary>options for specifying</secondary>
46820 </indexterm>
46821 In order to cause an ACL to be used, you have to name it in one of the relevant
46822 options in the main part of the configuration. These options are:
46823 <indexterm role="concept">
46824 <primary>AUTH</primary>
46825 <secondary>ACL for</secondary>
46826 </indexterm>
46827 <indexterm role="concept">
46828 <primary>DATA</primary>
46829 <secondary>ACLs for</secondary>
46830 </indexterm>
46831 <indexterm role="concept">
46832 <primary>ETRN</primary>
46833 <secondary>ACL for</secondary>
46834 </indexterm>
46835 <indexterm role="concept">
46836 <primary>EXPN</primary>
46837 <secondary>ACL for</secondary>
46838 </indexterm>
46839 <indexterm role="concept">
46840 <primary>HELO</primary>
46841 <secondary>ACL for</secondary>
46842 </indexterm>
46843 <indexterm role="concept">
46844 <primary>EHLO</primary>
46845 <secondary>ACL for</secondary>
46846 </indexterm>
46847 <indexterm role="concept">
46848 <primary>MAIL</primary>
46849 <secondary>ACL for</secondary>
46850 </indexterm>
46851 <indexterm role="concept">
46852 <primary>QUIT, ACL for</primary>
46853 </indexterm>
46854 <indexterm role="concept">
46855 <primary>RCPT</primary>
46856 <secondary>ACL for</secondary>
46857 </indexterm>
46858 <indexterm role="concept">
46859 <primary>STARTTLS, ACL for</primary>
46860 </indexterm>
46861 <indexterm role="concept">
46862 <primary>VRFY</primary>
46863 <secondary>ACL for</secondary>
46864 </indexterm>
46865 <indexterm role="concept">
46866 <primary>SMTP</primary>
46867 <secondary>connection, ACL for</secondary>
46868 </indexterm>
46869 <indexterm role="concept">
46870 <primary>non-SMTP messages</primary>
46871 <secondary>ACLs for</secondary>
46872 </indexterm>
46873 <indexterm role="concept">
46874 <primary>MIME content scanning</primary>
46875 <secondary>ACL for</secondary>
46876 </indexterm>
46877 </para>
46878 <informaltable frame="none">
46879 <tgroup cols="2" colsep="0" rowsep="0">
46880 <colspec colwidth="140pt" align="left"/>
46881 <colspec colwidth="254pt" align="left"/>
46882 <tbody>
46883 <row>
46884 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
46885 <entry>ACL for non-SMTP messages</entry>
46886 </row>
46887 <row>
46888 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
46889 <entry>ACL for non-SMTP MIME parts</entry>
46890 </row>
46891 <row>
46892 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
46893 <entry>ACL at start of non-SMTP message</entry>
46894 </row>
46895 <row>
46896 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
46897 <entry>ACL for AUTH</entry>
46898 </row>
46899 <row>
46900 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
46901 <entry>ACL for start of SMTP connection</entry>
46902 </row>
46903 <row>
46904 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
46905 <entry>ACL after DATA is complete</entry>
46906 </row>
46907 <row>
46908 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
46909 <entry>ACL for ETRN</entry>
46910 </row>
46911 <row>
46912 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
46913 <entry>ACL for EXPN</entry>
46914 </row>
46915 <row>
46916 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
46917 <entry>ACL for HELO or EHLO</entry>
46918 </row>
46919 <row>
46920 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
46921 <entry>ACL for MAIL</entry>
46922 </row>
46923 <row>
46924 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
46925 <entry>ACL for the AUTH parameter of MAIL</entry>
46926 </row>
46927 <row>
46928 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
46929 <entry>ACL for content-scanning MIME parts</entry>
46930 </row>
46931 <row>
46932 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
46933 <entry>ACL at start of DATA command</entry>
46934 </row>
46935 <row>
46936 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
46937 <entry>ACL for QUIT</entry>
46938 </row>
46939 <row>
46940 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
46941 <entry>ACL for RCPT</entry>
46942 </row>
46943 <row>
46944 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
46945 <entry>ACL for STARTTLS</entry>
46946 </row>
46947 <row>
46948 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
46949 <entry>ACL for VRFY</entry>
46950 </row>
46951 </tbody>
46952 </tgroup>
46953 </informaltable>
46954 <para>
46955 For example, if you set
46956 </para>
46957 <literallayout class="monospaced">
46958 acl_smtp_rcpt = small_acl
46959 </literallayout>
46960 <para>
46961 the little ACL defined above is used whenever Exim receives a RCPT command
46962 in an SMTP dialogue. The majority of policy tests on incoming messages can be
46963 done when RCPT commands arrive. A rejection of RCPT should cause the
46964 sending MTA to give up on the recipient address contained in the RCPT
46965 command, whereas rejection at other times may cause the client MTA to keep on
46966 trying to deliver the message. It is therefore recommended that you do as much
46967 testing as possible at RCPT time.
46968 </para>
46969 </section>
46970 <section id="SECID190">
46971 <title>The non-SMTP ACLs</title>
46972 <para>
46973 <indexterm role="concept">
46974 <primary>non-SMTP messages</primary>
46975 <secondary>ACLs for</secondary>
46976 </indexterm>
46977 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
46978 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
46979 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
46980 the state of the SMTP connection such as encryption and authentication) are not
46981 relevant and are forbidden in these ACLs. However, the sender and recipients
46982 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
46983 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
46984 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
46985 in any of these ACLs.
46986 </para>
46987 <para>
46988 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
46989 non-SMTP message, before any of the message has been read. (This is the
46990 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) <phrase revisionflag="changed">In the case of
46991 batched SMTP input, it runs after the DATA command has been reached.</phrase> The
46992 result of this ACL is ignored; it cannot be used to reject a message. If you
46993 really need to, you could set a value in an ACL variable here and reject based
46994 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
46995 controls, and in particular, it can be used to set
46996 </para>
46997 <literallayout class="monospaced">
46998 control = suppress_local_fixups
46999 </literallayout>
47000 <para>
47001 This cannot be used in the other non-SMTP ACLs because by the time they are
47002 run, it is too late.
47003 </para>
47004 <para>
47005 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
47006 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47007 </para>
47008 <para>
47009 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
47010 kind of rejection is treated as permanent, because there is no way of sending a
47011 temporary error for these kinds of message.
47012 </para>
47013 </section>
47014 <section id="SECID191">
47015 <title>The SMTP connect ACL</title>
47016 <para>
47017 <indexterm role="concept">
47018 <primary>SMTP</primary>
47019 <secondary>connection, ACL for</secondary>
47020 </indexterm>
47021 <indexterm role="option">
47022 <primary><option>smtp_banner</option></primary>
47023 </indexterm>
47024 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
47025 session, after the test specified by <option>host_reject_connection</option> (which is now
47026 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
47027 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
47028 the message override the banner message that is otherwise specified by the
47029 <option>smtp_banner</option> option.
47030 </para>
47031 </section>
47032 <section id="SECID192">
47033 <title>The EHLO/HELO ACL</title>
47034 <para>
47035 <indexterm role="concept">
47036 <primary>EHLO</primary>
47037 <secondary>ACL for</secondary>
47038 </indexterm>
47039 <indexterm role="concept">
47040 <primary>HELO</primary>
47041 <secondary>ACL for</secondary>
47042 </indexterm>
47043 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
47044 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
47045 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
47046 Note that a client may issue more than one EHLO or HELO command in an SMTP
47047 session, and indeed is required to issue a new EHLO or HELO after successfully
47048 setting up encryption following a STARTTLS command.
47049 </para>
47050 <para>
47051 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
47052 modifier, the message may not contain more than one line (it will be truncated
47053 at the first newline and a panic logged if it does). Such a message cannot
47054 affect the EHLO options that are listed on the second and subsequent lines of
47055 an EHLO response.
47056 </para>
47057 </section>
47058 <section id="SECID193">
47059 <title>The DATA ACLs</title>
47060 <para>
47061 <indexterm role="concept">
47062 <primary>DATA</primary>
47063 <secondary>ACLs for</secondary>
47064 </indexterm>
47065 Two ACLs are associated with the DATA command, because it is two-stage
47066 command, with two responses being sent to the client.
47067 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
47068 is obeyed. This gives you control after all the RCPT commands, but before
47069 the message itself is received. It offers the opportunity to give a negative
47070 response to the DATA command before the data is transmitted. Header lines
47071 added by MAIL or RCPT ACLs are not visible at this time, but any that
47072 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
47073 </para>
47074 <para>
47075 You cannot test the contents of the message, for example, to verify addresses
47076 in the headers, at RCPT time or when the DATA command is received. Such
47077 tests have to appear in the ACL that is run after the message itself has been
47078 received, before the final response to the DATA command is sent. This is
47079 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
47080 associated with the DATA command.
47081 </para>
47082 <para>
47083 For both of these ACLs, it is not possible to reject individual recipients. An
47084 error response rejects the entire message. Unfortunately, it is known that some
47085 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
47086 before or after the data) correctly &ndash; they keep the message on their queues
47087 and try again later, but that is their problem, though it does waste some of
47088 your resources.
47089 </para>
47090 </section>
47091 <section id="SECID194">
47092 <title>The SMTP MIME ACL</title>
47093 <para>
47094 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
47095 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47096 </para>
47097 </section>
47098 <section id="SECTQUITACL">
47099 <title>The QUIT ACL</title>
47100 <para>
47101 <indexterm role="concept">
47102 <primary>QUIT, ACL for</primary>
47103 </indexterm>
47104 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
47105 does not affect the response code to QUIT, which is always 221. Thus, the ACL
47106 does not in fact control any access. For this reason, the only verbs that are
47107 permitted are <option>accept</option> and <option>warn</option>.
47108 </para>
47109 <para>
47110 This ACL can be used for tasks such as custom logging at the end of an SMTP
47111 session. For example, you can use ACL variables in other ACLs to count
47112 messages, recipients, etc., and log the totals at QUIT time using one or
47113 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
47114 </para>
47115 <para>
47116 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
47117 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
47118 </para>
47119 <para>
47120 You do not need to have a final <option>accept</option>, but if you do, you can use a
47121 <option>message</option> modifier to specify custom text that is sent as part of the 221
47122 response to QUIT.
47123 </para>
47124 <para>
47125 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
47126 failure (for example, failure to open a log file, or when Exim is bombing out
47127 because it has detected an unrecoverable error), all SMTP commands from the
47128 client are given temporary error responses until QUIT is received or the
47129 connection is closed. In these special cases, the QUIT ACL does not run.
47130 </para>
47131 </section>
47132 <section id="SECID195">
47133 <title>Finding an ACL to use</title>
47134 <para>
47135 <indexterm role="concept">
47136 <primary>access control lists (ACLs)</primary>
47137 <secondary>finding which to use</secondary>
47138 </indexterm>
47139 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
47140 you can use different ACLs in different circumstances. For example,
47141 </para>
47142 <literallayout class="monospaced">
47143 acl_smtp_rcpt = ${if ={25}{$interface_port} \
47144                      {acl_check_rcpt} {acl_check_rcpt_submit} }
47145 </literallayout>
47146 <para>
47147 In the default configuration file there are some example settings for
47148 providing an RFC 4409 message submission service on port 587 and a
47149 non-standard <quote>smtps</quote> service on port 465. You can use a string
47150 expansion like this to choose an ACL for MUAs on these ports which is
47151 more appropriate for this purpose than the default ACL on port 25.
47152 </para>
47153 <para>
47154 The expanded string does not have to be the name of an ACL in the
47155 configuration file; there are other possibilities. Having expanded the
47156 string, Exim searches for an ACL as follows:
47157 </para>
47158 <itemizedlist>
47159 <listitem>
47160 <para>
47161 If the string begins with a slash, Exim uses it as a file name, and reads its
47162 contents as an ACL. The lines are processed in the same way as lines in the
47163 Exim configuration file. In particular, continuation lines are supported, blank
47164 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
47165 If the file does not exist or cannot be read, an error occurs (typically
47166 causing a temporary failure of whatever caused the ACL to be run). For example:
47167 </para>
47168 <literallayout class="monospaced">
47169 acl_smtp_data = /etc/acls/\
47170   ${lookup{$sender_host_address}lsearch\
47171   {/etc/acllist}{$value}{default}}
47172 </literallayout>
47173 <para>
47174 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
47175 back to a default if the lookup fails. If an ACL is successfully read from a
47176 file, it is retained in memory for the duration of the Exim process, so that it
47177 can be re-used without having to re-read the file.
47178 </para>
47179 </listitem>
47180 <listitem>
47181 <para>
47182 If the string does not start with a slash, and does not contain any spaces,
47183 Exim searches the ACL section of the configuration for an ACL whose name
47184 matches the string.
47185 </para>
47186 </listitem>
47187 <listitem>
47188 <para>
47189 If no named ACL is found, or if the string contains spaces, Exim parses
47190 the string as an inline ACL. This can save typing in cases where you just
47191 want to have something like
47192 </para>
47193 <literallayout class="monospaced">
47194 acl_smtp_vrfy = accept
47195 </literallayout>
47196 <para>
47197 in order to allow free use of the VRFY command. Such a string may contain
47198 newlines; it is processed in the same way as an ACL that is read from a file.
47199 </para>
47200 </listitem>
47201 </itemizedlist>
47202 </section>
47203 <section id="SECID196">
47204 <title>ACL return codes</title>
47205 <para>
47206 <indexterm role="concept">
47207 <primary>access control lists (ACLs)</primary>
47208 <secondary>return codes</secondary>
47209 </indexterm>
47210 Except for the QUIT ACL, which does not affect the SMTP return code (see
47211 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
47212 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
47213 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
47214 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
47215 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
47216 This also causes a 4<emphasis>xx</emphasis> return code.
47217 </para>
47218 <para>
47219 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
47220 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
47221 submitters of non-SMTP messages.
47222 </para>
47223 <para>
47224 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
47225 has the effect of <quote>accept</quote>, but causes either the entire message or an
47226 individual recipient address to be discarded. In other words, it is a
47227 blackholing facility. Use it with care.
47228 </para>
47229 <para>
47230 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
47231 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
47232 RCPT ACL is to discard just the one recipient address. If there are no
47233 recipients left when the message&#x2019;s data is received, the DATA ACL is not
47234 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
47235 remaining recipients. The <quote>discard</quote> return is not permitted for the
47236 <option>acl_smtp_predata</option> ACL.
47237 </para>
47238 <para>
47239 <indexterm role="concept">
47240 <primary><function>local_scan()</function> function</primary>
47241 <secondary>when all recipients discarded</secondary>
47242 </indexterm>
47243 The <function>local_scan()</function> function is always run, even if there are no remaining
47244 recipients; it may create new recipients.
47245 </para>
47246 </section>
47247 <section id="SECID197">
47248 <title>Unset ACL options</title>
47249 <para>
47250 <indexterm role="concept">
47251 <primary>access control lists (ACLs)</primary>
47252 <secondary>unset options</secondary>
47253 </indexterm>
47254 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
47255 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
47256 not defined at all. For any defined ACL, the default action when control
47257 reaches the end of the ACL statements is <quote>deny</quote>.
47258 </para>
47259 <para>
47260 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
47261 these two are ACLs that are used only for their side effects. They cannot be
47262 used to accept or reject anything.
47263 </para>
47264 <para>
47265 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
47266 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
47267 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
47268 when the ACL is not defined is <quote>accept</quote>.
47269 </para>
47270 <para>
47271 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
47272 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
47273 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
47274 messages over an SMTP connection. For an example, see the ACL in the default
47275 configuration file.
47276 </para>
47277 </section>
47278 <section id="SECID198">
47279 <title>Data for message ACLs</title>
47280 <para>
47281 <indexterm role="concept">
47282 <primary>access control lists (ACLs)</primary>
47283 <secondary>data for message ACL</secondary>
47284 </indexterm>
47285 <indexterm role="variable">
47286 <primary><varname>$domain</varname></primary>
47287 </indexterm>
47288 <indexterm role="variable">
47289 <primary><varname>$local_part</varname></primary>
47290 </indexterm>
47291 <indexterm role="variable">
47292 <primary><varname>$sender_address</varname></primary>
47293 </indexterm>
47294 <indexterm role="variable">
47295 <primary><varname>$sender_host_address</varname></primary>
47296 </indexterm>
47297 <indexterm role="variable">
47298 <primary><varname>$smtp_command</varname></primary>
47299 </indexterm>
47300 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
47301 that contain information about the host and the message&#x2019;s sender (for example,
47302 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
47303 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
47304 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
47305 is available in <varname>$smtp_command</varname>.
47306 </para>
47307 <para>
47308 When an ACL for the AUTH parameter of MAIL is running, the variables that
47309 contain information about the host are set, but <varname>$sender_address</varname> is not yet
47310 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
47311 how it is used.
47312 </para>
47313 <para>
47314 <indexterm role="variable">
47315 <primary><varname>$message_size</varname></primary>
47316 </indexterm>
47317 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
47318 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
47319 that parameter is not given. The value is updated to the true message size by
47320 the time the final DATA ACL is run (after the message data has been
47321 received).
47322 </para>
47323 <para>
47324 <indexterm role="variable">
47325 <primary><varname>$rcpt_count</varname></primary>
47326 </indexterm>
47327 <indexterm role="variable">
47328 <primary><varname>$recipients_count</varname></primary>
47329 </indexterm>
47330 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
47331 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
47332 accepted, so while an ACL for RCPT is being processed, it contains the number
47333 of previously accepted recipients. At DATA time (for both the DATA ACLs),
47334 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
47335 <varname>$recipients_count</varname> contains the total number of accepted recipients.
47336 </para>
47337 </section>
47338 <section id="SECTdatfornon">
47339 <title>Data for non-message ACLs</title>
47340 <para>
47341 <indexterm role="concept">
47342 <primary>access control lists (ACLs)</primary>
47343 <secondary>data for non-message ACL</secondary>
47344 </indexterm>
47345 <indexterm role="variable">
47346 <primary><varname>$smtp_command_argument</varname></primary>
47347 </indexterm>
47348 <indexterm role="variable">
47349 <primary><varname>$smtp_command</varname></primary>
47350 </indexterm>
47351 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
47352 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
47353 and the entire SMTP command is available in <varname>$smtp_command</varname>.
47354 These variables can be tested using a <option>condition</option> condition. For example,
47355 here is an ACL for use with AUTH, which insists that either the session is
47356 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
47357 does not permit authentication methods that use cleartext passwords on
47358 unencrypted connections.
47359 </para>
47360 <literallayout class="monospaced">
47361 acl_check_auth:
47362   accept encrypted = *
47363   accept condition = ${if eq{${uc:$smtp_command_argument}}\
47364                      {CRAM-MD5}}
47365   deny   message   = TLS encryption or CRAM-MD5 required
47366 </literallayout>
47367 <para>
47368 (Another way of applying this restriction is to arrange for the authenticators
47369 that use cleartext passwords not to be advertised when the connection is not
47370 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
47371 option to do this.)
47372 </para>
47373 </section>
47374 <section id="SECID199">
47375 <title>Format of an ACL</title>
47376 <para>
47377 <indexterm role="concept">
47378 <primary>access control lists (ACLs)</primary>
47379 <secondary>format of</secondary>
47380 </indexterm>
47381 <indexterm role="concept">
47382 <primary>access control lists (ACLs)</primary>
47383 <secondary>verbs, definition of</secondary>
47384 </indexterm>
47385 An individual ACL consists of a number of statements. Each statement starts
47386 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
47387 Modifiers can change the way the verb operates, define error and log messages,
47388 set variables, insert delays, and vary the processing of accepted messages.
47389 </para>
47390 <para>
47391 If all the conditions are met, the verb is obeyed. The same condition may be
47392 used (with different arguments) more than once in the same statement. This
47393 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
47394 example:
47395 </para>
47396 <literallayout class="monospaced">
47397 deny  dnslists = list1.example
47398 dnslists = list2.example
47399 </literallayout>
47400 <para>
47401 If there are no conditions, the verb is always obeyed. Exim stops evaluating
47402 the conditions and modifiers when it reaches a condition that fails. What
47403 happens then depends on the verb (and in one case, on a special modifier). Not
47404 all the conditions make sense at every testing point. For example, you cannot
47405 test a sender address in the ACL that is run for a VRFY command.
47406 </para>
47407 </section>
47408 <section id="SECID200">
47409 <title>ACL verbs</title>
47410 <para>
47411 The ACL verbs are as follows:
47412 </para>
47413 <itemizedlist>
47414 <listitem>
47415 <para>
47416 <indexterm role="concept">
47417 <primary><option>accept</option> ACL verb</primary>
47418 </indexterm>
47419 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
47420 of the conditions are not met, what happens depends on whether <option>endpass</option>
47421 appears among the conditions (for syntax see below). If the failing condition
47422 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
47423 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
47424 check a RCPT command:
47425 </para>
47426 <literallayout class="monospaced">
47427 accept domains = +local_domains
47428 endpass
47429 verify = recipient
47430 </literallayout>
47431 <para>
47432 If the recipient domain does not match the <option>domains</option> condition, control
47433 passes to the next statement. If it does match, the recipient is verified, and
47434 the command is accepted if verification succeeds. However, if verification
47435 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
47436 <option>endpass</option>.
47437 </para>
47438 <para>
47439 The <option>endpass</option> feature has turned out to be confusing to many people, so its
47440 use is not recommended nowadays. It is always possible to rewrite an ACL so
47441 that <option>endpass</option> is not needed, and it is no longer used in the default
47442 configuration.
47443 </para>
47444 <para>
47445 <indexterm role="concept">
47446 <primary><option>message</option> ACL modifier</primary>
47447 <secondary>with <option>accept</option></secondary>
47448 </indexterm>
47449 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
47450 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
47451 (when an <option>accept</option> verb either accepts or passes control to the next
47452 statement), <option>message</option> can be used to vary the message that is sent when an
47453 SMTP command is accepted. For example, in a RCPT ACL you could have:
47454 </para>
47455 <literallayout>
47456 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
47457 <literal>        message = OK, I'll allow you through today</literal>
47458 </literallayout>
47459 <para>
47460 You can specify an SMTP response code, optionally followed by an <quote>extended
47461 response code</quote> at the start of the message, but the first digit must be the
47462 same as would be sent by default, which is 2 for an <option>accept</option> verb.
47463 </para>
47464 <para>
47465 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
47466 an error message that is used when access is denied. This behaviour is retained
47467 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
47468 of <option>endpass</option>.
47469 </para>
47470 </listitem>
47471 <listitem>
47472 <para>
47473 <indexterm role="concept">
47474 <primary><option>defer</option> ACL verb</primary>
47475 </indexterm>
47476 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
47477 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
47478 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
47479 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
47480 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
47481 be used in any ACL, and even for a recipient it might be a simpler approach.
47482 </para>
47483 </listitem>
47484 <listitem>
47485 <para>
47486 <indexterm role="concept">
47487 <primary><option>deny</option> ACL verb</primary>
47488 </indexterm>
47489 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
47490 the conditions are not met, control is passed to the next ACL statement. For
47491 example,
47492 </para>
47493 <literallayout class="monospaced">
47494 deny dnslists = blackholes.mail-abuse.org
47495 </literallayout>
47496 <para>
47497 rejects commands from hosts that are on a DNS black list.
47498 </para>
47499 </listitem>
47500 <listitem>
47501 <para>
47502 <indexterm role="concept">
47503 <primary><option>discard</option> ACL verb</primary>
47504 </indexterm>
47505 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
47506 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
47507 that are concerned with receiving messages. When all the conditions are true,
47508 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
47509 recipients to be discarded. If it is used in an ACL for RCPT, just the one
47510 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
47511 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
47512 do not appear in the log line when the <option>log_recipients</option> log selector is set.
47513 </para>
47514 <para>
47515 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
47516 its contents are added to the line that is automatically written to the log.
47517 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
47518 </para>
47519 </listitem>
47520 <listitem>
47521 <para>
47522 <indexterm role="concept">
47523 <primary><option>drop</option> ACL verb</primary>
47524 </indexterm>
47525 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
47526 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
47527 </para>
47528 <literallayout class="monospaced">
47529 drop   message   = I don't take more than 20 RCPTs
47530        condition = ${if &gt; {$rcpt_count}{20}}
47531 </literallayout>
47532 <para>
47533 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
47534 The connection is always dropped after sending a 550 response.
47535 </para>
47536 </listitem>
47537 <listitem>
47538 <para>
47539 <indexterm role="concept">
47540 <primary><option>require</option> ACL verb</primary>
47541 </indexterm>
47542 <option>require</option>: If all the conditions are met, control is passed to the next ACL
47543 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
47544 example, when checking a RCPT command,
47545 </para>
47546 <literallayout class="monospaced">
47547 <phrase revisionflag="changed">require message = Sender did not verify
47548         verify  = sender
47549 </phrase></literallayout>
47550 <para>
47551 passes control to subsequent statements only if the message&#x2019;s sender can be
47552 verified. Otherwise, it rejects the command. <phrase revisionflag="changed">Note the positioning of the
47553 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
47554 discussed in section <xref linkend="SECTcondmodproc"/>.</phrase>
47555 </para>
47556 </listitem>
47557 <listitem>
47558 <para>
47559 <indexterm role="concept">
47560 <primary><option>warn</option> ACL verb</primary>
47561 </indexterm>
47562 <option>warn</option>: If all the conditions are true, a line specified by the
47563 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
47564 to the next ACL statement. If any condition is false, the log line is not
47565 written. If an identical log line is requested several times in the same
47566 message, only one copy is actually written to the log. If you want to force
47567 duplicates to be written, use the <option>logwrite</option> modifier instead.
47568 </para>
47569 <para>
47570 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
47571 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
47572 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
47573 condition. There is more about adding header lines in section
47574 <xref linkend="SECTaddheadacl"/>.
47575 </para>
47576 <para>
47577 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
47578 some sort of defer), the log line specified by <option>log_message</option> is not written.
47579 This does not include the case of a forced failure from a lookup, which
47580 is considered to be a successful completion. After a defer, no further
47581 conditions or modifiers in the <option>warn</option> statement are processed. The incident
47582 is logged, and the ACL continues to be processed, from the next statement
47583 onwards.
47584 </para>
47585 <para>
47586 <indexterm role="variable">
47587 <primary><varname>$acl_verify_message</varname></primary>
47588 </indexterm>
47589 When one of the <option>warn</option> conditions is an address verification that fails, the
47590 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
47591 want this logged, you must set it up explicitly. For example:
47592 </para>
47593 <literallayout class="monospaced">
47594 warn   !verify = sender
47595        log_message = sender verify failed: $acl_verify_message
47596 </literallayout>
47597 </listitem>
47598 </itemizedlist>
47599 <para>
47600 At the end of each ACL there is an implicit unconditional <option>deny</option>.
47601 </para>
47602 <para>
47603 As you can see from the examples above, the conditions and modifiers are
47604 written one to a line, with the first one on the same line as the verb, and
47605 subsequent ones on following lines. If you have a very long condition, you can
47606 continue it onto several physical lines by the usual backslash continuation
47607 mechanism. It is conventional to align the conditions vertically.
47608 </para>
47609 </section>
47610 <section id="SECTaclvariables">
47611 <title>ACL variables</title>
47612 <para>
47613 <indexterm role="concept">
47614 <primary>access control lists (ACLs)</primary>
47615 <secondary>variables</secondary>
47616 </indexterm>
47617 There are some special variables that can be set during ACL processing. They
47618 can be used to pass information between different ACLs, different invocations
47619 of the same ACL in the same SMTP connection, and between ACLs and the routers,
47620 transports, and filters that are used to deliver a message. The names of these
47621 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
47622 an underscore, but the remainder of the name can be any sequence of
47623 alphanumeric characters and underscores that you choose. There is no limit on
47624 the number of ACL variables. The two sets act as follows:
47625 </para>
47626 <itemizedlist>
47627 <listitem>
47628 <para>
47629 The values of those variables whose names begin with <varname>$acl_c</varname> persist
47630 throughout an SMTP connection. They are never reset. Thus, a value that is set
47631 while receiving one message is still available when receiving the next message
47632 on the same SMTP connection.
47633 </para>
47634 </listitem>
47635 <listitem>
47636 <para>
47637 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
47638 while a message is being received. They are reset afterwards. They are also
47639 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
47640 </para>
47641 </listitem>
47642 </itemizedlist>
47643 <para>
47644 When a message is accepted, the current values of all the ACL variables are
47645 preserved with the message and are subsequently made available at delivery
47646 time. The ACL variables are set by a modifier called <option>set</option>. For example:
47647 </para>
47648 <literallayout class="monospaced">
47649 accept hosts = whatever
47650        set acl_m4 = some value
47651 accept authenticated = *
47652        set acl_c_auth = yes
47653 </literallayout>
47654 <para>
47655 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
47656 be set. If you want to set a variable without taking any action, you can use a
47657 <option>warn</option> verb without any other modifiers or conditions.
47658 </para>
47659 <para>
47660 <indexterm role="option">
47661 <primary><option>strict_acl_vars</option></primary>
47662 </indexterm>
47663 What happens if a syntactically valid but undefined ACL variable is
47664 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
47665 false (the default), an empty string is substituted; if it is true, an
47666 error is generated.
47667 </para>
47668 <para>
47669 Versions of Exim before 4.64 have a limited set of numbered variables, but
47670 their names are compatible, so there is no problem with upgrading.
47671 </para>
47672 </section>
47673 <section id="SECTcondmodproc">
47674 <title>Condition and modifier processing</title>
47675 <para>
47676 <indexterm role="concept">
47677 <primary>access control lists (ACLs)</primary>
47678 <secondary>conditions; processing</secondary>
47679 </indexterm>
47680 <indexterm role="concept">
47681 <primary>access control lists (ACLs)</primary>
47682 <secondary>modifiers; processing</secondary>
47683 </indexterm>
47684 An exclamation mark preceding a condition negates its result. For example:
47685 </para>
47686 <literallayout class="monospaced">
47687 deny   domains = *.dom.example
47688       !verify  = recipient
47689 </literallayout>
47690 <para>
47691 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
47692 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
47693 negation can be used on the right-hand side of a condition. For example, these
47694 two statements are equivalent:
47695 </para>
47696 <literallayout class="monospaced">
47697 deny  hosts = !192.168.3.4
47698 deny !hosts =  192.168.3.4
47699 </literallayout>
47700 <para>
47701 However, for many conditions (<option>verify</option> being a good example), only left-hand
47702 side negation of the whole condition is possible.
47703 </para>
47704 <para>
47705 The arguments of conditions and modifiers are expanded. A forced failure
47706 of an expansion causes a condition to be ignored, that is, it behaves as if the
47707 condition is true. Consider these two statements:
47708 </para>
47709 <literallayout class="monospaced">
47710 accept  senders = ${lookup{$host_name}lsearch\
47711                   {/some/file}{$value}fail}
47712 accept  senders = ${lookup{$host_name}lsearch\
47713                   {/some/file}{$value}{}}
47714 </literallayout>
47715 <para>
47716 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
47717 the returned list is searched, but if the lookup fails the behaviour is
47718 different in the two cases. The <option>fail</option> in the first statement causes the
47719 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
47720 therefore succeeds. The second statement, however, generates an empty list when
47721 the lookup fails. No sender can match an empty list, so the condition fails,
47722 and therefore the <option>accept</option> also fails.
47723 </para>
47724 <para>
47725 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
47726 specify actions that are taken as the conditions for a statement are checked;
47727 others specify text for messages that are used when access is denied or a
47728 warning is generated. The <option>control</option> modifier affects the way an incoming
47729 message is handled.
47730 </para>
47731 <para>
47732 The positioning of the modifiers in an ACL statement important, because the
47733 processing of a verb ceases as soon as its outcome is known. Only those
47734 modifiers that have already been encountered will take effect. For example,
47735 consider this use of the <option>message</option> modifier:
47736 </para>
47737 <literallayout class="monospaced">
47738 require message = Can't verify sender
47739         verify  = sender
47740         message = Can't verify recipient
47741         verify  = recipient
47742         message = This message cannot be used
47743 </literallayout>
47744 <para>
47745 If sender verification fails, Exim knows that the result of the statement is
47746 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
47747 so its text is used as the error message. If sender verification succeeds, but
47748 recipient verification fails, the second message is used. If recipient
47749 verification succeeds, the third message becomes <quote>current</quote>, but is never used
47750 because there are no more conditions to cause failure.
47751 </para>
47752 <para>
47753 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
47754 modifier that is used, because all the conditions must be true for rejection to
47755 happen. Specifying more than one <option>message</option> modifier does not make sense, and
47756 the message can even be specified after all the conditions. For example:
47757 </para>
47758 <literallayout class="monospaced">
47759 deny   hosts = ...
47760       !senders = *@my.domain.example
47761        message = Invalid sender from client host
47762 </literallayout>
47763 <para>
47764 The <quote>deny</quote> result does not happen until the end of the statement is reached,
47765 by which time Exim has set up the message.
47766 </para>
47767 </section>
47768 <section id="SECTACLmodi">
47769 <title>ACL modifiers</title>
47770 <para>
47771 <indexterm role="concept">
47772 <primary>access control lists (ACLs)</primary>
47773 <secondary>modifiers; list of</secondary>
47774 </indexterm>
47775 The ACL modifiers are as follows:
47776 </para>
47777 <variablelist>
47778 <varlistentry>
47779 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47780 <listitem>
47781 <para>
47782 This modifier specifies one or more header lines that are to be added to an
47783 incoming message, assuming, of course, that the message is ultimately
47784 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
47785 </para>
47786 </listitem></varlistentry>
47787 <varlistentry revisionflag="changed">
47788 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47789 <listitem>
47790 <para revisionflag="changed">
47791 <indexterm role="concept">
47792 <primary><option>continue</option> ACL modifier</primary>
47793 </indexterm>
47794 <indexterm role="concept">
47795 <primary>database</primary>
47796 <secondary>updating in ACL</secondary>
47797 </indexterm>
47798 This modifier does nothing of itself, and processing of the ACL always
47799 continues with the next condition or modifier. The value of <option>continue</option> is in
47800 the side effects of expanding its argument. Typically this could be used to
47801 update a database. It is really just a syntactic tidiness, to avoid having to
47802 write rather ugly lines like this:
47803 </para>
47804 <literallayout revisionflag="changed">
47805 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
47806 </literallayout>
47807 <para revisionflag="changed">
47808 Instead, all you need is
47809 </para>
47810 <literallayout revisionflag="changed">
47811 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
47812 </literallayout>
47813 </listitem></varlistentry>
47814 <varlistentry>
47815 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47816 <listitem>
47817 <para>
47818 <indexterm role="concept">
47819 <primary><option>control</option> ACL modifier</primary>
47820 </indexterm>
47821 This modifier affects the subsequent processing of the SMTP connection or of an
47822 incoming message that is accepted. The effect of the first type of control
47823 lasts for the duration of the connection, whereas the effect of the second type
47824 lasts only until the current message has been received. The message-specific
47825 controls always apply to the whole message, not to individual recipients,
47826 even if the <option>control</option> modifier appears in a RCPT ACL.
47827 </para>
47828 <para>
47829 As there are now quite a few controls that can be applied, they are described
47830 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
47831 in several different ways. For example:
47832 </para>
47833 <itemizedlist>
47834 <listitem>
47835 <para>
47836 It can be at the end of an <option>accept</option> statement:
47837 </para>
47838 <literallayout class="monospaced">
47839     accept  ...some conditions
47840             control = queue_only
47841 </literallayout>
47842 <para>
47843 In this case, the control is applied when this statement yields <quote>accept</quote>, in
47844 other words, when the conditions are all true.
47845 </para>
47846 </listitem>
47847 <listitem>
47848 <para>
47849 It can be in the middle of an <option>accept</option> statement:
47850 </para>
47851 <literallayout class="monospaced">
47852     accept  ...some conditions...
47853             control = queue_only
47854             ...some more conditions...
47855 </literallayout>
47856 <para>
47857 If the first set of conditions are true, the control is applied, even if the
47858 statement does not accept because one of the second set of conditions is false.
47859 In this case, some subsequent statement must yield <quote>accept</quote> for the control
47860 to be relevant.
47861 </para>
47862 </listitem>
47863 <listitem>
47864 <para>
47865 It can be used with <option>warn</option> to apply the control, leaving the
47866 decision about accepting or denying to a subsequent verb. For
47867 example:
47868 </para>
47869 <literallayout class="monospaced">
47870     warn    ...some conditions...
47871             control = freeze
47872     accept  ...
47873 </literallayout>
47874 <para>
47875 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
47876 <option>logwrite</option>, so it does not add anything to the message and does not write a
47877 log entry.
47878 </para>
47879 </listitem>
47880 <listitem>
47881 <para>
47882 If you want to apply a control unconditionally, you can use it with a
47883 <option>require</option> verb. For example:
47884 </para>
47885 <literallayout class="monospaced">
47886     require  control = no_multiline_response
47887 </literallayout>
47888 </listitem>
47889 </itemizedlist>
47890 </listitem></varlistentry>
47891 <varlistentry>
47892 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
47893 <listitem>
47894 <para>
47895 <indexterm role="concept">
47896 <primary><option>delay</option> ACL modifier</primary>
47897 </indexterm>
47898 <indexterm role="option">
47899 <primary><option>-bh</option></primary>
47900 </indexterm>
47901 </para>
47902 <para revisionflag="changed">
47903 This modifier may appear in any ACL. It causes Exim to wait for the time
47904 interval before proceeding. However, when testing Exim using the <option>-bh</option>
47905 option, the delay is not actually imposed (an appropriate message is output
47906 instead). The time is given in the usual Exim notation, and the delay happens
47907 as soon as the modifier is processed. In an SMTP session, pending output is
47908 flushed before the delay is imposed.
47909 </para>
47910 <para>
47911 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
47912 example:
47913 </para>
47914 <literallayout class="monospaced">
47915 deny    ...some conditions...
47916         delay = 30s
47917 </literallayout>
47918 <para>
47919 The delay happens if all the conditions are true, before the statement returns
47920 <quote>deny</quote>. Compare this with:
47921 </para>
47922 <literallayout class="monospaced">
47923 deny    delay = 30s
47924         ...some conditions...
47925 </literallayout>
47926 <para>
47927 which waits for 30s before processing the conditions. The <option>delay</option> modifier
47928 can also be used with <option>warn</option> and together with <option>control</option>:
47929 </para>
47930 <literallayout class="monospaced">
47931 warn    ...some conditions...
47932         delay = 2m
47933         control = freeze
47934 accept  ...
47935 </literallayout>
47936 <para revisionflag="changed">
47937 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
47938 responses to several commands are no longer buffered and sent in one packet (as
47939 they would normally be) because all output is flushed before imposing the
47940 delay. This optimization is disabled so that a number of small delays do not
47941 appear to the client as one large aggregated delay that might provoke an
47942 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
47943 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
47944 </para>
47945 </listitem></varlistentry>
47946 <varlistentry>
47947 <term><emphasis role="bold">endpass</emphasis></term>
47948 <listitem>
47949 <para>
47950 <indexterm role="concept">
47951 <primary><option>endpass</option> ACL modifier</primary>
47952 </indexterm>
47953 This modifier, which has no argument, is recognized only in <option>accept</option> and
47954 <option>discard</option> statements. It marks the boundary between the conditions whose
47955 failure causes control to pass to the next statement, and the conditions whose
47956 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
47957 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
47958 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
47959 </para>
47960 </listitem></varlistentry>
47961 <varlistentry>
47962 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47963 <listitem>
47964 <para>
47965 <indexterm role="concept">
47966 <primary><option>log_message</option> ACL modifier</primary>
47967 </indexterm>
47968 This modifier sets up a message that is used as part of the log message if the
47969 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
47970 </para>
47971 <literallayout class="monospaced">
47972 require log_message = wrong cipher suite $tls_cipher
47973         encrypted   = DES-CBC3-SHA
47974 </literallayout>
47975 <para>
47976 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
47977 example:
47978 </para>
47979 <literallayout>
47980 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
47981 <literal>        log_message = Discarded $local_part@$domain because...</literal>
47982 </literallayout>
47983 <para>
47984 When access is denied, <option>log_message</option> adds to any underlying error message
47985 that may exist because of a condition failure. For example, while verifying a
47986 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
47987 message.
47988 </para>
47989 <para>
47990 The message may be defined before the conditions to which it applies, because
47991 the string expansion does not happen until Exim decides that access is to be
47992 denied. This means that any variables that are set by the condition are
47993 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
47994 variables are set after a DNS black list lookup succeeds. If the expansion of
47995 <option>log_message</option> fails, or if the result is an empty string, the modifier is
47996 ignored.
47997 </para>
47998 <para>
47999 <indexterm role="variable">
48000 <primary><varname>$acl_verify_message</varname></primary>
48001 </indexterm>
48002 If you want to use a <option>warn</option> statement to log the result of an address
48003 verification, you can use <varname>$acl_verify_message</varname> to include the verification
48004 error message.
48005 </para>
48006 <para>
48007 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
48008 the start of the logged message. If the same warning log message is requested
48009 more than once while receiving  a single email message, only one copy is
48010 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
48011 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
48012 is logged for a successful <option>warn</option> statement.
48013 </para>
48014 <para>
48015 If <option>log_message</option> is not present and there is no underlying error message (for
48016 example, from the failure of address verification), but <option>message</option> is present,
48017 the <option>message</option> text is used for logging rejections. However, if any text for
48018 logging contains newlines, only the first line is logged. In the absence of
48019 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
48020 logging rejections.
48021 </para>
48022 </listitem></varlistentry>
48023 <varlistentry>
48024 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
48025 <listitem>
48026 <para>
48027 <indexterm role="concept">
48028 <primary><option>log_reject_target</option> ACL modifier</primary>
48029 </indexterm>
48030 <indexterm role="concept">
48031 <primary>logging in ACL</primary>
48032 <secondary>specifying which log</secondary>
48033 </indexterm>
48034 This modifier makes it possible to specify which logs are used for messages
48035 about ACL rejections. Its argument is a colon-separated list of words that can
48036 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
48037 may be empty, in which case a rejection is not logged at all. For example, this
48038 ACL fragment writes no logging information when access is denied:
48039 </para>
48040 <literallayout>
48041 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48042 <literal>     log_reject_target =</literal>
48043 </literallayout>
48044 <para>
48045 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
48046 permanent and temporary rejections.
48047 </para>
48048 </listitem></varlistentry>
48049 <varlistentry>
48050 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48051 <listitem>
48052 <para>
48053 <indexterm role="concept">
48054 <primary><option>logwrite</option> ACL modifier</primary>
48055 </indexterm>
48056 <indexterm role="concept">
48057 <primary>logging in ACL</primary>
48058 <secondary>immediate</secondary>
48059 </indexterm>
48060 This modifier writes a message to a log file as soon as it is encountered when
48061 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
48062 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
48063 access.) The <option>logwrite</option> modifier can be used to log special incidents in
48064 ACLs. For example:
48065 </para>
48066 <literallayout>
48067 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
48068 <literal>       control  = freeze</literal>
48069 <literal>       logwrite = froze message because ...</literal>
48070 </literallayout>
48071 <para>
48072 By default, the message is written to the main log. However, it may begin
48073 with a colon, followed by a comma-separated list of log names, and then
48074 another colon, to specify exactly which logs are to be written. For
48075 example:
48076 </para>
48077 <literallayout class="monospaced">
48078 logwrite = :main,reject: text for main and reject logs
48079 logwrite = :panic: text for panic log only
48080 </literallayout>
48081 </listitem></varlistentry>
48082 <varlistentry>
48083 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48084 <listitem>
48085 <para>
48086 <indexterm role="concept">
48087 <primary><option>message</option> ACL modifier</primary>
48088 </indexterm>
48089 This modifier sets up a text string that is expanded and used as a response
48090 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
48091 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
48092 there is some complication if <option>endpass</option> is involved; see the description of
48093 <option>accept</option> for details.)
48094 </para>
48095 <para>
48096 The expansion of the message happens at the time Exim decides that the ACL is
48097 to end, not at the time it processes <option>message</option>. If the expansion fails, or
48098 generates an empty string, the modifier is ignored. Here is an example where
48099 <option>message</option> must be specified first, because the ACL ends with a rejection if
48100 the <option>hosts</option> condition fails:
48101 </para>
48102 <literallayout class="monospaced">
48103 require  message = Host not recognized
48104          hosts = 10.0.0.0/8
48105 </literallayout>
48106 <para>
48107 (Once a condition has failed, no further conditions or modifiers are
48108 processed.)
48109 </para>
48110 <para>
48111 <indexterm role="concept">
48112 <primary>SMTP</primary>
48113 <secondary>error codes</secondary>
48114 </indexterm>
48115 <indexterm role="option">
48116 <primary><option>smtp_banner</option></primary>
48117 </indexterm>
48118 For ACLs that are triggered by SMTP commands, the message is returned as part
48119 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
48120 is meaningful only for SMTP, as no message is returned when a non-SMTP message
48121 is accepted. In the case of the connect ACL, accepting with a message modifier
48122 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
48123 accept message may not contain more than one line (otherwise it will be
48124 truncated at the first newline and a panic logged), and it cannot affect the
48125 EHLO options.
48126 </para>
48127 <para>
48128 When SMTP is involved, the message may begin with an overriding response code,
48129 consisting of three digits optionally followed by an <quote>extended response code</quote>
48130 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
48131 </para>
48132 <literallayout class="monospaced">
48133 deny  message = 599 1.2.3 Host not welcome
48134       hosts = 192.168.34.0/24
48135 </literallayout>
48136 <para>
48137 The first digit of the supplied response code must be the same as would be sent
48138 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
48139 access, but for the predata ACL, note that the default success code is 354, not
48140 2<emphasis>xx</emphasis>.
48141 </para>
48142 <para>
48143 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
48144 the message modifier cannot override the 221 response code.
48145 </para>
48146 <para>
48147 The text in a <option>message</option> modifier is literal; any quotes are taken as
48148 literals, but because the string is expanded, backslash escapes are processed
48149 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
48150 response.
48151 </para>
48152 <para>
48153 <indexterm role="variable">
48154 <primary><varname>$acl_verify_message</varname></primary>
48155 </indexterm>
48156 If <option>message</option> is used on a statement that verifies an address, the message
48157 specified overrides any message that is generated by the verification process.
48158 However, the original message is available in the variable
48159 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
48160 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
48161 routers to be passed back as part of the SMTP response, you should either not
48162 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
48163 </para>
48164 <para>
48165 For compatibility with previous releases of Exim, a <option>message</option> modifier that
48166 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
48167 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
48168 all the conditions are true, wherever it appears in an ACL command, whereas
48169 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
48170 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
48171 effect.
48172 </para>
48173 </listitem></varlistentry>
48174 <varlistentry>
48175 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
48176 <listitem>
48177 <para>
48178 <indexterm role="concept">
48179 <primary><option>set</option> ACL modifier</primary>
48180 </indexterm>
48181 This modifier puts a value into one of the ACL variables (see section
48182 <xref linkend="SECTaclvariables"/>).
48183 </para>
48184 </listitem></varlistentry>
48185 </variablelist>
48186 </section>
48187 <section id="SECTcontrols">
48188 <title>Use of the control modifier</title>
48189 <para>
48190 <indexterm role="concept">
48191 <primary><option>control</option> ACL modifier</primary>
48192 </indexterm>
48193 The <option>control</option> modifier supports the following settings:
48194 </para>
48195 <variablelist>
48196 <varlistentry>
48197 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
48198 <listitem>
48199 <para>
48200 This modifier allows a client host to use the SMTP AUTH command even when it
48201 has not been advertised in response to EHLO. Furthermore, because there are
48202 apparently some really broken clients that do this, Exim will accept AUTH after
48203 HELO (rather than EHLO) when this control is set. It should be used only if you
48204 really need it, and you should limit its use to those broken clients that do
48205 not work without it. For example:
48206 </para>
48207 <literallayout class="monospaced">
48208 warn hosts   = 192.168.34.25
48209      control = allow_auth_unadvertised
48210 </literallayout>
48211 <para>
48212 Normally, when an Exim server receives an AUTH command, it checks the name of
48213 the authentication mechanism that is given in the command to ensure that it
48214 matches an advertised mechanism. When this control is set, the check that a
48215 mechanism has been advertised is bypassed. Any configured mechanism can be used
48216 by the client. This control is permitted only in the connection and HELO ACLs.
48217 </para>
48218 </listitem></varlistentry>
48219 <varlistentry>
48220 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
48221 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
48222 <listitem>
48223 <para>
48224 <indexterm role="concept">
48225 <primary>access control lists (ACLs)</primary>
48226 <secondary>case of local part in</secondary>
48227 </indexterm>
48228 <indexterm role="concept">
48229 <primary>case of local parts</primary>
48230 </indexterm>
48231 <indexterm role="variable">
48232 <primary><varname>$local_part</varname></primary>
48233 </indexterm>
48234 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
48235 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
48236 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
48237 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
48238 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
48239 is encountered.
48240 </para>
48241 <para>
48242 These controls affect only the current recipient. Moreover, they apply only to
48243 local part handling that takes place directly in the ACL (for example, as a key
48244 in lookups). If a test to verify the recipient is obeyed, the case-related
48245 handling of the local part during the verification is controlled by the router
48246 configuration (see the <option>caseful_local_part</option> generic router option).
48247 </para>
48248 <para>
48249 This facility could be used, for example, to add a spam score to local parts
48250 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
48251 spam score:
48252 </para>
48253 <literallayout class="monospaced">
48254 warn  control = caseful_local_part
48255       set acl_m4 = ${eval:\
48256                      $acl_m4 + \
48257                      ${if match{$local_part}{[A-Z]}{1}{0}}\
48258                     }
48259       control = caselower_local_part
48260 </literallayout>
48261 <para>
48262 Notice that we put back the lower cased version afterwards, assuming that
48263 is what is wanted for subsequent tests.
48264 </para>
48265 </listitem></varlistentry>
48266 <varlistentry>
48267 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
48268 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
48269 <listitem>
48270 <para>
48271 <indexterm role="concept">
48272 <primary>SMTP</primary>
48273 <secondary>synchronization checking</secondary>
48274 </indexterm>
48275 <indexterm role="concept">
48276 <primary>synchronization checking in SMTP</primary>
48277 </indexterm>
48278 These controls make it possible to be selective about when SMTP synchronization
48279 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
48280 state of the switch (it is true by default). See the description of this option
48281 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
48282 </para>
48283 <para>
48284 The effect of these two controls lasts for the remainder of the SMTP
48285 connection. They can appear in any ACL except the one for the non-SMTP
48286 messages. The most straightforward place to put them is in the ACL defined by
48287 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
48288 before the first synchronization check. The expected use is to turn off the
48289 synchronization checks for badly-behaved hosts that you nevertheless need to
48290 work with.
48291 </para>
48292 </listitem></varlistentry>
48293 <varlistentry>
48294 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
48295 <listitem>
48296 <para>
48297 <indexterm role="concept">
48298 <primary>fake defer</primary>
48299 </indexterm>
48300 <indexterm role="concept">
48301 <primary>defer, fake</primary>
48302 </indexterm>
48303 This control works in exactly the same way as <option>fakereject</option> (described below)
48304 except that it causes an SMTP 450 response after the message data instead of a
48305 550 response. You must take care when using <option>fakedefer</option> because it causes the
48306 messages to be duplicated when the sender retries. Therefore, you should not
48307 use <option>fakedefer</option> if the message is to be delivered normally.
48308 </para>
48309 </listitem></varlistentry>
48310 <varlistentry>
48311 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
48312 <listitem>
48313 <para>
48314 <indexterm role="concept">
48315 <primary>fake rejection</primary>
48316 </indexterm>
48317 <indexterm role="concept">
48318 <primary>rejection, fake</primary>
48319 </indexterm>
48320 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
48321 words, only when an SMTP message is being received. If Exim accepts the
48322 message, instead the final 250 response, a 550 rejection message is sent.
48323 However, Exim proceeds to deliver the message as normal. The control applies
48324 only to the current message, not to any subsequent ones that may be received in
48325 the same SMTP connection.
48326 </para>
48327 <para>
48328 The text for the 550 response is taken from the <option>control</option> modifier. If no
48329 message is supplied, the following is used:
48330 </para>
48331 <literallayout class="monospaced">
48332 550-Your message has been rejected but is being
48333 550-kept for evaluation.
48334 550-If it was a legitimate message, it may still be
48335 550 delivered to the target recipient(s).
48336 </literallayout>
48337 <para>
48338 This facility should be used with extreme caution.
48339 </para>
48340 </listitem></varlistentry>
48341 <varlistentry>
48342 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
48343 <listitem>
48344 <para>
48345 <indexterm role="concept">
48346 <primary>frozen messages</primary>
48347 <secondary>forcing in ACL</secondary>
48348 </indexterm>
48349 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
48350 other words, only when a message is being received. If the message is accepted,
48351 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
48352 current message, not to any subsequent ones that may be received in the same
48353 SMTP connection.
48354 </para>
48355 <para>
48356 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
48357 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
48358 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
48359 are obeyed for the current message have the <literal>/no_tell</literal> option.
48360 </para>
48361 </listitem></varlistentry>
48362 <varlistentry revisionflag="changed">
48363 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
48364 <listitem>
48365 <para revisionflag="changed">
48366 <indexterm role="concept">
48367 <primary>SMTP</primary>
48368 <secondary>output flushing, disabling for delay</secondary>
48369 </indexterm>
48370 Exim normally flushes SMTP output before implementing a delay in an ACL, to
48371 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
48372 use. This control, as long as it is encountered before the <option>delay</option> modifier,
48373 disables such output flushing.
48374 </para>
48375 </listitem></varlistentry>
48376 <varlistentry revisionflag="changed">
48377 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
48378 <listitem>
48379 <para revisionflag="changed">
48380 <indexterm role="concept">
48381 <primary>SMTP</primary>
48382 <secondary>output flushing, disabling for callout</secondary>
48383 </indexterm>
48384 Exim normally flushes SMTP output before performing a callout in an ACL, to
48385 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
48386 use. This control, as long as it is encountered before the <option>verify</option> condition
48387 that causes the callout, disables such output flushing.
48388 </para>
48389 </listitem></varlistentry>
48390 <varlistentry>
48391 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
48392 <listitem>
48393 <para>
48394 This control is available when Exim is compiled with the content scanning
48395 extension. Content scanning may require a copy of the current message, or parts
48396 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
48397 or spam scanner. Normally, such copies are deleted when they are no longer
48398 needed. If this control is set, the copies are not deleted. The control applies
48399 only to the current message, not to any subsequent ones that may be received in
48400 the same SMTP connection. It is provided for debugging purposes and is unlikely
48401 to be useful in production.
48402 </para>
48403 </listitem></varlistentry>
48404 <varlistentry>
48405 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_response</emphasis></term>
48406 <listitem>
48407 <para>
48408 <indexterm role="concept">
48409 <primary>multiline responses, suppressing</primary>
48410 </indexterm>
48411 This control is permitted for any ACL except the one for non-SMTP messages.
48412 It seems that there are broken clients in use that cannot handle multiline
48413 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
48414 </para>
48415 <para>
48416 If this control is set, multiline SMTP responses from ACL rejections are
48417 suppressed. One way of doing this would have been to put out these responses as
48418 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
48419 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
48420 responses might get close to that. So this facility, which is after all only a
48421 sop to broken clients, is implemented by doing two very easy things:
48422 </para>
48423 <itemizedlist>
48424 <listitem>
48425 <para>
48426 Extra information that is normally output as part of a rejection caused by
48427 sender verification failure is omitted. Only the final line (typically <quote>sender
48428 verification failed</quote>) is sent.
48429 </para>
48430 </listitem>
48431 <listitem>
48432 <para>
48433 If a <option>message</option> modifier supplies a multiline response, only the first
48434 line is output.
48435 </para>
48436 </listitem>
48437 </itemizedlist>
48438 <para>
48439 The setting of the switch can, of course, be made conditional on the
48440 calling host. Its effect lasts until the end of the SMTP connection.
48441 </para>
48442 </listitem></varlistentry>
48443 <varlistentry revisionflag="changed">
48444 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
48445 <listitem>
48446 <para revisionflag="changed">
48447 <indexterm role="concept">
48448 <primary>PIPELINING</primary>
48449 <secondary>suppressing advertising</secondary>
48450 </indexterm>
48451 This control turns off the advertising of the PIPELINING extension to SMTP in
48452 the current session. To be useful, it must be obeyed before Exim sends its
48453 response to an EHLO command. Therefore, it should normally appear in an ACL
48454 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
48455 <option>pipelining_advertise_hosts</option>.
48456 </para>
48457 </listitem></varlistentry>
48458 <varlistentry>
48459 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
48460 <listitem>
48461 <para>
48462 <indexterm role="option">
48463 <primary><option>queue_only</option></primary>
48464 </indexterm>
48465 <indexterm role="concept">
48466 <primary>queueing incoming messages</primary>
48467 </indexterm>
48468 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
48469 other words, only when a message is being received. If the message is accepted,
48470 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
48471 runner. No immediate delivery process is started. In other words, it has the
48472 effect as the <option>queue_only</option> global option. However, the control applies only
48473 to the current message, not to any subsequent ones that may be received in the
48474 same SMTP connection.
48475 </para>
48476 </listitem></varlistentry>
48477 <varlistentry>
48478 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
48479 <listitem>
48480 <para>
48481 <indexterm role="concept">
48482 <primary>message</primary>
48483 <secondary>submission</secondary>
48484 </indexterm>
48485 <indexterm role="concept">
48486 <primary>submission mode</primary>
48487 </indexterm>
48488 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
48489 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
48490 the current message is a submission from a local MUA. In this case, Exim
48491 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
48492 necessary. For example, it add a <emphasis>Date:</emphasis> header line if one is not present.
48493 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
48494 late (the message has already been created).
48495 </para>
48496 <para>
48497 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
48498 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
48499 submission mode; the available options for this control are described there.
48500 The control applies only to the current message, not to any subsequent ones
48501 that may be received in the same SMTP connection.
48502 </para>
48503 </listitem></varlistentry>
48504 <varlistentry>
48505 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
48506 <listitem>
48507 <para>
48508 <indexterm role="concept">
48509 <primary>submission fixups, suppressing</primary>
48510 </indexterm>
48511 This control applies to locally submitted (non TCP/IP) messages, and is the
48512 complement of <literal>control</literal> <literal>=</literal> <literal>submission</literal>. It disables the fixups that are
48513 normally applied to locally-submitted messages. Specifically:
48514 </para>
48515 <itemizedlist>
48516 <listitem>
48517 <para>
48518 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
48519 dynamic version of <option>local_sender_retain</option>).
48520 </para>
48521 </listitem>
48522 <listitem>
48523 <para>
48524 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
48525 </para>
48526 </listitem>
48527 <listitem>
48528 <para>
48529 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
48530 </para>
48531 </listitem>
48532 </itemizedlist>
48533 <para>
48534 This control may be useful when a remotely-originated message is accepted,
48535 passed to some scanning program, and then re-submitted for delivery. It can be
48536 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
48537 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
48538 data is read.
48539 </para>
48540 <para revisionflag="changed">
48541 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
48542 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
48543 </para>
48544 </listitem></varlistentry>
48545 </variablelist>
48546 </section>
48547 <section id="SECTsummesfix">
48548 <title>Summary of message fixup control</title>
48549 <para>
48550 All four possibilities for message fixups can be specified:
48551 </para>
48552 <itemizedlist>
48553 <listitem>
48554 <para>
48555 Locally submitted, fixups applied: the default.
48556 </para>
48557 </listitem>
48558 <listitem>
48559 <para>
48560 Locally submitted, no fixups applied: use <literal>control</literal> <literal>=</literal>
48561 <literal>suppress_local_fixups</literal>.
48562 </para>
48563 </listitem>
48564 <listitem>
48565 <para>
48566 Remotely submitted, no fixups applied: the default.
48567 </para>
48568 </listitem>
48569 <listitem>
48570 <para>
48571 Remotely submitted, fixups applied: use <literal>control</literal> <literal>=</literal> <literal>submission</literal>.
48572 </para>
48573 </listitem>
48574 </itemizedlist>
48575 </section>
48576 <section id="SECTaddheadacl">
48577 <title>Adding header lines in ACLs</title>
48578 <para>
48579 <indexterm role="concept">
48580 <primary>header lines</primary>
48581 <secondary>adding in an ACL</secondary>
48582 </indexterm>
48583 <indexterm role="concept">
48584 <primary>header lines</primary>
48585 <secondary>position of added lines</secondary>
48586 </indexterm>
48587 <indexterm role="concept">
48588 <primary><option>message</option> ACL modifier</primary>
48589 </indexterm>
48590 The <option>add_header</option> modifier can be used to add one or more extra header lines
48591 to an incoming message, as in this example:
48592 </para>
48593 <literallayout class="monospaced">
48594 warn dnslists = sbl.spamhaus.org : \
48595                 dialup.mail-abuse.org
48596      add_header = X-blacklisted-at: $dnslist_domain
48597 </literallayout>
48598 <para>
48599 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
48600 MIME, and non-SMTP ACLs (in other words, those that are concerned with
48601 receiving a message). The message must ultimately be accepted for
48602 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
48603 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
48604 RCPT ACL).
48605 </para>
48606 <para>
48607 If the data for the <option>add_header</option> modifier contains one or more newlines that
48608 are not followed by a space or a tab, it is assumed to contain multiple header
48609 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
48610 front of any line that is not a valid header line.
48611 </para>
48612 <para>
48613 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
48614 They are added to the message before processing the DATA and MIME ACLs.
48615 However, if an identical header line is requested more than once, only one copy
48616 is actually added to the message. Further header lines may be accumulated
48617 during the DATA and MIME ACLs, after which they are added to the message, again
48618 with duplicates suppressed. Thus, it is possible to add two identical header
48619 lines to an SMTP message, but only if one is added before DATA and one after.
48620 In the case of non-SMTP messages, new headers are accumulated during the
48621 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
48622 message is rejected after DATA or by the non-SMTP ACL, all added header lines
48623 are included in the entry that is written to the reject log.
48624 </para>
48625 <para>
48626 <indexterm role="concept">
48627 <primary>header lines</primary>
48628 <secondary>added; visibility of</secondary>
48629 </indexterm>
48630 Header lines are not visible in string expansions until they are added to the
48631 message. It follows that header lines defined in the MAIL, RCPT, and predata
48632 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
48633 header lines that are added by the DATA or MIME ACLs are not visible in those
48634 ACLs. Because of this restriction, you cannot use header lines as a way of
48635 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
48636 this, you can use ACL variables, as described in section
48637 <xref linkend="SECTaclvariables"/>.
48638 </para>
48639 <para>
48640 The <option>add_header</option> modifier acts immediately it is encountered during the
48641 processing of an ACL. Notice the difference between these two cases:
48642 </para>
48643 <literallayout>
48644 <literal>accept add_header = ADDED: some text</literal>
48645 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
48646
48647 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
48648 <literal>       add_header = ADDED: some text</literal>
48649 </literallayout>
48650 <para>
48651 In the first case, the header line is always added, whether or not the
48652 condition is true. In the second case, the header line is added only if the
48653 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
48654 ACL statement. All those that are encountered before a condition fails are
48655 honoured.
48656 </para>
48657 <para>
48658 <indexterm role="concept">
48659 <primary><option>warn</option> ACL verb</primary>
48660 </indexterm>
48661 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
48662 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
48663 effect only if all the conditions are true, even if it appears before some of
48664 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
48665 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
48666 are present on a <option>warn</option> verb, both are processed according to their
48667 specifications.
48668 </para>
48669 <para>
48670 By default, new header lines are added to a message at the end of the existing
48671 header lines. However, you can specify that any particular header line should
48672 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
48673 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
48674 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
48675 </para>
48676 <para>
48677 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
48678 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
48679 header line, respectively. (Header text cannot start with a colon, as there has
48680 to be a header name first.) For example:
48681 </para>
48682 <literallayout class="monospaced">
48683 warn add_header = \
48684        :after_received:X-My-Header: something or other...
48685 </literallayout>
48686 <para>
48687 If more than one header line is supplied in a single <option>add_header</option> modifier,
48688 each one is treated independently and can therefore be placed differently. If
48689 you add more than one line at the start, or after the Received: block, they end
48690 up in reverse order.
48691 </para>
48692 <para>
48693 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
48694 added in an ACL. It does NOT work for header lines that are added in a
48695 system filter or in a router or transport.
48696 </para>
48697 </section>
48698 <section id="SECTaclconditions">
48699 <title>ACL conditions</title>
48700 <para>
48701 <indexterm role="concept">
48702 <primary>access control lists (ACLs)</primary>
48703 <secondary>conditions; list of</secondary>
48704 </indexterm>
48705 Some of conditions listed in this section are available only when Exim is
48706 compiled with the content-scanning extension. They are included here briefly
48707 for completeness. More detailed descriptions can be found in the discussion on
48708 content scanning in chapter <xref linkend="CHAPexiscan"/>.
48709 </para>
48710 <para>
48711 Not all conditions are relevant in all circumstances. For example, testing
48712 senders and recipients does not make sense in an ACL that is being run as the
48713 result of the arrival of an ETRN command, and checks on message headers can be
48714 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
48715 can use the same condition (with different parameters) more than once in the
48716 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
48717 The conditions are as follows:
48718 </para>
48719 <variablelist>
48720 <varlistentry>
48721 <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>
48722 <listitem>
48723 <para>
48724 <indexterm role="concept">
48725 <primary>access control lists (ACLs)</primary>
48726 <secondary>nested</secondary>
48727 </indexterm>
48728 <indexterm role="concept">
48729 <primary>access control lists (ACLs)</primary>
48730 <secondary>indirect</secondary>
48731 </indexterm>
48732 <indexterm role="concept">
48733 <primary><option>acl</option> ACL condition</primary>
48734 </indexterm>
48735 The possible values of the argument are the same as for the
48736 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
48737 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
48738 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
48739 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
48740 condition false. This means that further processing of the <option>warn</option> verb
48741 ceases, but processing of the ACL continues.
48742 </para>
48743 <para>
48744 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
48745 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
48746 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
48747 conditions are tested.
48748 </para>
48749 <para>
48750 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
48751 loops. This condition allows you to use different ACLs in different
48752 circumstances. For example, different ACLs can be used to handle RCPT commands
48753 for different local users or different local domains.
48754 </para>
48755 </listitem></varlistentry>
48756 <varlistentry>
48757 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
48758 <listitem>
48759 <para>
48760 <indexterm role="concept">
48761 <primary><option>authenticated</option> ACL condition</primary>
48762 </indexterm>
48763 <indexterm role="concept">
48764 <primary>authentication</primary>
48765 <secondary>ACL checking</secondary>
48766 </indexterm>
48767 <indexterm role="concept">
48768 <primary>access control lists (ACLs)</primary>
48769 <secondary>testing for authentication</secondary>
48770 </indexterm>
48771 If the SMTP connection is not authenticated, the condition is false. Otherwise,
48772 the name of the authenticator is tested against the list. To test for
48773 authentication by any authenticator, you can set
48774 </para>
48775 <literallayout class="monospaced">
48776 authenticated = *
48777 </literallayout>
48778 </listitem></varlistentry>
48779 <varlistentry>
48780 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
48781 <listitem>
48782 <para>
48783 <indexterm role="concept">
48784 <primary><option>condition</option> ACL condition</primary>
48785 </indexterm>
48786 <indexterm role="concept">
48787 <primary>customizing</primary>
48788 <secondary>ACL condition</secondary>
48789 </indexterm>
48790 <indexterm role="concept">
48791 <primary>access control lists (ACLs)</primary>
48792 <secondary>customized test</secondary>
48793 </indexterm>
48794 <indexterm role="concept">
48795 <primary>access control lists (ACLs)</primary>
48796 <secondary>testing, customized</secondary>
48797 </indexterm>
48798 This feature allows you to make up custom conditions. If the result of
48799 expanding the string is an empty string, the number zero, or one of the strings
48800 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
48801 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
48802 any other value, some error is assumed to have occurred, and the ACL returns
48803 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
48804 ignored. The effect is to treat it as true, whether it is positive or
48805 negative.
48806 </para>
48807 </listitem></varlistentry>
48808 <varlistentry>
48809 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
48810 <listitem>
48811 <para>
48812 <indexterm role="concept">
48813 <primary><option>decode</option> ACL condition</primary>
48814 </indexterm>
48815 This condition is available only when Exim is compiled with the
48816 content-scanning extension, and it is allowed only in the ACL defined by
48817 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
48818 <phrase revisionflag="changed">If all goes well, the condition is true. It is false only if there are
48819 problems such as a syntax error or a memory shortage. For more details, see
48820 chapter <xref linkend="CHAPexiscan"/>.</phrase>
48821 </para>
48822 </listitem></varlistentry>
48823 <varlistentry>
48824 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
48825 <listitem>
48826 <para>
48827 <indexterm role="concept">
48828 <primary><option>demime</option> ACL condition</primary>
48829 </indexterm>
48830 This condition is available only when Exim is compiled with the
48831 content-scanning extension. Its use is described in section
48832 <xref linkend="SECTdemimecond"/>.
48833 </para>
48834 </listitem></varlistentry>
48835 <varlistentry>
48836 <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>
48837 <listitem>
48838 <para>
48839 <indexterm role="concept">
48840 <primary><option>dnslists</option> ACL condition</primary>
48841 </indexterm>
48842 <indexterm role="concept">
48843 <primary>DNS list</primary>
48844 <secondary>in ACL</secondary>
48845 </indexterm>
48846 <indexterm role="concept">
48847 <primary>black list (DNS)</primary>
48848 </indexterm>
48849 <indexterm role="concept">
48850 <primary>access control lists (ACLs)</primary>
48851 <secondary>testing a DNS list</secondary>
48852 </indexterm>
48853 This condition checks for entries in DNS black lists. These are also known as
48854 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
48855 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
48856 different variants of this condition to describe briefly here. See sections
48857 <xref linkend="SECTmorednslists"/>--<xref linkend="SECTmorednslistslast"/> for details.
48858 </para>
48859 </listitem></varlistentry>
48860 <varlistentry>
48861 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
48862 <listitem>
48863 <para>
48864 <indexterm role="concept">
48865 <primary><option>domains</option> ACL condition</primary>
48866 </indexterm>
48867 <indexterm role="concept">
48868 <primary>domain</primary>
48869 <secondary>ACL checking</secondary>
48870 </indexterm>
48871 <indexterm role="concept">
48872 <primary>access control lists (ACLs)</primary>
48873 <secondary>testing a recipient domain</secondary>
48874 </indexterm>
48875 <indexterm role="variable">
48876 <primary><varname>$domain_data</varname></primary>
48877 </indexterm>
48878 This condition is relevant only after a RCPT command. It checks that the domain
48879 of the recipient address is in the domain list. If percent-hack processing is
48880 enabled, it is done before this test is done. If the check succeeds with a
48881 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
48882 <option>domains</option> test.
48883 </para>
48884 <para>
48885 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
48886 use <option>domains</option> in a DATA ACL.
48887 </para>
48888 </listitem></varlistentry>
48889 <varlistentry>
48890 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
48891 <listitem>
48892 <para>
48893 <indexterm role="concept">
48894 <primary><option>encrypted</option> ACL condition</primary>
48895 </indexterm>
48896 <indexterm role="concept">
48897 <primary>encryption</primary>
48898 <secondary>checking in an ACL</secondary>
48899 </indexterm>
48900 <indexterm role="concept">
48901 <primary>access control lists (ACLs)</primary>
48902 <secondary>testing for encryption</secondary>
48903 </indexterm>
48904 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
48905 name of the cipher suite in use is tested against the list. To test for
48906 encryption without testing for any specific cipher suite(s), set
48907 </para>
48908 <literallayout class="monospaced">
48909 encrypted = *
48910 </literallayout>
48911 </listitem></varlistentry>
48912 <varlistentry>
48913 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
48914 <listitem>
48915 <para>
48916 <indexterm role="concept">
48917 <primary><option>hosts</option> ACL condition</primary>
48918 </indexterm>
48919 <indexterm role="concept">
48920 <primary>host</primary>
48921 <secondary>ACL checking</secondary>
48922 </indexterm>
48923 <indexterm role="concept">
48924 <primary>access control lists (ACLs)</primary>
48925 <secondary>testing the client host</secondary>
48926 </indexterm>
48927 This condition tests that the calling host matches the host list. If you have
48928 name lookups or wildcarded host names and IP addresses in the same host list,
48929 you should normally put the IP addresses first. For example, you could have:
48930 </para>
48931 <literallayout class="monospaced">
48932 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
48933 </literallayout>
48934 <para>
48935 The lookup in this example uses the host name for its key. This is implied by
48936 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
48937 and it wouldn&#x2019;t matter which way round you had these two items.)
48938 </para>
48939 <para>
48940 The reason for the problem with host names lies in the left-to-right way that
48941 Exim processes lists. It can test IP addresses without doing any DNS lookups,
48942 but when it reaches an item that requires a host name, it fails if it cannot
48943 find a host name to compare with the pattern. If the above list is given in the
48944 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
48945 found, even if its IP address is 10.9.8.7.
48946 </para>
48947 <para>
48948 If you really do want to do the name check first, and still recognize the IP
48949 address even if the name lookup fails, you can rewrite the ACL like this:
48950 </para>
48951 <literallayout class="monospaced">
48952 accept hosts = dbm;/etc/friendly/hosts
48953 accept hosts = 10.9.8.7
48954 </literallayout>
48955 <para>
48956 The default action on failing to find the host name is to assume that the host
48957 is not in the list, so the first <option>accept</option> statement fails. The second
48958 statement can then check the IP address.
48959 </para>
48960 <para>
48961 <indexterm role="variable">
48962 <primary><varname>$host_data</varname></primary>
48963 </indexterm>
48964 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
48965 of the lookup is made available in the <varname>$host_data</varname> variable. This
48966 allows you, for example, to set up a statement like this:
48967 </para>
48968 <literallayout class="monospaced">
48969 deny  hosts = net-lsearch;/some/file
48970 message = $host_data
48971 </literallayout>
48972 <para>
48973 which gives a custom error message for each denied host.
48974 </para>
48975 </listitem></varlistentry>
48976 <varlistentry>
48977 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
48978 <listitem>
48979 <para>
48980 <indexterm role="concept">
48981 <primary><option>local_parts</option> ACL condition</primary>
48982 </indexterm>
48983 <indexterm role="concept">
48984 <primary>local part</primary>
48985 <secondary>ACL checking</secondary>
48986 </indexterm>
48987 <indexterm role="concept">
48988 <primary>access control lists (ACLs)</primary>
48989 <secondary>testing a local part</secondary>
48990 </indexterm>
48991 <indexterm role="variable">
48992 <primary><varname>$local_part_data</varname></primary>
48993 </indexterm>
48994 This condition is relevant only after a RCPT command. It checks that the local
48995 part of the recipient address is in the list. If percent-hack processing is
48996 enabled, it is done before this test. If the check succeeds with a lookup, the
48997 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
48998 the next <option>local_parts</option> test.
48999 </para>
49000 </listitem></varlistentry>
49001 <varlistentry>
49002 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
49003 <listitem>
49004 <para>
49005 <indexterm role="concept">
49006 <primary><option>malware</option> ACL condition</primary>
49007 </indexterm>
49008 <indexterm role="concept">
49009 <primary>access control lists (ACLs)</primary>
49010 <secondary>virus scanning</secondary>
49011 </indexterm>
49012 <indexterm role="concept">
49013 <primary>access control lists (ACLs)</primary>
49014 <secondary>scanning for viruses</secondary>
49015 </indexterm>
49016 This condition is available only when Exim is compiled with the
49017 content-scanning extension. It causes the incoming message to be scanned for
49018 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
49019 </para>
49020 </listitem></varlistentry>
49021 <varlistentry>
49022 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
49023 <listitem>
49024 <para>
49025 <indexterm role="concept">
49026 <primary><option>mime_regex</option> ACL condition</primary>
49027 </indexterm>
49028 <indexterm role="concept">
49029 <primary>access control lists (ACLs)</primary>
49030 <secondary>testing by regex matching</secondary>
49031 </indexterm>
49032 This condition is available only when Exim is compiled with the
49033 content-scanning extension, and it is allowed only in the ACL defined by
49034 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
49035 with any of the regular expressions. For details, see chapter
49036 <xref linkend="CHAPexiscan"/>.
49037 </para>
49038 </listitem></varlistentry>
49039 <varlistentry>
49040 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
49041 <listitem>
49042 <para>
49043 <indexterm role="concept">
49044 <primary>rate limiting</primary>
49045 </indexterm>
49046 This condition can be used to limit the rate at which a user or host submits
49047 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
49048 </para>
49049 </listitem></varlistentry>
49050 <varlistentry>
49051 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
49052 <listitem>
49053 <para>
49054 <indexterm role="concept">
49055 <primary><option>recipients</option> ACL condition</primary>
49056 </indexterm>
49057 <indexterm role="concept">
49058 <primary>recipient</primary>
49059 <secondary>ACL checking</secondary>
49060 </indexterm>
49061 <indexterm role="concept">
49062 <primary>access control lists (ACLs)</primary>
49063 <secondary>testing a recipient</secondary>
49064 </indexterm>
49065 This condition is relevant only after a RCPT command. It checks the entire
49066 recipient address against a list of recipients.
49067 </para>
49068 </listitem></varlistentry>
49069 <varlistentry>
49070 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
49071 <listitem>
49072 <para>
49073 <indexterm role="concept">
49074 <primary><option>regex</option> ACL condition</primary>
49075 </indexterm>
49076 <indexterm role="concept">
49077 <primary>access control lists (ACLs)</primary>
49078 <secondary>testing by regex matching</secondary>
49079 </indexterm>
49080 This condition is available only when Exim is compiled with the
49081 content-scanning extension, and is available only in the DATA, MIME, and
49082 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
49083 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
49084 </para>
49085 </listitem></varlistentry>
49086 <varlistentry>
49087 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
49088 <listitem>
49089 <para>
49090 <indexterm role="concept">
49091 <primary><option>sender_domains</option> ACL condition</primary>
49092 </indexterm>
49093 <indexterm role="concept">
49094 <primary>sender</primary>
49095 <secondary>ACL checking</secondary>
49096 </indexterm>
49097 <indexterm role="concept">
49098 <primary>access control lists (ACLs)</primary>
49099 <secondary>testing a sender domain</secondary>
49100 </indexterm>
49101 <indexterm role="variable">
49102 <primary><varname>$domain</varname></primary>
49103 </indexterm>
49104 <indexterm role="variable">
49105 <primary><varname>$sender_address_domain</varname></primary>
49106 </indexterm>
49107 This condition tests the domain of the sender of the message against the given
49108 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
49109 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
49110 of this condition. This is an exception to the general rule for testing domain
49111 lists. It is done this way so that, if this condition is used in an ACL for a
49112 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
49113 influence the sender checking.
49114 </para>
49115 <para>
49116 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49117 relaying, because sender addresses are easily, and commonly, forged.
49118 </para>
49119 </listitem></varlistentry>
49120 <varlistentry>
49121 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
49122 <listitem>
49123 <para>
49124 <indexterm role="concept">
49125 <primary><option>senders</option> ACL condition</primary>
49126 </indexterm>
49127 <indexterm role="concept">
49128 <primary>sender</primary>
49129 <secondary>ACL checking</secondary>
49130 </indexterm>
49131 <indexterm role="concept">
49132 <primary>access control lists (ACLs)</primary>
49133 <secondary>testing a sender</secondary>
49134 </indexterm>
49135 This condition tests the sender of the message against the given list. To test
49136 for a bounce message, which has an empty sender, set
49137 </para>
49138 <literallayout class="monospaced">
49139 senders = :
49140 </literallayout>
49141 <para>
49142 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49143 relaying, because sender addresses are easily, and commonly, forged.
49144 </para>
49145 </listitem></varlistentry>
49146 <varlistentry>
49147 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
49148 <listitem>
49149 <para>
49150 <indexterm role="concept">
49151 <primary><option>spam</option> ACL condition</primary>
49152 </indexterm>
49153 <indexterm role="concept">
49154 <primary>access control lists (ACLs)</primary>
49155 <secondary>scanning for spam</secondary>
49156 </indexterm>
49157 This condition is available only when Exim is compiled with the
49158 content-scanning extension. It causes the incoming message to be scanned by
49159 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
49160 </para>
49161 </listitem></varlistentry>
49162 <varlistentry>
49163 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
49164 <listitem>
49165 <para>
49166 <indexterm role="concept">
49167 <primary><option>verify</option> ACL condition</primary>
49168 </indexterm>
49169 <indexterm role="concept">
49170 <primary>TLS</primary>
49171 <secondary>client certificate verification</secondary>
49172 </indexterm>
49173 <indexterm role="concept">
49174 <primary>certificate</primary>
49175 <secondary>verification of client</secondary>
49176 </indexterm>
49177 <indexterm role="concept">
49178 <primary>access control lists (ACLs)</primary>
49179 <secondary>certificate verification</secondary>
49180 </indexterm>
49181 <indexterm role="concept">
49182 <primary>access control lists (ACLs)</primary>
49183 <secondary>testing a TLS certificate</secondary>
49184 </indexterm>
49185 This condition is true in an SMTP session if the session is encrypted, and a
49186 certificate was received from the client, and the certificate was verified. The
49187 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
49188 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
49189 </para>
49190 </listitem></varlistentry>
49191 <varlistentry>
49192 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
49193 <listitem>
49194 <para>
49195 <indexterm role="concept">
49196 <primary>CSA verification</primary>
49197 </indexterm>
49198 This condition checks whether the sending host (the client) is authorized to
49199 send email. Details of how this works are given in section
49200 <xref linkend="SECTverifyCSA"/>.
49201 </para>
49202 </listitem></varlistentry>
49203 <varlistentry>
49204 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49205 <listitem>
49206 <para>
49207 <indexterm role="concept">
49208 <primary><option>verify</option> ACL condition</primary>
49209 </indexterm>
49210 <indexterm role="concept">
49211 <primary>access control lists (ACLs)</primary>
49212 <secondary>verifying sender in the header</secondary>
49213 </indexterm>
49214 <indexterm role="concept">
49215 <primary>header lines</primary>
49216 <secondary>verifying the sender in</secondary>
49217 </indexterm>
49218 <indexterm role="concept">
49219 <primary>sender</primary>
49220 <secondary>verifying in header</secondary>
49221 </indexterm>
49222 <indexterm role="concept">
49223 <primary>verifying</primary>
49224 <secondary>sender in header</secondary>
49225 </indexterm>
49226 This condition is relevant only in an ACL that is run after a message has been
49227 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49228 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
49229 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
49230 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
49231 However, an address that appears in one of these headers need not be an address
49232 that accepts bounce messages; only sender addresses in envelopes are required
49233 to accept bounces. Therefore, if you use the callout option on this check, you
49234 might want to arrange for a non-empty address in the MAIL command.
49235 </para>
49236 <para>
49237 Details of address verification and the options are given later, starting at
49238 section <xref linkend="SECTaddressverification"/> (callouts are described in section
49239 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
49240 condition to restrict it to bounce messages only:
49241 </para>
49242 <literallayout class="monospaced">
49243 deny    senders = :
49244         message = A valid sender header is required for bounces
49245        !verify  = header_sender
49246 </literallayout>
49247 </listitem></varlistentry>
49248 <varlistentry>
49249 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
49250 <listitem>
49251 <para>
49252 <indexterm role="concept">
49253 <primary><option>verify</option> ACL condition</primary>
49254 </indexterm>
49255 <indexterm role="concept">
49256 <primary>access control lists (ACLs)</primary>
49257 <secondary>verifying header syntax</secondary>
49258 </indexterm>
49259 <indexterm role="concept">
49260 <primary>header lines</primary>
49261 <secondary>verifying syntax</secondary>
49262 </indexterm>
49263 <indexterm role="concept">
49264 <primary>verifying</primary>
49265 <secondary>header syntax</secondary>
49266 </indexterm>
49267 This condition is relevant only in an ACL that is run after a message has been
49268 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49269 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
49270 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
49271 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
49272 permitted only in locally generated messages and from hosts that match
49273 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
49274 appropriate.
49275 </para>
49276 <para>
49277 Note that this condition is a syntax check only. However, a common spamming
49278 ploy used to be to send syntactically invalid headers such as
49279 </para>
49280 <literallayout class="monospaced">
49281 To: @
49282 </literallayout>
49283 <para>
49284 and this condition can be used to reject such messages, though they are not as
49285 common as they used to be.
49286 </para>
49287 </listitem></varlistentry>
49288 <varlistentry>
49289 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
49290 <listitem>
49291 <para>
49292 <indexterm role="concept">
49293 <primary><option>verify</option> ACL condition</primary>
49294 </indexterm>
49295 <indexterm role="concept">
49296 <primary>access control lists (ACLs)</primary>
49297 <secondary>verifying HELO/EHLO</secondary>
49298 </indexterm>
49299 <indexterm role="concept">
49300 <primary>HELO</primary>
49301 <secondary>verifying</secondary>
49302 </indexterm>
49303 <indexterm role="concept">
49304 <primary>EHLO</primary>
49305 <secondary>verifying</secondary>
49306 </indexterm>
49307 <indexterm role="concept">
49308 <primary>verifying</primary>
49309 <secondary>EHLO</secondary>
49310 </indexterm>
49311 <indexterm role="concept">
49312 <primary>verifying</primary>
49313 <secondary>HELO</secondary>
49314 </indexterm>
49315 This condition is true if a HELO or EHLO command has been received from the
49316 client host, and its contents have been verified. If there has been no previous
49317 attempt to verify the HELO/EHLO contents, it is carried out when this
49318 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
49319 <option>helo_try_verify_hosts</option> options for details of how to request verification
49320 independently of this condition.
49321 </para>
49322 <para>
49323 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
49324 option), this condition is always true.
49325 </para>
49326 </listitem></varlistentry>
49327 <varlistentry>
49328 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
49329 <listitem>
49330 <para>
49331 <indexterm role="concept">
49332 <primary>verifying</primary>
49333 <secondary>not blind</secondary>
49334 </indexterm>
49335 <indexterm role="concept">
49336 <primary>bcc recipients, verifying none</primary>
49337 </indexterm>
49338 This condition checks that there are no blind (bcc) recipients in the message.
49339 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
49340 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
49341 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
49342 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
49343 used only in a DATA or non-SMTP ACL.
49344 </para>
49345 <para>
49346 There are, of course, many legitimate messages that make use of blind (bcc)
49347 recipients. This check should not be used on its own for blocking messages.
49348 </para>
49349 </listitem></varlistentry>
49350 <varlistentry>
49351 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49352 <listitem>
49353 <para>
49354 <indexterm role="concept">
49355 <primary><option>verify</option> ACL condition</primary>
49356 </indexterm>
49357 <indexterm role="concept">
49358 <primary>access control lists (ACLs)</primary>
49359 <secondary>verifying recipient</secondary>
49360 </indexterm>
49361 <indexterm role="concept">
49362 <primary>recipient</primary>
49363 <secondary>verifying</secondary>
49364 </indexterm>
49365 <indexterm role="concept">
49366 <primary>verifying</primary>
49367 <secondary>recipient</secondary>
49368 </indexterm>
49369 <indexterm role="variable">
49370 <primary><varname>$address_data</varname></primary>
49371 </indexterm>
49372 This condition is relevant only after a RCPT command. It verifies the current
49373 recipient. Details of address verification are given later, starting at section
49374 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
49375 of <varname>$address_data</varname> is the last value that was set while routing the address.
49376 This applies even if the verification fails. When an address that is being
49377 verified is redirected to a single address, verification continues with the new
49378 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
49379 value for the child address.
49380 </para>
49381 </listitem></varlistentry>
49382 <varlistentry>
49383 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
49384 <listitem>
49385 <para>
49386 <indexterm role="concept">
49387 <primary><option>verify</option> ACL condition</primary>
49388 </indexterm>
49389 <indexterm role="concept">
49390 <primary>access control lists (ACLs)</primary>
49391 <secondary>verifying host reverse lookup</secondary>
49392 </indexterm>
49393 <indexterm role="concept">
49394 <primary>host</primary>
49395 <secondary>verifying reverse lookup</secondary>
49396 </indexterm>
49397 This condition ensures that a verified host name has been looked up from the IP
49398 address of the client host. (This may have happened already if the host name
49399 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
49400 Verification ensures that the host name obtained from a reverse DNS lookup, or
49401 one of its aliases, does, when it is itself looked up in the DNS, yield the
49402 original IP address.
49403 </para>
49404 <para>
49405 If this condition is used for a locally generated message (that is, when there
49406 is no client host involved), it always succeeds.
49407 </para>
49408 </listitem></varlistentry>
49409 <varlistentry>
49410 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49411 <listitem>
49412 <para>
49413 <indexterm role="concept">
49414 <primary><option>verify</option> ACL condition</primary>
49415 </indexterm>
49416 <indexterm role="concept">
49417 <primary>access control lists (ACLs)</primary>
49418 <secondary>verifying sender</secondary>
49419 </indexterm>
49420 <indexterm role="concept">
49421 <primary>sender</primary>
49422 <secondary>verifying</secondary>
49423 </indexterm>
49424 <indexterm role="concept">
49425 <primary>verifying</primary>
49426 <secondary>sender</secondary>
49427 </indexterm>
49428 This condition is relevant only after a MAIL or RCPT command, or after a
49429 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
49430 the message&#x2019;s sender is empty (that is, this is a bounce message), the
49431 condition is true. Otherwise, the sender address is verified.
49432 </para>
49433 <para>
49434 <indexterm role="variable">
49435 <primary><varname>$address_data</varname></primary>
49436 </indexterm>
49437 <indexterm role="variable">
49438 <primary><varname>$sender_address_data</varname></primary>
49439 </indexterm>
49440 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
49441 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
49442 value can be used in subsequent conditions and modifiers in the same ACL
49443 statement. It does not persist after the end of the current statement. If you
49444 want to preserve the value for longer, you can save it in an ACL variable.
49445 </para>
49446 <para>
49447 Details of verification are given later, starting at section
49448 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
49449 to avoid doing it more than once per message.
49450 </para>
49451 </listitem></varlistentry>
49452 <varlistentry>
49453 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49454 <listitem>
49455 <para>
49456 <indexterm role="concept">
49457 <primary><option>verify</option> ACL condition</primary>
49458 </indexterm>
49459 This is a variation of the previous option, in which a modified address is
49460 verified as a sender.
49461 </para>
49462 </listitem></varlistentry>
49463 </variablelist>
49464 </section>
49465 <section id="SECTmorednslists">
49466 <title>Using DNS lists</title>
49467 <para>
49468 <indexterm role="concept">
49469 <primary>DNS list</primary>
49470 <secondary>in ACL</secondary>
49471 </indexterm>
49472 <indexterm role="concept">
49473 <primary>black list (DNS)</primary>
49474 </indexterm>
49475 <indexterm role="concept">
49476 <primary>access control lists (ACLs)</primary>
49477 <secondary>testing a DNS list</secondary>
49478 </indexterm>
49479 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
49480 is on at least one of a number of DNS lists by looking up the inverted IP
49481 address in one or more DNS domains. For example, if the calling host&#x2019;s IP
49482 address is 192.168.62.43, and the ACL statement is
49483 </para>
49484 <literallayout class="monospaced">
49485 deny dnslists = blackholes.mail-abuse.org : \
49486                 dialups.mail-abuse.org
49487 </literallayout>
49488 <para>
49489 the following records are looked up:
49490 </para>
49491 <literallayout class="monospaced">
49492 43.62.168.192.blackholes.mail-abuse.org
49493 43.62.168.192.dialups.mail-abuse.org
49494 </literallayout>
49495 <para>
49496 As soon as Exim finds an existing DNS record, processing of the list stops.
49497 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
49498 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
49499 use two separate conditions:
49500 </para>
49501 <literallayout class="monospaced">
49502 deny dnslists = blackholes.mail-abuse.org
49503      dnslists = dialups.mail-abuse.org
49504 </literallayout>
49505 <para>
49506 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
49507 behaves as if the host does not match the list item, that is, as if the DNS
49508 record does not exist. If there are further items in the DNS list, they are
49509 processed.
49510 </para>
49511 <para>
49512 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
49513 (which is the most common usage), because it prevents a DNS failure from
49514 blocking mail. However, you can change this behaviour by putting one of the
49515 following special items in the list:
49516 </para>
49517 <literallayout>
49518 <literal>+include_unknown </literal>   behave as if the item is on the list
49519 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
49520 <literal>+defer_unknown   </literal>   give a temporary error
49521 </literallayout>
49522 <para>
49523 <indexterm role="concept">
49524 <primary><literal>+include_unknown</literal></primary>
49525 </indexterm>
49526 <indexterm role="concept">
49527 <primary><literal>+exclude_unknown</literal></primary>
49528 </indexterm>
49529 <indexterm role="concept">
49530 <primary><literal>+defer_unknown</literal></primary>
49531 </indexterm>
49532 Each of these applies to any subsequent items on the list. For example:
49533 </para>
49534 <literallayout class="monospaced">
49535 deny dnslists = +defer_unknown : foo.bar.example
49536 </literallayout>
49537 <para>
49538 Testing the list of domains stops as soon as a match is found. If you want to
49539 warn for one list and block for another, you can use two different statements:
49540 </para>
49541 <literallayout class="monospaced">
49542 deny  dnslists = blackholes.mail-abuse.org
49543 warn  message  = X-Warn: sending host is on dialups list
49544       dnslists = dialups.mail-abuse.org
49545 </literallayout>
49546 <para>
49547 DNS list lookups are cached by Exim for the duration of the SMTP session,
49548 so a lookup based on the IP address is done at most once for any incoming
49549 connection. Exim does not share information between multiple incoming
49550 connections (but your local name server cache should be active).
49551 </para>
49552 </section>
49553 <section id="SECID201">
49554 <title>Specifying the IP address for a DNS list lookup</title>
49555 <para>
49556 <indexterm role="concept">
49557 <primary>DNS list</primary>
49558 <secondary>keyed by explicit IP address</secondary>
49559 </indexterm>
49560 By default, the IP address that is used in a DNS list lookup is the IP address
49561 of the calling host. However, you can specify another IP address by listing it
49562 after the domain name, introduced by a slash. For example:
49563 </para>
49564 <literallayout class="monospaced">
49565 deny dnslists = black.list.tld/192.168.1.2
49566 </literallayout>
49567 <para>
49568 This feature is not very helpful with explicit IP addresses; it is intended for
49569 use with IP addresses that are looked up, for example, the IP addresses of the
49570 MX hosts or nameservers of an email sender address. For an example, see section
49571 <xref linkend="SECTmulkeyfor"/> below.
49572 </para>
49573 </section>
49574 <section id="SECID202">
49575 <title>DNS lists keyed on domain names</title>
49576 <para>
49577 <indexterm role="concept">
49578 <primary>DNS list</primary>
49579 <secondary>keyed by domain name</secondary>
49580 </indexterm>
49581 There are some lists that are keyed on domain names rather than inverted IP
49582 addresses (see for example the <emphasis>domain based zones</emphasis> link at
49583 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
49584 with these lists. You can change the name that is looked up in a DNS list by
49585 listing it after the domain name, introduced by a slash. For example,
49586 </para>
49587 <literallayout class="monospaced">
49588 deny  message  = Sender's domain is listed at $dnslist_domain
49589       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
49590 </literallayout>
49591 <para>
49592 This particular example is useful only in ACLs that are obeyed after the
49593 RCPT or DATA commands, when a sender address is available. If (for
49594 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
49595 up by this example is
49596 </para>
49597 <literallayout class="monospaced">
49598 tld.example.dsn.rfc-ignorant.org
49599 </literallayout>
49600 <para>
49601 A single <option>dnslists</option> condition can contain entries for both names and IP
49602 addresses. For example:
49603 </para>
49604 <literallayout class="monospaced">
49605 deny dnslists = sbl.spamhaus.org : \
49606                 dsn.rfc-ignorant.org/$sender_address_domain
49607 </literallayout>
49608 <para>
49609 The first item checks the sending host&#x2019;s IP address; the second checks a domain
49610 name. The whole condition is true if either of the DNS lookups succeeds.
49611 </para>
49612 </section>
49613 <section id="SECTmulkeyfor">
49614 <title>Multiple explicit keys for a DNS list</title>
49615 <para>
49616 <indexterm role="concept">
49617 <primary>DNS list</primary>
49618 <secondary>multiple keys for</secondary>
49619 </indexterm>
49620 The syntax described above for looking up explicitly-defined values (either
49621 names or IP addresses) in a DNS blacklist is a simplification. After the domain
49622 name for the DNS list, what follows the slash can in fact be a list of items.
49623 As with all lists in Exim, the default separator is a colon. However, because
49624 this is a sublist within the list of DNS blacklist domains, it is necessary
49625 either to double the separators like this:
49626 </para>
49627 <literallayout class="monospaced">
49628 dnslists = black.list.tld/name.1::name.2
49629 </literallayout>
49630 <para>
49631 or to change the separator character, like this:
49632 </para>
49633 <literallayout class="monospaced">
49634 dnslists = black.list.tld/&lt;;name.1;name.2
49635 </literallayout>
49636 <para>
49637 If an item in the list is an IP address, it is inverted before the DNS
49638 blacklist domain is appended. If it is not an IP address, no inversion
49639 occurs. Consider this condition:
49640 </para>
49641 <literallayout class="monospaced">
49642 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
49643 </literallayout>
49644 <para>
49645 The DNS lookups that occur are:
49646 </para>
49647 <literallayout class="monospaced">
49648 2.1.168.192.black.list.tld
49649 a.domain.black.list.tld
49650 </literallayout>
49651 <para>
49652 Once a DNS record has been found (that matches a specific IP return
49653 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
49654 are done. If there is a temporary DNS error, the rest of the sublist of domains
49655 or IP addresses is tried. A temporary error for the whole dnslists item occurs
49656 only if no other DNS lookup in this sublist succeeds. In other words, a
49657 successful lookup for any of the items in the sublist overrides a temporary
49658 error for a previous item.
49659 </para>
49660 <para>
49661 The ability to supply a list of items after the slash is in some sense just a
49662 syntactic convenience. These two examples have the same effect:
49663 </para>
49664 <literallayout class="monospaced">
49665 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
49666 dnslists = black.list.tld/a.domain::b.domain
49667 </literallayout>
49668 <para>
49669 However, when the data for the list is obtained from a lookup, the second form
49670 is usually much more convenient. Consider this example:
49671 </para>
49672 <literallayout class="monospaced">
49673 deny message  = The mail servers for the domain \
49674                 $sender_address_domain \
49675                 are listed at $dnslist_domain ($dnslist_value); \
49676                 see $dnslist_text.
49677      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
49678                                    ${lookup dnsdb {&gt;|mxh=\
49679                                    $sender_address_domain} }} }
49680 </literallayout>
49681 <para>
49682 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
49683 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
49684 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
49685 of expanding the condition might be something like this:
49686 </para>
49687 <literallayout class="monospaced">
49688 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
49689 </literallayout>
49690 <para>
49691 Thus, this example checks whether or not the IP addresses of the sender
49692 domain&#x2019;s mail servers are on the Spamhaus black list.
49693 </para>
49694 </section>
49695 <section id="SECID203">
49696 <title>Data returned by DNS lists</title>
49697 <para>
49698 <indexterm role="concept">
49699 <primary>DNS list</primary>
49700 <secondary>data returned from</secondary>
49701 </indexterm>
49702 DNS lists are constructed using address records in the DNS. The original RBL
49703 just used the address 127.0.0.1 on the right hand side of each record, but the
49704 RBL+ list and some other lists use a number of values with different meanings.
49705 The values used on the RBL+ list are:
49706 </para>
49707 <literallayout>
49708 127.1.0.1  RBL
49709 127.1.0.2  DUL
49710 127.1.0.3  DUL and RBL
49711 127.1.0.4  RSS
49712 127.1.0.5  RSS and RBL
49713 127.1.0.6  RSS and DUL
49714 127.1.0.7  RSS and DUL and RBL
49715 </literallayout>
49716 <para>
49717 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
49718 different values. Some DNS lists may return more than one address record;
49719 <phrase revisionflag="changed">see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.</phrase>
49720 </para>
49721 </section>
49722 <section id="SECID204">
49723 <title>Variables set from DNS lists</title>
49724 <para>
49725 <indexterm role="concept">
49726 <primary>DNS list</primary>
49727 <secondary>variables set from</secondary>
49728 </indexterm>
49729 <indexterm role="variable">
49730 <primary><varname>$dnslist_domain</varname></primary>
49731 </indexterm>
49732 <indexterm role="variable">
49733 <primary><varname>$dnslist_text</varname></primary>
49734 </indexterm>
49735 <indexterm role="variable">
49736 <primary><varname>$dnslist_value</varname></primary>
49737 </indexterm>
49738 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname>
49739 contains the name of the domain that matched, and <varname>$dnslist_value</varname> contains
49740 the data from the entry. If more than one address record is returned by the DNS
49741 lookup, all the IP addresses are included in <varname>$dnslist_value</varname>, separated by
49742 commas and spaces. The variable <varname>$dnslist_text</varname> contains the contents of any
49743 associated TXT record. For lists such as RBL+ the TXT record for a merged entry
49744 is often not very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of
49745 obtaining more information.
49746 </para>
49747 <para>
49748 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
49749 &ndash; although these appear before the condition in the ACL, they are not
49750 expanded until after it has failed. For example:
49751 </para>
49752 <literallayout class="monospaced">
49753 deny    hosts = !+local_networks
49754         message = $sender_host_address is listed \
49755                   at $dnslist_domain
49756         dnslists = rbl-plus.mail-abuse.example
49757 </literallayout>
49758 </section>
49759 <section id="SECTaddmatcon">
49760 <title>Additional matching conditions for DNS lists</title>
49761 <para>
49762 <indexterm role="concept">
49763 <primary>DNS list</primary>
49764 <secondary>matching specific returned data</secondary>
49765 </indexterm>
49766 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
49767 in order to restrict its action to DNS records with a matching right hand side.
49768 For example,
49769 </para>
49770 <literallayout class="monospaced">
49771 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
49772 </literallayout>
49773 <para>
49774 rejects only those hosts that yield 127.0.0.2. Without this additional data,
49775 any address record is considered to be a match. <phrase revisionflag="changed">For the moment, we assume
49776 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
49777 describes how multiple records are handled.</phrase>
49778 </para>
49779 <para>
49780 More than one IP address may be given for checking, using a comma as a
49781 separator. These are alternatives &ndash; if any one of them matches, the
49782 <option>dnslists</option> condition is true. For example:
49783 </para>
49784 <literallayout class="monospaced">
49785 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
49786 </literallayout>
49787 <para>
49788 If you want to specify a constraining address list and also specify names or IP
49789 addresses to be looked up, the constraining address list must be specified
49790 first. For example:
49791 </para>
49792 <literallayout class="monospaced">
49793 deny dnslists = dsn.rfc-ignorant.org\
49794                 =127.0.0.2/$sender_address_domain
49795 </literallayout>
49796 <para>
49797 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
49798 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
49799 In other words, the listed addresses are used as bit masks. The comparison is
49800 true if all the bits in the mask are present in the address that is being
49801 tested. For example:
49802 </para>
49803 <literallayout class="monospaced">
49804 dnslists = a.b.c&amp;0.0.0.3
49805 </literallayout>
49806 <para>
49807 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
49808 want to test whether one bit or another bit is present (as opposed to both
49809 being present), you must use multiple values. For example:
49810 </para>
49811 <literallayout class="monospaced">
49812 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
49813 </literallayout>
49814 <para>
49815 matches if the final component of the address is an odd number or two times
49816 an odd number.
49817 </para>
49818 </section>
49819 <section id="SECID205">
49820 <title>Negated DNS matching conditions</title>
49821 <para>
49822 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
49823 condition. Whereas
49824 </para>
49825 <literallayout class="monospaced">
49826 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
49827 </literallayout>
49828 <para>
49829 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
49830 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
49831 </para>
49832 <literallayout class="monospaced">
49833 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
49834 </literallayout>
49835 <para>
49836 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
49837 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
49838 words, the result of the test is inverted if an exclamation mark appears before
49839 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
49840 </para>
49841 <para>
49842 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
49843 host, or address list (which is why the syntax is different).
49844 </para>
49845 <para>
49846 If you are using just one list, the negation syntax does not gain you much. The
49847 previous example is precisely equivalent to
49848 </para>
49849 <literallayout class="monospaced">
49850 deny  dnslists = a.b.c
49851      !dnslists = a.b.c=127.0.0.2,127.0.0.3
49852 </literallayout>
49853 <para>
49854 However, if you are using multiple lists, the negation syntax is clearer.
49855 Consider this example:
49856 </para>
49857 <literallayout class="monospaced">
49858 deny  dnslists = sbl.spamhaus.org : \
49859                  list.dsbl.org : \
49860                  dnsbl.njabl.org!=127.0.0.3 : \
49861                  relays.ordb.org
49862 </literallayout>
49863 <para>
49864 Using only positive lists, this would have to be:
49865 </para>
49866 <literallayout class="monospaced">
49867 deny  dnslists = sbl.spamhaus.org : \
49868                  list.dsbl.org
49869 deny  dnslists = dnsbl.njabl.org
49870      !dnslists = dnsbl.njabl.org=127.0.0.3
49871 deny  dnslists = relays.ordb.org
49872 </literallayout>
49873 <para>
49874 which is less clear, and harder to maintain.
49875 </para>
49876 </section>
49877 <section id="SECThanmuldnsrec" revisionflag="changed">
49878 <title>Handling multiple DNS records from a DNS list</title>
49879 <para revisionflag="changed">
49880 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
49881 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
49882 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
49883 the match to specific results from the DNS lookup, there are two ways in which
49884 the checking can be handled. For example, consider the condition:
49885 </para>
49886 <literallayout class="monospaced" revisionflag="changed">
49887 dnslists = a.b.c=127.0.0.1
49888 </literallayout>
49889 <para revisionflag="changed">
49890 What happens if the DNS lookup for the incoming IP address yields both
49891 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
49892 condition true because at least one given value was found, or is it false
49893 because at least one of the found values was not listed? And how does this
49894 affect negated conditions? Both possibilities are provided for with the help of
49895 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
49896 </para>
49897 <itemizedlist revisionflag="changed">
49898 <listitem>
49899 <para revisionflag="changed">
49900 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
49901 IP addresses matches one of the listed addresses. For the example above, the
49902 condition is true because 127.0.0.1 matches.
49903 </para>
49904 </listitem>
49905 <listitem>
49906 <para revisionflag="changed">
49907 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
49908 looked up IP addresses matches one of the listed addresses. If the condition is
49909 changed to:
49910 </para>
49911 <literallayout class="monospaced" revisionflag="changed">
49912 dnslists = a.b.c==127.0.0.1
49913 </literallayout>
49914 <para revisionflag="changed">
49915 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
49916 false because 127.0.0.2 is not listed. You would need to have:
49917 </para>
49918 <literallayout class="monospaced" revisionflag="changed">
49919 dnslists = a.b.c==127.0.0.1,127.0.0.2
49920 </literallayout>
49921 <para revisionflag="changed">
49922 for the condition to be true.
49923 </para>
49924 </listitem>
49925 </itemizedlist>
49926 <para revisionflag="changed">
49927 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
49928 the precise opposite of the behaviour above. Thus:
49929 </para>
49930 <itemizedlist revisionflag="changed">
49931 <listitem>
49932 <para revisionflag="changed">
49933 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
49934 addresses matches one of the listed addresses. Consider:
49935 </para>
49936 <literallayout class="monospaced" revisionflag="changed">
49937 dnslists = a.b.c!&amp;0.0.0.1
49938 </literallayout>
49939 <para revisionflag="changed">
49940 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
49941 false because 127.0.0.1 matches.
49942 </para>
49943 </listitem>
49944 <listitem>
49945 <para revisionflag="changed">
49946 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true there is at least one
49947 looked up IP address that does not match. Consider:
49948 </para>
49949 <literallayout class="monospaced" revisionflag="changed">
49950 dnslists = a.b.c!=&amp;0.0.0.1
49951 </literallayout>
49952 <para revisionflag="changed">
49953 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
49954 true, because 127.0.0.2 does not match. You would need to have:
49955 </para>
49956 <literallayout class="monospaced" revisionflag="changed">
49957 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
49958 </literallayout>
49959 <para revisionflag="changed">
49960 for the condition to be false.
49961 </para>
49962 </listitem>
49963 </itemizedlist>
49964 <para revisionflag="changed">
49965 When the DNS lookup yields only a single IP address, there is no difference
49966 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
49967 </para>
49968 </section>
49969 <section id="SECTmordetinf">
49970 <title>Detailed information from merged DNS lists</title>
49971 <para>
49972 <indexterm role="concept">
49973 <primary>DNS list</primary>
49974 <secondary>information from merged</secondary>
49975 </indexterm>
49976 When the facility for restricting the matching IP values in a DNS list is used,
49977 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
49978 the true reason for rejection. This happens when lists are merged and the IP
49979 address in the A record is used to distinguish them; unfortunately there is
49980 only one TXT record. One way round this is not to use merged lists, but that
49981 can be inefficient because it requires multiple DNS lookups where one would do
49982 in the vast majority of cases when the host of interest is not on any of the
49983 lists.
49984 </para>
49985 <para>
49986 A less inefficient way of solving this problem is available. If
49987 two domain names, comma-separated, are given, the second is used first to
49988 do an initial check, making use of any IP value restrictions that are set.
49989 If there is a match, the first domain is used, without any IP value
49990 restrictions, to get the TXT record. As a byproduct of this, there is also
49991 a check that the IP being tested is indeed on the first list. The first
49992 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
49993 </para>
49994 <literallayout class="monospaced">
49995 reject message  = \
49996          rejected because $sender_host_address is blacklisted \
49997          at $dnslist_domain\n$dnslist_text
49998        dnslists = \
49999          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
50000          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50001 </literallayout>
50002 <para>
50003 For the first blacklist item, this starts by doing a lookup in
50004 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
50005 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
50006 value, and as long as something is found, it looks for the corresponding TXT
50007 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
50008 The second blacklist item is processed similarly.
50009 </para>
50010 <para>
50011 If you are interested in more than one merged list, the same list must be
50012 given several times, but because the results of the DNS lookups are cached,
50013 the DNS calls themselves are not repeated. For example:
50014 </para>
50015 <literallayout class="monospaced">
50016 reject dnslists = \
50017          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
50018          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
50019          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
50020          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50021 </literallayout>
50022 <para>
50023 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
50024 values matches (or if no record is found), this is the only lookup that is
50025 done. Only if there is a match is one of the more specific lists consulted.
50026 </para>
50027 </section>
50028 <section id="SECTmorednslistslast">
50029 <title>DNS lists and IPv6</title>
50030 <para>
50031 <indexterm role="concept">
50032 <primary>IPv6</primary>
50033 <secondary>DNS black lists</secondary>
50034 </indexterm>
50035 <indexterm role="concept">
50036 <primary>DNS list</primary>
50037 <secondary>IPv6 usage</secondary>
50038 </indexterm>
50039 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
50040 nibble by nibble. For example, if the calling host&#x2019;s IP address is
50041 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
50042 </para>
50043 <literallayout class="monospaced">
50044 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
50045   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
50046 </literallayout>
50047 <para>
50048 (split over two lines here to fit on the page). Unfortunately, some of the DNS
50049 lists contain wildcard records, intended for IPv4, that interact badly with
50050 IPv6. For example, the DNS entry
50051 </para>
50052 <literallayout class="monospaced">
50053 *.3.some.list.example.    A    127.0.0.1
50054 </literallayout>
50055 <para>
50056 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
50057 Unfortunately, it also matches the entire 3::/4 IPv6 network.
50058 </para>
50059 <para>
50060 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
50061 <option>condition</option> condition, as in this example:
50062 </para>
50063 <literallayout class="monospaced">
50064 deny   condition = ${if isip4{$sender_host_address}}
50065        dnslists  = some.list.example
50066 </literallayout>
50067 </section>
50068 <section id="SECTratelimiting">
50069 <title>Rate limiting senders</title>
50070 <para>
50071 <indexterm role="concept">
50072 <primary>rate limiting</primary>
50073 <secondary>client sending</secondary>
50074 </indexterm>
50075 <indexterm role="concept">
50076 <primary>limiting client sending rates</primary>
50077 </indexterm>
50078 <indexterm role="option">
50079 <primary><option>smtp_ratelimit_*</option></primary>
50080 </indexterm>
50081 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
50082 which clients can send email. This is more powerful than the
50083 <option>smtp_ratelimit_*</option> options, because those options control the rate of
50084 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
50085 works across all connections (concurrent and sequential) from the same client
50086 host. The syntax of the <option>ratelimit</option> condition is:
50087 </para>
50088 <literallayout>
50089 <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;
50090 </literallayout>
50091 <para>
50092 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
50093 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
50094 </para>
50095 <para>
50096 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
50097 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
50098 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
50099 of <emphasis>p</emphasis>.
50100 </para>
50101 <para>
50102 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
50103 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
50104 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
50105 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
50106 send in each time interval. It also specifies the number of messages permitted
50107 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
50108 constant, you can allow a client to send more messages in a burst without
50109 changing its overall sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
50110 both small, messages must be sent at an even rate.
50111 </para>
50112 <para>
50113 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
50114 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
50115 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
50116 instructions when it is run with no arguments.
50117 </para>
50118 <para>
50119 The key is used to look up the data for calculating the client&#x2019;s average
50120 sending rate. This data is stored in a database maintained by Exim in its spool
50121 directory, alongside the retry and other hints databases. The default key is
50122 <varname>$sender_host_address</varname>, which applies the limit to each client host IP address.
50123 By changing the key you can change how Exim identifies clients for the purpose
50124 of ratelimiting. For example, to limit the sending rate of each authenticated
50125 user, independent of the computer they are sending from, set the key to
50126 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
50127 example, <varname>$authenticated_id</varname> is only meaningful if the client has
50128 authenticated, and you can check with the <option>authenticated</option> ACL condition.
50129 </para>
50130 <para>
50131 Internally, Exim includes the smoothing constant <emphasis>p</emphasis> and the options in the
50132 lookup key because they alter the meaning of the stored data. This is not true
50133 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
50134 still remember clients&#x2019; past behaviour, but if you alter the other ratelimit
50135 parameters Exim forgets past behaviour.
50136 </para>
50137 <para>
50138 Each <option>ratelimit</option> condition can have up to two options. The first option
50139 specifies what Exim measures the rate of, and the second specifies how Exim
50140 handles excessively fast clients. The options are separated by a slash, like
50141 the other parameters.
50142 </para>
50143 <para>
50144 The <option>per_conn</option> option limits the client&#x2019;s connection rate.
50145 </para>
50146 <para>
50147 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
50148 the default if none of the <option>per_*</option> options is specified.
50149 </para>
50150 <para>
50151 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. Note that it is
50152 best to use this option in the DATA ACL; if it is used in an earlier ACL it
50153 relies on the SIZE parameter on the MAIL command, which may be inaccurate or
50154 completely missing. You can follow the limit <emphasis>m</emphasis> in the configuration with K,
50155 M, or G to specify limits in kilobytes, megabytes, or gigabytes, respectively.
50156 </para>
50157 <para>
50158 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
50159 condition is processed. This can be used to limit the SMTP command rate. The
50160 alias <option>per_rcpt</option> is provided for use in the RCPT ACL instead of <option>per_cmd</option>
50161 to make it clear that the effect is to limit the rate at which recipients are
50162 accepted. Note that in this case the rate limiting engine will see a message
50163 with many recipients as a large high-speed burst.
50164 </para>
50165 <para>
50166 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
50167 engine can react in two possible ways, depending on the presence of the
50168 <option>strict</option> or <option>leaky</option> options. This is independent of the other
50169 counter-measures (such as rejecting the message) that may be specified by the
50170 rest of the ACL. The default mode is leaky, which avoids a sender&#x2019;s
50171 over-aggressive retry rate preventing it from getting any email through.
50172 </para>
50173 <para>
50174 The <option>strict</option> option means that the client&#x2019;s recorded rate is always updated.
50175 The effect of this is that Exim measures the client&#x2019;s average rate of attempts
50176 to send email, which can be much higher than the maximum. If the client is over
50177 the limit it will be subjected to counter-measures until it slows down below
50178 the maximum rate. The smoothing period determines the time it takes for a high
50179 sending rate to decay exponentially to 37% of its peak value, which means that
50180 you can work out the time (the number of smoothing periods) that a client is
50181 subjected to counter-measures after an over-limit burst with this formula:
50182 </para>
50183 <literallayout class="monospaced">
50184 ln(peakrate/maxrate)
50185 </literallayout>
50186 <para>
50187 The <option>leaky</option> option means that the client&#x2019;s recorded rate is not updated if it
50188 is above the limit. The effect of this is that Exim measures the client&#x2019;s
50189 average rate of successfully sent email, which cannot be greater than the
50190 maximum. If the client is over the limit it may suffer some
50191 counter-measures (as specified in the ACL), but it will still be able to send
50192 email at the configured maximum rate, whatever the rate of its attempts. This
50193 is generally the better choice if you have clients that retry automatically.
50194 </para>
50195 <para>
50196 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
50197 when the rate limit is exceeded. This might be anything from logging a warning
50198 (for example, while measuring existing sending rates in order to define
50199 policy), through time delays to slow down fast senders, up to rejecting the
50200 message. For example:
50201 </para>
50202 <literallayout class="monospaced">
50203 # Log all senders' rates
50204 warn ratelimit = 0 / 1h / strict
50205      log_message = Sender rate $sender_rate / $sender_rate_period
50206
50207 # Slow down fast senders; note the need to truncate $sender_rate
50208 # at the decimal point.
50209 warn ratelimit = 100 / 1h / per_rcpt / strict
50210      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
50211                    $sender_rate_limit }s
50212
50213 # Keep authenticated users under control
50214 deny authenticated = *
50215      ratelimit = 100 / 1d / strict / $authenticated_id
50216
50217 # System-wide rate limit
50218 defer message = Sorry, too busy. Try again later.
50219      ratelimit = 10 / 1s / $primary_hostname
50220
50221 # Restrict incoming rate from each host, with a default
50222 # set using a macro and special cases looked up in a table.
50223 defer message = Sender rate exceeds $sender_rate_limit \
50224                messages per $sender_rate_period
50225      ratelimit = ${lookup {$sender_host_address} \
50226                    cdb {DB/ratelimits.cdb} \
50227                    {$value} {RATELIMIT} }
50228 </literallayout>
50229 <para>
50230 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
50231 especially with the <option>per_rcpt</option> option, you may suffer from a performance
50232 bottleneck caused by locking on the ratelimit hints database. Apart from
50233 making your ACLs less complicated, you can reduce the problem by using a
50234 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
50235 this means that Exim will lose its hints data after a reboot (including retry
50236 hints, the callout cache, and ratelimit data).
50237 </para>
50238 </section>
50239 <section id="SECTaddressverification">
50240 <title>Address verification</title>
50241 <para>
50242 <indexterm role="concept">
50243 <primary>verifying address</primary>
50244 <secondary>options for</secondary>
50245 </indexterm>
50246 <indexterm role="concept">
50247 <primary>policy control</primary>
50248 <secondary>address verification</secondary>
50249 </indexterm>
50250 Several of the <option>verify</option> conditions described in section
50251 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
50252 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
50253 The verification conditions can be followed by options that modify the
50254 verification process. The options are separated from the keyword and from each
50255 other by slashes, and some of them contain parameters. For example:
50256 </para>
50257 <literallayout class="monospaced">
50258 verify = sender/callout
50259 verify = recipient/defer_ok/callout=10s,defer_ok
50260 </literallayout>
50261 <para>
50262 The first stage of address verification, which always happens, is to run the
50263 address through the routers, in <quote>verify mode</quote>. Routers can detect the
50264 difference between verification and routing for delivery, and their actions can
50265 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
50266 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
50267 The available options are as follows:
50268 </para>
50269 <itemizedlist>
50270 <listitem>
50271 <para>
50272 If the <option>callout</option> option is specified, successful routing to one or more
50273 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
50274 check. Callouts and their sub-options are discussed in the next section.
50275 </para>
50276 </listitem>
50277 <listitem>
50278 <para>
50279 If there is a defer error while doing verification routing, the ACL
50280 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
50281 options, the condition is forced to be true instead. Note that this is a main
50282 verification option as well as a suboption for callouts.
50283 </para>
50284 </listitem>
50285 <listitem>
50286 <para>
50287 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
50288 discusses the reporting of sender address verification failures.
50289 </para>
50290 </listitem>
50291 <listitem>
50292 <para>
50293 The <option>success_on_redirect</option> option causes verification always to succeed
50294 immediately after a successful redirection. By default, if a redirection
50295 generates just one address, that address is also verified. See further
50296 discussion in section <xref linkend="SECTredirwhilveri"/>.
50297 </para>
50298 </listitem>
50299 </itemizedlist>
50300 <para>
50301 <indexterm role="concept">
50302 <primary>verifying address</primary>
50303 <secondary>differentiating failures</secondary>
50304 </indexterm>
50305 <indexterm role="variable">
50306 <primary><varname>$recipient_verify_failure</varname></primary>
50307 </indexterm>
50308 <indexterm role="variable">
50309 <primary><varname>$sender_verify_failure</varname></primary>
50310 </indexterm>
50311 <indexterm role="variable">
50312 <primary><varname>$acl_verify_message</varname></primary>
50313 </indexterm>
50314 After an address verification failure, <varname>$acl_verify_message</varname> contains the
50315 error message that is associated with the failure. It can be preserved by
50316 coding like this:
50317 </para>
50318 <literallayout class="monospaced">
50319 warn  !verify = sender
50320        set acl_m0 = $acl_verify_message
50321 </literallayout>
50322 <para>
50323 If you are writing your own custom rejection message or log message when
50324 denying access, you can use this variable to include information about the
50325 verification failure.
50326 </para>
50327 <para>
50328 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
50329 appropriate) contains one of the following words:
50330 </para>
50331 <itemizedlist>
50332 <listitem>
50333 <para>
50334 <option>qualify</option>: The address was unqualified (no domain), and the message
50335 was neither local nor came from an exempted host.
50336 </para>
50337 </listitem>
50338 <listitem>
50339 <para>
50340 <option>route</option>: Routing failed.
50341 </para>
50342 </listitem>
50343 <listitem>
50344 <para>
50345 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
50346 occurred at or before the MAIL command (that is, on initial
50347 connection, HELO, or MAIL).
50348 </para>
50349 </listitem>
50350 <listitem>
50351 <para>
50352 <option>recipient</option>: The RCPT command in a callout was rejected.
50353 </para>
50354 </listitem>
50355 <listitem>
50356 <para>
50357 <option>postmaster</option>: The postmaster check in a callout was rejected.
50358 </para>
50359 </listitem>
50360 </itemizedlist>
50361 <para>
50362 The main use of these variables is expected to be to distinguish between
50363 rejections of MAIL and rejections of RCPT in callouts.
50364 </para>
50365 </section>
50366 <section id="SECTcallver">
50367 <title>Callout verification</title>
50368 <para>
50369 <indexterm role="concept">
50370 <primary>verifying address</primary>
50371 <secondary>by callout</secondary>
50372 </indexterm>
50373 <indexterm role="concept">
50374 <primary>callout</primary>
50375 <secondary>verification</secondary>
50376 </indexterm>
50377 <indexterm role="concept">
50378 <primary>SMTP</primary>
50379 <secondary>callout verification</secondary>
50380 </indexterm>
50381 For non-local addresses, routing verifies the domain, but is unable to do any
50382 checking of the local part. There are situations where some means of verifying
50383 the local part is desirable. One way this can be done is to make an SMTP
50384 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
50385 a subsequent host for a recipient address, to see if the host accepts the
50386 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
50387 sender address, the callback is not to the client host that is trying to
50388 deliver the message, but to one of the hosts that accepts incoming mail for the
50389 sender&#x2019;s domain.
50390 </para>
50391 <para>
50392 Exim does not do callouts by default. If you want them to happen, you must
50393 request them by setting appropriate options on the <option>verify</option> condition, as
50394 described below. This facility should be used with care, because it can add a
50395 lot of resource usage to the cost of verifying an address. However, Exim does
50396 cache the results of callouts, which helps to reduce the cost. Details of
50397 caching are in section <xref linkend="SECTcallvercache"/>.
50398 </para>
50399 <para>
50400 Recipient callouts are usually used only between hosts that are controlled by
50401 the same administration. For example, a corporate gateway host could use
50402 callouts to check for valid recipients on an internal mailserver. A successful
50403 callout does not guarantee that a real delivery to the address would succeed;
50404 on the other hand, a failing callout does guarantee that a delivery would fail.
50405 </para>
50406 <para>
50407 If the <option>callout</option> option is present on a condition that verifies an address, a
50408 second stage of verification occurs if the address is successfully routed to
50409 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
50410 <command>manualroute</command> router, where the router specifies the hosts. However, if a
50411 router that does not set up hosts routes to an <command>smtp</command> transport with a
50412 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
50413 <option>hosts_override</option> set, its hosts are always used, whether or not the router
50414 supplies a host list.
50415 </para>
50416 <para>
50417 The port that is used is taken from the transport, if it is specified and is a
50418 remote transport. (For routers that do verification only, no transport need be
50419 specified.) Otherwise, the default SMTP port is used. If a remote transport
50420 specifies an outgoing interface, this is used; otherwise the interface is not
50421 specified. Likewise, the text that is used for the HELO command is taken from
50422 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
50423 <varname>$smtp_active_hostname</varname> is used.
50424 </para>
50425 <para>
50426 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
50427 test whether a bounce message could be delivered to the sender address. The
50428 following SMTP commands are sent:
50429 </para>
50430 <literallayout>
50431 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
50432 <literal>MAIL FROM:&lt;&gt;</literal>
50433 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
50434 <literal>QUIT</literal>
50435 </literallayout>
50436 <para>
50437 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
50438 set to <quote>lmtp</quote>.
50439 </para>
50440 <para>
50441 A recipient callout check is similar. By default, it also uses an empty address
50442 for the sender. This default is chosen because most hosts do not make use of
50443 the sender address when verifying a recipient. Using the same address means
50444 that a single cache entry can be used for each recipient. Some sites, however,
50445 do make use of the sender address when verifying. These are catered for by the
50446 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
50447 </para>
50448 <para>
50449 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
50450 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
50451 Exim tries the next host, if any. If there is a problem with all the remote
50452 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
50453 <option>callout</option> option is given, in which case the condition is forced to succeed.
50454 </para>
50455 <para revisionflag="changed">
50456 <indexterm role="concept">
50457 <primary>SMTP</primary>
50458 <secondary>output flushing, disabling for callout</secondary>
50459 </indexterm>
50460 A callout may take a little time. For this reason, Exim normally flushes SMTP
50461 output before performing a callout in an ACL, to avoid unexpected timeouts in
50462 clients when the SMTP PIPELINING extension is in use. The flushing can be
50463 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
50464 </para>
50465 </section>
50466 <section id="CALLaddparcall">
50467 <title>Additional parameters for callouts</title>
50468 <para>
50469 <indexterm role="concept">
50470 <primary>callout</primary>
50471 <secondary>additional parameters for</secondary>
50472 </indexterm>
50473 The <option>callout</option> option can be followed by an equals sign and a number of
50474 optional parameters, separated by commas. For example:
50475 </para>
50476 <literallayout class="monospaced">
50477 verify = recipient/callout=10s,defer_ok
50478 </literallayout>
50479 <para>
50480 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
50481 separate verify options, is retained for backwards compatibility, but is now
50482 deprecated. The additional parameters for <option>callout</option> are as follows:
50483 </para>
50484 <variablelist>
50485 <varlistentry>
50486 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
50487 <listitem>
50488 <para>
50489 <indexterm role="concept">
50490 <primary>callout</primary>
50491 <secondary>timeout, specifying</secondary>
50492 </indexterm>
50493 This specifies the timeout that applies for the callout attempt to each host.
50494 For example:
50495 </para>
50496 <literallayout class="monospaced">
50497 verify = sender/callout=5s
50498 </literallayout>
50499 <para>
50500 The default is 30 seconds. The timeout is used for each response from the
50501 remote host. It is also used for the initial connection, unless overridden by
50502 the <option>connect</option> parameter.
50503 </para>
50504 </listitem></varlistentry>
50505 <varlistentry>
50506 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
50507 <listitem>
50508 <para>
50509 <indexterm role="concept">
50510 <primary>callout</primary>
50511 <secondary>connection timeout, specifying</secondary>
50512 </indexterm>
50513 This parameter makes it possible to set a different (usually smaller) timeout
50514 for making the SMTP connection. For example:
50515 </para>
50516 <literallayout class="monospaced">
50517 verify = sender/callout=5s,connect=1s
50518 </literallayout>
50519 <para>
50520 If not specified, this timeout defaults to the general timeout value.
50521 </para>
50522 </listitem></varlistentry>
50523 <varlistentry>
50524 <term><emphasis role="bold">defer_ok</emphasis></term>
50525 <listitem>
50526 <para>
50527 <indexterm role="concept">
50528 <primary>callout</primary>
50529 <secondary>defer, action on</secondary>
50530 </indexterm>
50531 When this parameter is present, failure to contact any host, or any other kind
50532 of temporary error, is treated as success by the ACL. However, the cache is not
50533 updated in this circumstance.
50534 </para>
50535 </listitem></varlistentry>
50536 <varlistentry>
50537 <term><emphasis role="bold">fullpostmaster</emphasis></term>
50538 <listitem>
50539 <para>
50540 <indexterm role="concept">
50541 <primary>callout</primary>
50542 <secondary>full postmaster check</secondary>
50543 </indexterm>
50544 This operates like the <option>postmaster</option> option (see below), but if the check for
50545 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
50546 accordance with the specification in RFC 2821. The RFC states that the
50547 unqualified address <emphasis>postmaster</emphasis> should be accepted.
50548 </para>
50549 </listitem></varlistentry>
50550 <varlistentry>
50551 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
50552 <listitem>
50553 <para>
50554 <indexterm role="concept">
50555 <primary>callout</primary>
50556 <secondary>sender when verifying header</secondary>
50557 </indexterm>
50558 When verifying addresses in header lines using the <option>header_sender</option>
50559 verification option, Exim behaves by default as if the addresses are envelope
50560 sender addresses from a message. Callout verification therefore tests to see
50561 whether a bounce message could be delivered, by using an empty address in the
50562 MAIL command. However, it is arguable that these addresses might never be used
50563 as envelope senders, and could therefore justifiably reject bounce messages
50564 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
50565 address to use in the MAIL command. For example:
50566 </para>
50567 <literallayout class="monospaced">
50568 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
50569 </literallayout>
50570 <para>
50571 This parameter is available only for the <option>header_sender</option> verification option.
50572 </para>
50573 </listitem></varlistentry>
50574 <varlistentry>
50575 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
50576 <listitem>
50577 <para>
50578 <indexterm role="concept">
50579 <primary>callout</primary>
50580 <secondary>overall timeout, specifying</secondary>
50581 </indexterm>
50582 This parameter sets an overall timeout for performing a callout verification.
50583 For example:
50584 </para>
50585 <literallayout class="monospaced">
50586 verify = sender/callout=5s,maxwait=30s
50587 </literallayout>
50588 <para>
50589 This timeout defaults to four times the callout timeout for individual SMTP
50590 commands. The overall timeout applies when there is more than one host that can
50591 be tried. The timeout is checked before trying the next host. This prevents
50592 very long delays if there are a large number of hosts and all are timing out
50593 (for example, when network connections are timing out).
50594 </para>
50595 </listitem></varlistentry>
50596 <varlistentry>
50597 <term><emphasis role="bold">no_cache</emphasis></term>
50598 <listitem>
50599 <para>
50600 <indexterm role="concept">
50601 <primary>callout</primary>
50602 <secondary>cache, suppressing</secondary>
50603 </indexterm>
50604 <indexterm role="concept">
50605 <primary>caching callout, suppressing</primary>
50606 </indexterm>
50607 When this parameter is given, the callout cache is neither read nor updated.
50608 </para>
50609 </listitem></varlistentry>
50610 <varlistentry>
50611 <term><emphasis role="bold">postmaster</emphasis></term>
50612 <listitem>
50613 <para>
50614 <indexterm role="concept">
50615 <primary>callout</primary>
50616 <secondary>postmaster; checking</secondary>
50617 </indexterm>
50618 When this parameter is set, a successful callout check is followed by a similar
50619 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
50620 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
50621 the postmaster check is recorded in a cache record; if it is a failure, this is
50622 used to fail subsequent callouts for the domain without a connection being
50623 made, until the cache record expires.
50624 </para>
50625 </listitem></varlistentry>
50626 <varlistentry>
50627 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
50628 <listitem>
50629 <para>
50630 The postmaster check uses an empty sender in the MAIL command by default.
50631 You can use this parameter to do a postmaster check using a different address.
50632 For example:
50633 </para>
50634 <literallayout class="monospaced">
50635 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
50636 </literallayout>
50637 <para>
50638 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
50639 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
50640 </para>
50641 <literallayout class="monospaced">
50642 require  verify = sender/callout=postmaster_mailfrom=
50643 </literallayout>
50644 <para>
50645 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
50646 account of the sender address. It is assumed that either the empty address or
50647 a fixed non-empty address will be used. All that Exim remembers is that the
50648 postmaster check for the domain succeeded or failed.
50649 </para>
50650 </listitem></varlistentry>
50651 <varlistentry>
50652 <term><emphasis role="bold">random</emphasis></term>
50653 <listitem>
50654 <para>
50655 <indexterm role="concept">
50656 <primary>callout</primary>
50657 <secondary><quote>random</quote> check</secondary>
50658 </indexterm>
50659 When this parameter is set, before doing the normal callout check, Exim does a
50660 check for a <quote>random</quote> local part at the same domain. The local part is not
50661 really random &ndash; it is defined by the expansion of the option
50662 <option>callout_random_local_part</option>, which defaults to
50663 </para>
50664 <literallayout class="monospaced">
50665 $primary_host_name-$tod_epoch-testing
50666 </literallayout>
50667 <para>
50668 The idea here is to try to determine whether the remote host accepts all local
50669 parts without checking. If it does, there is no point in doing callouts for
50670 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
50671 a cache record, and used to force the current and subsequent callout checks to
50672 succeed without a connection being made, until the cache record expires.
50673 </para>
50674 </listitem></varlistentry>
50675 <varlistentry>
50676 <term><emphasis role="bold">use_postmaster</emphasis></term>
50677 <listitem>
50678 <para>
50679 <indexterm role="concept">
50680 <primary>callout</primary>
50681 <secondary>sender for recipient check</secondary>
50682 </indexterm>
50683 This parameter applies to recipient callouts only. For example:
50684 </para>
50685 <literallayout class="monospaced">
50686 deny  !verify = recipient/callout=use_postmaster
50687 </literallayout>
50688 <para>
50689 <indexterm role="variable">
50690 <primary><varname>$qualify_domain</varname></primary>
50691 </indexterm>
50692 It causes a non-empty postmaster address to be used in the MAIL command when
50693 performing the callout for the recipient, and also for a <quote>random</quote> check if
50694 that is configured. The local part of the address is <literal>postmaster</literal> and the
50695 domain is the contents of <varname>$qualify_domain</varname>.
50696 </para>
50697 </listitem></varlistentry>
50698 <varlistentry>
50699 <term><emphasis role="bold">use_sender</emphasis></term>
50700 <listitem>
50701 <para>
50702 This option applies to recipient callouts only. For example:
50703 </para>
50704 <literallayout class="monospaced">
50705 require  verify = recipient/callout=use_sender
50706 </literallayout>
50707 <para>
50708 It causes the message&#x2019;s actual sender address to be used in the MAIL
50709 command when performing the callout, instead of an empty address. There is no
50710 need to use this option unless you know that the called hosts make use of the
50711 sender when checking recipients. If used indiscriminately, it reduces the
50712 usefulness of callout caching.
50713 </para>
50714 </listitem></varlistentry>
50715 </variablelist>
50716 <para>
50717 If you use any of the parameters that set a non-empty sender for the MAIL
50718 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
50719 <option>use_sender</option>), you should think about possible loops. Recipient checking is
50720 usually done between two hosts that are under the same management, and the host
50721 that receives the callouts is not normally configured to do callouts itself.
50722 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
50723 these circumstances.
50724 </para>
50725 <para>
50726 However, if you use a non-empty sender address for a callout to an arbitrary
50727 host, there is the likelihood that the remote host will itself initiate a
50728 callout check back to your host. As it is checking what appears to be a message
50729 sender, it is likely to use an empty address in MAIL, thus avoiding a
50730 callout loop. However, to be on the safe side it would be best to set up your
50731 own ACLs so that they do not do sender verification checks when the recipient
50732 is the address you use for header sender or postmaster callout checking.
50733 </para>
50734 <para>
50735 Another issue to think about when using non-empty senders for callouts is
50736 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
50737 by the sender/recipient combination; thus, for any given recipient, many more
50738 actual callouts are performed than when an empty sender or postmaster is used.
50739 </para>
50740 </section>
50741 <section id="SECTcallvercache">
50742 <title>Callout caching</title>
50743 <para>
50744 <indexterm role="concept">
50745 <primary>hints database</primary>
50746 <secondary>callout cache</secondary>
50747 </indexterm>
50748 <indexterm role="concept">
50749 <primary>callout</primary>
50750 <secondary>cache, description of</secondary>
50751 </indexterm>
50752 <indexterm role="concept">
50753 <primary>caching</primary>
50754 <secondary>callout</secondary>
50755 </indexterm>
50756 Exim caches the results of callouts in order to reduce the amount of resources
50757 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
50758 option. A hints database called <quote>callout</quote> is used for the cache. Two
50759 different record types are used: one records the result of a callout check for
50760 a specific address, and the other records information that applies to the
50761 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
50762 </para>
50763 <para>
50764 When an original callout fails, a detailed SMTP error message is given about
50765 the failure. However, for subsequent failures use the cache data, this message
50766 is not available.
50767 </para>
50768 <para>
50769 The expiry times for negative and positive address cache records are
50770 independent, and can be set by the global options <option>callout_negative_expire</option>
50771 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
50772 </para>
50773 <para>
50774 If a host gives a negative response to an SMTP connection, or rejects any
50775 commands up to and including
50776 </para>
50777 <literallayout class="monospaced">
50778 MAIL FROM:&lt;&gt;
50779 </literallayout>
50780 <para>
50781 (but not including the MAIL command with a non-empty address),
50782 any callout attempt is bound to fail. Exim remembers such failures in a
50783 domain cache record, which it uses to fail callouts for the domain without
50784 making new connections, until the domain record times out. There are two
50785 separate expiry times for domain cache records:
50786 <option>callout_domain_negative_expire</option> (default 3h) and
50787 <option>callout_domain_positive_expire</option> (default 7d).
50788 </para>
50789 <para>
50790 Domain records expire when the negative expiry time is reached if callouts
50791 cannot be made for the domain, or if the postmaster check failed.
50792 Otherwise, they expire when the positive expiry time is reached. This
50793 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
50794 will eventually be noticed.
50795 </para>
50796 <para>
50797 The callout caching mechanism is based on the domain of the address that is
50798 being tested. If the domain routes to several hosts, it is assumed that their
50799 behaviour will be the same.
50800 </para>
50801 </section>
50802 <section id="SECTsenaddver">
50803 <title>Sender address verification reporting</title>
50804 <para>
50805 <indexterm role="concept">
50806 <primary>verifying</primary>
50807 <secondary>suppressing error details</secondary>
50808 </indexterm>
50809 See section <xref linkend="SECTaddressverification"/> for a general discussion of
50810 verification. When sender verification fails in an ACL, the details of the
50811 failure are given as additional output lines before the 550 response to the
50812 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
50813 you might see:
50814 </para>
50815 <literallayout class="monospaced">
50816 MAIL FROM:&lt;xyz@abc.example&gt;
50817 250 OK
50818 RCPT TO:&lt;pqr@def.example&gt;
50819 550-Verification failed for &lt;xyz@abc.example&gt;
50820 550-Called:   192.168.34.43
50821 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
50822 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
50823 550 Sender verification failed
50824 </literallayout>
50825 <para>
50826 If more than one RCPT command fails in the same way, the details are given
50827 only for the first of them. However, some administrators do not want to send
50828 out this much information. You can suppress the details by adding
50829 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
50830 example:
50831 </para>
50832 <literallayout class="monospaced">
50833 verify = sender/no_details
50834 </literallayout>
50835 </section>
50836 <section id="SECTredirwhilveri">
50837 <title>Redirection while verifying</title>
50838 <para>
50839 <indexterm role="concept">
50840 <primary>verifying</primary>
50841 <secondary>redirection while</secondary>
50842 </indexterm>
50843 <indexterm role="concept">
50844 <primary>address redirection</primary>
50845 <secondary>while verifying</secondary>
50846 </indexterm>
50847 A dilemma arises when a local address is redirected by aliasing or forwarding
50848 during verification: should the generated addresses themselves be verified,
50849 or should the successful expansion of the original address be enough to verify
50850 it? By default, Exim takes the following pragmatic approach:
50851 </para>
50852 <itemizedlist>
50853 <listitem>
50854 <para>
50855 When an incoming address is redirected to just one child address, verification
50856 continues with the child address, and if that fails to verify, the original
50857 verification also fails.
50858 </para>
50859 </listitem>
50860 <listitem>
50861 <para>
50862 When an incoming address is redirected to more than one child address,
50863 verification does not continue. A success result is returned.
50864 </para>
50865 </listitem>
50866 </itemizedlist>
50867 <para>
50868 This seems the most reasonable behaviour for the common use of aliasing as a
50869 way of redirecting different local parts to the same mailbox. It means, for
50870 example, that a pair of alias entries of the form
50871 </para>
50872 <literallayout class="monospaced">
50873 A.Wol:   aw123
50874 aw123:   :fail: Gone away, no forwarding address
50875 </literallayout>
50876 <para>
50877 work as expected, with both local parts causing verification failure. When a
50878 redirection generates more than one address, the behaviour is more like a
50879 mailing list, where the existence of the alias itself is sufficient for
50880 verification to succeed.
50881 </para>
50882 <para>
50883 It is possible, however, to change the default behaviour so that all successful
50884 redirections count as successful verifications, however many new addresses are
50885 generated. This is specified by the <option>success_on_redirect</option> verification
50886 option. For example:
50887 </para>
50888 <literallayout class="monospaced">
50889 require verify = recipient/success_on_redirect/callout=10s
50890 </literallayout>
50891 <para>
50892 In this example, verification succeeds if a router generates a new address, and
50893 the callout does not occur, because no address was routed to a remote host.
50894 </para>
50895 <para>
50896 When verification is being tested via the <option>-bv</option> option, the treatment of
50897 redirections is as just described, unless the <option>-v</option> or any debugging option is
50898 also specified. In that case, full verification is done for every generated
50899 address and a report is output for each of them.
50900 </para>
50901 </section>
50902 <section id="SECTverifyCSA">
50903 <title>Client SMTP authorization (CSA)</title>
50904 <para>
50905 <indexterm role="concept">
50906 <primary>CSA</primary>
50907 <secondary>verifying</secondary>
50908 </indexterm>
50909 Client SMTP Authorization is a system that allows a site to advertise
50910 which machines are and are not permitted to send email. This is done by placing
50911 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
50912 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
50913 Authorization checks in Exim are performed by the ACL condition:
50914 </para>
50915 <literallayout class="monospaced">
50916 verify = csa
50917 </literallayout>
50918 <para>
50919 This fails if the client is not authorized. If there is a DNS problem, or if no
50920 valid CSA SRV record is found, or if the client is authorized, the condition
50921 succeeds. These three cases can be distinguished using the expansion variable
50922 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
50923 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
50924 be likely to cause problems for legitimate email.
50925 </para>
50926 <para>
50927 The error messages produced by the CSA code include slightly more
50928 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
50929 looking up the CSA SRV record, or problems looking up the CSA target
50930 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
50931 </para>
50932 <itemizedlist>
50933 <listitem>
50934 <para>
50935 The client&#x2019;s host name is explicitly not authorized.
50936 </para>
50937 </listitem>
50938 <listitem>
50939 <para>
50940 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
50941 </para>
50942 </listitem>
50943 <listitem>
50944 <para>
50945 The client&#x2019;s host name is authorized but it has no valid target IP addresses
50946 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
50947 </para>
50948 </listitem>
50949 <listitem>
50950 <para>
50951 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
50952 that all subdomains must be explicitly authorized.
50953 </para>
50954 </listitem>
50955 </itemizedlist>
50956 <para>
50957 The <option>csa</option> verification condition can take an argument which is the domain to
50958 use for the DNS query. The default is:
50959 </para>
50960 <literallayout class="monospaced">
50961 verify = csa/$sender_helo_name
50962 </literallayout>
50963 <para>
50964 This implementation includes an extension to CSA. If the query domain
50965 is an address literal such as [192.0.2.95], or if it is a bare IP
50966 address, Exim searches for CSA SRV records in the reverse DNS as if
50967 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
50968 meaningful to say:
50969 </para>
50970 <literallayout class="monospaced">
50971 verify = csa/$sender_host_address
50972 </literallayout>
50973 <para>
50974 In fact, this is the check that Exim performs if the client does not say HELO.
50975 This extension can be turned off by setting the main configuration option
50976 <option>dns_csa_use_reverse</option> to be false.
50977 </para>
50978 <para>
50979 If a CSA SRV record is not found for the domain itself, a search
50980 is performed through its parent domains for a record which might be
50981 making assertions about subdomains. The maximum depth of this search is limited
50982 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
50983 default. Exim does not look for CSA SRV records in a top level domain, so the
50984 default settings handle HELO domains as long as seven
50985 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
50986 of legitimate HELO domains.
50987 </para>
50988 <para>
50989 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
50990 direct SRV lookups, this is not sufficient because of the extra parent domain
50991 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
50992 addresses into lookups in the reverse DNS space. The result of a successful
50993 lookup such as:
50994 </para>
50995 <literallayout class="monospaced">
50996 ${lookup dnsdb {csa=$sender_helo_name}}
50997 </literallayout>
50998 <para>
50999 has two space-separated fields: an authorization code and a target host name.
51000 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
51001 authorization required but absent, or <quote>?</quote> for unknown.
51002 </para>
51003 </section>
51004 <section id="SECTverifyPRVS">
51005 <title>Bounce address tag validation</title>
51006 <para>
51007 <indexterm role="concept">
51008 <primary>BATV, verifying</primary>
51009 </indexterm>
51010 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
51011 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
51012 Genuine incoming bounce messages should therefore always be addressed to
51013 recipients that have a valid tag. This scheme is a way of detecting unwanted
51014 bounce messages caused by sender address forgeries (often called <quote>collateral
51015 spam</quote>), because the recipients of such messages do not include valid tags.
51016 </para>
51017 <para>
51018 There are two expansion items to help with the implementation of the BATV
51019 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
51020 the original envelope sender address by using a simple key to add a hash of the
51021 address and some time-based randomizing information. The <option>prvs</option> expansion
51022 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
51023 The syntax of these expansion items is described in section
51024 <xref linkend="SECTexpansionitems"/>.
51025 </para>
51026 <para>
51027 As an example, suppose the secret per-address keys are stored in an MySQL
51028 database. A query to look up the key for an address could be defined as a macro
51029 like this:
51030 </para>
51031 <literallayout class="monospaced">
51032 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
51033                 WHERE sender='${quote_mysql:$prvscheck_address}'\
51034                 }{$value}}
51035 </literallayout>
51036 <para>
51037 Suppose also that the senders who make use of BATV are defined by an address
51038 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
51039 use this:
51040 </para>
51041 <literallayout class="monospaced">
51042 # Bounces: drop unsigned addresses for BATV senders
51043 deny message = This address does not send an unsigned reverse path
51044      senders = :
51045      recipients = +batv_senders
51046
51047 # Bounces: In case of prvs-signed address, check signature.
51048 deny message = Invalid reverse path signature.
51049      senders = :
51050      condition  = ${prvscheck {$local_part@$domain}\
51051                   {PRVSCHECK_SQL}{1}}
51052      !condition = $prvscheck_result
51053 </literallayout>
51054 <para>
51055 The first statement rejects recipients for bounce messages that are addressed
51056 to plain BATV sender addresses, because it is known that BATV senders do not
51057 send out messages with plain sender addresses. The second statement rejects
51058 recipients that are prvs-signed, but with invalid signatures (either because
51059 the key is wrong, or the signature has timed out).
51060 </para>
51061 <para>
51062 A non-prvs-signed address is not rejected by the second statement, because the
51063 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
51064 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
51065 the first argument is a syntactically valid prvs-signed address, the yield is
51066 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
51067 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
51068 of the checks (empty for failure, <quote>1</quote> for success).
51069 </para>
51070 <para>
51071 There are two more issues you must consider when implementing prvs-signing.
51072 Firstly, you need to ensure that prvs-signed addresses are not blocked by your
51073 ACLs. A prvs-signed address contains a slash character, but the default Exim
51074 configuration contains this statement in the RCPT ACL:
51075 </para>
51076 <literallayout class="monospaced">
51077 deny    message       = Restricted characters in address
51078         domains       = +local_domains
51079         local_parts   = ^[.] : ^.*[@%!/|]
51080 </literallayout>
51081 <para>
51082 This is a conservative rule that blocks local parts that contain slashes. You
51083 should remove the slash in the last line.
51084 </para>
51085 <para>
51086 Secondly, you have to ensure that the routers accept prvs-signed addresses and
51087 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
51088 router to remove the signature with a configuration along these lines:
51089 </para>
51090 <literallayout class="monospaced">
51091 batv_redirect:
51092   driver = redirect
51093   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
51094 </literallayout>
51095 <para>
51096 This works because, if the third argument of <option>prvscheck</option> is empty, the result
51097 of the expansion of a prvs-signed address is the decoded value of the original
51098 address. This router should probably be the first of your routers that handles
51099 local addresses.
51100 </para>
51101 <para>
51102 To create BATV-signed addresses in the first place, a transport of this form
51103 can be used:
51104 </para>
51105 <literallayout class="monospaced">
51106 external_smtp_batv:
51107   driver = smtp
51108   return_path = ${prvs {$return_path} \
51109                        {${lookup mysql{SELECT \
51110                        secret FROM batv_prvs WHERE \
51111                        sender='${quote_mysql:$sender_address}'} \
51112                        {$value}fail}}}
51113 </literallayout>
51114 <para>
51115 If no key can be found for the existing return path, no signing takes place.
51116 </para>
51117 </section>
51118 <section id="SECTrelaycontrol">
51119 <title>Using an ACL to control relaying</title>
51120 <para>
51121 <indexterm role="concept">
51122 <primary>access control lists (ACLs)</primary>
51123 <secondary>relay control</secondary>
51124 </indexterm>
51125 <indexterm role="concept">
51126 <primary>relaying</primary>
51127 <secondary>control by ACL</secondary>
51128 </indexterm>
51129 <indexterm role="concept">
51130 <primary>policy control</primary>
51131 <secondary>relay control</secondary>
51132 </indexterm>
51133 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
51134 delivers it directly to another host as a result of a remote address contained
51135 within it. Redirecting a local address via an alias or forward file and then
51136 passing the message on to another host is not relaying,
51137 <indexterm role="concept">
51138 <primary><quote>percent hack</quote></primary>
51139 </indexterm>
51140 but a redirection as a result of the <quote>percent hack</quote> is.
51141 </para>
51142 <para>
51143 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
51144 A host which is acting as a gateway or an MX backup is concerned with incoming
51145 relaying from arbitrary hosts to a specific set of domains. On the other hand,
51146 a host which is acting as a smart host for a number of clients is concerned
51147 with outgoing relaying from those clients to the Internet at large. Often the
51148 same host is fulfilling both functions,
51149 but in principle these two kinds of relaying are entirely independent. What is
51150 not wanted is the transmission of mail from arbitrary remote hosts through your
51151 system to arbitrary domains.
51152 </para>
51153 <para>
51154 You can implement relay control by means of suitable statements in the ACL that
51155 runs for each RCPT command. For convenience, it is often easiest to use
51156 Exim&#x2019;s named list facility to define the domains and hosts involved. For
51157 example, suppose you want to do the following:
51158 </para>
51159 <itemizedlist>
51160 <listitem>
51161 <para>
51162 Deliver a number of domains to mailboxes on the local host (or process them
51163 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
51164 <emphasis>my.dom2.example</emphasis>.
51165 </para>
51166 </listitem>
51167 <listitem>
51168 <para>
51169 Relay mail for a number of other domains for which you are the secondary MX.
51170 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
51171 </para>
51172 </listitem>
51173 <listitem>
51174 <para>
51175 Relay mail from the hosts on your local LAN, to whatever domains are involved.
51176 Suppose your LAN is 192.168.45.0/24.
51177 </para>
51178 </listitem>
51179 </itemizedlist>
51180 <para>
51181 In the main part of the configuration, you put the following definitions:
51182 </para>
51183 <literallayout class="monospaced">
51184 domainlist local_domains = my.dom1.example : my.dom2.example
51185 domainlist relay_domains = friend1.example : friend2.example
51186 hostlist   relay_hosts   = 192.168.45.0/24
51187 </literallayout>
51188 <para>
51189 Now you can use these definitions in the ACL that is run for every RCPT
51190 command:
51191 </para>
51192 <literallayout class="monospaced">
51193 acl_check_rcpt:
51194   accept domains = +local_domains : +relay_domains
51195   accept hosts   = +relay_hosts
51196 </literallayout>
51197 <para>
51198 The first statement accepts any RCPT command that contains an address in
51199 the local or relay domains. For any other domain, control passes to the second
51200 statement, which accepts the command only if it comes from one of the relay
51201 hosts. In practice, you will probably want to make your ACL more sophisticated
51202 than this, for example, by including sender and recipient verification. The
51203 default configuration includes a more comprehensive example, which is described
51204 in chapter <xref linkend="CHAPdefconfil"/>.
51205 </para>
51206 </section>
51207 <section id="SECTcheralcon">
51208 <title>Checking a relay configuration</title>
51209 <para>
51210 <indexterm role="concept">
51211 <primary>relaying</primary>
51212 <secondary>checking control of</secondary>
51213 </indexterm>
51214 You can check the relay characteristics of your configuration in the same way
51215 that you can test any ACL behaviour for an incoming SMTP connection, by using
51216 the <option>-bh</option> option to run a fake SMTP session with which you interact.
51217 </para>
51218 <para>
51219 For specifically testing for unwanted relaying, the host
51220 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
51221 host from the host on which Exim is running, using the normal telnet port, you
51222 will see a normal telnet connection message and then quite a long delay. Be
51223 patient. The remote host is making an SMTP connection back to your host, and
51224 trying a number of common probes to test for open relay vulnerability. The
51225 results of the tests will eventually appear on your terminal.
51226 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
51227 </para>
51228 </section>
51229 </chapter>
51230
51231 <chapter id="CHAPexiscan">
51232 <title>Content scanning at ACL time</title>
51233 <para>
51234 <indexterm role="concept" id="IIDcosca" class="startofrange">
51235 <primary>content scanning</primary>
51236 <secondary>at ACL time</secondary>
51237 </indexterm>
51238 The extension of Exim to include content scanning at ACL time, formerly known
51239 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
51240 was integrated into the main source for Exim release 4.50, and Tom continues to
51241 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
51242 specification.
51243 </para>
51244 <para>
51245 It is also possible to scan the content of messages at other times. The
51246 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
51247 scanning after all the ACLs have run. A transport filter can be used to scan
51248 messages at delivery time (see the <option>transport_filter</option> option, described in
51249 chapter <xref linkend="CHAPtransportgeneric"/>).
51250 </para>
51251 <para>
51252 If you want to include the ACL-time content-scanning features when you compile
51253 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
51254 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
51255 </para>
51256 <itemizedlist>
51257 <listitem>
51258 <para>
51259 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
51260 for all MIME parts for SMTP and non-SMTP messages, respectively.
51261 </para>
51262 </listitem>
51263 <listitem>
51264 <para>
51265 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
51266 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
51267 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
51268 </para>
51269 </listitem>
51270 <listitem>
51271 <para>
51272 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
51273 of messages, or parts of messages, for debugging purposes.
51274 </para>
51275 </listitem>
51276 <listitem>
51277 <para>
51278 Additional expansion variables that are set in the new ACL and by the new
51279 conditions.
51280 </para>
51281 </listitem>
51282 <listitem>
51283 <para>
51284 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
51285 </para>
51286 </listitem>
51287 </itemizedlist>
51288 <para>
51289 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
51290 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
51291 condition is compiled, in addition to all the other content-scanning features.
51292 </para>
51293 <para>
51294 Content-scanning is continually evolving, and new features are still being
51295 added. While such features are still unstable and liable to incompatible
51296 changes, they are made available in Exim by setting options whose names begin
51297 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
51298 this manual. You can find out about them by reading the file called
51299 <filename>doc/experimental.txt</filename>.
51300 </para>
51301 <para>
51302 All the content-scanning facilities work on a MBOX copy of the message that is
51303 temporarily created in a file called:
51304 </para>
51305 <literallayout>
51306 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
51307 </literallayout>
51308 <para>
51309 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
51310 expect an MBOX-like structure inside that file. The file is created when the
51311 first content scanning facility is called. Subsequent calls to content
51312 scanning conditions open the same file again. The directory is recursively
51313 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
51314 </para>
51315 <literallayout class="monospaced">
51316 control = no_mbox_unspool
51317 </literallayout>
51318 <para>
51319 has been encountered. When the MIME ACL decodes files, they are put into the
51320 same directory by default.
51321 </para>
51322 <section id="SECTscanvirus">
51323 <title>Scanning for viruses</title>
51324 <para>
51325 <indexterm role="concept">
51326 <primary>virus scanning</primary>
51327 </indexterm>
51328 <indexterm role="concept">
51329 <primary>content scanning</primary>
51330 <secondary>for viruses</secondary>
51331 </indexterm>
51332 <indexterm role="concept">
51333 <primary>content scanning</primary>
51334 <secondary>the <option>malware</option> condition</secondary>
51335 </indexterm>
51336 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
51337 It supports a <quote>generic</quote> interface to scanners called via the shell, and
51338 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
51339 in memory and thus are much faster.
51340 </para>
51341 <para>
51342 <indexterm role="option">
51343 <primary><option>av_scanner</option></primary>
51344 </indexterm>
51345 You can set the <option>av_scanner</option> option in first part of the Exim configuration
51346 file to specify which scanner to use, together with any additional options that
51347 are needed. The basic syntax is as follows:
51348 </para>
51349 <literallayout>
51350 <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>
51351 </literallayout>
51352 <para>
51353 If you do not set <option>av_scanner</option>, it defaults to
51354 </para>
51355 <literallayout class="monospaced">
51356 av_scanner = sophie:/var/run/sophie
51357 </literallayout>
51358 <para>
51359 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
51360 before use. The following scanner types are supported in this release:
51361 </para>
51362 <variablelist>
51363 <varlistentry>
51364 <term><option>aveserver</option></term>
51365 <listitem>
51366 <para>
51367 <indexterm role="concept">
51368 <primary>virus scanners</primary>
51369 <secondary>Kaspersky</secondary>
51370 </indexterm>
51371 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
51372 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
51373 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
51374 example:
51375 </para>
51376 <literallayout class="monospaced">
51377 av_scanner = aveserver:/var/run/aveserver
51378 </literallayout>
51379 </listitem></varlistentry>
51380 <varlistentry>
51381 <term><option>clamd</option></term>
51382 <listitem>
51383 <para>
51384 <indexterm role="concept">
51385 <primary>virus scanners</primary>
51386 <secondary>clamd</secondary>
51387 </indexterm>
51388 This daemon-type scanner is GPL and free. You can get it at
51389 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
51390 unpack MIME containers, so it used to be recommended to unpack MIME attachments
51391 in the MIME ACL. This no longer believed to be necessary. One option is
51392 required: either the path and name of a UNIX socket file, or a hostname or IP
51393 number, and a port, separated by space, as in the second of these examples:
51394 </para>
51395 <literallayout class="monospaced">
51396 av_scanner = clamd:/opt/clamd/socket
51397 av_scanner = clamd:192.168.2.100 1234
51398 </literallayout>
51399 <para>
51400 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
51401 contributing the code for this scanner.
51402 </para>
51403 </listitem></varlistentry>
51404 <varlistentry>
51405 <term><option>cmdline</option></term>
51406 <listitem>
51407 <para>
51408 <indexterm role="concept">
51409 <primary>virus scanners</primary>
51410 <secondary>command line interface</secondary>
51411 </indexterm>
51412 This is the keyword for the generic command line scanner interface. It can be
51413 used to attach virus scanners that are invoked from the shell. This scanner
51414 type takes 3 mandatory options:
51415 </para>
51416 <orderedlist numeration="arabic">
51417 <listitem>
51418 <para>
51419 The full path and name of the scanner binary, with all command line options,
51420 and a placeholder (<literal>%s</literal>) for the directory to scan.
51421 </para>
51422 </listitem>
51423 <listitem>
51424 <para>
51425 A regular expression to match against the STDOUT and STDERR output of the
51426 virus scanner. If the expression matches, a virus was found. You must make
51427 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
51428 the <quote>trigger</quote> expression.
51429 </para>
51430 </listitem>
51431 <listitem>
51432 <para>
51433 Another regular expression, containing exactly one pair of parentheses, to
51434 match the name of the virus found in the scanners output. This is called the
51435 <quote>name</quote> expression.
51436 </para>
51437 </listitem>
51438 </orderedlist>
51439 <para>
51440 For example, Sophos Sweep reports a virus on a line like this:
51441 </para>
51442 <literallayout class="monospaced">
51443 Virus 'W32/Magistr-B' found in file ./those.bat
51444 </literallayout>
51445 <para>
51446 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
51447 name expression, we want to extract the W32/Magistr-B string, so we can match
51448 for the single quotes left and right of it. Altogether, this makes the
51449 configuration setting:
51450 </para>
51451 <literallayout class="monospaced">
51452 av_scanner = cmdline:\
51453              /path/to/sweep -ss -all -rec -archive %s:\
51454              found in file:'(.+)'
51455 </literallayout>
51456 </listitem></varlistentry>
51457 <varlistentry>
51458 <term><option>drweb</option></term>
51459 <listitem>
51460 <para>
51461 <indexterm role="concept">
51462 <primary>virus scanners</primary>
51463 <secondary>DrWeb</secondary>
51464 </indexterm>
51465 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
51466 argument, either a full path to a UNIX socket, or an IP address and port
51467 separated by white space, as in these examples:
51468 </para>
51469 <literallayout class="monospaced">
51470 av_scanner = drweb:/var/run/drwebd.sock
51471 av_scanner = drweb:192.168.2.20 31337
51472 </literallayout>
51473 <para>
51474 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
51475 is used. Thanks to Alex Miller for contributing the code for this scanner.
51476 </para>
51477 </listitem></varlistentry>
51478 <varlistentry>
51479 <term><option>fsecure</option></term>
51480 <listitem>
51481 <para>
51482 <indexterm role="concept">
51483 <primary>virus scanners</primary>
51484 <secondary>F-Secure</secondary>
51485 </indexterm>
51486 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
51487 argument which is the path to a UNIX socket. For example:
51488 </para>
51489 <literallayout class="monospaced">
51490 av_scanner = fsecure:/path/to/.fsav
51491 </literallayout>
51492 <para>
51493 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
51494 Thelmen for contributing the code for this scanner.
51495 </para>
51496 </listitem></varlistentry>
51497 <varlistentry>
51498 <term><option>kavdaemon</option></term>
51499 <listitem>
51500 <para>
51501 <indexterm role="concept">
51502 <primary>virus scanners</primary>
51503 <secondary>Kaspersky</secondary>
51504 </indexterm>
51505 This is the scanner daemon of Kaspersky Version 4. This version of the
51506 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
51507 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
51508 For example:
51509 </para>
51510 <literallayout class="monospaced">
51511 av_scanner = kavdaemon:/opt/AVP/AvpCtl
51512 </literallayout>
51513 <para>
51514 The default path is <filename>/var/run/AvpCtl</filename>.
51515 </para>
51516 </listitem></varlistentry>
51517 <varlistentry>
51518 <term><option>mksd</option></term>
51519 <listitem>
51520 <para>
51521 <indexterm role="concept">
51522 <primary>virus scanners</primary>
51523 <secondary>mksd</secondary>
51524 </indexterm>
51525 This is a daemon type scanner that is aimed mainly at Polish users, though some
51526 parts of documentation are now available in English. You can get it at
51527 <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
51528 the maximum number of processes used simultaneously to scan the attachments,
51529 provided that the demime facility is employed and also provided that mksd has
51530 been run with at least the same number of child processes. For example:
51531 </para>
51532 <literallayout class="monospaced">
51533 av_scanner = mksd:2
51534 </literallayout>
51535 <para>
51536 You can safely omit this option (the default value is 1).
51537 </para>
51538 </listitem></varlistentry>
51539 <varlistentry>
51540 <term><option>sophie</option></term>
51541 <listitem>
51542 <para>
51543 <indexterm role="concept">
51544 <primary>virus scanners</primary>
51545 <secondary>Sophos and Sophie</secondary>
51546 </indexterm>
51547 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
51548 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
51549 for this scanner type is the path to the UNIX socket that Sophie uses for
51550 client communication. For example:
51551 </para>
51552 <literallayout class="monospaced">
51553 av_scanner = sophie:/tmp/sophie
51554 </literallayout>
51555 <para>
51556 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
51557 the option.
51558 </para>
51559 </listitem></varlistentry>
51560 </variablelist>
51561 <para>
51562 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
51563 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
51564 ACL.
51565 </para>
51566 <para>
51567 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
51568 makes it possible to use different scanners. See further below for an example.
51569 The <option>malware</option> condition caches its results, so when you use it multiple times
51570 for the same message, the actual scanning process is only carried out once.
51571 However, using expandable items in <option>av_scanner</option> disables this caching, in
51572 which case each use of the <option>malware</option> condition causes a new scan of the
51573 message.
51574 </para>
51575 <para>
51576 The <option>malware</option> condition takes a right-hand argument that is expanded before
51577 use. It can then be one of
51578 </para>
51579 <itemizedlist>
51580 <listitem>
51581 <para>
51582 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
51583 The condition succeeds if a virus was found, and fail otherwise. This is the
51584 recommended usage.
51585 </para>
51586 </listitem>
51587 <listitem>
51588 <para>
51589 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
51590 the condition fails immediately.
51591 </para>
51592 </listitem>
51593 <listitem>
51594 <para>
51595 A regular expression, in which case the message is scanned for viruses. The
51596 condition succeeds if a virus is found and its name matches the regular
51597 expression. This allows you to take special actions on certain types of virus.
51598 </para>
51599 </listitem>
51600 </itemizedlist>
51601 <para>
51602 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
51603 even if there is a problem with the virus scanner. Otherwise, such a problem
51604 causes the ACL to defer.
51605 </para>
51606 <para>
51607 <indexterm role="variable">
51608 <primary><varname>$malware_name</varname></primary>
51609 </indexterm>
51610 When a virus is found, the condition sets up an expansion variable called
51611 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
51612 <option>message</option> modifier that specifies the error returned to the sender, and/or in
51613 logging data.
51614 </para>
51615 <para>
51616 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
51617 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
51618 <option>malware</option> condition.
51619 </para>
51620 <para>
51621 Here is a very simple scanning example:
51622 </para>
51623 <literallayout class="monospaced">
51624 deny message = This message contains malware ($malware_name)
51625      demime = *
51626      malware = *
51627 </literallayout>
51628 <para>
51629 The next example accepts messages when there is a problem with the scanner:
51630 </para>
51631 <literallayout class="monospaced">
51632 deny message = This message contains malware ($malware_name)
51633      demime = *
51634      malware = */defer_ok
51635 </literallayout>
51636 <para>
51637 The next example shows how to use an ACL variable to scan with both sophie and
51638 aveserver. It assumes you have set:
51639 </para>
51640 <literallayout class="monospaced">
51641 av_scanner = $acl_m0
51642 </literallayout>
51643 <para>
51644 in the main Exim configuration.
51645 </para>
51646 <literallayout class="monospaced">
51647 deny message = This message contains malware ($malware_name)
51648      set acl_m0 = sophie
51649      malware = *
51650
51651 deny message = This message contains malware ($malware_name)
51652      set acl_m0 = aveserver
51653      malware = *
51654 </literallayout>
51655 </section>
51656 <section id="SECTscanspamass">
51657 <title>Scanning with SpamAssassin</title>
51658 <para>
51659 <indexterm role="concept">
51660 <primary>content scanning</primary>
51661 <secondary>for spam</secondary>
51662 </indexterm>
51663 <indexterm role="concept">
51664 <primary>spam scanning</primary>
51665 </indexterm>
51666 <indexterm role="concept">
51667 <primary>SpamAssassin</primary>
51668 </indexterm>
51669 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
51670 score and a report for the message. You can get SpamAssassin at
51671 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
51672 installation, you can use CPAN by running:
51673 </para>
51674 <literallayout class="monospaced">
51675 perl -MCPAN -e 'install Mail::SpamAssassin'
51676 </literallayout>
51677 <para>
51678 SpamAssassin has its own set of configuration files. Please review its
51679 documentation to see how you can tweak it. The default installation should work
51680 nicely, however.
51681 </para>
51682 <para>
51683 <indexterm role="option">
51684 <primary><option>spamd_address</option></primary>
51685 </indexterm>
51686 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
51687 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
51688 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
51689 part of the Exim configuration as follows (example):
51690 </para>
51691 <literallayout class="monospaced">
51692 spamd_address = 192.168.99.45 387
51693 </literallayout>
51694 <para>
51695 You do not need to set this option if you use the default. As of version 2.60,
51696 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
51697 these, supply <option>spamd_address</option> with an absolute file name instead of a
51698 address/port pair:
51699 </para>
51700 <literallayout class="monospaced">
51701 spamd_address = /var/run/spamd_socket
51702 </literallayout>
51703 <para>
51704 You can have multiple <option>spamd</option> servers to improve scalability. These can
51705 reside on other hardware reachable over the network. To specify multiple
51706 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
51707 option, separated with colons:
51708 </para>
51709 <literallayout class="monospaced">
51710 spamd_address = 192.168.2.10 783 : \
51711                 192.168.2.11 783 : \
51712                 192.168.2.12 783
51713 </literallayout>
51714 <para>
51715 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
51716 fashion. When a server fails to respond to the connection attempt, all other
51717 servers are tried until one succeeds. If no server responds, the <option>spam</option>
51718 condition defers.
51719 </para>
51720 <para>
51721 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
51722 multiple <option>spamd</option> servers.
51723 </para>
51724 </section>
51725 <section id="SECID206">
51726 <title>Calling SpamAssassin from an Exim ACL</title>
51727 <para>
51728 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
51729 </para>
51730 <literallayout class="monospaced">
51731 deny message = This message was classified as SPAM
51732      spam = joe
51733 </literallayout>
51734 <para>
51735 The right-hand side of the <option>spam</option> condition specifies a name. This is
51736 relevant if you have set up multiple SpamAssassin profiles. If you do not want
51737 to scan using a specific profile, but rather use the SpamAssassin system-wide
51738 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
51739 However, you must put something on the right-hand side.
51740 </para>
51741 <para>
51742 The name allows you to use per-domain or per-user antispam profiles in
51743 principle, but this is not straightforward in practice, because a message may
51744 have multiple recipients, not necessarily all in the same domain. Because the
51745 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
51746 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
51747 are not set.
51748 </para>
51749 <para>
51750 The right-hand side of the <option>spam</option> condition is expanded before being used, so
51751 you can put lookups or conditions there. When the right-hand side evaluates to
51752 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
51753 </para>
51754 <para>
51755 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
51756 large ones may cause significant performance degradation. As most spam messages
51757 are quite small, it is recommended that you do not scan the big ones. For
51758 example:
51759 </para>
51760 <literallayout class="monospaced">
51761 deny message = This message was classified as SPAM
51762      condition = ${if &lt; {$message_size}{10K}}
51763      spam = nobody
51764 </literallayout>
51765 <para>
51766 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
51767 SpamAssassin profile has been matched or exceeded. If you want to use the
51768 <option>spam</option> condition for its side effects (see the variables below), you can make
51769 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
51770 </para>
51771 <para>
51772 <indexterm role="concept">
51773 <primary>spam scanning</primary>
51774 <secondary>returned variables</secondary>
51775 </indexterm>
51776 When the <option>spam</option> condition is run, it sets up a number of expansion
51777 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
51778 within ACLs; their values are not retained with the message and so cannot be
51779 used at delivery time.
51780 </para>
51781 <variablelist>
51782 <varlistentry>
51783 <term><varname>$spam_score</varname></term>
51784 <listitem>
51785 <para>
51786 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
51787 for inclusion in log or reject messages.
51788 </para>
51789 </listitem></varlistentry>
51790 <varlistentry>
51791 <term><varname>$spam_score_int</varname></term>
51792 <listitem>
51793 <para>
51794 The spam score of the message, multiplied by ten, as an integer value. For
51795 example <quote>34</quote> or <quote>305</quote>. This is useful for numeric comparisons in
51796 conditions. This variable is special; its value is saved with the message, and
51797 written to Exim&#x2019;s spool file. This means that it can be used during the whole
51798 life of the message on your Exim system, in particular, in routers or
51799 transports during the later delivery phase.
51800 </para>
51801 </listitem></varlistentry>
51802 <varlistentry>
51803 <term><varname>$spam_bar</varname></term>
51804 <listitem>
51805 <para>
51806 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
51807 integer part of the spam score value. A spam score of 4.4 would have a
51808 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
51809 headers, since MUAs can match on such strings.
51810 </para>
51811 </listitem></varlistentry>
51812 <varlistentry>
51813 <term><varname>$spam_report</varname></term>
51814 <listitem>
51815 <para>
51816 A multiline text table, containing the full SpamAssassin report for the
51817 message. Useful for inclusion in headers or reject messages.
51818 </para>
51819 </listitem></varlistentry>
51820 </variablelist>
51821 <para>
51822 The <option>spam</option> condition caches its results. If you call it again with the same
51823 user name, it does not scan again, but rather returns the same values as
51824 before.
51825 </para>
51826 <para>
51827 The <option>spam</option> condition returns DEFER if there is any error while running the
51828 message through SpamAssassin. If you want to treat DEFER as FAIL (to pass on to
51829 the next ACL statement block), append <literal>/defer_ok</literal> to the right-hand side of
51830 the spam condition, like this:
51831 </para>
51832 <literallayout class="monospaced">
51833 deny message = This message was classified as SPAM
51834      spam    = joe/defer_ok
51835 </literallayout>
51836 <para>
51837 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
51838 </para>
51839 <para>
51840 Here is a longer, commented example of the use of the <option>spam</option>
51841 condition:
51842 </para>
51843 <literallayout class="monospaced">
51844 # put headers in all messages (no matter if spam or not)
51845 warn  spam = nobody:true
51846       add_header = X-Spam-Score: $spam_score ($spam_bar)
51847       add_header = X-Spam-Report: $spam_report
51848
51849 # add second subject line with *SPAM* marker when message
51850 # is over threshold
51851 warn  spam = nobody
51852       add_header = Subject: *SPAM* $h_Subject:
51853
51854 # reject spam at high scores (&gt; 12)
51855 deny  message = This message scored $spam_score spam points.
51856       spam = nobody:true
51857       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
51858 </literallayout>
51859 </section>
51860 <section id="SECTscanmimepart">
51861 <title>Scanning MIME parts</title>
51862 <para>
51863 <indexterm role="concept">
51864 <primary>content scanning</primary>
51865 <secondary>MIME parts</secondary>
51866 </indexterm>
51867 <indexterm role="concept">
51868 <primary>MIME content scanning</primary>
51869 </indexterm>
51870 <indexterm role="option">
51871 <primary><option>acl_smtp_mime</option></primary>
51872 </indexterm>
51873 <indexterm role="option">
51874 <primary><option>acl_not_smtp_mime</option></primary>
51875 </indexterm>
51876 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
51877 each MIME part of an SMTP message, including multipart types, in the sequence
51878 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
51879 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
51880 options may both refer to the same ACL if you want the same processing in both
51881 cases.
51882 </para>
51883 <para>
51884 These ACLs are called (possibly many times) just before the
51885 <option>acl_smtp_data</option> ACL in the case of an SMTP message, or just before the
51886 <option>acl_not_smtp</option> ACL in the case of a non-SMTP message. However, a MIME ACL
51887 is called only if the message contains a <emphasis>MIME-Version:</emphasis> header line. When a
51888 call to a MIME ACL does not yield <quote>accept</quote>, ACL processing is aborted and the
51889 appropriate result code is sent to the client. In the case of an SMTP message,
51890 the <option>acl_smtp_data</option> ACL is not called when this happens.
51891 </para>
51892 <para>
51893 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
51894 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
51895 condition to match against the raw MIME part. You can also use the
51896 <option>mime_regex</option> condition to match against the decoded MIME part (see section
51897 <xref linkend="SECTscanregex"/>).
51898 </para>
51899 <para>
51900 At the start of a MIME ACL, a number of variables are set from the header
51901 information for the relevant MIME part. These are described below. The contents
51902 of the MIME part are not by default decoded into a disk file except for MIME
51903 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
51904 part into a disk file, you can use the <option>decode</option> condition. The general
51905 syntax is:
51906 </para>
51907 <literallayout>
51908 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
51909 </literallayout>
51910 <para>
51911 The right hand side is expanded before use. After expansion,
51912 the value can be:
51913 </para>
51914 <orderedlist numeration="arabic">
51915 <listitem>
51916 <para>
51917 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
51918 </para>
51919 </listitem>
51920 <listitem>
51921 <para>
51922 The string <quote>default</quote>. In that case, the file is put in the temporary
51923 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
51924 a sequential file name consisting of the message id and a sequence number. The
51925 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
51926 </para>
51927 </listitem>
51928 <listitem>
51929 <para>
51930 A full path name starting with a slash. If the full name is an existing
51931 directory, it is used as a replacement for the default directory. The filename
51932 is then sequentially assigned. If the path does not exist, it is used as
51933 the full path and file name.
51934 </para>
51935 </listitem>
51936 <listitem>
51937 <para>
51938 If the string does not start with a slash, it is used as the
51939 filename, and the default path is then used.
51940 </para>
51941 </listitem>
51942 </orderedlist>
51943 <para>
51944 <phrase revisionflag="changed">The <option>decode</option> condition normally succeeds. It is only false for syntax
51945 errors or unusual circumstances such as memory shortages.</phrase>
51946 You can easily decode a file with its original, proposed filename using
51947 </para>
51948 <literallayout class="monospaced">
51949 decode = $mime_filename
51950 </literallayout>
51951 <para>
51952 However, you should keep in mind that <varname>$mime_filename</varname> might contain
51953 anything. If you place files outside of the default path, they are not
51954 automatically unlinked.
51955 </para>
51956 <para>
51957 For RFC822 attachments (these are messages attached to messages, with a
51958 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
51959 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
51960 variable is set (see below). Attached messages are always decoded to disk
51961 before being checked, and the files are unlinked once the check is done.
51962 </para>
51963 <para>
51964 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
51965 used to match regular expressions against raw and decoded MIME parts,
51966 respectively. They are described in section <xref linkend="SECTscanregex"/>.
51967 </para>
51968 <para>
51969 <indexterm role="concept">
51970 <primary>MIME content scanning</primary>
51971 <secondary>returned variables</secondary>
51972 </indexterm>
51973 The following list describes all expansion variables that are
51974 available in the MIME ACL:
51975 </para>
51976 <variablelist>
51977 <varlistentry>
51978 <term><varname>$mime_boundary</varname></term>
51979 <listitem>
51980 <para>
51981 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
51982 have a boundary string, which is stored in this variable. If the current part
51983 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
51984 contains the empty string.
51985 </para>
51986 </listitem></varlistentry>
51987 <varlistentry>
51988 <term><varname>$mime_charset</varname></term>
51989 <listitem>
51990 <para>
51991 This variable contains the character set identifier, if one was found in the
51992 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
51993 </para>
51994 <literallayout class="monospaced">
51995 us-ascii
51996 gb2312 (Chinese)
51997 iso-8859-1
51998 </literallayout>
51999 <para>
52000 Please note that this value is not normalized, so you should do matches
52001 case-insensitively.
52002 </para>
52003 </listitem></varlistentry>
52004 <varlistentry>
52005 <term><varname>$mime_content_description</varname></term>
52006 <listitem>
52007 <para>
52008 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
52009 header. It can contain a human-readable description of the parts content. Some
52010 implementations repeat the filename for attachments here, but they are usually
52011 only used for display purposes.
52012 </para>
52013 </listitem></varlistentry>
52014 <varlistentry>
52015 <term><varname>$mime_content_disposition</varname></term>
52016 <listitem>
52017 <para>
52018 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
52019 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
52020 </para>
52021 </listitem></varlistentry>
52022 <varlistentry>
52023 <term><varname>$mime_content_id</varname></term>
52024 <listitem>
52025 <para>
52026 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
52027 This is a unique ID that can be used to reference a part from another part.
52028 </para>
52029 </listitem></varlistentry>
52030 <varlistentry>
52031 <term><varname>$mime_content_size</varname></term>
52032 <listitem>
52033 <para>
52034 This variable is set only after the <option>decode</option> modifier (see above) has been
52035 successfully run. It contains the size of the decoded part in kilobytes. The
52036 size is always rounded up to full kilobytes, so only a completely empty part
52037 has a <varname>$mime_content_size</varname> of zero.
52038 </para>
52039 </listitem></varlistentry>
52040 <varlistentry>
52041 <term><varname>$mime_content_transfer_encoding</varname></term>
52042 <listitem>
52043 <para>
52044 This variable contains the normalized content of the
52045 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
52046 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
52047 </para>
52048 </listitem></varlistentry>
52049 <varlistentry>
52050 <term><varname>$mime_content_type</varname></term>
52051 <listitem>
52052 <para>
52053 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
52054 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
52055 are some examples of popular MIME types, as they may appear in this variable:
52056 </para>
52057 <literallayout class="monospaced">
52058 text/plain
52059 text/html
52060 application/octet-stream
52061 image/jpeg
52062 audio/midi
52063 </literallayout>
52064 <para>
52065 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
52066 empty string.
52067 </para>
52068 </listitem></varlistentry>
52069 <varlistentry>
52070 <term><varname>$mime_decoded_filename</varname></term>
52071 <listitem>
52072 <para>
52073 This variable is set only after the <option>decode</option> modifier (see above) has been
52074 successfully run. It contains the full path and file name of the file
52075 containing the decoded data.
52076 </para>
52077 </listitem></varlistentry>
52078 </variablelist>
52079 <para>
52080 <indexterm role="concept">
52081 <primary>RFC 2047</primary>
52082 </indexterm>
52083 </para>
52084 <variablelist>
52085 <varlistentry>
52086 <term><varname>$mime_filename</varname></term>
52087 <listitem>
52088 <para>
52089 This is perhaps the most important of the MIME variables. It contains a
52090 proposed filename for an attachment, if one was found in either the
52091 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
52092 RFC2047 decoded, but no additional sanity checks are done. If no filename was
52093 found, this variable contains the empty string.
52094 </para>
52095 </listitem></varlistentry>
52096 <varlistentry>
52097 <term><varname>$mime_is_coverletter</varname></term>
52098 <listitem>
52099 <para>
52100 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
52101 attached data. It can be used to clamp down on flashy or unnecessarily encoded
52102 content in the cover letter, while not restricting attachments at all.
52103 </para>
52104 <para>
52105 The variable contains 1 (true) for a MIME part believed to be part of the
52106 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
52107 follows:
52108 </para>
52109 <orderedlist numeration="arabic">
52110 <listitem>
52111 <para>
52112 The outermost MIME part of a message is always a cover letter.
52113 </para>
52114 </listitem>
52115 <listitem>
52116 <para>
52117 If a multipart/alternative or multipart/related MIME part is a cover letter,
52118 so are all MIME subparts within that multipart.
52119 </para>
52120 </listitem>
52121 <listitem>
52122 <para>
52123 If any other multipart is a cover letter, the first subpart is a cover letter,
52124 and the rest are attachments.
52125 </para>
52126 </listitem>
52127 <listitem>
52128 <para>
52129 All parts contained within an attachment multipart are attachments.
52130 </para>
52131 </listitem>
52132 </orderedlist>
52133 <para>
52134 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
52135 alternative plain text), while allowing HTML files to be attached. HTML
52136 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
52137 </para>
52138 <literallayout class="monospaced">
52139 deny message = HTML mail is not accepted here
52140 !condition = $mime_is_rfc822
52141 condition = $mime_is_coverletter
52142 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
52143 </literallayout>
52144 </listitem></varlistentry>
52145 <varlistentry>
52146 <term><varname>$mime_is_multipart</varname></term>
52147 <listitem>
52148 <para>
52149 This variable has the value 1 (true) when the current part has the main type
52150 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
52151 Since multipart entities only serve as containers for other parts, you may not
52152 want to carry out specific actions on them.
52153 </para>
52154 </listitem></varlistentry>
52155 <varlistentry>
52156 <term><varname>$mime_is_rfc822</varname></term>
52157 <listitem>
52158 <para>
52159 This variable has the value 1 (true) if the current part is not a part of the
52160 checked message itself, but part of an attached message. Attached message
52161 decoding is fully recursive.
52162 </para>
52163 </listitem></varlistentry>
52164 <varlistentry>
52165 <term><varname>$mime_part_count</varname></term>
52166 <listitem>
52167 <para>
52168 This variable is a counter that is raised for each processed MIME part. It
52169 starts at zero for the very first part (which is usually a multipart). The
52170 counter is per-message, so it is reset when processing RFC822 attachments (see
52171 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
52172 complete, so you can use it in the DATA ACL to determine the number of MIME
52173 parts of a message. For non-MIME messages, this variable contains the value -1.
52174 </para>
52175 </listitem></varlistentry>
52176 </variablelist>
52177 </section>
52178 <section id="SECTscanregex">
52179 <title>Scanning with regular expressions</title>
52180 <para>
52181 <indexterm role="concept">
52182 <primary>content scanning</primary>
52183 <secondary>with regular expressions</secondary>
52184 </indexterm>
52185 <indexterm role="concept">
52186 <primary>regular expressions</primary>
52187 <secondary>content scanning with</secondary>
52188 </indexterm>
52189 You can specify your own custom regular expression matches on the full body of
52190 the message, or on individual MIME parts.
52191 </para>
52192 <para>
52193 The <option>regex</option> condition takes one or more regular expressions as arguments and
52194 matches them against the full message (when called in the DATA ACL) or a raw
52195 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
52196 linewise, with a maximum line length of 32K characters. That means you cannot
52197 have multiline matches with the <option>regex</option> condition.
52198 </para>
52199 <para>
52200 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
52201 to 32K of decoded content (the whole content at once, not linewise). If the
52202 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
52203 is decoded automatically when <option>mime_regex</option> is executed (using default path
52204 and filename values). If the decoded data is larger than  32K, only the first
52205 32K characters are checked.
52206 </para>
52207 <para>
52208 The regular expressions are passed as a colon-separated list. To include a
52209 literal colon, you must double it. Since the whole right-hand side string is
52210 expanded before being used, you must also escape dollar signs and backslashes
52211 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
52212 Here is a simple example that contains two regular expressions:
52213 </para>
52214 <literallayout class="monospaced">
52215 deny message = contains blacklisted regex ($regex_match_string)
52216      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
52217 </literallayout>
52218 <para>
52219 The conditions returns true if any one of the regular expressions matches. The
52220 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
52221 matching regular expression.
52222 </para>
52223 <para>
52224 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
52225 CPU-intensive.
52226 </para>
52227 </section>
52228 <section id="SECTdemimecond">
52229 <title>The demime condition</title>
52230 <para>
52231 <indexterm role="concept">
52232 <primary>content scanning</primary>
52233 <secondary>MIME checking</secondary>
52234 </indexterm>
52235 <indexterm role="concept">
52236 <primary>MIME content scanning</primary>
52237 </indexterm>
52238 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
52239 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
52240 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
52241 ACL functionality, but provides no additional facilities. Please note that this
52242 condition is deprecated and kept only for backward compatibility. You must set
52243 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
52244 use the <option>demime</option> condition.
52245 </para>
52246 <para>
52247 The <option>demime</option> condition unpacks MIME containers in the message. It detects
52248 errors in MIME containers and can match file extensions found in the message
52249 against a list. Using this facility produces files containing the unpacked MIME
52250 parts of the message in the temporary scan directory. If you do antivirus
52251 scanning, it is recommended that you use the <option>demime</option> condition before the
52252 antivirus (<option>malware</option>) condition.
52253 </para>
52254 <para>
52255 On the right-hand side of the <option>demime</option> condition you can pass a
52256 colon-separated list of file extensions that it should match against. For
52257 example:
52258 </para>
52259 <literallayout class="monospaced">
52260 deny message = Found blacklisted file attachment
52261      demime  = vbs:com:bat:pif:prf:lnk
52262 </literallayout>
52263 <para>
52264 If one of the file extensions is found, the condition is true, otherwise it is
52265 false. If there is a temporary error while demimeing (for example, <quote>disk
52266 full</quote>), the condition defers, and the message is temporarily rejected (unless
52267 the condition is on a <option>warn</option> verb).
52268 </para>
52269 <para>
52270 The right-hand side is expanded before being treated as a list, so you can have
52271 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
52272 zero (<quote>0</quote>), no demimeing is done and the condition is false.
52273 </para>
52274 <para>
52275 The <option>demime</option> condition set the following variables:
52276 </para>
52277 <variablelist>
52278 <varlistentry>
52279 <term><varname>$demime_errorlevel</varname></term>
52280 <listitem>
52281 <para>
52282 <indexterm role="variable">
52283 <primary><varname>$demime_errorlevel</varname></primary>
52284 </indexterm>
52285 When an error is detected in a MIME container, this variable contains the
52286 severity of the error, as an integer number. The higher the value, the more
52287 severe the error (the current maximum value is 3). If this variable is unset or
52288 zero, no error occurred.
52289 </para>
52290 </listitem></varlistentry>
52291 <varlistentry>
52292 <term><varname>$demime_reason</varname></term>
52293 <listitem>
52294 <para>
52295 <indexterm role="variable">
52296 <primary><varname>$demime_reason</varname></primary>
52297 </indexterm>
52298 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
52299 human-readable text string describing the MIME error that occurred.
52300 </para>
52301 </listitem></varlistentry>
52302 </variablelist>
52303 <variablelist>
52304 <varlistentry>
52305 <term><varname>$found_extension</varname></term>
52306 <listitem>
52307 <para>
52308 <indexterm role="variable">
52309 <primary><varname>$found_extension</varname></primary>
52310 </indexterm>
52311 When the <option>demime</option> condition is true, this variable contains the file
52312 extension it found.
52313 </para>
52314 </listitem></varlistentry>
52315 </variablelist>
52316 <para>
52317 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
52318 the <option>demime</option> condition, and are not changed on subsequent calls.
52319 </para>
52320 <para>
52321 If you do not want to check for file extensions, but rather use the <option>demime</option>
52322 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
52323 right-hand side value. Here is a more elaborate example of how to use this
52324 facility:
52325 </para>
52326 <literallayout class="monospaced">
52327 # Reject messages with serious MIME container errors
52328 deny  message = Found MIME error ($demime_reason).
52329       demime = *
52330       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
52331
52332 # Reject known virus spreading file extensions.
52333 # Accepting these is pretty much braindead.
52334 deny  message = contains $found_extension file (blacklisted).
52335       demime  = com:vbs:bat:pif:scr
52336
52337 # Freeze .exe and .doc files. Postmaster can
52338 # examine them and eventually thaw them.
52339 deny  log_message = Another $found_extension file.
52340       demime = exe:doc
52341       control = freeze
52342 </literallayout>
52343 <para>
52344 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
52345 </para>
52346 </section>
52347 </chapter>
52348
52349 <chapter id="CHAPlocalscan">
52350 <title>Adding a local scan function to Exim</title>
52351 <titleabbrev>Local scan function</titleabbrev>
52352 <para>
52353 <indexterm role="concept" id="IIDlosca" class="startofrange">
52354 <primary><function>local_scan()</function> function</primary>
52355 <secondary>description of</secondary>
52356 </indexterm>
52357 <indexterm role="concept">
52358 <primary>customizing</primary>
52359 <secondary>input scan using C function</secondary>
52360 </indexterm>
52361 <indexterm role="concept">
52362 <primary>policy control</primary>
52363 <secondary>by local scan function</secondary>
52364 </indexterm>
52365 In these days of email worms, viruses, and ever-increasing spam, some sites
52366 want to apply a lot of checking to messages before accepting them.
52367 </para>
52368 <para>
52369 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
52370 passing messages to external virus and spam scanning software. You can also do
52371 a certain amount in Exim itself through string expansions and the <option>condition</option>
52372 condition in the ACL that runs after the SMTP DATA command or the ACL for
52373 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
52374 </para>
52375 <para>
52376 To allow for further customization to a site&#x2019;s own requirements, there is the
52377 possibility of linking Exim with a private message scanning function, written
52378 in C. If you want to run code that is written in something other than C, you
52379 can of course use a little C stub to call it.
52380 </para>
52381 <para>
52382 The local scan function is run once for every incoming message, at the point
52383 when Exim is just about to accept the message.
52384 It can therefore be used to control non-SMTP messages from local processes as
52385 well as messages arriving via SMTP.
52386 </para>
52387 <para>
52388 Exim applies a timeout to calls of the local scan function, and there is an
52389 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
52390 Zero means <quote>no timeout</quote>.
52391 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
52392 before calling the local scan function, so that the most common types of crash
52393 are caught. If the timeout is exceeded or one of those signals is caught, the
52394 incoming message is rejected with a temporary error if it is an SMTP message.
52395 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
52396 code. The incident is logged on the main and reject logs.
52397 </para>
52398 <section id="SECID207">
52399 <title>Building Exim to use a local scan function</title>
52400 <para>
52401 <indexterm role="concept">
52402 <primary><function>local_scan()</function> function</primary>
52403 <secondary>building Exim to use</secondary>
52404 </indexterm>
52405 To make use of the local scan function feature, you must tell Exim where your
52406 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
52407 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
52408 directory, so you might set
52409 </para>
52410 <literallayout class="monospaced">
52411 LOCAL_SCAN_SOURCE=Local/local_scan.c
52412 </literallayout>
52413 <para>
52414 for example. The function must be called <function>local_scan()</function>. It is called by
52415 Exim after it has received a message, when the success return code is about to
52416 be sent. This is after all the ACLs have been run. The return code from your
52417 function controls whether the message is actually accepted or not. There is a
52418 commented template function (that just accepts the message) in the file
52419 _src/local_scan.c_.
52420 </para>
52421 <para>
52422 If you want to make use of Exim&#x2019;s run time configuration file to set options
52423 for your <function>local_scan()</function> function, you must also set
52424 </para>
52425 <literallayout class="monospaced">
52426 LOCAL_SCAN_HAS_OPTIONS=yes
52427 </literallayout>
52428 <para>
52429 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
52430 </para>
52431 </section>
52432 <section id="SECTapiforloc">
52433 <title>API for local_scan()</title>
52434 <para>
52435 <indexterm role="concept">
52436 <primary><function>local_scan()</function> function</primary>
52437 <secondary>API description</secondary>
52438 </indexterm>
52439 You must include this line near the start of your code:
52440 </para>
52441 <literallayout class="monospaced">
52442 #include "local_scan.h"
52443 </literallayout>
52444 <para>
52445 This header file defines a number of variables and other values, and the
52446 prototype for the function itself. Exim is coded to use unsigned char values
52447 almost exclusively, and one of the things this header defines is a shorthand
52448 for <literal>unsigned char</literal> called <literal>uschar</literal>.
52449 It also contains the following macro definitions, to simplify casting character
52450 strings and pointers to character strings:
52451 </para>
52452 <literallayout class="monospaced">
52453 #define CS   (char *)
52454 #define CCS  (const char *)
52455 #define CSS  (char **)
52456 #define US   (unsigned char *)
52457 #define CUS  (const unsigned char *)
52458 #define USS  (unsigned char **)
52459 </literallayout>
52460 <para>
52461 The function prototype for <function>local_scan()</function> is:
52462 </para>
52463 <literallayout class="monospaced">
52464 extern int local_scan(int fd, uschar **return_text);
52465 </literallayout>
52466 <para>
52467 The arguments are as follows:
52468 </para>
52469 <itemizedlist>
52470 <listitem>
52471 <para>
52472 <option>fd</option> is a file descriptor for the file that contains the body of the message
52473 (the -D file). The file is open for reading and writing, but updating it is not
52474 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
52475 </para>
52476 <para>
52477 The descriptor is positioned at character 19 of the file, which is the first
52478 character of the body itself, because the first 19 characters are the message
52479 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
52480 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
52481 case this changes in some future version.
52482 </para>
52483 </listitem>
52484 <listitem>
52485 <para>
52486 <option>return_text</option> is an address which you can use to return a pointer to a text
52487 string at the end of the function. The value it points to on entry is NULL.
52488 </para>
52489 </listitem>
52490 </itemizedlist>
52491 <para>
52492 The function must return an <option>int</option> value which is one of the following macros:
52493 </para>
52494 <variablelist>
52495 <varlistentry>
52496 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
52497 <listitem>
52498 <para>
52499 <indexterm role="variable">
52500 <primary><varname>$local_scan_data</varname></primary>
52501 </indexterm>
52502 The message is accepted. If you pass back a string of text, it is saved with
52503 the message, and made available in the variable <varname>$local_scan_data</varname>. No
52504 newlines are permitted (if there are any, they are turned into spaces) and the
52505 maximum length of text is 1000 characters.
52506 </para>
52507 </listitem></varlistentry>
52508 <varlistentry>
52509 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
52510 <listitem>
52511 <para>
52512 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
52513 queued without immediate delivery, and is frozen.
52514 </para>
52515 </listitem></varlistentry>
52516 <varlistentry>
52517 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
52518 <listitem>
52519 <para>
52520 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
52521 queued without immediate delivery.
52522 </para>
52523 </listitem></varlistentry>
52524 <varlistentry>
52525 <term><literal>LOCAL_SCAN_REJECT</literal></term>
52526 <listitem>
52527 <para>
52528 The message is rejected; the returned text is used as an error message which is
52529 passed back to the sender and which is also logged. Newlines are permitted &ndash;
52530 they cause a multiline response for SMTP rejections, but are converted to
52531 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
52532 used.
52533 </para>
52534 </listitem></varlistentry>
52535 <varlistentry>
52536 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
52537 <listitem>
52538 <para>
52539 The message is temporarily rejected; the returned text is used as an error
52540 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
52541 problem</quote> is used.
52542 </para>
52543 </listitem></varlistentry>
52544 <varlistentry>
52545 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
52546 <listitem>
52547 <para>
52548 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
52549 message is not written to the reject log. It has the effect of unsetting the
52550 <option>rejected_header</option> log selector for just this rejection. If
52551 <option>rejected_header</option> is already unset (see the discussion of the
52552 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
52553 same as LOCAL_SCAN_REJECT.
52554 </para>
52555 </listitem></varlistentry>
52556 <varlistentry>
52557 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
52558 <listitem>
52559 <para>
52560 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
52561 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
52562 </para>
52563 </listitem></varlistentry>
52564 </variablelist>
52565 <para>
52566 If the message is not being received by interactive SMTP, rejections are
52567 reported by writing to <option>stderr</option> or by sending an email, as configured by the
52568 <option>-oe</option> command line options.
52569 </para>
52570 </section>
52571 <section id="SECTconoptloc">
52572 <title>Configuration options for local_scan()</title>
52573 <para>
52574 <indexterm role="concept">
52575 <primary><function>local_scan()</function> function</primary>
52576 <secondary>configuration options</secondary>
52577 </indexterm>
52578 It is possible to have option settings in the main configuration file
52579 that set values in static variables in the <function>local_scan()</function> module. If you
52580 want to do this, you must have the line
52581 </para>
52582 <literallayout class="monospaced">
52583 LOCAL_SCAN_HAS_OPTIONS=yes
52584 </literallayout>
52585 <para>
52586 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
52587 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
52588 file, you must define static variables to hold the option values, and a table
52589 to define them.
52590 </para>
52591 <para>
52592 The table must be a vector called <option>local_scan_options</option>, of type
52593 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
52594 and a pointer to the variable that holds the value. The entries must appear in
52595 alphabetical order. Following <option>local_scan_options</option> you must also define a
52596 variable called <option>local_scan_options_count</option> that contains the number of
52597 entries in the table. Here is a short example, showing two kinds of option:
52598 </para>
52599 <literallayout class="monospaced">
52600 static int my_integer_option = 42;
52601 static uschar *my_string_option = US"a default string";
52602
52603 optionlist local_scan_options[] = {
52604   { "my_integer", opt_int,       &amp;my_integer_option },
52605   { "my_string",  opt_stringptr, &amp;my_string_option }
52606 };
52607
52608 int local_scan_options_count =
52609   sizeof(local_scan_options)/sizeof(optionlist);
52610 </literallayout>
52611 <para>
52612 The values of the variables can now be changed from Exim&#x2019;s runtime
52613 configuration file by including a local scan section as in this example:
52614 </para>
52615 <literallayout class="monospaced">
52616 begin local_scan
52617 my_integer = 99
52618 my_string = some string of text...
52619 </literallayout>
52620 <para>
52621 The available types of option data are as follows:
52622 </para>
52623 <variablelist>
52624 <varlistentry>
52625 <term><emphasis role="bold">opt_bool</emphasis></term>
52626 <listitem>
52627 <para>
52628 This specifies a boolean (true/false) option. The address should point to a
52629 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
52630 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
52631 whether such a variable has been set at all, you can initialize it to
52632 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
52633 values.)
52634 </para>
52635 </listitem></varlistentry>
52636 <varlistentry>
52637 <term><emphasis role="bold">opt_fixed</emphasis></term>
52638 <listitem>
52639 <para>
52640 This specifies a fixed point number, such as is used for load averages.
52641 The address should point to a variable of type <literal>int</literal>. The value is stored
52642 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
52643 </para>
52644 </listitem></varlistentry>
52645 <varlistentry>
52646 <term><emphasis role="bold">opt_int</emphasis></term>
52647 <listitem>
52648 <para>
52649 This specifies an integer; the address should point to a variable of type
52650 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
52651 Exim.
52652 </para>
52653 </listitem></varlistentry>
52654 <varlistentry>
52655 <term><emphasis role="bold">opt_mkint</emphasis></term>
52656 <listitem>
52657 <para>
52658 This is the same as <option>opt_int</option>, except that when such a value is output in a
52659 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
52660 printed with the suffix K or M.
52661 </para>
52662 </listitem></varlistentry>
52663 <varlistentry>
52664 <term><emphasis role="bold">opt_octint</emphasis></term>
52665 <listitem>
52666 <para>
52667 This also specifies an integer, but the value is always interpreted as an
52668 octal integer, whether or not it starts with the digit zero, and it is
52669 always output in octal.
52670 </para>
52671 </listitem></varlistentry>
52672 <varlistentry>
52673 <term><emphasis role="bold">opt_stringptr</emphasis></term>
52674 <listitem>
52675 <para>
52676 This specifies a string value; the address must be a pointer to a
52677 variable that points to a string (for example, of type <literal>uschar *</literal>).
52678 </para>
52679 </listitem></varlistentry>
52680 <varlistentry>
52681 <term><emphasis role="bold">opt_time</emphasis></term>
52682 <listitem>
52683 <para>
52684 This specifies a time interval value. The address must point to a variable of
52685 type <literal>int</literal>. The value that is placed there is a number of seconds.
52686 </para>
52687 </listitem></varlistentry>
52688 </variablelist>
52689 <para>
52690 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
52691 out the values of all the <function>local_scan()</function> options.
52692 </para>
52693 </section>
52694 <section id="SECID208">
52695 <title>Available Exim variables</title>
52696 <para>
52697 <indexterm role="concept">
52698 <primary><function>local_scan()</function> function</primary>
52699 <secondary>available Exim variables</secondary>
52700 </indexterm>
52701 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
52702 are the only ones that are guaranteed to be maintained from release to release.
52703 Note, however, that you can obtain the value of any Exim variable,
52704 <phrase revisionflag="changed">including <varname>$recipients</varname>,</phrase> by calling <emphasis>expand_string()</emphasis>. The exported
52705 variables are as follows:
52706 </para>
52707 <variablelist>
52708 <varlistentry>
52709 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
52710 <listitem>
52711 <para>
52712 This variable is set to zero when no debugging is taking place. Otherwise, it
52713 is a bitmap of debugging selectors. Two bits are identified for use in
52714 <function>local_scan()</function>; they are defined as macros:
52715 </para>
52716 <itemizedlist>
52717 <listitem>
52718 <para>
52719 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
52720 testing option that is not privileged &ndash; any caller may set it. All the
52721 other selector bits can be set only by admin users.
52722 </para>
52723 </listitem>
52724 <listitem>
52725 <para>
52726 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
52727 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
52728 of debugging bits.
52729 </para>
52730 </listitem>
52731 </itemizedlist>
52732 <para>
52733 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
52734 selected, you should use code like this:
52735 </para>
52736 <literallayout class="monospaced">
52737 if ((debug_selector &amp; D_local_scan) != 0)
52738   debug_printf("xxx", ...);
52739 </literallayout>
52740 </listitem></varlistentry>
52741 <varlistentry>
52742 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
52743 <listitem>
52744 <para>
52745 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
52746 variable <option>expand_string_message</option> contains the error message, zero-terminated.
52747 </para>
52748 </listitem></varlistentry>
52749 <varlistentry>
52750 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
52751 <listitem>
52752 <para>
52753 A pointer to a chain of header lines. The <option>header_line</option> structure is
52754 discussed below.
52755 </para>
52756 </listitem></varlistentry>
52757 <varlistentry>
52758 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
52759 <listitem>
52760 <para>
52761 A pointer to the last of the header lines.
52762 </para>
52763 </listitem></varlistentry>
52764 <varlistentry>
52765 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
52766 <listitem>
52767 <para>
52768 The value of the <option>headers_charset</option> configuration option.
52769 </para>
52770 </listitem></varlistentry>
52771 <varlistentry>
52772 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
52773 <listitem>
52774 <para>
52775 This variable is TRUE during a host checking session that is initiated by the
52776 <option>-bh</option> command line option.
52777 </para>
52778 </listitem></varlistentry>
52779 <varlistentry>
52780 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
52781 <listitem>
52782 <para>
52783 The IP address of the interface that received the message, as a string. This
52784 is NULL for locally submitted messages.
52785 </para>
52786 </listitem></varlistentry>
52787 <varlistentry>
52788 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
52789 <listitem>
52790 <para>
52791 The port on which this message was received. When testing with the <option>-bh</option>
52792 command line option, the value of this variable is -1 unless a port has been
52793 specified via the <option>-oMi</option> option.
52794 </para>
52795 </listitem></varlistentry>
52796 <varlistentry>
52797 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
52798 <listitem>
52799 <para>
52800 This variable contains Exim&#x2019;s message id for the incoming message (the value of
52801 <varname>$message_exim_id</varname>) as a zero-terminated string.
52802 </para>
52803 </listitem></varlistentry>
52804 <varlistentry>
52805 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
52806 <listitem>
52807 <para>
52808 The name of the protocol by which the message was received.
52809 </para>
52810 </listitem></varlistentry>
52811 <varlistentry>
52812 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
52813 <listitem>
52814 <para>
52815 The number of accepted recipients.
52816 </para>
52817 </listitem></varlistentry>
52818 <varlistentry>
52819 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
52820 <listitem>
52821 <para>
52822 <indexterm role="concept">
52823 <primary>recipient</primary>
52824 <secondary>adding in local scan</secondary>
52825 </indexterm>
52826 <indexterm role="concept">
52827 <primary>recipient</primary>
52828 <secondary>removing in local scan</secondary>
52829 </indexterm>
52830 The list of accepted recipients, held in a vector of length
52831 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
52832 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
52833 below). You can delete recipients by removing them from the vector and
52834 adjusting the value in <option>recipients_count</option>. In particular, by setting
52835 <option>recipients_count</option> to zero you remove all recipients. If you then return the
52836 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
52837 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
52838 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
52839 </para>
52840 </listitem></varlistentry>
52841 <varlistentry>
52842 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
52843 <listitem>
52844 <para>
52845 The envelope sender address. For bounce messages this is the empty string.
52846 </para>
52847 </listitem></varlistentry>
52848 <varlistentry>
52849 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
52850 <listitem>
52851 <para>
52852 The IP address of the sending host, as a string. This is NULL for
52853 locally-submitted messages.
52854 </para>
52855 </listitem></varlistentry>
52856 <varlistentry>
52857 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
52858 <listitem>
52859 <para>
52860 The name of the authentication mechanism that was used, or NULL if the message
52861 was not received over an authenticated SMTP connection.
52862 </para>
52863 </listitem></varlistentry>
52864 <varlistentry>
52865 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
52866 <listitem>
52867 <para>
52868 The name of the sending host, if known.
52869 </para>
52870 </listitem></varlistentry>
52871 <varlistentry>
52872 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
52873 <listitem>
52874 <para>
52875 The port on the sending host.
52876 </para>
52877 </listitem></varlistentry>
52878 <varlistentry>
52879 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
52880 <listitem>
52881 <para>
52882 This variable is TRUE for all SMTP input, including BSMTP.
52883 </para>
52884 </listitem></varlistentry>
52885 <varlistentry>
52886 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
52887 <listitem>
52888 <para>
52889 This variable is TRUE for BSMTP input.
52890 </para>
52891 </listitem></varlistentry>
52892 <varlistentry>
52893 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
52894 <listitem>
52895 <para>
52896 The contents of this variable control which pool of memory is used for new
52897 requests. See section <xref linkend="SECTmemhanloc"/> for details.
52898 </para>
52899 </listitem></varlistentry>
52900 </variablelist>
52901 </section>
52902 <section id="SECID209">
52903 <title>Structure of header lines</title>
52904 <para>
52905 The <option>header_line</option> structure contains the members listed below.
52906 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
52907 (see below). You can cause header lines to be ignored (deleted) by setting
52908 their type to *.
52909 </para>
52910 <variablelist>
52911 <varlistentry>
52912 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
52913 <listitem>
52914 <para>
52915 A pointer to the next header line, or NULL for the last line.
52916 </para>
52917 </listitem></varlistentry>
52918 <varlistentry>
52919 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
52920 <listitem>
52921 <para>
52922 A code identifying certain headers that Exim recognizes. The codes are printing
52923 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
52924 Notice in particular that any header line whose type is * is not transmitted
52925 with the message. This flagging is used for header lines that have been
52926 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
52927 lines.) Effectively, * means <quote>deleted</quote>.
52928 </para>
52929 </listitem></varlistentry>
52930 <varlistentry>
52931 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
52932 <listitem>
52933 <para>
52934 The number of characters in the header line, including the terminating and any
52935 internal newlines.
52936 </para>
52937 </listitem></varlistentry>
52938 <varlistentry>
52939 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
52940 <listitem>
52941 <para>
52942 A pointer to the text of the header. It always ends with a newline, followed by
52943 a zero byte. Internal newlines are preserved.
52944 </para>
52945 </listitem></varlistentry>
52946 </variablelist>
52947 </section>
52948 <section id="SECID210">
52949 <title>Structure of recipient items</title>
52950 <para>
52951 The <option>recipient_item</option> structure contains these members:
52952 </para>
52953 <variablelist>
52954 <varlistentry>
52955 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
52956 <listitem>
52957 <para>
52958 This is a pointer to the recipient address as it was received.
52959 </para>
52960 </listitem></varlistentry>
52961 <varlistentry>
52962 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
52963 <listitem>
52964 <para>
52965 This is used in later Exim processing when top level addresses are created by
52966 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
52967 and must always contain -1 at this stage.
52968 </para>
52969 </listitem></varlistentry>
52970 <varlistentry>
52971 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
52972 <listitem>
52973 <para>
52974 If this value is not NULL, bounce messages caused by failing to deliver to the
52975 recipient are sent to the address it contains. In other words, it overrides the
52976 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
52977 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
52978 an unqualified address, Exim qualifies it using the domain from
52979 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
52980 is NULL for all recipients.
52981 </para>
52982 </listitem></varlistentry>
52983 </variablelist>
52984 </section>
52985 <section id="SECID211">
52986 <title>Available Exim functions</title>
52987 <para>
52988 <indexterm role="concept">
52989 <primary><function>local_scan()</function> function</primary>
52990 <secondary>available Exim functions</secondary>
52991 </indexterm>
52992 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
52993 These are the only ones that are guaranteed to be maintained from release to
52994 release:
52995 </para>
52996 <variablelist>
52997 <varlistentry>
52998 <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>
52999 <listitem>
53000 <para>
53001 This function creates a child process that runs the command specified by
53002 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
53003 be NULL if no environment variables are to be passed. A new umask is supplied
53004 for the process in <option>newumask</option>.
53005 </para>
53006 <para>
53007 Pipes to the standard input and output of the new process are set up
53008 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
53009 standard error is cloned to the standard output. If there are any file
53010 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
53011 argument is TRUE, the new process is made into a process group leader.
53012 </para>
53013 <para>
53014 The function returns the pid of the new process, or -1 if things go wrong.
53015 </para>
53016 </listitem></varlistentry>
53017 <varlistentry>
53018 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
53019 <listitem>
53020 <para>
53021 This function waits for a child process to terminate, or for a timeout (in
53022 seconds) to expire. A timeout value of zero means wait as long as it takes. The
53023 return value is as follows:
53024 </para>
53025 <itemizedlist>
53026 <listitem>
53027 <para>
53028 &gt;= 0
53029 </para>
53030 <para>
53031 The process terminated by a normal exit and the value is the process
53032 ending status.
53033 </para>
53034 </listitem>
53035 <listitem>
53036 <para>
53037 &lt; 0 and &gt; &ndash;256
53038 </para>
53039 <para>
53040 The process was terminated by a signal and the value is the negation of the
53041 signal number.
53042 </para>
53043 </listitem>
53044 <listitem>
53045 <para>
53046 &ndash;256
53047 </para>
53048 <para>
53049 The process timed out.
53050 </para>
53051 </listitem>
53052 <listitem>
53053 <para>
53054 &ndash;257
53055 </para>
53056 <para>
53057 The was some other error in wait(); <option>errno</option> is still set.
53058 </para>
53059 </listitem>
53060 </itemizedlist>
53061 </listitem></varlistentry>
53062 <varlistentry>
53063 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
53064 <listitem>
53065 <para>
53066 This function provide you with a means of submitting a new message to
53067 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
53068 want, but this packages it all up for you.) The function creates a pipe,
53069 forks a subprocess that is running
53070 </para>
53071 <literallayout class="monospaced">
53072 exim -t -oem -oi -f &lt;&gt;
53073 </literallayout>
53074 <para>
53075 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
53076 that is connected to the standard input. The yield of the function is the PID
53077 of the subprocess. You can then write a message to the file descriptor, with
53078 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
53079 </para>
53080 <para>
53081 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
53082 finish and to collect its ending status. A timeout value of zero is usually
53083 fine in this circumstance. Unless you have made a mistake with the recipient
53084 addresses, you should get a return code of zero.
53085 </para>
53086 </listitem></varlistentry>
53087 <varlistentry>
53088 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
53089 <listitem>
53090 <para>
53091 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
53092 that it runs is:
53093 </para>
53094 <literallayout>
53095 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
53096 </literallayout>
53097 <para>
53098 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
53099 </para>
53100 </listitem></varlistentry>
53101 <varlistentry>
53102 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
53103 <listitem>
53104 <para>
53105 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
53106 output is written to the standard error stream. If no debugging is selected,
53107 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
53108 conditional on the <literal>local_scan</literal> debug selector by coding like this:
53109 </para>
53110 <literallayout class="monospaced">
53111 if ((debug_selector &amp; D_local_scan) != 0)
53112   debug_printf("xxx", ...);
53113 </literallayout>
53114 </listitem></varlistentry>
53115 <varlistentry>
53116 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
53117 <listitem>
53118 <para>
53119 This is an interface to Exim&#x2019;s string expansion code. The return value is the
53120 expanded string, or NULL if there was an expansion failure.
53121 The C variable <option>expand_string_message</option> contains an error message after an
53122 expansion failure. If expansion does not change the string, the return value is
53123 the pointer to the input string. Otherwise, the return value points to a new
53124 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
53125 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
53126 </para>
53127 </listitem></varlistentry>
53128 <varlistentry>
53129 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
53130 <listitem>
53131 <para>
53132 This function allows you to an add additional header line at the end of the
53133 existing ones. The first argument is the type, and should normally be a space
53134 character. The second argument is a format string and any number of
53135 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
53136 if you want, and you must ensure that the string ends with a newline.
53137 </para>
53138 </listitem></varlistentry>
53139 <varlistentry>
53140 <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>
53141 <listitem>
53142 <para>
53143 This function adds a new header line at a specified point in the header
53144 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
53145 </para>
53146 <para>
53147 If <option>name</option> is NULL, the new header is added at the end of the chain if
53148 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
53149 NULL, the header lines are searched for the first non-deleted header that
53150 matches the name. If one is found, the new header is added before it if
53151 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
53152 found header and any adjacent subsequent ones with the same name (even if
53153 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
53154 option controls where the header is added. If it is true, addition is at the
53155 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
53156 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
53157 </para>
53158 <literallayout class="monospaced">
53159 header_add_at_position(TRUE, US"Received", TRUE,
53160   ' ', "X-xxx: ...");
53161 </literallayout>
53162 <para>
53163 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
53164 there may not be if <option>received_header_text</option> expands to an empty string.
53165 </para>
53166 </listitem></varlistentry>
53167 <varlistentry>
53168 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
53169 <listitem>
53170 <para>
53171 This function removes header lines. If <option>occurrence</option> is zero or negative, all
53172 occurrences of the header are removed. If occurrence is greater than zero, that
53173 particular instance of the header is removed. If no header(s) can be found that
53174 match the specification, the function does nothing.
53175 </para>
53176 </listitem></varlistentry>
53177 <varlistentry>
53178 <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>
53179 <listitem>
53180 <para>
53181 This function tests whether the given header has the given name. It is not just
53182 a string comparison, because white space is permitted between the name and the
53183 colon. If the <option>notdel</option> argument is true, a false return is forced for all
53184 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
53185 </para>
53186 <literallayout class="monospaced">
53187 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
53188 </literallayout>
53189 </listitem></varlistentry>
53190 <varlistentry>
53191 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
53192 <listitem>
53193 <para>
53194 <indexterm role="concept">
53195 <primary>base64 encoding</primary>
53196 <secondary>functions for <function>local_scan()</function> use</secondary>
53197 </indexterm>
53198 This function base64-encodes a string, which is passed by address and length.
53199 The text may contain bytes of any value, including zero. The result is passed
53200 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
53201 zero-terminated.
53202 </para>
53203 </listitem></varlistentry>
53204 <varlistentry>
53205 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
53206 <listitem>
53207 <para>
53208 This function decodes a base64-encoded string. Its arguments are a
53209 zero-terminated base64-encoded string and the address of a variable that is set
53210 to point to the result, which is in dynamic memory. The length of the decoded
53211 string is the yield of the function. If the input is invalid base64 data, the
53212 yield is -1. A zero byte is added to the end of the output string to make it
53213 easy to interpret as a C string (assuming it contains no zeros of its own). The
53214 added zero byte is not included in the returned count.
53215 </para>
53216 </listitem></varlistentry>
53217 <varlistentry>
53218 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
53219 <listitem>
53220 <para>
53221 This function checks for a match in a domain list. Domains are always
53222 matched caselessly. The return value is one of the following:
53223 </para>
53224 <literallayout>
53225 <literal>OK     </literal> match succeeded
53226 <literal>FAIL   </literal> match failed
53227 <literal>DEFER  </literal> match deferred
53228 </literallayout>
53229 <para>
53230 DEFER is usually caused by some kind of lookup defer, such as the
53231 inability to contact a database.
53232 </para>
53233 </listitem></varlistentry>
53234 <varlistentry>
53235 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
53236 <listitem>
53237 <para>
53238 This function checks for a match in a local part list. The third argument
53239 controls case-sensitivity. The return values are as for
53240 <emphasis>lss_match_domain()</emphasis>.
53241 </para>
53242 </listitem></varlistentry>
53243 <varlistentry>
53244 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
53245 <listitem>
53246 <para>
53247 This function checks for a match in an address list. The third argument
53248 controls the case-sensitivity of the local part match. The domain is always
53249 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
53250 </para>
53251 </listitem></varlistentry>
53252 <varlistentry>
53253 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
53254 <listitem>
53255 <para>
53256 This function checks for a match in a host list. The most common usage is
53257 expected to be
53258 </para>
53259 <literallayout class="monospaced">
53260 lss_match_host(sender_host_name, sender_host_address, ...)
53261 </literallayout>
53262 <para>
53263 <indexterm role="variable">
53264 <primary><varname>$sender_host_address</varname></primary>
53265 </indexterm>
53266 An empty address field matches an empty item in the host list. If the host name
53267 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
53268 looked up if a host name is required to match an item in the list. The return
53269 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
53270 returns ERROR in the case when it had to look up a host name, but the lookup
53271 failed.
53272 </para>
53273 </listitem></varlistentry>
53274 <varlistentry>
53275 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
53276 <listitem>
53277 <para>
53278 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
53279 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
53280 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
53281 them. It specifies to which log or logs the message is written. The remaining
53282 arguments are a format and relevant insertion arguments. The string should not
53283 contain any newlines, not even at the end.
53284 </para>
53285 </listitem></varlistentry>
53286 <varlistentry>
53287 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
53288 <listitem>
53289 <para>
53290 This function adds an additional recipient to the message. The first argument
53291 is the recipient address. If it is unqualified (has no domain), it is qualified
53292 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
53293 </para>
53294 <para>
53295 This function does not allow you to specify a private <option>errors_to</option> address (as
53296 described with the structure of <option>recipient_item</option> above), because it pre-dates
53297 the addition of that field to the structure. However, it is easy to add such a
53298 value afterwards. For example:
53299 </para>
53300 <literallayout class="monospaced">
53301  receive_add_recipient(US"monitor@mydom.example", -1);
53302  recipients_list[recipients_count-1].errors_to =
53303    US"postmaster@mydom.example";
53304 </literallayout>
53305 </listitem></varlistentry>
53306 <varlistentry>
53307 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
53308 <listitem>
53309 <para>
53310 This is a convenience function to remove a named recipient from the list of
53311 recipients. It returns true if a recipient was removed, and false if no
53312 matching recipient could be found. The argument must be a complete email
53313 address.
53314 </para>
53315 </listitem></varlistentry>
53316 </variablelist>
53317 <para>
53318 <indexterm role="concept">
53319 <primary>RFC 2047</primary>
53320 </indexterm>
53321 </para>
53322 <variablelist>
53323 <varlistentry>
53324 <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>
53325 <listitem>
53326 <para>
53327 This function decodes strings that are encoded according to RFC 2047. Typically
53328 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
53329 from the Q or B encoding into a byte-string. Then, if provided with the name of
53330 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
53331 made  to translate the result to the named character set. If this fails, the
53332 binary string is returned with an error message.
53333 </para>
53334 <para>
53335 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
53336 maximum MIME word length is enforced. The third argument is the target
53337 encoding, or NULL if no translation is wanted.
53338 </para>
53339 <para>
53340 <indexterm role="concept">
53341 <primary>binary zero</primary>
53342 <secondary>in RFC 2047 decoding</secondary>
53343 </indexterm>
53344 <indexterm role="concept">
53345 <primary>RFC 2047</primary>
53346 <secondary>binary zero in</secondary>
53347 </indexterm>
53348 If a binary zero is encountered in the decoded string, it is replaced by the
53349 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
53350 not be 0 because header lines are handled as zero-terminated strings.
53351 </para>
53352 <para>
53353 The function returns the result of processing the string, zero-terminated; if
53354 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
53355 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
53356 </para>
53357 <para>
53358 If an error is encountered, the function returns NULL and uses the <option>error</option>
53359 argument to return an error message. The variable pointed to by <option>error</option> is
53360 set to NULL if there is no error; it may be set non-NULL even when the function
53361 returns a non-NULL value if decoding was successful, but there was a problem
53362 with translation.
53363 </para>
53364 </listitem></varlistentry>
53365 <varlistentry>
53366 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
53367 <listitem>
53368 <para>
53369 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
53370 below.
53371 </para>
53372 </listitem></varlistentry>
53373 <varlistentry>
53374 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
53375 <listitem>
53376 <para>
53377 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
53378 output stream. You should use this function only when there is an SMTP output
53379 stream, that is, when the incoming message is being received via interactive
53380 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
53381 is FALSE. If you want to test for an incoming message from another host (as
53382 opposed to a local process that used the <option>-bs</option> command line option), you can
53383 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
53384 is involved.
53385 </para>
53386 <para>
53387 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
53388 output function, so it can be used for all forms of SMTP connection.
53389 </para>
53390 <para>
53391 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
53392 must start with an appropriate response code: 550 if you are going to return
53393 LOCAL_SCAN_REJECT, 451 if you are going to return
53394 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
53395 initial lines of a multi-line response, the code must be followed by a hyphen
53396 to indicate that the line is not the final response line. You must also ensure
53397 that the lines you write terminate with CRLF. For example:
53398 </para>
53399 <literallayout class="monospaced">
53400 smtp_printf("550-this is some extra info\r\n");
53401 return LOCAL_SCAN_REJECT;
53402 </literallayout>
53403 <para>
53404 Note that you can also create multi-line responses by including newlines in
53405 the data returned via the <option>return_text</option> argument. The added value of using
53406 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
53407 multiple output lines.
53408 </para>
53409 <para>
53410 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
53411 does not automatically flush pending output, and therefore does not test
53412 the state of the stream. (In the main code of Exim, flushing and error
53413 detection is done when Exim is ready for the next SMTP input command.) If
53414 you want to flush the output and check for an error (for example, the
53415 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
53416 arguments. It flushes the output stream, and returns a non-zero value if there
53417 is an error.
53418 </para>
53419 </listitem></varlistentry>
53420 <varlistentry>
53421 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
53422 <listitem>
53423 <para>
53424 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
53425 chunk of memory whose size is given by the argument. Exim bombs out if it ever
53426 runs out of memory. See the next section for a discussion of memory handling.
53427 </para>
53428 </listitem></varlistentry>
53429 <varlistentry>
53430 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
53431 <listitem>
53432 <para>
53433 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
53434 permanent pool. See the next section for a discussion of memory handling.
53435 </para>
53436 </listitem></varlistentry>
53437 <varlistentry>
53438 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
53439 <listitem>
53440 <para>
53441 See below.
53442 </para>
53443 </listitem></varlistentry>
53444 <varlistentry>
53445 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
53446 <listitem>
53447 <para>
53448 See below.
53449 </para>
53450 </listitem></varlistentry>
53451 <varlistentry>
53452 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
53453 <listitem>
53454 <para>
53455 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
53456 The first makes a copy of an entire string. The second copies up to a maximum
53457 number of characters, indicated by the second argument. The third uses a format
53458 and insertion arguments to create a new string. In each case, the result is a
53459 pointer to a new string in the current memory pool. See the next section for
53460 more discussion.
53461 </para>
53462 </listitem></varlistentry>
53463 </variablelist>
53464 </section>
53465 <section id="SECTmemhanloc">
53466 <title>More about Exim&#x2019;s memory handling</title>
53467 <para>
53468 <indexterm role="concept">
53469 <primary><function>local_scan()</function> function</primary>
53470 <secondary>memory handling</secondary>
53471 </indexterm>
53472 No function is provided for freeing memory, because that is never needed.
53473 The dynamic memory that Exim uses when receiving a message is automatically
53474 recycled if another message is received by the same process (this applies only
53475 to incoming SMTP connections &ndash; other input methods can supply only one
53476 message at a time). After receiving the last message, a reception process
53477 terminates.
53478 </para>
53479 <para>
53480 Because it is recycled, the normal dynamic memory cannot be used for holding
53481 data that must be preserved over a number of incoming messages on the same SMTP
53482 connection. However, Exim in fact uses two pools of dynamic memory; the second
53483 one is not recycled, and can be used for this purpose.
53484 </para>
53485 <para>
53486 If you want to allocate memory that remains available for subsequent messages
53487 in the same SMTP connection, you should set
53488 </para>
53489 <literallayout class="monospaced">
53490 store_pool = POOL_PERM
53491 </literallayout>
53492 <para>
53493 before calling the function that does the allocation. There is no need to
53494 restore the value if you do not need to; however, if you do want to revert to
53495 the normal pool, you can either restore the previous value of <option>store_pool</option> or
53496 set it explicitly to POOL_MAIN.
53497 </para>
53498 <para>
53499 The pool setting applies to all functions that get dynamic memory, including
53500 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
53501 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
53502 block of memory from the permanent pool while preserving the value of
53503 <option>store_pool</option>.
53504 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
53505 </para>
53506 </section>
53507 </chapter>
53508
53509 <chapter id="CHAPsystemfilter">
53510 <title>System-wide message filtering</title>
53511 <para>
53512 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
53513 <primary>filter</primary>
53514 <secondary>system filter</secondary>
53515 </indexterm>
53516 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
53517 <primary>filtering all mail</primary>
53518 </indexterm>
53519 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
53520 <primary>system filter</primary>
53521 </indexterm>
53522 The previous chapters (on ACLs and the local scan function) describe checks
53523 that can be applied to messages before they are accepted by a host. There is
53524 also a mechanism for checking messages once they have been received, but before
53525 they are delivered. This is called the <emphasis>system filter</emphasis>.
53526 </para>
53527 <para>
53528 The system filter operates in a similar manner to users&#x2019; filter files, but it
53529 is run just once per message (however many recipients the message has).
53530 It should not normally be used as a substitute for routing, because <option>deliver</option>
53531 commands in a system router provide new envelope recipient addresses.
53532 The system filter must be an Exim filter. It cannot be a Sieve filter.
53533 </para>
53534 <para>
53535 The system filter is run at the start of a delivery attempt, before any routing
53536 is done. If a message fails to be completely delivered at the first attempt,
53537 the system filter is run again at the start of every retry.
53538 If you want your filter to do something only once per message, you can make use
53539 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
53540 prevent it happening on retries.
53541 </para>
53542 <para>
53543 <indexterm role="variable">
53544 <primary><varname>$domain</varname></primary>
53545 </indexterm>
53546 <indexterm role="variable">
53547 <primary><varname>$local_part</varname></primary>
53548 </indexterm>
53549 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
53550 specific to individual recipient addresses, such as <varname>$local_part</varname> and
53551 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
53552 you want to run a centrally-specified filter for each recipient address
53553 independently, you can do so by setting up a suitable <command>redirect</command> router, as
53554 described in section <xref linkend="SECTperaddfil"/> below.
53555 </para>
53556 <section id="SECID212">
53557 <title>Specifying a system filter</title>
53558 <para>
53559 <indexterm role="concept">
53560 <primary>uid (user id)</primary>
53561 <secondary>system filter</secondary>
53562 </indexterm>
53563 <indexterm role="concept">
53564 <primary>gid (group id)</primary>
53565 <secondary>system filter</secondary>
53566 </indexterm>
53567 The name of the file that contains the system filter must be specified by
53568 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
53569 other than root, you must also set <option>system_filter_user</option> and
53570 <option>system_filter_group</option> as appropriate. For example:
53571 </para>
53572 <literallayout class="monospaced">
53573 system_filter = /etc/mail/exim.filter
53574 system_filter_user = exim
53575 </literallayout>
53576 <para>
53577 If a system filter generates any deliveries directly to files or pipes (via the
53578 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
53579 specified by setting <option>system_filter_file_transport</option> and
53580 <option>system_filter_pipe_transport</option>, respectively. Similarly,
53581 <option>system_filter_reply_transport</option> must be set to handle any messages generated
53582 by the <option>reply</option> command.
53583 </para>
53584 </section>
53585 <section id="SECID213">
53586 <title>Testing a system filter</title>
53587 <para>
53588 You can run simple tests of a system filter in the same way as for a user
53589 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
53590 are permitted only in system filters are recognized.
53591 </para>
53592 <para>
53593 If you want to test the combined effect of a system filter and a user filter,
53594 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
53595 </para>
53596 </section>
53597 <section id="SECID214">
53598 <title>Contents of a system filter</title>
53599 <para>
53600 The language used to specify system filters is the same as for users&#x2019; filter
53601 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
53602 mail filtering</emphasis>. However, there are some additional features that are
53603 available only in system filters; these are described in subsequent sections.
53604 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
53605 they cause errors.
53606 </para>
53607 <para>
53608 <indexterm role="concept">
53609 <primary>frozen messages</primary>
53610 <secondary>manual thaw; testing in filter</secondary>
53611 </indexterm>
53612 There are two special conditions which, though available in users&#x2019; filter
53613 files, are designed for use in system filters. The condition <option>first_delivery</option>
53614 is true only for the first attempt at delivering a message, and
53615 <option>manually_thawed</option> is true only if the message has been frozen, and
53616 subsequently thawed by an admin user. An explicit forced delivery counts as a
53617 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
53618 </para>
53619 <para>
53620 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
53621 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
53622 succeed, it will not be tried again.
53623 If you want Exim to retry an unseen delivery until it succeeds, you should
53624 arrange to set it up every time the filter runs.
53625 </para>
53626 <para>
53627 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
53628 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
53629 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
53630 to which users&#x2019; filter files can refer.
53631 </para>
53632 </section>
53633 <section id="SECID215">
53634 <title>Additional variable for system filters</title>
53635 <para>
53636 <indexterm role="variable">
53637 <primary><varname>$recipients</varname></primary>
53638 </indexterm>
53639 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
53640 of the message (separated by commas and white space), is available in system
53641 filters. It is not available in users&#x2019; filters for privacy reasons.
53642 </para>
53643 </section>
53644 <section id="SECID216">
53645 <title>Defer, freeze, and fail commands for system filters</title>
53646 <para>
53647 <indexterm role="concept">
53648 <primary>freezing messages</primary>
53649 </indexterm>
53650 <indexterm role="concept">
53651 <primary>message</primary>
53652 <secondary>freezing</secondary>
53653 </indexterm>
53654 <indexterm role="concept">
53655 <primary>message</primary>
53656 <secondary>forced failure</secondary>
53657 </indexterm>
53658 <indexterm role="concept">
53659 <primary><option>fail</option></primary>
53660 <secondary>in system filter</secondary>
53661 </indexterm>
53662 <indexterm role="concept">
53663 <primary><option>freeze</option> in system filter</primary>
53664 </indexterm>
53665 <indexterm role="concept">
53666 <primary><option>defer</option> in system filter</primary>
53667 </indexterm>
53668 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
53669 always available in system filters, but are not normally enabled in users&#x2019;
53670 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
53671 for the <command>redirect</command> router.) These commands can optionally be followed by the
53672 word <option>text</option> and a string containing an error message, for example:
53673 </para>
53674 <literallayout class="monospaced">
53675 fail text "this message looks like spam to me"
53676 </literallayout>
53677 <para>
53678 The keyword <option>text</option> is optional if the next character is a double quote.
53679 </para>
53680 <para>
53681 The <option>defer</option> command defers delivery of the original recipients of the
53682 message. The <option>fail</option> command causes all the original recipients to be failed,
53683 and a bounce message to be created. The <option>freeze</option> command suspends all
53684 delivery attempts for the original recipients. In all cases, any new deliveries
53685 that are specified by the filter are attempted as normal after the filter has
53686 run.
53687 </para>
53688 <para>
53689 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
53690 not manually frozen since. This means that automatic freezing by a system
53691 filter can be used as a way of checking out suspicious messages. If a message
53692 is found to be all right, manually unfreezing it allows it to be delivered.
53693 </para>
53694 <para>
53695 <indexterm role="concept">
53696 <primary>log</primary>
53697 <secondary><option>fail</option> command log line</secondary>
53698 </indexterm>
53699 <indexterm role="concept">
53700 <primary><option>fail</option></primary>
53701 <secondary>log line; reducing</secondary>
53702 </indexterm>
53703 The text given with a fail command is used as part of the bounce message as
53704 well as being written to the log. If the message is quite long, this can fill
53705 up a lot of log space when such failures are common. To reduce the size of the
53706 log message, Exim interprets the text in a special way if it starts with the
53707 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
53708 strings is written to the log, and the rest of the text is used in the bounce
53709 message. For example:
53710 </para>
53711 <literallayout class="monospaced">
53712 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
53713      because it contains attachments that we are \
53714      not prepared to receive."
53715 </literallayout>
53716 <para>
53717 <indexterm role="concept">
53718 <primary>loop</primary>
53719 <secondary>caused by <option>fail</option></secondary>
53720 </indexterm>
53721 Take great care with the <option>fail</option> command when basing the decision to fail on
53722 the contents of the message, because the bounce message will of course include
53723 the contents of the original message and will therefore trigger the <option>fail</option>
53724 command again (causing a mail loop) unless steps are taken to prevent this.
53725 Testing the <option>error_message</option> condition is one way to prevent this. You could
53726 use, for example
53727 </para>
53728 <literallayout class="monospaced">
53729 if $message_body contains "this is spam" and not error_message
53730 then fail text "spam is not wanted here" endif
53731 </literallayout>
53732 <para>
53733 though of course that might let through unwanted bounce messages. The
53734 alternative is clever checking of the body and/or headers to detect bounces
53735 generated by the filter.
53736 </para>
53737 <para>
53738 The interpretation of a system filter file ceases after a
53739 <option>defer</option>,
53740 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
53741 set up earlier in the filter file are honoured, so you can use a sequence such
53742 as
53743 </para>
53744 <literallayout class="monospaced">
53745 mail ...
53746 freeze
53747 </literallayout>
53748 <para>
53749 to send a specified message when the system filter is freezing (or deferring or
53750 failing) a message. The normal deliveries for the message do not, of course,
53751 take place.
53752 </para>
53753 </section>
53754 <section id="SECTaddremheasys">
53755 <title>Adding and removing headers in a system filter</title>
53756 <para>
53757 <indexterm role="concept">
53758 <primary>header lines</primary>
53759 <secondary>adding; in system filter</secondary>
53760 </indexterm>
53761 <indexterm role="concept">
53762 <primary>header lines</primary>
53763 <secondary>removing; in system filter</secondary>
53764 </indexterm>
53765 <indexterm role="concept">
53766 <primary>filter</primary>
53767 <secondary>header lines; adding/removing</secondary>
53768 </indexterm>
53769 Two filter commands that are available only in system filters are:
53770 </para>
53771 <literallayout class="monospaced">
53772 headers add &lt;string&gt;
53773 headers remove &lt;string&gt;
53774 </literallayout>
53775 <para>
53776 The argument for the <option>headers add</option> is a string that is expanded and then
53777 added to the end of the message&#x2019;s headers. It is the responsibility of the
53778 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
53779 space is ignored, and if the string is otherwise empty, or if the expansion is
53780 forced to fail, the command has no effect.
53781 </para>
53782 <para>
53783 You can use <quote>\n</quote> within the string, followed by white space, to specify
53784 continued header lines. More than one header may be added in one command by
53785 including <quote>\n</quote> within the string without any following white space. For
53786 example:
53787 </para>
53788 <literallayout class="monospaced">
53789 headers add "X-header-1: ....\n  \
53790              continuation of X-header-1 ...\n\
53791              X-header-2: ...."
53792 </literallayout>
53793 <para>
53794 Note that the header line continuation white space after the first newline must
53795 be placed before the backslash that continues the input string, because white
53796 space after input continuations is ignored.
53797 </para>
53798 <para>
53799 The argument for <option>headers remove</option> is a colon-separated list of header names.
53800 This command applies only to those headers that are stored with the message;
53801 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
53802 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
53803 header with the same name, they are all removed.
53804 </para>
53805 <para>
53806 The <option>headers</option> command in a system filter makes an immediate change to the set
53807 of header lines that was received with the message (with possible additions
53808 from ACL processing). Subsequent commands in the system filter operate on the
53809 modified set, which also forms the basis for subsequent message delivery.
53810 Unless further modified during routing or transporting, this set of headers is
53811 used for all recipients of the message.
53812 </para>
53813 <para>
53814 During routing and transporting, the variables that refer to the contents of
53815 header lines refer only to those lines that are in this set. Thus, header lines
53816 that are added by a system filter are visible to users&#x2019; filter files and to all
53817 routers and transports. This contrasts with the manipulation of header lines by
53818 routers and transports, which is not immediate, but which instead is saved up
53819 until the message is actually being written (see section
53820 <xref linkend="SECTheadersaddrem"/>).
53821 </para>
53822 <para>
53823 If the message is not delivered at the first attempt, header lines that were
53824 added by the system filter are stored with the message, and so are still
53825 present at the next delivery attempt. Header lines that were removed are still
53826 present, but marked <quote>deleted</quote> so that they are not transported with the
53827 message. For this reason, it is usual to make the <option>headers</option> command
53828 conditional on <option>first_delivery</option> so that the set of header lines is not
53829 modified more than once.
53830 </para>
53831 <para>
53832 Because header modification in a system filter acts immediately, you have to
53833 use an indirect approach if you want to modify the contents of a header line.
53834 For example:
53835 </para>
53836 <literallayout class="monospaced">
53837 headers add "Old-Subject: $h_subject:"
53838 headers remove "Subject"
53839 headers add "Subject: new subject (was: $h_old-subject:)"
53840 headers remove "Old-Subject"
53841 </literallayout>
53842 </section>
53843 <section id="SECID217">
53844 <title>Setting an errors address in a system filter</title>
53845 <para>
53846 <indexterm role="concept">
53847 <primary>envelope sender</primary>
53848 </indexterm>
53849 In a system filter, if a <option>deliver</option> command is followed by
53850 </para>
53851 <literallayout class="monospaced">
53852 errors_to &lt;some address&gt;
53853 </literallayout>
53854 <para>
53855 in order to change the envelope sender (and hence the error reporting) for that
53856 delivery, any address may be specified. (In a user filter, only the current
53857 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
53858 might use
53859 </para>
53860 <literallayout class="monospaced">
53861 unseen deliver monitor@spying.example errors_to root@local.example
53862 </literallayout>
53863 <para>
53864 to take a copy which would not be sent back to the normal error reporting
53865 address if its delivery failed.
53866 </para>
53867 </section>
53868 <section id="SECTperaddfil">
53869 <title>Per-address filtering</title>
53870 <para>
53871 <indexterm role="variable">
53872 <primary><varname>$domain</varname></primary>
53873 </indexterm>
53874 <indexterm role="variable">
53875 <primary><varname>$local_part</varname></primary>
53876 </indexterm>
53877 In contrast to the system filter, which is run just once per message for each
53878 delivery attempt, it is also possible to set up a system-wide filtering
53879 operation that runs once for each recipient address. In this case, variables
53880 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
53881 filter file could be made dependent on them. This is an example of a router
53882 which implements such a filter:
53883 </para>
53884 <literallayout class="monospaced">
53885 central_filter:
53886   check_local_user
53887   driver = redirect
53888   domains = +local_domains
53889   file = /central/filters/$local_part
53890   no_verify
53891   allow_filter
53892   allow_freeze
53893 </literallayout>
53894 <para>
53895 The filter is run in a separate process under its own uid. Therefore, either
53896 <option>check_local_user</option> must be set (as above), in which case the filter is run as
53897 the local user, or the <option>user</option> option must be used to specify which user to
53898 use. If both are set, <option>user</option> overrides.
53899 </para>
53900 <para>
53901 Care should be taken to ensure that none of the commands in the filter file
53902 specify a significant delivery if the message is to go on to be delivered to
53903 its intended recipient. The router will not then claim to have dealt with the
53904 address, so it will be passed on to subsequent routers to be delivered in the
53905 normal way.
53906 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
53907 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
53908 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
53909 </para>
53910 </section>
53911 </chapter>
53912
53913 <chapter id="CHAPmsgproc">
53914 <title>Message processing</title>
53915 <para>
53916 <indexterm role="concept" id="IIDmesproc" class="startofrange">
53917 <primary>message</primary>
53918 <secondary>general processing</secondary>
53919 </indexterm>
53920 Exim performs various transformations on the sender and recipient addresses of
53921 all messages that it handles, and also on the messages&#x2019; header lines. Some of
53922 these are optional and configurable, while others always take place. All of
53923 this processing, except rewriting as a result of routing, and the addition or
53924 removal of header lines while delivering, happens when a message is received,
53925 before it is placed on Exim&#x2019;s queue.
53926 </para>
53927 <para>
53928 Some of the automatic processing takes place by default only for
53929 <quote>locally-originated</quote> messages. This adjective is used to describe messages
53930 that are not received over TCP/IP, but instead are passed to an Exim process on
53931 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
53932 set up by the <option>-bs</option> command line option.
53933 </para>
53934 <para>
53935 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
53936 or ::1) are not considered to be locally-originated. Exim does not treat the
53937 loopback interface specially in any way.
53938 </para>
53939 <para>
53940 If you want the loopback interface to be treated specially, you must ensure
53941 that there are appropriate entries in your ACLs.
53942 </para>
53943 <section id="SECTsubmodnon">
53944 <title>Submission mode for non-local messages</title>
53945 <para>
53946 <indexterm role="concept">
53947 <primary>message</primary>
53948 <secondary>submission</secondary>
53949 </indexterm>
53950 <indexterm role="concept">
53951 <primary>submission mode</primary>
53952 </indexterm>
53953 Processing that happens automatically for locally-originated messages (unless
53954 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
53955 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
53956 state. Submission mode is set by the modifier
53957 </para>
53958 <literallayout class="monospaced">
53959 control = submission
53960 </literallayout>
53961 <para>
53962 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
53963 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
53964 a local submission, and is normally used when the source of the message is
53965 known to be an MUA running on a client host (as opposed to an MTA). For
53966 example, to set submission mode for messages originating on the IPv4 loopback
53967 interface, you could include the following in the MAIL ACL:
53968 </para>
53969 <literallayout class="monospaced">
53970 warn  hosts = 127.0.0.1
53971       control = submission
53972 </literallayout>
53973 <para>
53974 <indexterm role="concept">
53975 <primary><option>sender_retain</option> submission option</primary>
53976 </indexterm>
53977 There are some options that can be used when setting submission mode. A slash
53978 is used to separate options. For example:
53979 </para>
53980 <literallayout class="monospaced">
53981 control = submission/sender_retain
53982 </literallayout>
53983 <para>
53984 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
53985 true and <option>local_from_check</option> false for the current incoming message. The first
53986 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
53987 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
53988 authenticated sender. With this setting, Exim still fixes up messages by adding
53989 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
53990 attempt to check sender authenticity in header lines.
53991 </para>
53992 <para>
53993 When <option>sender_retain</option> is not set, a submission mode setting may specify a
53994 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
53995 example:
53996 </para>
53997 <literallayout class="monospaced">
53998 control = submission/domain=some.domain
53999 </literallayout>
54000 <para>
54001 The domain may be empty. How this value is used is described in sections
54002 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
54003 that allows you to specify the user&#x2019;s full name for inclusion in a created
54004 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
54005 </para>
54006 <literallayout class="monospaced">
54007 accept authenticated = *
54008        control = submission/domain=wonderland.example/\
54009                             name=${lookup {$authenticated_id} \
54010                                    lsearch {/etc/exim/namelist}}
54011 </literallayout>
54012 <para>
54013 Because the name may contain any characters, including slashes, the <option>name</option>
54014 option must be given last. The remainder of the string is used as the name. For
54015 the example above, if <filename>/etc/exim/namelist</filename> contains:
54016 </para>
54017 <literallayout class="monospaced">
54018 bigegg:  Humpty Dumpty
54019 </literallayout>
54020 <para>
54021 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
54022 line would be:
54023 </para>
54024 <literallayout class="monospaced">
54025 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
54026 </literallayout>
54027 <para>
54028 <indexterm role="concept">
54029 <primary>return path</primary>
54030 <secondary>in submission mode</secondary>
54031 </indexterm>
54032 By default, submission mode forces the return path to the same address as is
54033 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
54034 specified, the return path is also left unchanged.
54035 </para>
54036 <para>
54037 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
54038 ACL. This means that any sender checks performed before the fix-ups use the
54039 untrusted sender address specified by the user, not the trusted sender address
54040 specified by submission mode. Although this might be slightly unexpected, it
54041 does mean that you can configure ACL checks to spot that a user is trying to
54042 spoof another&#x2019;s address.
54043 </para>
54044 </section>
54045 <section id="SECTlineendings">
54046 <title>Line endings</title>
54047 <para>
54048 <indexterm role="concept">
54049 <primary>line endings</primary>
54050 </indexterm>
54051 <indexterm role="concept">
54052 <primary>carriage return</primary>
54053 </indexterm>
54054 <indexterm role="concept">
54055 <primary>linefeed</primary>
54056 </indexterm>
54057 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
54058 linefeed) is the line ending for messages transmitted over the Internet using
54059 SMTP over TCP/IP. However, within individual operating systems, different
54060 conventions are used. For example, Unix-like systems use just LF, but others
54061 use CRLF or just CR.
54062 </para>
54063 <para>
54064 Exim was designed for Unix-like systems, and internally, it stores messages
54065 using the system&#x2019;s convention of a single LF as a line terminator. When
54066 receiving a message, all line endings are translated to this standard format.
54067 Originally, it was thought that programs that passed messages directly to an
54068 MTA within an operating system would use that system&#x2019;s convention. Experience
54069 has shown that this is not the case; for example, there are Unix applications
54070 that use CRLF in this circumstance. For this reason, and for compatibility with
54071 other MTAs, the way Exim handles line endings for all messages is now as
54072 follows:
54073 </para>
54074 <itemizedlist>
54075 <listitem>
54076 <para>
54077 LF not preceded by CR is treated as a line ending.
54078 </para>
54079 </listitem>
54080 <listitem>
54081 <para>
54082 CR is treated as a line ending; if it is immediately followed by LF, the LF
54083 is ignored.
54084 </para>
54085 </listitem>
54086 <listitem>
54087 <para>
54088 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
54089 nor a local message in the state where a line containing only a dot is a
54090 terminator.
54091 </para>
54092 </listitem>
54093 <listitem>
54094 <para>
54095 If a bare CR is encountered within a header line, an extra space is added after
54096 the line terminator so as not to end the header line. The reasoning behind this
54097 is that bare CRs in header lines are most likely either to be mistakes, or
54098 people trying to play silly games.
54099 </para>
54100 </listitem>
54101 <listitem>
54102 <para>
54103 If the first header line received in a message ends with CRLF, a subsequent
54104 bare LF in a header line is treated in the same way as a bare CR in a header
54105 line.
54106 </para>
54107 </listitem>
54108 </itemizedlist>
54109 </section>
54110 <section id="SECID218">
54111 <title>Unqualified addresses</title>
54112 <para>
54113 <indexterm role="concept">
54114 <primary>unqualified addresses</primary>
54115 </indexterm>
54116 <indexterm role="concept">
54117 <primary>address</primary>
54118 <secondary>qualification</secondary>
54119 </indexterm>
54120 By default, Exim expects every envelope address it receives from an external
54121 host to be fully qualified. Unqualified addresses cause negative responses to
54122 SMTP commands. However, because SMTP is used as a means of transporting
54123 messages from MUAs running on personal workstations, there is sometimes a
54124 requirement to accept unqualified addresses from specific hosts or IP networks.
54125 </para>
54126 <para>
54127 Exim has two options that separately control which hosts may send unqualified
54128 sender or recipient addresses in SMTP commands, namely
54129 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
54130 cases, if an unqualified address is accepted, it is qualified by adding the
54131 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
54132 </para>
54133 <para>
54134 <indexterm role="option">
54135 <primary><option>qualify_domain</option></primary>
54136 </indexterm>
54137 <indexterm role="option">
54138 <primary><option>qualify_recipient</option></primary>
54139 </indexterm>
54140 Unqualified addresses in header lines are automatically qualified for messages
54141 that are locally originated, unless the <option>-bnq</option> option is given on the command
54142 line. For messages received over SMTP, unqualified addresses in header lines
54143 are qualified only if unqualified addresses are permitted in SMTP commands. In
54144 other words, such qualification is also controlled by
54145 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
54146 </para>
54147 </section>
54148 <section id="SECID219">
54149 <title>The UUCP From line</title>
54150 <para>
54151 <indexterm role="concept">
54152 <primary><quote>From</quote> line</primary>
54153 </indexterm>
54154 <indexterm role="concept">
54155 <primary>UUCP</primary>
54156 <secondary><quote>From</quote> line</secondary>
54157 </indexterm>
54158 <indexterm role="concept">
54159 <primary>sender</primary>
54160 <secondary>address</secondary>
54161 </indexterm>
54162 <indexterm role="option">
54163 <primary><option>uucp_from_pattern</option></primary>
54164 </indexterm>
54165 <indexterm role="option">
54166 <primary><option>uucp_from_sender</option></primary>
54167 </indexterm>
54168 <indexterm role="concept">
54169 <primary>envelope sender</primary>
54170 </indexterm>
54171 <indexterm role="concept">
54172 <primary>Sendmail compatibility</primary>
54173 <secondary><quote>From</quote> line</secondary>
54174 </indexterm>
54175 Messages that have come from UUCP (and some other applications) often begin
54176 with a line containing the envelope sender and a timestamp, following the word
54177 <quote>From</quote>. Examples of two common formats are:
54178 </para>
54179 <literallayout class="monospaced">
54180 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
54181 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
54182 </literallayout>
54183 <para>
54184 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
54185 Exim recognizes such lines at the start of messages that are submitted to it
54186 via the command line (that is, on the standard input). It does not recognize
54187 such lines in incoming SMTP messages, unless the sending host matches
54188 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
54189 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
54190 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
54191 default value matches the two common cases shown above and puts the address
54192 that follows <quote>From</quote> into <varname>$1</varname>.
54193 </para>
54194 <para>
54195 <indexterm role="concept">
54196 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
54197 <secondary>in <quote>From </quote> line handling</secondary>
54198 </indexterm>
54199 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
54200 a trusted user, the message&#x2019;s sender address is constructed by expanding the
54201 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
54202 then parsed as an RFC 2822 address. If there is no domain, the local part is
54203 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
54204 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
54205 </para>
54206 <para>
54207 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
54208 sender address is not changed. This is also the case for incoming SMTP messages
54209 that are permitted to contain <quote>From</quote> lines.
54210 </para>
54211 <para>
54212 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
54213 treated as a data line that starts the body of the message, as it is not valid
54214 as a header line. This also happens if a <quote>From</quote> line is present in an
54215 incoming SMTP message from a source that is not permitted to send them.
54216 </para>
54217 </section>
54218 <section id="SECID220">
54219 <title>Resent- header lines</title>
54220 <para>
54221 <indexterm role="concept">
54222 <primary><option>Resent-</option> header lines</primary>
54223 </indexterm>
54224 RFC 2822 makes provision for sets of header lines starting with the string
54225 <literal>Resent-</literal> to be added to a message when it is resent by the original
54226 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
54227 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
54228 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
54229 </para>
54230 <blockquote>
54231 <para>
54232 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
54233 processing of replies or other such automatic actions on messages.</emphasis>
54234 </para>
54235 </blockquote>
54236 <para>
54237 This leaves things a bit vague as far as other processing actions such as
54238 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
54239 follows:
54240 </para>
54241 <itemizedlist>
54242 <listitem>
54243 <para>
54244 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
54245 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
54246 </para>
54247 </listitem>
54248 <listitem>
54249 <para>
54250 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
54251 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
54252 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
54253 </para>
54254 </listitem>
54255 <listitem>
54256 <para>
54257 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
54258 also removed.
54259 </para>
54260 </listitem>
54261 <listitem>
54262 <para>
54263 For a locally-submitted message,
54264 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
54265 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
54266 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
54267 included in log lines in this case.
54268 </para>
54269 </listitem>
54270 <listitem>
54271 <para>
54272 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
54273 <option>Resent-</option> header lines are present.
54274 </para>
54275 </listitem>
54276 </itemizedlist>
54277 </section>
54278 <section id="SECID221">
54279 <title>The Auto-Submitted: header line</title>
54280 <para>
54281 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
54282 includes the header line:
54283 </para>
54284 <literallayout class="monospaced">
54285 Auto-Submitted: auto-replied
54286 </literallayout>
54287 </section>
54288 <section id="SECID222">
54289 <title>The Bcc: header line</title>
54290 <para>
54291 <indexterm role="concept">
54292 <primary><emphasis>Bcc:</emphasis> header line</primary>
54293 </indexterm>
54294 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
54295 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
54296 extracting its addresses). If <option>-t</option> is not present on the command line, any
54297 existing <emphasis>Bcc:</emphasis> is not removed.
54298 </para>
54299 </section>
54300 <section id="SECID223">
54301 <title>The Date: header line</title>
54302 <para>
54303 <indexterm role="concept">
54304 <primary><emphasis>Date:</emphasis> header line</primary>
54305 </indexterm>
54306 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
54307 Exim adds one, using the current date and time, unless the
54308 <option>suppress_local_fixups</option> control has been specified.
54309 </para>
54310 </section>
54311 <section id="SECID224">
54312 <title>The Delivery-date: header line</title>
54313 <para>
54314 <indexterm role="concept">
54315 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
54316 </indexterm>
54317 <indexterm role="option">
54318 <primary><option>delivery_date_remove</option></primary>
54319 </indexterm>
54320 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
54321 set. Exim can be configured to add them to the final delivery of messages. (See
54322 the generic <option>delivery_date_add</option> transport option.) They should not be present
54323 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
54324 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
54325 messages.
54326 </para>
54327 </section>
54328 <section id="SECID225">
54329 <title>The Envelope-to: header line</title>
54330 <para>
54331 <indexterm role="concept">
54332 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
54333 </indexterm>
54334 <indexterm role="option">
54335 <primary><option>envelope_to_remove</option></primary>
54336 </indexterm>
54337 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
54338 Exim can be configured to add them to the final delivery of messages. (See the
54339 generic <option>envelope_to_add</option> transport option.) They should not be present in
54340 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
54341 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
54342 messages.
54343 </para>
54344 </section>
54345 <section id="SECTthefrohea">
54346 <title>The From: header line</title>
54347 <para>
54348 <indexterm role="concept">
54349 <primary><emphasis>From:</emphasis> header line</primary>
54350 </indexterm>
54351 <indexterm role="concept">
54352 <primary>Sendmail compatibility</primary>
54353 <secondary><quote>From</quote> line</secondary>
54354 </indexterm>
54355 <indexterm role="concept">
54356 <primary>message</primary>
54357 <secondary>submission</secondary>
54358 </indexterm>
54359 <indexterm role="concept">
54360 <primary>submission mode</primary>
54361 </indexterm>
54362 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
54363 adds one if either of the following conditions is true:
54364 </para>
54365 <itemizedlist>
54366 <listitem>
54367 <para>
54368 The envelope sender address is not empty (that is, this is not a bounce
54369 message). The added header line copies the envelope sender address.
54370 </para>
54371 </listitem>
54372 <listitem>
54373 <para>
54374 <indexterm role="variable">
54375 <primary><varname>$authenticated_id</varname></primary>
54376 </indexterm>
54377 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
54378 </para>
54379 <orderedlist numeration="arabic">
54380 <listitem>
54381 <para>
54382 <indexterm role="variable">
54383 <primary><varname>$qualify_domain</varname></primary>
54384 </indexterm>
54385 If no domain is specified by the submission control, the local part is
54386 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
54387 </para>
54388 </listitem>
54389 <listitem>
54390 <para>
54391 If a non-empty domain is specified by the submission control, the local
54392 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
54393 </para>
54394 </listitem>
54395 <listitem>
54396 <para>
54397 If an empty domain is specified by the submission control,
54398 <varname>$authenticated_id</varname> is assumed to be the complete address.
54399 </para>
54400 </listitem>
54401 </orderedlist>
54402 </listitem>
54403 </itemizedlist>
54404 <para>
54405 A non-empty envelope sender takes precedence.
54406 </para>
54407 <para>
54408 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
54409 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
54410 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
54411 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
54412 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
54413 <option>unknown_login</option> configuration option). The address is qualified with
54414 <option>qualify_domain</option>.
54415 </para>
54416 <para>
54417 For compatibility with Sendmail, if an incoming, non-SMTP message has a
54418 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
54419 user, this is replaced by an address containing the user&#x2019;s login name and full
54420 name as described in section <xref linkend="SECTconstr"/>.
54421 </para>
54422 </section>
54423 <section id="SECID226">
54424 <title>The Message-ID: header line</title>
54425 <para>
54426 <indexterm role="concept">
54427 <primary><emphasis>Message-ID:</emphasis> header line</primary>
54428 </indexterm>
54429 <indexterm role="concept">
54430 <primary>message</primary>
54431 <secondary>submission</secondary>
54432 </indexterm>
54433 <indexterm role="option">
54434 <primary><option>message_id_header_text</option></primary>
54435 </indexterm>
54436 If a locally-generated or submission-mode incoming message does not contain a
54437 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
54438 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
54439 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
54440 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
54441 message id, preceded by the letter E to ensure it starts with a letter, and
54442 followed by @ and the primary host name. Additional information can be included
54443 in this header line by setting the <option>message_id_header_text</option> and/or
54444 <option>message_id_header_domain</option> options.
54445 </para>
54446 </section>
54447 <section id="SECID227">
54448 <title>The Received: header line</title>
54449 <para>
54450 <indexterm role="concept">
54451 <primary><emphasis>Received:</emphasis> header line</primary>
54452 </indexterm>
54453 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
54454 contents are defined by the <option>received_header_text</option> configuration option, and
54455 Exim automatically adds a semicolon and a timestamp to the configured string.
54456 </para>
54457 <para>
54458 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
54459 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
54460 line is the time that the message started to be received. This is the value
54461 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
54462 </para>
54463 <para>
54464 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
54465 changed to the time of acceptance, which is (apart from a small delay while the
54466 -H spool file is written) the earliest time at which delivery could start.
54467 </para>
54468 </section>
54469 <section id="SECID228">
54470 <title>The References: header line</title>
54471 <para>
54472 <indexterm role="concept">
54473 <primary><emphasis>References:</emphasis> header line</primary>
54474 </indexterm>
54475 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
54476 header line. This is constructed according to the rules that are described in
54477 section 3.64 of RFC 2822 (which states that replies should contain such a
54478 header line), and section 3.14 of RFC 3834 (which states that automatic
54479 responses are not different in this respect). However, because some mail
54480 processing software does not cope well with very long header lines, no more
54481 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
54482 incoming message. If there are more than 12, the first one and then the final
54483 11 are copied, before adding the message ID of the incoming message.
54484 </para>
54485 </section>
54486 <section id="SECID229">
54487 <title>The Return-path: header line</title>
54488 <para>
54489 <indexterm role="concept">
54490 <primary><emphasis>Return-path:</emphasis> header line</primary>
54491 </indexterm>
54492 <indexterm role="option">
54493 <primary><option>return_path_remove</option></primary>
54494 </indexterm>
54495 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
54496 it does the final delivery of messages. (See the generic <option>return_path_add</option>
54497 transport option.) Therefore, they should not be present in messages in
54498 transit. If the <option>return_path_remove</option> configuration option is set (the
54499 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
54500 </para>
54501 </section>
54502 <section id="SECTthesenhea">
54503 <title>The Sender: header line</title>
54504 <para>
54505 <indexterm role="concept">
54506 <primary><emphasis>Sender:</emphasis> header line</primary>
54507 </indexterm>
54508 <indexterm role="concept">
54509 <primary>message</primary>
54510 <secondary>submission</secondary>
54511 </indexterm>
54512 For a locally-originated message from an untrusted user, Exim may remove an
54513 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
54514 these actions by setting the <option>local_sender_retain</option> option true, the
54515 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
54516 control setting.
54517 </para>
54518 <para>
54519 When a local message is received from an untrusted user and
54520 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
54521 control has not been set, a check is made to see if the address given in the
54522 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
54523 that is expected has the login name as the local part and the value of
54524 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
54525 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
54526 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
54527 line is added to the message.
54528 </para>
54529 <para>
54530 If you set <option>local_from_check</option> false, this checking does not occur. However,
54531 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
54532 <option>local_sender_retain</option> to be true. It is not possible to set both of these
54533 options true at the same time.
54534 </para>
54535 <para>
54536 <indexterm role="concept">
54537 <primary>submission mode</primary>
54538 </indexterm>
54539 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
54540 received over TCP/IP or for messages submitted by trusted users. However, when
54541 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
54542 not specified on the submission control, the following processing takes place:
54543 </para>
54544 <para>
54545 <indexterm role="variable">
54546 <primary><varname>$authenticated_id</varname></primary>
54547 </indexterm>
54548 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
54549 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
54550 created as follows:
54551 </para>
54552 <itemizedlist>
54553 <listitem>
54554 <para>
54555 <indexterm role="variable">
54556 <primary><varname>$qualify_domain</varname></primary>
54557 </indexterm>
54558 If no domain is specified by the submission control, the local part is
54559 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
54560 </para>
54561 </listitem>
54562 <listitem>
54563 <para>
54564 If a non-empty domain is specified by the submission control, the local part
54565 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
54566 </para>
54567 </listitem>
54568 <listitem>
54569 <para>
54570 If an empty domain is specified by the submission control,
54571 <varname>$authenticated_id</varname> is assumed to be the complete address.
54572 </para>
54573 </listitem>
54574 </itemizedlist>
54575 <para>
54576 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
54577 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
54578 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
54579 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
54580 </para>
54581 <para>
54582 <indexterm role="concept">
54583 <primary>return path</primary>
54584 <secondary>created from <emphasis>Sender:</emphasis></secondary>
54585 </indexterm>
54586 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
54587 the message (the envelope sender address) is changed to be the same address,
54588 except in the case of submission mode when <option>sender_retain</option> is specified.
54589 </para>
54590 </section>
54591 <section id="SECTheadersaddrem">
54592 <title>Adding and removing header lines in routers and transports</title>
54593 <para>
54594 <indexterm role="concept">
54595 <primary>header lines</primary>
54596 <secondary>adding; in router or transport</secondary>
54597 </indexterm>
54598 <indexterm role="concept">
54599 <primary>header lines</primary>
54600 <secondary>removing; in router or transport</secondary>
54601 </indexterm>
54602 When a message is delivered, the addition and removal of header lines can be
54603 specified in a system filter, or on any of the routers and transports that
54604 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
54605 modifying headers in a system filter. Header lines can also be added in an ACL
54606 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
54607 </para>
54608 <para>
54609 In contrast to what happens in a system filter, header modifications that are
54610 specified on routers and transports apply only to the particular recipient
54611 addresses that are being processed by those routers and transports. These
54612 changes do not actually take place until a copy of the message is being
54613 transported. Therefore, they do not affect the basic set of header lines, and
54614 they do not affect the values of the variables that refer to header lines.
54615 </para>
54616 <para>
54617 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
54618 the transport cannot refer to the modified header lines, because such
54619 expansions all occur before the message is actually transported.
54620 </para>
54621 <para>
54622 For both routers and transports, the result of expanding a <option>headers_add</option>
54623 option must be in the form of one or more RFC 2822 header lines, separated by
54624 newlines (coded as <quote>\n</quote>). For example:
54625 </para>
54626 <literallayout class="monospaced">
54627 headers_add = X-added-header: added by $primary_hostname\n\
54628               X-added-second: another added header line
54629 </literallayout>
54630 <para>
54631 Exim does not check the syntax of these added header lines.
54632 </para>
54633 <para>
54634 The result of expanding <option>headers_remove</option> must consist of a colon-separated
54635 list of header names. This is confusing, because header names themselves are
54636 often terminated by colons. In this case, the colons are the list separators,
54637 not part of the names. For example:
54638 </para>
54639 <literallayout class="monospaced">
54640 headers_remove = return-receipt-to:acknowledge-to
54641 </literallayout>
54642 <para>
54643 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
54644 is expanded at routing time, and then associated with all addresses that are
54645 accepted by that router, and also with any new addresses that it generates. If
54646 an address passes through several routers as a result of aliasing or
54647 forwarding, the changes are cumulative.
54648 </para>
54649 <para>
54650 <indexterm role="option">
54651 <primary><option>unseen</option></primary>
54652 </indexterm>
54653 However, this does not apply to multiple routers that result from the use of
54654 the <option>unseen</option> option. Any header modifications that were specified by the
54655 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
54656 </para>
54657 <para>
54658 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
54659 settings cannot be delivered together in a batch, so a transport is always
54660 dealing with a set of addresses that have the same header-processing
54661 requirements.
54662 </para>
54663 <para>
54664 The transport starts by writing the original set of header lines that arrived
54665 with the message, possibly modified by the system filter. As it writes out
54666 these lines, it consults the list of header names that were attached to the
54667 recipient address(es) by <option>headers_remove</option> options in routers, and it also
54668 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
54669 names are on either of these lists are not written out. If there are multiple
54670 instances of any listed header, they are all skipped.
54671 </para>
54672 <para>
54673 After the remaining original header lines have been written, new header
54674 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
54675 the order in which they were attached to the address. These are followed by any
54676 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
54677 </para>
54678 <para>
54679 This way of handling header line modifications in routers and transports has
54680 the following consequences:
54681 </para>
54682 <itemizedlist>
54683 <listitem>
54684 <para>
54685 The original set of header lines, possibly modified by the system filter,
54686 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
54687 to it, at all times.
54688 </para>
54689 </listitem>
54690 <listitem>
54691 <para>
54692 Header lines that are added by a router&#x2019;s
54693 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
54694 expansion syntax in subsequent routers or the transport.
54695 </para>
54696 </listitem>
54697 <listitem>
54698 <para>
54699 Conversely, header lines that are specified for removal by <option>headers_remove</option>
54700 in a router remain visible to subsequent routers and the transport.
54701 </para>
54702 </listitem>
54703 <listitem>
54704 <para>
54705 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
54706 a later router or by a transport.
54707 </para>
54708 </listitem>
54709 <listitem>
54710 <para>
54711 An added header can refer to the contents of an original header that is to be
54712 removed, even it has the same name as the added header. For example:
54713 </para>
54714 <literallayout class="monospaced">
54715 headers_remove = subject
54716 headers_add = Subject: new subject (was: $h_subject:)
54717 </literallayout>
54718 </listitem>
54719 </itemizedlist>
54720 <para>
54721 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
54722 for a <command>redirect</command> router that has the <option>one_time</option> option set.
54723 </para>
54724 </section>
54725 <section id="SECTconstr">
54726 <title>Constructed addresses</title>
54727 <para>
54728 <indexterm role="concept">
54729 <primary>address</primary>
54730 <secondary>constructed</secondary>
54731 </indexterm>
54732 <indexterm role="concept">
54733 <primary>constructed address</primary>
54734 </indexterm>
54735 When Exim constructs a sender address for a locally-generated message, it uses
54736 the form
54737 </para>
54738 <literallayout>
54739 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
54740 </literallayout>
54741 <para>
54742 For example:
54743 </para>
54744 <literallayout class="monospaced">
54745 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
54746 </literallayout>
54747 <para>
54748 The user name is obtained from the <option>-F</option> command line option if set, or
54749 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
54750 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
54751 ampersand character, this is replaced by the login name with the first letter
54752 upper cased, as is conventional in a number of operating systems. See the
54753 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
54754 The <option>unknown_username</option> option can be used to specify user names in cases when
54755 there is no password file entry.
54756 </para>
54757 <para>
54758 <indexterm role="concept">
54759 <primary>RFC 2047</primary>
54760 </indexterm>
54761 In all cases, the user name is made to conform to RFC 2822 by quoting all or
54762 parts of it if necessary. In addition, if it contains any non-printing
54763 characters, it is encoded as described in RFC 2047, which defines a way of
54764 including non-ASCII characters in header lines. The value of the
54765 <option>headers_charset</option> option specifies the name of the encoding that is used (the
54766 characters are assumed to be in this encoding). The setting of
54767 <option>print_topbitchars</option> controls whether characters with the top bit set (that
54768 is, with codes greater than 127) count as printing characters or not.
54769 </para>
54770 </section>
54771 <section id="SECID230">
54772 <title>Case of local parts</title>
54773 <para>
54774 <indexterm role="concept">
54775 <primary>case of local parts</primary>
54776 </indexterm>
54777 <indexterm role="concept">
54778 <primary>local part</primary>
54779 <secondary>case of</secondary>
54780 </indexterm>
54781 RFC 2822 states that the case of letters in the local parts of addresses cannot
54782 be assumed to be non-significant. Exim preserves the case of local parts of
54783 addresses, but by default it uses a lower-cased form when it is routing,
54784 because on most Unix systems, usernames are in lower case and case-insensitive
54785 routing is required. However, any particular router can be made to use the
54786 original case for local parts by setting the <option>caseful_local_part</option> generic
54787 router option.
54788 </para>
54789 <para>
54790 <indexterm role="concept">
54791 <primary>mixed-case login names</primary>
54792 </indexterm>
54793 If you must have mixed-case user names on your system, the best way to proceed,
54794 assuming you want case-independent handling of incoming email, is to set up
54795 your first router to convert incoming local parts in your domains to the
54796 correct case by means of a file lookup. For example:
54797 </para>
54798 <literallayout class="monospaced">
54799 correct_case:
54800   driver = redirect
54801   domains = +local_domains
54802   data = ${lookup{$local_part}cdb\
54803               {/etc/usercased.cdb}{$value}fail}\
54804               @$domain
54805 </literallayout>
54806 <para>
54807 For this router, the local part is forced to lower case by the default action
54808 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
54809 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
54810 on any subsequent routers which process your domains, they will operate on
54811 local parts with the correct case in a case-sensitive manner.
54812 </para>
54813 </section>
54814 <section id="SECID231">
54815 <title>Dots in local parts</title>
54816 <para>
54817 <indexterm role="concept">
54818 <primary>dot</primary>
54819 <secondary>in local part</secondary>
54820 </indexterm>
54821 <indexterm role="concept">
54822 <primary>local part</primary>
54823 <secondary>dots in</secondary>
54824 </indexterm>
54825 RFC 2822 forbids empty components in local parts. That is, an unquoted local
54826 part may not begin or end with a dot, nor have two consecutive dots in the
54827 middle. However, it seems that many MTAs do not enforce this, so Exim permits
54828 empty components for compatibility.
54829 </para>
54830 </section>
54831 <section id="SECID232">
54832 <title>Rewriting addresses</title>
54833 <para>
54834 <indexterm role="concept">
54835 <primary>rewriting</primary>
54836 <secondary>addresses</secondary>
54837 </indexterm>
54838 Rewriting of sender and recipient addresses, and addresses in headers, can
54839 happen automatically, or as the result of configuration options, as described
54840 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
54841 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
54842 </para>
54843 <para>
54844 Automatic rewriting includes qualification, as mentioned above. The other case
54845 in which it can happen is when an incomplete non-local domain is given. The
54846 routing process may cause this to be expanded into the full domain name. For
54847 example, a header such as
54848 </para>
54849 <literallayout class="monospaced">
54850 To: hare@teaparty
54851 </literallayout>
54852 <para>
54853 might get rewritten as
54854 </para>
54855 <literallayout class="monospaced">
54856 To: hare@teaparty.wonderland.fict.example
54857 </literallayout>
54858 <para>
54859 Rewriting as a result of routing is the one kind of message processing that
54860 does not happen at input time, as it cannot be done until the address has
54861 been routed.
54862 </para>
54863 <para>
54864 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
54865 addresses have been routed, in case any of the headers get changed as a
54866 result of routing. However, doing this in practice would hold up many
54867 deliveries for unreasonable amounts of time, just because one address could not
54868 immediately be routed. Exim therefore does not delay other deliveries when
54869 routing of one or more addresses is deferred.
54870 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
54871 </para>
54872 </section>
54873 </chapter>
54874
54875 <chapter id="CHAPSMTP">
54876 <title>SMTP processing</title>
54877 <para>
54878 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
54879 <primary>SMTP</primary>
54880 <secondary>processing details</secondary>
54881 </indexterm>
54882 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
54883 <primary>LMTP</primary>
54884 <secondary>processing details</secondary>
54885 </indexterm>
54886 Exim supports a number of different ways of using the SMTP protocol, and its
54887 LMTP variant, which is an interactive protocol for transferring messages into a
54888 closed mail store application. This chapter contains details of how SMTP is
54889 processed. For incoming mail, the following are available:
54890 </para>
54891 <itemizedlist>
54892 <listitem>
54893 <para>
54894 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
54895 </para>
54896 </listitem>
54897 <listitem>
54898 <para>
54899 SMTP over the standard input and output (the <option>-bs</option> option);
54900 </para>
54901 </listitem>
54902 <listitem>
54903 <para>
54904 Batched SMTP on the standard input (the <option>-bS</option> option).
54905 </para>
54906 </listitem>
54907 </itemizedlist>
54908 <para>
54909 For mail delivery, the following are available:
54910 </para>
54911 <itemizedlist>
54912 <listitem>
54913 <para>
54914 SMTP over TCP/IP (the <command>smtp</command> transport);
54915 </para>
54916 </listitem>
54917 <listitem>
54918 <para>
54919 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
54920 <quote>lmtp</quote>);
54921 </para>
54922 </listitem>
54923 <listitem>
54924 <para>
54925 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
54926 transport);
54927 </para>
54928 </listitem>
54929 <listitem>
54930 <para>
54931 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
54932 the <option>use_bsmtp</option> option set).
54933 </para>
54934 </listitem>
54935 </itemizedlist>
54936 <para>
54937 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
54938 stored in or read from files (or pipes), in a format in which SMTP commands are
54939 used to contain the envelope information.
54940 </para>
54941 <section id="SECToutSMTPTCP">
54942 <title>Outgoing SMTP and LMTP over TCP/IP</title>
54943 <para>
54944 <indexterm role="concept">
54945 <primary>SMTP</primary>
54946 <secondary>outgoing over TCP/IP</secondary>
54947 </indexterm>
54948 <indexterm role="concept">
54949 <primary>outgoing SMTP over TCP/IP</primary>
54950 </indexterm>
54951 <indexterm role="concept">
54952 <primary>LMTP</primary>
54953 <secondary>over TCP/IP</secondary>
54954 </indexterm>
54955 <indexterm role="concept">
54956 <primary>outgoing LMTP over TCP/IP</primary>
54957 </indexterm>
54958 <indexterm role="concept">
54959 <primary>EHLO</primary>
54960 </indexterm>
54961 <indexterm role="concept">
54962 <primary>HELO</primary>
54963 </indexterm>
54964 <indexterm role="concept">
54965 <primary>SIZE option on MAIL command</primary>
54966 </indexterm>
54967 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
54968 The <option>protocol</option> option selects which protocol is to be used, but the actual
54969 processing is the same in both cases.
54970 </para>
54971 <para>
54972 If, in response to its EHLO command, Exim is told that the SIZE
54973 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
54974 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
54975 <option>size_addition</option> option (default 1024) to allow for additions to the message
54976 such as per-transport header lines, or changes made in a
54977 <indexterm role="concept">
54978 <primary>transport</primary>
54979 <secondary>filter</secondary>
54980 </indexterm>
54981 <indexterm role="concept">
54982 <primary>filter</primary>
54983 <secondary>transport filter</secondary>
54984 </indexterm>
54985 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
54986 suppressed.
54987 </para>
54988 <para>
54989 If the remote server advertises support for PIPELINING, Exim uses the
54990 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
54991 required for the transaction.
54992 </para>
54993 <para>
54994 If the remote server advertises support for the STARTTLS command, and Exim
54995 was built to support TLS encryption, it tries to start a TLS session unless the
54996 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
54997 </para>
54998 <para>
54999 If the remote server advertises support for the AUTH command, Exim scans
55000 the authenticators configuration for any suitable client settings, as described
55001 in chapter <xref linkend="CHAPSMTPAUTH"/>.
55002 </para>
55003 <para>
55004 <indexterm role="concept">
55005 <primary>carriage return</primary>
55006 </indexterm>
55007 <indexterm role="concept">
55008 <primary>linefeed</primary>
55009 </indexterm>
55010 Responses from the remote host are supposed to be terminated by CR followed by
55011 LF. However, there are known to be hosts that do not send CR characters, so in
55012 order to be able to interwork with such hosts, Exim treats LF on its own as a
55013 line terminator.
55014 </para>
55015 <para>
55016 If a message contains a number of different addresses, all those with the same
55017 characteristics (for example, the same envelope sender) that resolve to the
55018 same set of hosts, in the same order, are sent in a single SMTP transaction,
55019 even if they are for different domains, unless there are more than the setting
55020 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
55021 they are split into groups containing no more than <option>max_rcpts</option> addresses
55022 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
55023 in parallel sessions. The order of hosts with identical MX values is not
55024 significant when checking whether addresses can be batched in this way.
55025 </para>
55026 <para>
55027 When the <command>smtp</command> transport suffers a temporary failure that is not
55028 message-related, Exim updates its transport-specific database, which contains
55029 records indexed by host name that remember which messages are waiting for each
55030 particular host. It also updates the retry database with new retry times.
55031 </para>
55032 <para>
55033 <indexterm role="concept">
55034 <primary>hints database</primary>
55035 <secondary>retry keys</secondary>
55036 </indexterm>
55037 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
55038 a multi-homed host is broken, it will soon be skipped most of the time.
55039 See the next section for more detail about error handling.
55040 </para>
55041 <para>
55042 <indexterm role="concept">
55043 <primary>SMTP</primary>
55044 <secondary>passed connection</secondary>
55045 </indexterm>
55046 <indexterm role="concept">
55047 <primary>SMTP</primary>
55048 <secondary>batching over TCP/IP</secondary>
55049 </indexterm>
55050 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
55051 looks in the hints database for the transport to see if there are any queued
55052 messages waiting for the host to which it is connected. If it finds one, it
55053 creates a new Exim process using the <option>-MC</option> option (which can only be used by
55054 a process running as root or the Exim user) and passes the TCP/IP socket to it
55055 so that it can deliver another message using the same socket. The new process
55056 does only those deliveries that are routed to the connected host, and may in
55057 turn pass the socket on to a third process, and so on.
55058 </para>
55059 <para>
55060 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
55061 limit the number of messages sent down a single TCP/IP connection.
55062 </para>
55063 <para>
55064 <indexterm role="concept">
55065 <primary>asterisk</primary>
55066 <secondary>after IP address</secondary>
55067 </indexterm>
55068 The second and subsequent messages delivered down an existing connection are
55069 identified in the main log by the addition of an asterisk after the closing
55070 square bracket of the IP address.
55071 </para>
55072 </section>
55073 <section id="SECToutSMTPerr">
55074 <title>Errors in outgoing SMTP</title>
55075 <para>
55076 <indexterm role="concept">
55077 <primary>error</primary>
55078 <secondary>in outgoing SMTP</secondary>
55079 </indexterm>
55080 <indexterm role="concept">
55081 <primary>SMTP</primary>
55082 <secondary>errors in outgoing</secondary>
55083 </indexterm>
55084 <indexterm role="concept">
55085 <primary>host</primary>
55086 <secondary>error</secondary>
55087 </indexterm>
55088 Three different kinds of error are recognized for outgoing SMTP: host errors,
55089 message errors, and recipient errors.
55090 </para>
55091 <variablelist>
55092 <varlistentry>
55093 <term><emphasis role="bold">Host errors</emphasis></term>
55094 <listitem>
55095 <para>
55096 A host error is not associated with a particular message or with a
55097 particular recipient of a message. The host errors are:
55098 </para>
55099 <itemizedlist>
55100 <listitem>
55101 <para>
55102 Connection refused or timed out,
55103 </para>
55104 </listitem>
55105 <listitem>
55106 <para>
55107 Any error response code on connection,
55108 </para>
55109 </listitem>
55110 <listitem>
55111 <para>
55112 Any error response code to EHLO or HELO,
55113 </para>
55114 </listitem>
55115 <listitem>
55116 <para>
55117 Loss of connection at any time, except after <quote>.</quote>,
55118 </para>
55119 </listitem>
55120 <listitem>
55121 <para>
55122 I/O errors at any time,
55123 </para>
55124 </listitem>
55125 <listitem>
55126 <para>
55127 Timeouts during the session, other than in response to MAIL, RCPT or
55128 the <quote>.</quote> at the end of the data.
55129 </para>
55130 </listitem>
55131 </itemizedlist>
55132 <para>
55133 For a host error, a permanent error response on connection, or in response to
55134 EHLO, causes all addresses routed to the host to be failed. Any other host
55135 error causes all addresses to be deferred, and retry data to be created for the
55136 host. It is not tried again, for any message, until its retry time arrives. If
55137 the current set of addresses are not all delivered in this run (to some
55138 alternative host), the message is added to the list of those waiting for this
55139 host, so if it is still undelivered when a subsequent successful delivery is
55140 made to the host, it will be sent down the same SMTP connection.
55141 </para>
55142 </listitem></varlistentry>
55143 <varlistentry>
55144 <term><emphasis role="bold">Message errors</emphasis></term>
55145 <listitem>
55146 <para>
55147 <indexterm role="concept">
55148 <primary>message</primary>
55149 <secondary>error</secondary>
55150 </indexterm>
55151 A message error is associated with a particular message when sent to a
55152 particular host, but not with a particular recipient of the message. The
55153 message errors are:
55154 </para>
55155 <itemizedlist>
55156 <listitem>
55157 <para>
55158 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
55159 the data,
55160 </para>
55161 </listitem>
55162 <listitem>
55163 <para>
55164 Timeout after MAIL,
55165 </para>
55166 </listitem>
55167 <listitem>
55168 <para>
55169 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
55170 timeout after the DATA command itself is treated as a host error, as is loss of
55171 connection at any other time.
55172 </para>
55173 </listitem>
55174 </itemizedlist>
55175 <para>
55176 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
55177 to be failed, and a delivery error report to be returned to the sender. A
55178 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
55179 addresses to be deferred. Retry data is not created for the host, but instead,
55180 a retry record for the combination of host plus message id is created. The
55181 message is not added to the list of those waiting for this host. This ensures
55182 that the failing message will not be sent to this host again until the retry
55183 time arrives. However, other messages that are routed to the host are not
55184 affected, so if it is some property of the message that is causing the error,
55185 it will not stop the delivery of other mail.
55186 </para>
55187 <para>
55188 If the remote host specified support for the SIZE parameter in its response
55189 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
55190 over-large message will cause a message error because the error arrives as a
55191 response to MAIL.
55192 </para>
55193 </listitem></varlistentry>
55194 <varlistentry>
55195 <term><emphasis role="bold">Recipient errors</emphasis></term>
55196 <listitem>
55197 <para>
55198 <indexterm role="concept">
55199 <primary>recipient</primary>
55200 <secondary>error</secondary>
55201 </indexterm>
55202 A recipient error is associated with a particular recipient of a message. The
55203 recipient errors are:
55204 </para>
55205 <itemizedlist>
55206 <listitem>
55207 <para>
55208 Any error response to RCPT,
55209 </para>
55210 </listitem>
55211 <listitem>
55212 <para>
55213 Timeout after RCPT.
55214 </para>
55215 </listitem>
55216 </itemizedlist>
55217 <para>
55218 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
55219 recipient address to be failed, and a bounce message to be returned to the
55220 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
55221 address to be deferred, and routing retry data to be created for it. This is
55222 used to delay processing of the address in subsequent queue runs, until its
55223 routing retry time arrives. This applies to all messages, but because it
55224 operates only in queue runs, one attempt will be made to deliver a new message
55225 to the failing address before the delay starts to operate. This ensures that,
55226 if the failure is really related to the message rather than the recipient
55227 (<quote>message too big for this recipient</quote> is a possible example), other messages
55228 have a chance of getting delivered. If a delivery to the address does succeed,
55229 the retry information gets cleared, so all stuck messages get tried again, and
55230 the retry clock is reset.
55231 </para>
55232 <para>
55233 The message is not added to the list of those waiting for this host. Use of the
55234 host for other messages is unaffected, and except in the case of a timeout,
55235 other recipients are processed independently, and may be successfully delivered
55236 in the current SMTP session. After a timeout it is of course impossible to
55237 proceed with the session, so all addresses get deferred. However, those other
55238 than the one that failed do not suffer any subsequent retry delays. Therefore,
55239 if one recipient is causing trouble, the others have a chance of getting
55240 through when a subsequent delivery attempt occurs before the failing
55241 recipient&#x2019;s retry time.
55242 </para>
55243 </listitem></varlistentry>
55244 </variablelist>
55245 <para>
55246 In all cases, if there are other hosts (or IP addresses) available for the
55247 current set of addresses (for example, from multiple MX records), they are
55248 tried in this run for any undelivered addresses, subject of course to their
55249 own retry data. In other words, recipient error retry data does not take effect
55250 until the next delivery attempt.
55251 </para>
55252 <para>
55253 Some hosts have been observed to give temporary error responses to every
55254 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
55255 would be nice if such circumstances could be recognized, and defer data for the
55256 host itself created, but this is not possible within the current Exim design.
55257 What actually happens is that retry data for every (host, message) combination
55258 is created.
55259 </para>
55260 <para>
55261 The reason that timeouts after MAIL and RCPT are treated specially is that
55262 these can sometimes arise as a result of the remote host&#x2019;s verification
55263 procedures. Exim makes this assumption, and treats them as if a temporary error
55264 response had been received. A timeout after <quote>.</quote> is treated specially because
55265 it is known that some broken implementations fail to recognize the end of the
55266 message if the last character of the last line is a binary zero. Thus, it is
55267 helpful to treat this case as a message error.
55268 </para>
55269 <para>
55270 Timeouts at other times are treated as host errors, assuming a problem with the
55271 host, or the connection to it. If a timeout after MAIL, RCPT,
55272 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
55273 the timeout is likely to occur at some other point in the dialogue, causing it
55274 then to be treated as a host error.
55275 </para>
55276 <para>
55277 There is experimental evidence that some MTAs drop the connection after the
55278 terminating <quote>.</quote> if they do not like the contents of the message for some
55279 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
55280 should be given. That is why Exim treats this case as a message rather than a
55281 host error, in order not to delay other messages to the same host.
55282 </para>
55283 </section>
55284 <section id="SECID233">
55285 <title>Incoming SMTP messages over TCP/IP</title>
55286 <para>
55287 <indexterm role="concept">
55288 <primary>SMTP</primary>
55289 <secondary>incoming over TCP/IP</secondary>
55290 </indexterm>
55291 <indexterm role="concept">
55292 <primary>incoming SMTP over TCP/IP</primary>
55293 </indexterm>
55294 <indexterm role="concept">
55295 <primary>inetd</primary>
55296 </indexterm>
55297 <indexterm role="concept">
55298 <primary>daemon</primary>
55299 </indexterm>
55300 Incoming SMTP messages can be accepted in one of two ways: by running a
55301 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
55302 <filename>/etc/inetd.conf</filename> should be like this:
55303 </para>
55304 <literallayout class="monospaced">
55305 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
55306 </literallayout>
55307 <para>
55308 Exim distinguishes between this case and the case of a locally running user
55309 agent using the <option>-bs</option> option by checking whether or not the standard input is
55310 a socket. When it is, either the port must be privileged (less than 1024), or
55311 the caller must be root or the Exim user. If any other user passes a socket
55312 with an unprivileged port number, Exim prints a message on the standard error
55313 stream and exits with an error code.
55314 </para>
55315 <para>
55316 By default, Exim does not make a log entry when a remote host connects or
55317 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
55318 unexpected. It can be made to write such log entries by setting the
55319 <option>smtp_connection</option> log selector.
55320 </para>
55321 <para>
55322 <indexterm role="concept">
55323 <primary>carriage return</primary>
55324 </indexterm>
55325 <indexterm role="concept">
55326 <primary>linefeed</primary>
55327 </indexterm>
55328 Commands from the remote host are supposed to be terminated by CR followed by
55329 LF. However, there are known to be hosts that do not send CR characters. In
55330 order to be able to interwork with such hosts, Exim treats LF on its own as a
55331 line terminator.
55332 Furthermore, because common code is used for receiving messages from all
55333 sources, a CR on its own is also interpreted as a line terminator. However, the
55334 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
55335 </para>
55336 <para>
55337 <indexterm role="concept">
55338 <primary>EHLO</primary>
55339 <secondary>invalid data</secondary>
55340 </indexterm>
55341 <indexterm role="concept">
55342 <primary>HELO</primary>
55343 <secondary>invalid data</secondary>
55344 </indexterm>
55345 One area that sometimes gives rise to problems concerns the EHLO or
55346 HELO commands. Some clients send syntactically invalid versions of these
55347 commands, which Exim rejects by default. (This is nothing to do with verifying
55348 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
55349 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
55350 match the broken hosts that send invalid commands.
55351 </para>
55352 <para>
55353 <indexterm role="concept">
55354 <primary>SIZE option on MAIL command</primary>
55355 </indexterm>
55356 <indexterm role="concept">
55357 <primary>MAIL</primary>
55358 <secondary>SIZE option</secondary>
55359 </indexterm>
55360 The amount of disk space available is checked whenever SIZE is received on
55361 a MAIL command, independently of whether <option>message_size_limit</option> or
55362 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
55363 false. A temporary error is given if there is not enough space. If
55364 <option>check_spool_space</option> is set, the check is for that amount of space plus the
55365 value given with SIZE, that is, it checks that the addition of the incoming
55366 message will not reduce the space below the threshold.
55367 </para>
55368 <para>
55369 When a message is successfully received, Exim includes the local message id in
55370 its response to the final <quote>.</quote> that terminates the data. If the remote host
55371 logs this text it can help with tracing what has happened to a message.
55372 </para>
55373 <para>
55374 The Exim daemon can limit the number of simultaneous incoming connections it is
55375 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
55376 number of simultaneous incoming connections from a single remote host (see the
55377 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
55378 rejected using the SMTP temporary error code 421.
55379 </para>
55380 <para>
55381 The Exim daemon does not rely on the SIGCHLD signal to detect when a
55382 subprocess has finished, as this can get lost at busy times. Instead, it looks
55383 for completed subprocesses every time it wakes up. Provided there are other
55384 things happening (new incoming calls, starts of queue runs), completed
55385 processes will be noticed and tidied away. On very quiet systems you may
55386 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
55387 it will be noticed when the daemon next wakes up.
55388 </para>
55389 <para>
55390 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
55391 and can also be set up to reject SMTP calls from non-reserved hosts at times of
55392 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
55393 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
55394 applies in both the daemon and <emphasis>inetd</emphasis> cases.
55395 </para>
55396 <para>
55397 Exim normally starts a delivery process for each message received, though this
55398 can be varied by means of the <option>-odq</option> command line option and the
55399 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
55400 number of simultaneously running delivery processes started in this way from
55401 SMTP input can be limited by the <option>smtp_accept_queue</option> and
55402 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
55403 subsequently received messages are just put on the input queue without starting
55404 a delivery process.
55405 </para>
55406 <para>
55407 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
55408 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
55409 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
55410 handled by an entirely independent Exim process. Control by load average is,
55411 however, available with <emphasis>inetd</emphasis>.
55412 </para>
55413 <para>
55414 Exim can be configured to verify addresses in incoming SMTP commands as they
55415 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
55416 to rewrite addresses at this time &ndash; before any syntax checking is done. See
55417 section <xref linkend="SECTrewriteS"/>.
55418 </para>
55419 <para>
55420 Exim can also be configured to limit the rate at which a client host submits
55421 MAIL and RCPT commands in a single SMTP session. See the
55422 <option>smtp_ratelimit_hosts</option> option.
55423 </para>
55424 </section>
55425 <section id="SECID234">
55426 <title>Unrecognized SMTP commands</title>
55427 <para>
55428 <indexterm role="concept">
55429 <primary>SMTP</primary>
55430 <secondary>unrecognized commands</secondary>
55431 </indexterm>
55432 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
55433 commands during a single SMTP connection, it drops the connection after sending
55434 the error response to the last command. The default value for
55435 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
55436 abuse that subvert web servers into making connections to SMTP ports; in these
55437 circumstances, a number of non-SMTP lines are sent first.
55438 </para>
55439 </section>
55440 <section id="SECID235">
55441 <title>Syntax and protocol errors in SMTP commands</title>
55442 <para>
55443 <indexterm role="concept">
55444 <primary>SMTP</primary>
55445 <secondary>syntax errors</secondary>
55446 </indexterm>
55447 <indexterm role="concept">
55448 <primary>SMTP</primary>
55449 <secondary>protocol errors</secondary>
55450 </indexterm>
55451 A syntax error is detected if an SMTP command is recognized, but there is
55452 something syntactically wrong with its data, for example, a malformed email
55453 address in a RCPT command. Protocol errors include invalid command
55454 sequencing such as RCPT before MAIL. If Exim receives more than
55455 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
55456 drops the connection after sending the error response to the last command. The
55457 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
55458 broken clients that loop sending bad commands (yes, it has been seen).
55459 </para>
55460 </section>
55461 <section id="SECID236">
55462 <title>Use of non-mail SMTP commands</title>
55463 <para>
55464 <indexterm role="concept">
55465 <primary>SMTP</primary>
55466 <secondary>non-mail commands</secondary>
55467 </indexterm>
55468 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
55469 DATA. Exim counts such commands, and drops the connection if there are too
55470 many of them in a single SMTP session. This action catches some
55471 denial-of-service attempts and things like repeated failing AUTHs, or a mad
55472 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
55473 defines what <quote>too many</quote> means. Its default value is 10.
55474 </para>
55475 <para>
55476 When a new message is expected, one occurrence of RSET is not counted. This
55477 allows a client to send one RSET between messages (this is not necessary,
55478 but some clients do it). Exim also allows one uncounted occurrence of HELO
55479 or EHLO, and one occurrence of STARTTLS between messages. After
55480 starting up a TLS session, another EHLO is expected, and so it too is not
55481 counted.
55482 </para>
55483 <para>
55484 The first occurrence of AUTH in a connection, or immediately following
55485 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
55486 RCPT, DATA, and QUIT are counted.
55487 </para>
55488 <para>
55489 You can control which hosts are subject to the limit set by
55490 <option>smtp_accept_max_nonmail</option> by setting
55491 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
55492 the limit apply to all hosts. This option means that you can exclude any
55493 specific badly-behaved hosts that you have to live with.
55494 </para>
55495 </section>
55496 <section id="SECID237">
55497 <title>The VRFY and EXPN commands</title>
55498 <para>
55499 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
55500 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
55501 appropriate) in order to decide whether the command should be accepted or not.
55502 If no ACL is defined, the command is rejected.
55503 </para>
55504 <para>
55505 <indexterm role="concept">
55506 <primary>VRFY</primary>
55507 <secondary>processing</secondary>
55508 </indexterm>
55509 When VRFY is accepted, it runs exactly the same code as when Exim is
55510 called with the <option>-bv</option> option.
55511 </para>
55512 <para>
55513 <indexterm role="concept">
55514 <primary>EXPN</primary>
55515 <secondary>processing</secondary>
55516 </indexterm>
55517 When EXPN is accepted, a single-level expansion of the address is done.
55518 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
55519 than a verification (the <option>-bv</option> option). If an unqualified local part is given
55520 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
55521 of VRFY and EXPN commands are logged on the main and reject logs, and
55522 VRFY verification failures are logged on the main log for consistency with
55523 RCPT failures.
55524 </para>
55525 </section>
55526 <section id="SECTETRN">
55527 <title>The ETRN command</title>
55528 <para>
55529 <indexterm role="concept">
55530 <primary>ETRN</primary>
55531 <secondary>processing</secondary>
55532 </indexterm>
55533 RFC 1985 describes an SMTP command called ETRN that is designed to
55534 overcome the security problems of the TURN command (which has fallen into
55535 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
55536 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
55537 should be accepted or not. If no ACL is defined, the command is rejected.
55538 </para>
55539 <para>
55540 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
55541 delivery to certain hosts. As Exim does not organize its message queue by host,
55542 the only form of ETRN that is supported by default is the one where the
55543 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
55544 specific to the SMTP server. A valid ETRN command causes a run of Exim with
55545 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
55546 argument. For example,
55547 </para>
55548 <literallayout class="monospaced">
55549 ETRN #brigadoon
55550 </literallayout>
55551 <para>
55552 runs the command
55553 </para>
55554 <literallayout class="monospaced">
55555 exim -R brigadoon
55556 </literallayout>
55557 <para>
55558 which causes a delivery attempt on all messages with undelivered addresses
55559 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
55560 default), Exim prevents the simultaneous execution of more than one queue run
55561 for the same argument string as a result of an ETRN command. This stops
55562 a misbehaving client from starting more than one queue runner at once.
55563 </para>
55564 <para>
55565 <indexterm role="concept">
55566 <primary>hints database</primary>
55567 <secondary>ETRN serialization</secondary>
55568 </indexterm>
55569 Exim implements the serialization by means of a hints database in which a
55570 record is written whenever a process is started by ETRN, and deleted when
55571 the process completes. However, Exim does not keep the SMTP session waiting for
55572 the ETRN process to complete. Once ETRN is accepted, the client is sent
55573 a <quote>success</quote> return code. Obviously there is scope for hints records to get
55574 left lying around if there is a system or program crash. To guard against this,
55575 Exim ignores any records that are more than six hours old.
55576 </para>
55577 <para>
55578 <indexterm role="option">
55579 <primary><option>smtp_etrn_command</option></primary>
55580 </indexterm>
55581 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
55582 used. This specifies a command that is run whenever ETRN is received,
55583 whatever the form of its argument. For
55584 example:
55585 </para>
55586 <literallayout class="monospaced">
55587 smtp_etrn_command = /etc/etrn_command $domain \
55588                     $sender_host_address
55589 </literallayout>
55590 <para>
55591 <indexterm role="variable">
55592 <primary><varname>$domain</varname></primary>
55593 </indexterm>
55594 The string is split up into arguments which are independently expanded. The
55595 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
55596 and no syntax checking is done on the contents of this argument. Exim does not
55597 wait for the command to complete, so its status code is not checked. Exim runs
55598 under its own uid and gid when receiving incoming SMTP, so it is not possible
55599 for it to change them before running the command.
55600 </para>
55601 </section>
55602 <section id="SECID238">
55603 <title>Incoming local SMTP</title>
55604 <para>
55605 <indexterm role="concept">
55606 <primary>SMTP</primary>
55607 <secondary>local incoming</secondary>
55608 </indexterm>
55609 Some user agents use SMTP to pass messages to their local MTA using the
55610 standard input and output, as opposed to passing the envelope on the command
55611 line and writing the message to the standard input. This is supported by the
55612 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
55613 messages over TCP/IP (including the use of ACLs), except that the envelope
55614 sender given in a MAIL command is ignored unless the caller is trusted. In
55615 an ACL you can detect this form of SMTP input by testing for an empty host
55616 identification. It is common to have this as the first line in the ACL that
55617 runs for RCPT commands:
55618 </para>
55619 <literallayout class="monospaced">
55620 accept hosts = :
55621 </literallayout>
55622 <para>
55623 This accepts SMTP messages from local processes without doing any other tests.
55624 </para>
55625 </section>
55626 <section id="SECTbatchSMTP">
55627 <title>Outgoing batched SMTP</title>
55628 <para>
55629 <indexterm role="concept">
55630 <primary>SMTP</primary>
55631 <secondary>batched outgoing</secondary>
55632 </indexterm>
55633 <indexterm role="concept">
55634 <primary>batched SMTP output</primary>
55635 </indexterm>
55636 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
55637 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
55638 be output in BSMTP format. No SMTP responses are possible for this form of
55639 delivery. All it is doing is using SMTP commands as a way of transmitting the
55640 envelope along with the message.
55641 </para>
55642 <para>
55643 The message is written to the file or pipe preceded by the SMTP commands
55644 MAIL and RCPT, and followed by a line containing a single dot. Lines in
55645 the message that start with a dot have an extra dot added. The SMTP command
55646 HELO is not normally used. If it is required, the <option>message_prefix</option> option
55647 can be used to specify it.
55648 </para>
55649 <para>
55650 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
55651 one recipient address at a time by default. However, you can arrange for them
55652 to handle several addresses at once by setting the <option>batch_max</option> option. When
55653 this is done for BSMTP, messages may contain multiple RCPT commands. See
55654 chapter <xref linkend="CHAPbatching"/> for more details.
55655 </para>
55656 <para>
55657 <indexterm role="variable">
55658 <primary><varname>$host</varname></primary>
55659 </indexterm>
55660 When one or more addresses are routed to a BSMTP transport by a router that
55661 sets up a host list, the name of the first host on the list is available to the
55662 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
55663 router:
55664 </para>
55665 <literallayout class="monospaced">
55666 begin routers
55667 route_append:
55668   driver = manualroute
55669   transport = smtp_appendfile
55670   route_list = domain.example  batch.host.example
55671
55672 begin transports
55673 smtp_appendfile:
55674   driver = appendfile
55675   directory = /var/bsmtp/$host
55676   batch_max = 1000
55677   use_bsmtp
55678   user = exim
55679 </literallayout>
55680 <para>
55681 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
55682 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
55683 message (unless there are more than 1000 recipients).
55684 </para>
55685 </section>
55686 <section id="SECTincomingbatchedSMTP">
55687 <title>Incoming batched SMTP</title>
55688 <para>
55689 <indexterm role="concept">
55690 <primary>SMTP</primary>
55691 <secondary>batched incoming</secondary>
55692 </indexterm>
55693 <indexterm role="concept">
55694 <primary>batched SMTP input</primary>
55695 </indexterm>
55696 The <option>-bS</option> command line option causes Exim to accept one or more messages by
55697 reading SMTP on the standard input, but to generate no responses. If the caller
55698 is trusted, the senders in the MAIL commands are believed; otherwise the
55699 sender is always the caller of Exim. Unqualified senders and receivers are not
55700 rejected (there seems little point) but instead just get qualified. HELO
55701 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
55702 as NOOP; QUIT quits.
55703 </para>
55704 <para>
55705 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
55706 In this respect it is like non-SMTP local input.
55707 </para>
55708 <para>
55709 If an error is detected while reading a message, including a missing <quote>.</quote> at
55710 the end, Exim gives up immediately. It writes details of the error to the
55711 standard output in a stylized way that the calling program should be able to
55712 make some use of automatically, for example:
55713 </para>
55714 <literallayout class="monospaced">
55715 554 Unexpected end of file
55716 Transaction started in line 10
55717 Error detected in line 14
55718 </literallayout>
55719 <para>
55720 It writes a more verbose version, for human consumption, to the standard error
55721 file, for example:
55722 </para>
55723 <literallayout class="monospaced">
55724 An error was detected while processing a file of BSMTP input.
55725 The error message was:
55726
55727 501 '&gt;' missing at end of address
55728
55729 The SMTP transaction started in line 10.
55730 The error was detected in line 12.
55731 The SMTP command at fault was:
55732
55733 rcpt to:&lt;malformed@in.com.plete
55734
55735 1 previous message was successfully processed.
55736 The rest of the batch was abandoned.
55737 </literallayout>
55738 <para>
55739 The return code from Exim is zero only if there were no errors. It is 1 if some
55740 messages were accepted before an error was detected, and 2 if no messages were
55741 accepted.
55742 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
55743 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
55744 </para>
55745 </section>
55746 </chapter>
55747
55748 <chapter id="CHAPemsgcust">
55749 <title>Customizing bounce and warning messages</title>
55750 <titleabbrev>Customizing messages</titleabbrev>
55751 <para>
55752 When a message fails to be delivered, or remains on the queue for more than a
55753 configured amount of time, Exim sends a message to the original sender, or
55754 to an alternative configured address. The text of these messages is built into
55755 the code of Exim, but it is possible to change it, either by adding a single
55756 string, or by replacing each of the paragraphs by text supplied in a file.
55757 </para>
55758 <para>
55759 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
55760 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
55761 option. Exim also adds the line
55762 </para>
55763 <literallayout class="monospaced">
55764 Auto-Submitted: auto-generated
55765 </literallayout>
55766 <para>
55767 to all warning and bounce messages,
55768 </para>
55769 <section id="SECID239">
55770 <title>Customizing bounce messages</title>
55771 <para>
55772 <indexterm role="concept">
55773 <primary>customizing</primary>
55774 <secondary>bounce message</secondary>
55775 </indexterm>
55776 <indexterm role="concept">
55777 <primary>bounce message</primary>
55778 <secondary>customizing</secondary>
55779 </indexterm>
55780 If <option>bounce_message_text</option> is set, its contents are included in the default
55781 message immediately after <quote>This message was created automatically by mail
55782 delivery software.</quote> The string is not expanded. It is not used if
55783 <option>bounce_message_file</option> is set.
55784 </para>
55785 <para>
55786 When <option>bounce_message_file</option> is set, it must point to a template file for
55787 constructing error messages. The file consists of a series of text items,
55788 separated by lines consisting of exactly four asterisks. If the file cannot be
55789 opened, default text is used and a message is written to the main and panic
55790 logs. If any text item in the file is empty, default text is used for that
55791 item.
55792 </para>
55793 <para>
55794 <indexterm role="variable">
55795 <primary><varname>$bounce_recipient</varname></primary>
55796 </indexterm>
55797 <indexterm role="variable">
55798 <primary><varname>$bounce_return_size_limit</varname></primary>
55799 </indexterm>
55800 Each item of text that is read from the file is expanded, and there are two
55801 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
55802 the recipient of an error message while it is being created, and
55803 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
55804 option, rounded to a whole number.
55805 </para>
55806 <para>
55807 The items must appear in the file in the following order:
55808 </para>
55809 <itemizedlist>
55810 <listitem>
55811 <para>
55812 The first item is included in the headers, and should include at least a
55813 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
55814 </para>
55815 </listitem>
55816 <listitem>
55817 <para>
55818 The second item forms the start of the error message. After it, Exim lists the
55819 failing addresses with their error messages.
55820 </para>
55821 </listitem>
55822 <listitem>
55823 <para>
55824 The third item is used to introduce any text from pipe transports that is to be
55825 returned to the sender. It is omitted if there is no such text.
55826 </para>
55827 </listitem>
55828 <listitem>
55829 <para>
55830 The fourth item is used to introduce the copy of the message that is returned
55831 as part of the error report.
55832 </para>
55833 </listitem>
55834 <listitem>
55835 <para>
55836 The fifth item is added after the fourth one if the returned message is
55837 truncated because it is bigger than <option>return_size_limit</option>.
55838 </para>
55839 </listitem>
55840 <listitem>
55841 <para>
55842 The sixth item is added after the copy of the original message.
55843 </para>
55844 </listitem>
55845 </itemizedlist>
55846 <para>
55847 The default state (<option>bounce_message_file</option> unset) is equivalent to the
55848 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
55849 other lines have been split in order to fit them on the page:
55850 </para>
55851 <literallayout class="monospaced">
55852 Subject: Mail delivery failed
55853   ${if eq{$sender_address}{$bounce_recipient}
55854   {: returning message to sender}}
55855 ****
55856 This message was created automatically by mail delivery software.
55857
55858 A message ${if eq{$sender_address}{$bounce_recipient}
55859   {that you sent }{sent by
55860
55861 &lt;$sender_address&gt;
55862
55863 }}could not be delivered to all of its recipients.
55864 This is a permanent error. The following address(es) failed:
55865 ****
55866 The following text was generated during the delivery attempt(s):
55867 ****
55868 ------ This is a copy of the message, including all the headers.
55869   ------
55870 ****
55871 ------ The body of the message is $message_size characters long;
55872   only the first
55873 ------ $bounce_return_size_limit or so are included here.
55874 ****
55875 </literallayout>
55876 </section>
55877 <section id="SECTcustwarn">
55878 <title>Customizing warning messages</title>
55879 <para>
55880 <indexterm role="concept">
55881 <primary>customizing</primary>
55882 <secondary>warning message</secondary>
55883 </indexterm>
55884 <indexterm role="concept">
55885 <primary>warning of delay</primary>
55886 <secondary>customizing the message</secondary>
55887 </indexterm>
55888 The option <option>warn_message_file</option> can be pointed at a template file for use when
55889 warnings about message delays are created. In this case there are only three
55890 text sections:
55891 </para>
55892 <itemizedlist>
55893 <listitem>
55894 <para>
55895 The first item is included in the headers, and should include at least a
55896 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
55897 </para>
55898 </listitem>
55899 <listitem>
55900 <para>
55901 The second item forms the start of the warning message. After it, Exim lists
55902 the delayed addresses.
55903 </para>
55904 </listitem>
55905 <listitem>
55906 <para>
55907 The third item then ends the message.
55908 </para>
55909 </listitem>
55910 </itemizedlist>
55911 <para>
55912 The default state is equivalent to the following file, except that some lines
55913 have been split here, in order to fit them on the page:
55914 </para>
55915 <literallayout class="monospaced">
55916 Subject: Warning: message $message_exim_id delayed
55917   $warn_message_delay
55918 ****
55919 This message was created automatically by mail delivery software.
55920
55921 A message ${if eq{$sender_address}{$warn_message_recipients}
55922 {that you sent }{sent by
55923
55924 &lt;$sender_address&gt;
55925
55926 }}has not been delivered to all of its recipients after
55927 more than $warn_message_delay on the queue on $primary_hostname.
55928
55929 The message identifier is:     $message_exim_id
55930 The subject of the message is: $h_subject
55931 The date of the message is:    $h_date
55932
55933 The following address(es) have not yet been delivered:
55934 ****
55935 No action is required on your part. Delivery attempts will
55936 continue for some time, and this warning may be repeated at
55937 intervals if the message remains undelivered. Eventually the
55938 mail delivery software will give up, and when that happens,
55939 the message will be returned to you.
55940 </literallayout>
55941 <para>
55942 <indexterm role="variable">
55943 <primary><varname>$warn_message_delay</varname></primary>
55944 </indexterm>
55945 <indexterm role="variable">
55946 <primary><varname>$warn_message_recipients</varname></primary>
55947 </indexterm>
55948 However, in the default state the subject and date lines are omitted if no
55949 appropriate headers exist. During the expansion of this file,
55950 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
55951 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
55952 of recipients for the warning message. There may be more than one if there are
55953 multiple addresses with different <option>errors_to</option> settings on the routers that
55954 handled them.
55955 </para>
55956 </section>
55957 </chapter>
55958
55959 <chapter id="CHAPcomconreq">
55960 <title>Some common configuration settings</title>
55961 <para>
55962 This chapter discusses some configuration settings that seem to be fairly
55963 common. More examples and discussion can be found in the Exim book.
55964 </para>
55965 <section id="SECID240">
55966 <title>Sending mail to a smart host</title>
55967 <para>
55968 <indexterm role="concept">
55969 <primary>smart host</primary>
55970 <secondary>example router</secondary>
55971 </indexterm>
55972 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
55973 should replace the default <command>dnslookup</command> router with a router which does the
55974 routing explicitly:
55975 </para>
55976 <literallayout class="monospaced">
55977 send_to_smart_host:
55978   driver = manualroute
55979   route_list = !+local_domains smart.host.name
55980   transport = remote_smtp
55981 </literallayout>
55982 <para>
55983 You can use the smart host&#x2019;s IP address instead of the name if you wish.
55984 If you are using Exim only to submit messages to a smart host, and not for
55985 receiving incoming messages, you can arrange for it to do the submission
55986 synchronously by setting the <option>mua_wrapper</option> option (see chapter
55987 <xref linkend="CHAPnonqueueing"/>).
55988 </para>
55989 </section>
55990 <section id="SECTmailinglists">
55991 <title>Using Exim to handle mailing lists</title>
55992 <para>
55993 <indexterm role="concept">
55994 <primary>mailing lists</primary>
55995 </indexterm>
55996 Exim can be used to run simple mailing lists, but for large and/or complicated
55997 requirements, the use of additional specialized mailing list software such as
55998 Majordomo or Mailman is recommended.
55999 </para>
56000 <para>
56001 The <command>redirect</command> router can be used to handle mailing lists where each list
56002 is maintained in a separate file, which can therefore be managed by an
56003 independent manager. The <option>domains</option> router option can be used to run these
56004 lists in a separate domain from normal mail. For example:
56005 </para>
56006 <literallayout class="monospaced">
56007 lists:
56008   driver = redirect
56009   domains = lists.example
56010   file = /usr/lists/$local_part
56011   forbid_pipe
56012   forbid_file
56013   errors_to = $local_part-request@lists.example
56014   no_more
56015 </literallayout>
56016 <para>
56017 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
56018 in that domain, it looks for a file that matches the local part. If there is no
56019 such file, the router declines, but because <option>no_more</option> is set, no subsequent
56020 routers are tried, and so the whole delivery fails.
56021 </para>
56022 <para>
56023 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
56024 expanded into a file name or a pipe delivery, which is usually inappropriate in
56025 a mailing list.
56026 </para>
56027 <para>
56028 <indexterm role="option">
56029 <primary><option>errors_to</option></primary>
56030 </indexterm>
56031 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
56032 taken from a mailing list are to be sent to the given address rather than the
56033 original sender of the message. However, before acting on this, Exim verifies
56034 the error address, and ignores it if verification fails.
56035 </para>
56036 <para>
56037 For example, using the configuration above, mail sent to
56038 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
56039 <filename>/usr/lists/dicts</filename>, with error reports directed to
56040 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
56041 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
56042 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
56043 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
56044 or <option>local_part_suffix</option> options) to handle addresses of the form
56045 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
56046 </para>
56047 </section>
56048 <section id="SECID241">
56049 <title>Syntax errors in mailing lists</title>
56050 <para>
56051 <indexterm role="concept">
56052 <primary>mailing lists</primary>
56053 <secondary>syntax errors in</secondary>
56054 </indexterm>
56055 If an entry in redirection data contains a syntax error, Exim normally defers
56056 delivery of the original address. That means that a syntax error in a mailing
56057 list holds up all deliveries to the list. This may not be appropriate when a
56058 list is being maintained automatically from data supplied by users, and the
56059 addresses are not rigorously checked.
56060 </para>
56061 <para>
56062 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
56063 entries that fail to parse, noting the incident in the log. If in addition
56064 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
56065 whenever a broken address is skipped. It is usually appropriate to set
56066 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
56067 </para>
56068 </section>
56069 <section id="SECID242">
56070 <title>Re-expansion of mailing lists</title>
56071 <para>
56072 <indexterm role="concept">
56073 <primary>mailing lists</primary>
56074 <secondary>re-expansion of</secondary>
56075 </indexterm>
56076 Exim remembers every individual address to which a message has been delivered,
56077 in order to avoid duplication, but it normally stores only the original
56078 recipient addresses with a message. If all the deliveries to a mailing list
56079 cannot be done at the first attempt, the mailing list is re-expanded when the
56080 delivery is next tried. This means that alterations to the list are taken into
56081 account at each delivery attempt, so addresses that have been added to
56082 the list since the message arrived will therefore receive a copy of the
56083 message, even though it pre-dates their subscription.
56084 </para>
56085 <para>
56086 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
56087 on the <command>redirect</command> router. If this is done, any addresses generated by the
56088 router that fail to deliver at the first attempt are added to the message as
56089 <quote>top level</quote> addresses, and the parent address that generated them is marked
56090 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
56091 subsequent delivery attempts. The disadvantage of this is that if any of the
56092 failing addresses are incorrect, correcting them in the file has no effect on
56093 pre-existing messages.
56094 </para>
56095 <para>
56096 The original top-level address is remembered with each of the generated
56097 addresses, and is output in any log messages. However, any intermediate parent
56098 addresses are not recorded. This makes a difference to the log only if the
56099 <option>all_parents</option> selector is set, but for mailing lists there is normally only
56100 one level of expansion anyway.
56101 </para>
56102 </section>
56103 <section id="SECID243">
56104 <title>Closed mailing lists</title>
56105 <para>
56106 <indexterm role="concept">
56107 <primary>mailing lists</primary>
56108 <secondary>closed</secondary>
56109 </indexterm>
56110 The examples so far have assumed open mailing lists, to which anybody may
56111 send mail. It is also possible to set up closed lists, where mail is accepted
56112 from specified senders only. This is done by making use of the generic
56113 <option>senders</option> option to restrict the router that handles the list.
56114 </para>
56115 <para>
56116 The following example uses the same file as a list of recipients and as a list
56117 of permitted senders. It requires three routers:
56118 </para>
56119 <literallayout class="monospaced">
56120 lists_request:
56121   driver = redirect
56122   domains = lists.example
56123   local_part_suffix = -request
56124   file = /usr/lists/$local_part$local_part_suffix
56125   no_more
56126
56127 lists_post:
56128   driver = redirect
56129   domains = lists.example
56130   senders = ${if exists {/usr/lists/$local_part}\
56131              {lsearch;/usr/lists/$local_part}{*}}
56132   file = /usr/lists/$local_part
56133   forbid_pipe
56134   forbid_file
56135   errors_to = $local_part-request@lists.example
56136   no_more
56137
56138 lists_closed:
56139   driver = redirect
56140   domains = lists.example
56141   allow_fail
56142   data = :fail: $local_part@lists.example is a closed mailing list
56143 </literallayout>
56144 <para>
56145 All three routers have the same <option>domains</option> setting, so for any other domains,
56146 they are all skipped. The first router runs only if the local part ends in
56147 <option>-request</option>. It handles messages to the list manager(s) by means of an open
56148 mailing list.
56149 </para>
56150 <para>
56151 The second router runs only if the <option>senders</option> precondition is satisfied. It
56152 checks for the existence of a list that corresponds to the local part, and then
56153 checks that the sender is on the list by means of a linear search. It is
56154 necessary to check for the existence of the file before trying to search it,
56155 because otherwise Exim thinks there is a configuration error. If the file does
56156 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
56157 means that the router runs, but because there is no list, declines, and
56158 <option>no_more</option> ensures that no further routers are run. The address fails with an
56159 <quote>unrouteable address</quote> error.
56160 </para>
56161 <para>
56162 The third router runs only if the second router is skipped, which happens when
56163 a mailing list exists, but the sender is not on it. This router forcibly fails
56164 the address, giving a suitable error message.
56165 </para>
56166 </section>
56167 <section id="SECTverp">
56168 <title>Variable Envelope Return Paths (VERP)</title>
56169 <para>
56170 <indexterm role="concept">
56171 <primary>VERP</primary>
56172 </indexterm>
56173 <indexterm role="concept">
56174 <primary>Variable Envelope Return Paths</primary>
56175 </indexterm>
56176 <indexterm role="concept">
56177 <primary>envelope sender</primary>
56178 </indexterm>
56179 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;
56180 are a way of helping mailing list administrators discover which subscription
56181 address is the cause of a particular delivery failure. The idea is to encode
56182 the original recipient address in the outgoing envelope sender address, so that
56183 if the message is forwarded by another host and then subsequently bounces, the
56184 original recipient can be extracted from the recipient address of the bounce.
56185 </para>
56186 <para>
56187 <indexterm role="option">
56188 <primary><option>errors_to</option></primary>
56189 </indexterm>
56190 <indexterm role="option">
56191 <primary><option>return_path</option></primary>
56192 </indexterm>
56193 Envelope sender addresses can be modified by Exim using two different
56194 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
56195 list examples), or the <option>return_path</option> option on a transport. The second of
56196 these is effective only if the message is successfully delivered to another
56197 host; it is not used for errors detected on the local host (see the description
56198 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
56199 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
56200 </para>
56201 <literallayout class="monospaced">
56202 verp_smtp:
56203   driver = smtp
56204   max_rcpt = 1
56205   return_path = \
56206     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56207       {$1-request+$local_part=$domain@your.dom.example}fail}
56208 </literallayout>
56209 <para>
56210 This has the effect of rewriting the return path (envelope sender) on outgoing
56211 SMTP messages, if the local part of the original return path ends in
56212 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
56213 local part and domain of the recipient into the return path. Suppose, for
56214 example, that a message whose return path has been set to
56215 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
56216 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
56217 rewritten as
56218 </para>
56219 <literallayout class="monospaced">
56220 somelist-request+subscriber=other.dom.example@your.dom.example
56221 </literallayout>
56222 <para>
56223 <indexterm role="variable">
56224 <primary><varname>$local_part</varname></primary>
56225 </indexterm>
56226 For this to work, you must tell Exim to send multiple copies of messages that
56227 have more than one recipient, so that each copy has just one recipient. This is
56228 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
56229 might be sent to several different recipients in the same domain, in which case
56230 <varname>$local_part</varname> is not available in the transport, because it is not unique.
56231 </para>
56232 <para>
56233 Unless your host is doing nothing but mailing list deliveries, you should
56234 probably use a separate transport for the VERP deliveries, so as not to use
56235 extra resources in making one-per-recipient copies for other deliveries. This
56236 can easily be done by expanding the <option>transport</option> option in the router:
56237 </para>
56238 <literallayout class="monospaced">
56239 dnslookup:
56240   driver = dnslookup
56241   domains = ! +local_domains
56242   transport = \
56243     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56244       {verp_smtp}{remote_smtp}}
56245   no_more
56246 </literallayout>
56247 <para>
56248 If you want to change the return path using <option>errors_to</option> in a router instead
56249 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
56250 routers that handle mailing list addresses. This will ensure that all delivery
56251 errors, including those detected on the local host, are sent to the VERP
56252 address.
56253 </para>
56254 <para>
56255 On a host that does no local deliveries and has no manual routing, only the
56256 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
56257 SMTP deliveries. Every mailing list recipient has its own return path value,
56258 and so Exim must hand them to the transport one at a time. Here is an example
56259 of a <command>dnslookup</command> router that implements VERP:
56260 </para>
56261 <literallayout class="monospaced">
56262 verp_dnslookup:
56263   driver = dnslookup
56264   domains = ! +local_domains
56265   transport = remote_smtp
56266   errors_to = \
56267     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
56268      {$1-request+$local_part=$domain@your.dom.example}fail}
56269   no_more
56270 </literallayout>
56271 <para>
56272 Before you start sending out messages with VERPed return paths, you must also
56273 configure Exim to accept the bounce messages that come back to those paths.
56274 Typically this is done by setting a <option>local_part_suffix</option> option for a
56275 router, and using this to route the messages to wherever you want to handle
56276 them.
56277 </para>
56278 <para>
56279 The overhead incurred in using VERP depends very much on the size of the
56280 message, the number of recipient addresses that resolve to the same remote
56281 host, and the speed of the connection over which the message is being sent. If
56282 a lot of addresses resolve to the same host and the connection is slow, sending
56283 a separate copy of the message for each address may take substantially longer
56284 than sending a single copy with many recipients (for which VERP cannot be
56285 used).
56286 </para>
56287 </section>
56288 <section id="SECTvirtualdomains">
56289 <title>Virtual domains</title>
56290 <para>
56291 <indexterm role="concept">
56292 <primary>virtual domains</primary>
56293 </indexterm>
56294 <indexterm role="concept">
56295 <primary>domain</primary>
56296 <secondary>virtual</secondary>
56297 </indexterm>
56298 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
56299 meanings:
56300 </para>
56301 <itemizedlist>
56302 <listitem>
56303 <para>
56304 A domain for which there are no real mailboxes; all valid local parts are
56305 aliases for other email addresses. Common examples are organizational
56306 top-level domains and <quote>vanity</quote> domains.
56307 </para>
56308 </listitem>
56309 <listitem>
56310 <para>
56311 One of a number of independent domains that are all handled by the same host,
56312 with mailboxes on that host, but where the mailbox owners do not necessarily
56313 have login accounts on that host.
56314 </para>
56315 </listitem>
56316 </itemizedlist>
56317 <para>
56318 The first usage is probably more common, and does seem more <quote>virtual</quote> than
56319 the second. This kind of domain can be handled in Exim with a straightforward
56320 aliasing router. One approach is to create a separate alias file for each
56321 virtual domain. Exim can test for the existence of the alias file to determine
56322 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
56323 to a router of this form:
56324 </para>
56325 <literallayout class="monospaced">
56326 virtual:
56327   driver = redirect
56328   domains = dsearch;/etc/mail/virtual
56329   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
56330   no_more
56331 </literallayout>
56332 <para>
56333 The <option>domains</option> option specifies that the router is to be skipped, unless there
56334 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
56335 domain that is being processed. When the router runs, it looks up the local
56336 part in the file to find a new address (or list of addresses). The <option>no_more</option>
56337 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
56338 string), Exim gives up on the address without trying any subsequent routers.
56339 </para>
56340 <para>
56341 This one router can handle all the virtual domains because the alias file names
56342 follow a fixed pattern. Permissions can be arranged so that appropriate people
56343 can edit the different alias files. A successful aliasing operation results in
56344 a new envelope recipient address, which is then routed from scratch.
56345 </para>
56346 <para>
56347 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
56348 way. One approach is to create a file for each domain containing a list of
56349 valid local parts, and use it in a router like this:
56350 </para>
56351 <literallayout class="monospaced">
56352 my_domains:
56353   driver = accept
56354   domains = dsearch;/etc/mail/domains
56355   local_parts = lsearch;/etc/mail/domains/$domain
56356   transport = my_mailboxes
56357 </literallayout>
56358 <para>
56359 The address is accepted if there is a file for the domain, and the local part
56360 can be found in the file. The <option>domains</option> option is used to check for the
56361 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
56362 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
56363 because that option is tested after <option>local_parts</option>. The transport is as
56364 follows:
56365 </para>
56366 <literallayout class="monospaced">
56367 my_mailboxes:
56368   driver = appendfile
56369   file = /var/mail/$domain/$local_part
56370   user = mail
56371 </literallayout>
56372 <para>
56373 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
56374 required, to specify which uid is to be used for writing to the mailboxes.
56375 </para>
56376 <para>
56377 The configuration shown here is just one example of how you might support this
56378 requirement. There are many other ways this kind of configuration can be set
56379 up, for example, by using a database instead of separate files to hold all the
56380 information about the domains.
56381 </para>
56382 </section>
56383 <section id="SECTmulbox">
56384 <title>Multiple user mailboxes</title>
56385 <para>
56386 <indexterm role="concept">
56387 <primary>multiple mailboxes</primary>
56388 </indexterm>
56389 <indexterm role="concept">
56390 <primary>mailbox</primary>
56391 <secondary>multiple</secondary>
56392 </indexterm>
56393 <indexterm role="concept">
56394 <primary>local part</primary>
56395 <secondary>prefix</secondary>
56396 </indexterm>
56397 <indexterm role="concept">
56398 <primary>local part</primary>
56399 <secondary>suffix</secondary>
56400 </indexterm>
56401 Heavy email users often want to operate with multiple mailboxes, into which
56402 incoming mail is automatically sorted. A popular way of handling this is to
56403 allow users to use multiple sender addresses, so that replies can easily be
56404 identified. Users are permitted to add prefixes or suffixes to their local
56405 parts for this purpose. The wildcard facility of the generic router options
56406 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
56407 example, consider this router:
56408 </para>
56409 <literallayout class="monospaced">
56410 userforward:
56411   driver = redirect
56412   check_local_user
56413   file = $home/.forward
56414   local_part_suffix = -*
56415   local_part_suffix_optional
56416   allow_filter
56417 </literallayout>
56418 <para>
56419 <indexterm role="variable">
56420 <primary><varname>$local_part_suffix</varname></primary>
56421 </indexterm>
56422 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
56423 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
56424 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
56425 </para>
56426 <literallayout class="monospaced">
56427 if $local_part_suffix contains -special then
56428 save /home/$local_part/Mail/special
56429 endif
56430 </literallayout>
56431 <para>
56432 If the filter file does not exist, or does not deal with such addresses, they
56433 fall through to subsequent routers, and, assuming no subsequent use of the
56434 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
56435 control over which suffixes are valid.
56436 </para>
56437 <para>
56438 Alternatively, a suffix can be used to trigger the use of a different
56439 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
56440 another MTA:
56441 </para>
56442 <literallayout class="monospaced">
56443 userforward:
56444   driver = redirect
56445   check_local_user
56446   file = $home/.forward$local_part_suffix
56447   local_part_suffix = -*
56448   local_part_suffix_optional
56449   allow_filter
56450 </literallayout>
56451 <para>
56452 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
56453 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
56454 does not exist, or does not deal with the address, it is passed on to
56455 subsequent routers, which could, if required, look for an unqualified
56456 <filename>.forward</filename> file to use as a default.
56457 </para>
56458 </section>
56459 <section id="SECID244">
56460 <title>Simplified vacation processing</title>
56461 <para>
56462 <indexterm role="concept">
56463 <primary>vacation processing</primary>
56464 </indexterm>
56465 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
56466 a pipe command in a <filename>.forward</filename> file
56467 (see section <xref linkend="SECTspecitredli"/> for syntax details).
56468 This is prone to error by inexperienced users. There are two features of Exim
56469 that can be used to make this process simpler for users:
56470 </para>
56471 <itemizedlist>
56472 <listitem>
56473 <para>
56474 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
56475 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
56476 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
56477 <filename>.forward</filename> file are then much simpler. For example:
56478 </para>
56479 <literallayout class="monospaced">
56480 spqr, vacation-spqr
56481 </literallayout>
56482 </listitem>
56483 <listitem>
56484 <para>
56485 The <option>require_files</option> generic router option can be used to trigger a
56486 vacation delivery by checking for the existence of a certain file in the
56487 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
56488 ensure that the original delivery also proceeds. In this case, all the user has
56489 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
56490 message.
56491 </para>
56492 </listitem>
56493 </itemizedlist>
56494 <para>
56495 Another advantage of both these methods is that they both work even when the
56496 use of arbitrary pipes by users is locked out.
56497 </para>
56498 </section>
56499 <section id="SECID245">
56500 <title>Taking copies of mail</title>
56501 <para>
56502 <indexterm role="concept">
56503 <primary>message</primary>
56504 <secondary>copying every</secondary>
56505 </indexterm>
56506 Some installations have policies that require archive copies of all messages to
56507 be made. A single copy of each message can easily be taken by an appropriate
56508 command in a system filter, which could, for example, use a different file for
56509 each day&#x2019;s messages.
56510 </para>
56511 <para>
56512 There is also a shadow transport mechanism that can be used to take copies of
56513 messages that are successfully delivered by local transports, one copy per
56514 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
56515 notification of delivery by sites that insist on doing such things.
56516 </para>
56517 </section>
56518 <section id="SECID246">
56519 <title>Intermittently connected hosts</title>
56520 <para>
56521 <indexterm role="concept">
56522 <primary>intermittently connected hosts</primary>
56523 </indexterm>
56524 It has become quite common (because it is cheaper) for hosts to connect to the
56525 Internet periodically rather than remain connected all the time. The normal
56526 arrangement is that mail for such hosts accumulates on a system that is
56527 permanently connected.
56528 </para>
56529 <para>
56530 Exim was designed for use on permanently connected hosts, and so it is not
56531 particularly well-suited to use in an intermittently connected environment.
56532 Nevertheless there are some features that can be used.
56533 </para>
56534 </section>
56535 <section id="SECID247">
56536 <title>Exim on the upstream server host</title>
56537 <para>
56538 It is tempting to arrange for incoming mail for the intermittently connected
56539 host to remain on Exim&#x2019;s queue until the client connects. However, this
56540 approach does not scale very well. Two different kinds of waiting message are
56541 being mixed up in the same queue &ndash; those that cannot be delivered because of
56542 some temporary problem, and those that are waiting for their destination host
56543 to connect. This makes it hard to manage the queue, as well as wasting
56544 resources, because each queue runner scans the entire queue.
56545 </para>
56546 <para>
56547 A better approach is to separate off those messages that are waiting for an
56548 intermittently connected host. This can be done by delivering these messages
56549 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
56550 format, from where they are transmitted by other software when their
56551 destination connects. This makes it easy to collect all the mail for one host
56552 in a single directory, and to apply local timeout rules on a per-message basis
56553 if required.
56554 </para>
56555 <para>
56556 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
56557 you are doing this, you should configure Exim with a long retry period for the
56558 intermittent host. For example:
56559 </para>
56560 <literallayout class="monospaced">
56561 cheshire.wonderland.fict.example    *   F,5d,24h
56562 </literallayout>
56563 <para>
56564 This stops a lot of failed delivery attempts from occurring, but Exim remembers
56565 which messages it has queued up for that host. Once the intermittent host comes
56566 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
56567 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
56568 causes all the queued up messages to be delivered, often down a single SMTP
56569 connection. While the host remains connected, any new messages get delivered
56570 immediately.
56571 </para>
56572 <para>
56573 If the connecting hosts do not have fixed IP addresses, that is, if a host is
56574 issued with a different IP address each time it connects, Exim&#x2019;s retry
56575 mechanisms on the holding host get confused, because the IP address is normally
56576 used as part of the key string for holding retry information. This can be
56577 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
56578 Since this has disadvantages for permanently connected hosts, it is best to
56579 arrange a separate transport for the intermittently connected ones.
56580 </para>
56581 </section>
56582 <section id="SECID248">
56583 <title>Exim on the intermittently connected client host</title>
56584 <para>
56585 The value of <option>smtp_accept_queue_per_connection</option> should probably be
56586 increased, or even set to zero (that is, disabled) on the intermittently
56587 connected host, so that all incoming messages down a single connection get
56588 delivered immediately.
56589 </para>
56590 <para>
56591 <indexterm role="concept">
56592 <primary>SMTP</primary>
56593 <secondary>passed connection</secondary>
56594 </indexterm>
56595 <indexterm role="concept">
56596 <primary>SMTP</primary>
56597 <secondary>multiple deliveries</secondary>
56598 </indexterm>
56599 <indexterm role="concept">
56600 <primary>multiple SMTP deliveries</primary>
56601 </indexterm>
56602 Mail waiting to be sent from an intermittently connected host will probably
56603 not have been routed, because without a connection DNS lookups are not
56604 possible. This means that if a normal queue run is done at connection time,
56605 each message is likely to be sent in a separate SMTP session. This can be
56606 avoided by starting the queue run with a command line option beginning with
56607 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
56608 first pass, routing is done but no deliveries take place. The second pass is a
56609 normal queue run; since all the messages have been previously routed, those
56610 destined for the same host are likely to get sent as multiple deliveries in a
56611 single SMTP connection.
56612 </para>
56613 </section>
56614 </chapter>
56615
56616 <chapter id="CHAPnonqueueing">
56617 <title>Using Exim as a non-queueing client</title>
56618 <titleabbrev>Exim as a non-queueing client</titleabbrev>
56619 <para>
56620 <indexterm role="concept">
56621 <primary>client, non-queueing</primary>
56622 </indexterm>
56623 <indexterm role="concept">
56624 <primary>smart host</primary>
56625 <secondary>suppressing queueing</secondary>
56626 </indexterm>
56627 On a personal computer, it is a common requirement for all
56628 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
56629 configured to operate that way, for all the popular operating systems.
56630 However, there are some MUAs for Unix-like systems that cannot be so
56631 configured: they submit messages using the command line interface of
56632 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
56633 messages this way.
56634 </para>
56635 <para>
56636 If the personal computer runs continuously, there is no problem, because it can
56637 run a conventional MTA that handles delivery to the smart host, and deal with
56638 any delays via its queueing mechanism. However, if the computer does not run
56639 continuously or runs different operating systems at different times, queueing
56640 email is not desirable.
56641 </para>
56642 <para>
56643 There is therefore a requirement for something that can provide the
56644 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
56645 any queueing or retrying facilities. Furthermore, the delivery to the smart
56646 host should be synchronous, so that if it fails, the sending MUA is immediately
56647 informed. In other words, we want something that extends an MUA that submits
56648 to a local MTA via the command line so that it behaves like one that submits
56649 to a remote smart host using TCP/SMTP.
56650 </para>
56651 <para>
56652 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
56653 that do this job. However, people have found them to be lacking in various
56654 ways. For instance, you might want to allow aliasing and forwarding to be done
56655 before sending a message to the smart host.
56656 </para>
56657 <para>
56658 Exim already had the necessary infrastructure for doing this job. Just a few
56659 tweaks were needed to make it behave as required, though it is somewhat of an
56660 overkill to use a fully-featured MTA for this purpose.
56661 </para>
56662 <para>
56663 <indexterm role="option">
56664 <primary><option>mua_wrapper</option></primary>
56665 </indexterm>
56666 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
56667 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
56668 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
56669 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
56670 compatible router and transport configuration. Typically there will be just one
56671 router and one transport, sending everything to a smart host.
56672 </para>
56673 <para>
56674 When run in MUA wrapping mode, the behaviour of Exim changes in the
56675 following ways:
56676 </para>
56677 <itemizedlist>
56678 <listitem>
56679 <para>
56680 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
56681 In other words, the only way to submit messages is via the command line.
56682 </para>
56683 </listitem>
56684 <listitem>
56685 <para>
56686 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
56687 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
56688 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
56689 does not finish until the delivery attempt is complete. If the delivery is
56690 successful, a zero return code is given.
56691 </para>
56692 </listitem>
56693 <listitem>
56694 <para>
56695 Address redirection is permitted, but the final routing for all addresses must
56696 be to the same remote transport, and to the same list of hosts. Furthermore,
56697 the return address (envelope sender) must be the same for all recipients, as
56698 must any added or deleted header lines. In other words, it must be possible to
56699 deliver the message in a single SMTP transaction, however many recipients there
56700 are.
56701 </para>
56702 </listitem>
56703 <listitem>
56704 <para>
56705 If these conditions are not met, or if routing any address results in a
56706 failure or defer status, or if Exim is unable to deliver all the recipients
56707 successfully to one of the smart hosts, delivery of the entire message fails.
56708 </para>
56709 </listitem>
56710 <listitem>
56711 <para>
56712 Because no queueing is allowed, all failures are treated as permanent; there
56713 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
56714 smart host. Furthermore, because only a single yes/no response can be given to
56715 the caller, it is not possible to deliver to some recipients and not others. If
56716 there is an error (temporary or permanent) for any recipient, all are failed.
56717 </para>
56718 </listitem>
56719 <listitem>
56720 <para>
56721 If more than one smart host is listed, Exim will try another host after a
56722 connection failure or a timeout, in the normal way. However, if this kind of
56723 failure happens for all the hosts, the delivery fails.
56724 </para>
56725 </listitem>
56726 <listitem>
56727 <para>
56728 When delivery fails, an error message is written to the standard error stream
56729 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
56730 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
56731 are ever generated.
56732 </para>
56733 </listitem>
56734 <listitem>
56735 <para>
56736 No retry data is maintained, and any retry rules are ignored.
56737 </para>
56738 </listitem>
56739 <listitem>
56740 <para>
56741 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
56742 true, <option>max_rcpt</option> in the smtp transport is forced to <quote>unlimited</quote>,
56743 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
56744 </para>
56745 </listitem>
56746 </itemizedlist>
56747 <para>
56748 The overall effect is that Exim makes a single synchronous attempt to deliver
56749 the message, failing if there is any kind of problem. Because no local
56750 deliveries are done and no daemon can be run, Exim does not need root
56751 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
56752 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
56753 the advantages and disadvantages of running without root privilege.
56754 </para>
56755 </chapter>
56756
56757 <chapter id="CHAPlog">
56758 <title>Log files</title>
56759 <para>
56760 <indexterm role="concept" id="IIDloggen" class="startofrange">
56761 <primary>log</primary>
56762 <secondary>general description</secondary>
56763 </indexterm>
56764 <indexterm role="concept">
56765 <primary>log</primary>
56766 <secondary>types of</secondary>
56767 </indexterm>
56768 Exim writes three different logs, referred to as the main log, the reject log,
56769 and the panic log:
56770 </para>
56771 <itemizedlist>
56772 <listitem>
56773 <para>
56774 <indexterm role="concept">
56775 <primary>main log</primary>
56776 </indexterm>
56777 The main log records the arrival of each message and each delivery in a single
56778 line in each case. The format is as compact as possible, in an attempt to keep
56779 down the size of log files. Two-character flag sequences make it easy to pick
56780 out these lines. A number of other events are recorded in the main log. Some of
56781 them are optional, in which case the <option>log_selector</option> option controls whether
56782 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
56783 analysis of main log files, is provided in the Exim distribution (see section
56784 <xref linkend="SECTmailstat"/>).
56785 </para>
56786 </listitem>
56787 <listitem>
56788 <para>
56789 <indexterm role="concept">
56790 <primary>reject log</primary>
56791 </indexterm>
56792 The reject log records information from messages that are rejected as a result
56793 of a configuration option (that is, for policy reasons).
56794 The first line of each rejection is a copy of the line that is also written to
56795 the main log. Then, if the message&#x2019;s header has been read at the time the log
56796 is written, its contents are written to this log. Only the original header
56797 lines are available; header lines added by ACLs are not logged. You can use the
56798 reject log to check that your policy controls are working correctly; on a busy
56799 host this may be easier than scanning the main log for rejection messages. You
56800 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
56801 false.
56802 </para>
56803 </listitem>
56804 <listitem>
56805 <para>
56806 <indexterm role="concept">
56807 <primary>panic log</primary>
56808 </indexterm>
56809 <indexterm role="concept">
56810 <primary>system log</primary>
56811 </indexterm>
56812 When certain serious errors occur, Exim writes entries to its panic log. If the
56813 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
56814 are usually written to the main log as well, but can get lost amid the mass of
56815 other entries. The panic log should be empty under normal circumstances. It is
56816 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
56817 regularly, in order to become aware of any problems. When Exim cannot open its
56818 panic log, it tries as a last resort to write to the system log (syslog). This
56819 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
56820 message itself is written at priority LOG_CRIT.
56821 </para>
56822 </listitem>
56823 </itemizedlist>
56824 <para>
56825 Every log line starts with a timestamp, in the format shown in the following
56826 example. Note that many of the examples shown in this chapter are line-wrapped.
56827 In the log file, this would be all on one line:
56828 </para>
56829 <literallayout class="monospaced">
56830 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
56831   by QUIT
56832 </literallayout>
56833 <para>
56834 By default, the timestamps are in the local timezone. There are two
56835 ways of changing this:
56836 </para>
56837 <itemizedlist>
56838 <listitem>
56839 <para>
56840 You can set the <option>timezone</option> option to a different time zone; in particular, if
56841 you set
56842 </para>
56843 <literallayout class="monospaced">
56844 timezone = UTC
56845 </literallayout>
56846 <para>
56847 the timestamps will be in UTC (aka GMT).
56848 </para>
56849 </listitem>
56850 <listitem>
56851 <para>
56852 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
56853 example:
56854 </para>
56855 <literallayout class="monospaced">
56856 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
56857 </literallayout>
56858 </listitem>
56859 </itemizedlist>
56860 <para revisionflag="changed">
56861 <indexterm role="concept">
56862 <primary>log</primary>
56863 <secondary>process ids in</secondary>
56864 </indexterm>
56865 <indexterm role="concept">
56866 <primary>pid (process id)</primary>
56867 <secondary>in log lines</secondary>
56868 </indexterm>
56869 Exim does not include its process id in log lines by default, but you can
56870 request that it does so by specifying the <literal>pid</literal> log selector (see section
56871 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
56872 brackets, immediately after the time and date.
56873 </para>
56874 <section id="SECTwhelogwri">
56875 <title>Where the logs are written</title>
56876 <para>
56877 <indexterm role="concept">
56878 <primary>log</primary>
56879 <secondary>destination</secondary>
56880 </indexterm>
56881 <indexterm role="concept">
56882 <primary>log</primary>
56883 <secondary>to file</secondary>
56884 </indexterm>
56885 <indexterm role="concept">
56886 <primary>log</primary>
56887 <secondary>to syslog</secondary>
56888 </indexterm>
56889 <indexterm role="concept">
56890 <primary>syslog</primary>
56891 </indexterm>
56892 The logs may be written to local files, or to syslog, or both. However, it
56893 should be noted that many syslog implementations use UDP as a transport, and
56894 are therefore unreliable in the sense that messages are not guaranteed to
56895 arrive at the loghost, nor is the ordering of messages necessarily maintained.
56896 It has also been reported that on large log files (tens of megabytes) you may
56897 need to tweak syslog to prevent it syncing the file with each write &ndash; on
56898 Linux this has been seen to make syslog take 90% plus of CPU time.
56899 </para>
56900 <para>
56901 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
56902 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
56903 configuration. This latter string is expanded, so it can contain, for example,
56904 references to the host name:
56905 </para>
56906 <literallayout class="monospaced">
56907 log_file_path = /var/log/$primary_hostname/exim_%slog
56908 </literallayout>
56909 <para>
56910 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
56911 rather than at run time, because then the setting is available right from the
56912 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
56913 before it has read the configuration file (for example, an error in the
56914 configuration file) it will not use the path you want, and may not be able to
56915 log at all.
56916 </para>
56917 <para>
56918 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
56919 list, currently limited to at most two items. This is one option where the
56920 facility for changing a list separator may not be used. The list must always be
56921 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
56922 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
56923 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
56924 implying the use of a default path.
56925 </para>
56926 <para>
56927 When Exim encounters an empty item in the list, it searches the list defined by
56928 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
56929 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
56930 mean <quote>use the path specified at build time</quote>. It no such item exists, log
56931 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
56932 equivalent to the setting:
56933 </para>
56934 <literallayout class="monospaced">
56935 log_file_path = $spool_directory/log/%slog
56936 </literallayout>
56937 <para>
56938 If you do not specify anything at build time or run time, that is where the
56939 logs are written.
56940 </para>
56941 <para>
56942 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
56943 use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
56944 </para>
56945 <para>
56946 Here are some examples of possible settings:
56947 </para>
56948 <literallayout>
56949 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
56950 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
56951 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
56952 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
56953 </literallayout>
56954 <para>
56955 If there are more than two paths in the list, the first is used and a panic
56956 error is logged.
56957 </para>
56958 </section>
56959 <section id="SECID285">
56960 <title>Logging to local files that are periodically <quote>cycled</quote></title>
56961 <para>
56962 <indexterm role="concept">
56963 <primary>log</primary>
56964 <secondary>cycling local files</secondary>
56965 </indexterm>
56966 <indexterm role="concept">
56967 <primary>cycling logs</primary>
56968 </indexterm>
56969 <indexterm role="concept">
56970 <primary><emphasis>exicyclog</emphasis></primary>
56971 </indexterm>
56972 <indexterm role="concept">
56973 <primary>log</primary>
56974 <secondary>local files; writing to</secondary>
56975 </indexterm>
56976 Some operating systems provide centralized and standardized methods for cycling
56977 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
56978 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
56979 main and reject logs each time it is called. The maximum number of old logs to
56980 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
56981 </para>
56982 <para>
56983 An Exim delivery process opens the main log when it first needs to write to it,
56984 and it keeps the file open in case subsequent entries are required &ndash; for
56985 example, if a number of different deliveries are being done for the same
56986 message. However, remote SMTP deliveries can take a long time, and this means
56987 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
56988 something similar is being used to rename log files on a regular basis. To
56989 ensure that a switch of log files is noticed as soon as possible, Exim calls
56990 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
56991 does not exist, or its inode has changed, the old file is closed and Exim
56992 tries to open the main log from scratch. Thus, an old log file may remain open
56993 for quite some time, but no Exim processes should write to it once it has been
56994 renamed.
56995 </para>
56996 </section>
56997 <section id="SECTdatlogfil">
56998 <title>Datestamped log files</title>
56999 <para>
57000 <indexterm role="concept">
57001 <primary>log</primary>
57002 <secondary>datestamped files</secondary>
57003 </indexterm>
57004 Instead of cycling the main and reject log files by renaming them
57005 periodically, some sites like to use files whose names contain a datestamp,
57006 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
57007 Exim has support for this way of working. It is enabled by setting the
57008 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
57009 datestamp is required. For example:
57010 </para>
57011 <literallayout class="monospaced">
57012 log_file_path = /var/spool/exim/log/%slog-%D
57013 log_file_path = /var/log/exim-%s-%D.log
57014 log_file_path = /var/spool/exim/log/%D-%slog
57015 </literallayout>
57016 <para>
57017 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
57018 examples of names generated by the above examples:
57019 </para>
57020 <literallayout class="monospaced">
57021 /var/spool/exim/log/mainlog-20021225
57022 /var/log/exim-reject-20021225.log
57023 /var/spool/exim/log/20021225-mainlog
57024 </literallayout>
57025 <para>
57026 When this form of log file is specified, Exim automatically switches to new
57027 files at midnight. It does not make any attempt to compress old logs; you
57028 will need to write your own script if you require this. You should not
57029 run <emphasis>exicyclog</emphasis> with this form of logging.
57030 </para>
57031 <para>
57032 The location of the panic log is also determined by <option>log_file_path</option>, but it
57033 is not datestamped, because rotation of the panic log does not make sense.
57034 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
57035 In addition, if it immediately follows a slash, a following non-alphanumeric
57036 character is removed; otherwise a preceding non-alphanumeric character is
57037 removed. Thus, the three examples above would give these panic log names:
57038 </para>
57039 <literallayout class="monospaced">
57040 /var/spool/exim/log/paniclog
57041 /var/log/exim-panic.log
57042 /var/spool/exim/log/paniclog
57043 </literallayout>
57044 </section>
57045 <section id="SECID249">
57046 <title>Logging to syslog</title>
57047 <para>
57048 <indexterm role="concept">
57049 <primary>log</primary>
57050 <secondary>syslog; writing to</secondary>
57051 </indexterm>
57052 The use of syslog does not change what Exim logs or the format of its messages,
57053 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
57054 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
57055 that, the same strings are written to syslog as to log files. The syslog
57056 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
57057 by default, but you can change these by setting the <option>syslog_facility</option> and
57058 <option>syslog_processname</option> options, respectively. If Exim was compiled with
57059 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
57060 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
57061 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
57062 the time and host name to each line.
57063 The three log streams are mapped onto syslog priorities as follows:
57064 </para>
57065 <itemizedlist>
57066 <listitem>
57067 <para>
57068 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
57069 </para>
57070 </listitem>
57071 <listitem>
57072 <para>
57073 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
57074 </para>
57075 </listitem>
57076 <listitem>
57077 <para>
57078 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
57079 </para>
57080 </listitem>
57081 </itemizedlist>
57082 <para>
57083 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
57084 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
57085 these are routed by syslog to the same place. You can suppress this duplication
57086 by setting <option>syslog_duplication</option> false.
57087 </para>
57088 <para>
57089 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
57090 entries contain multiple lines when headers are included. To cope with both
57091 these cases, entries written to syslog are split into separate <function>syslog()</function>
57092 calls at each internal newline, and also after a maximum of
57093 870 data characters. (This allows for a total syslog line length of 1024, when
57094 additions such as timestamps are added.) If you are running a syslog
57095 replacement that can handle lines longer than the 1024 characters allowed by
57096 RFC 3164, you should set
57097 </para>
57098 <literallayout class="monospaced">
57099 SYSLOG_LONG_LINES=yes
57100 </literallayout>
57101 <para>
57102 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
57103 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
57104 </para>
57105 <para>
57106 To make it easy to re-assemble split lines later, each component of a split
57107 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;]
57108 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
57109 components in the entry. The / delimiter is used when the line was split
57110 because it was too long; if it was split because of an internal newline, the \
57111 delimiter is used. For example, supposing the length limit to be 50 instead of
57112 870, the following would be the result of a typical rejection message to
57113 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
57114 name, and pid as added by syslog:
57115 </para>
57116 <literallayout class="monospaced">
57117 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
57118 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
57119 [3/5]  when scanning for sender: missing or malformed lo
57120 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
57121 [5/5] mple&gt;)
57122 </literallayout>
57123 <para>
57124 The same error might cause the following lines to be written to <quote>rejectlog</quote>
57125 (LOG_NOTICE):
57126 </para>
57127 <literallayout class="monospaced">
57128 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
57129 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
57130 [3/18] er when scanning for sender: missing or malformed
57131 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
57132 [5\18] .example&gt;)
57133 [6\18] Recipients: ph10@some.domain.cam.example
57134 [7\18] P Received: from [127.0.0.1] (ident=ph10)
57135 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
57136 [9\18]        id 16RdAL-0006pc-00
57137 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
57138 [11\18] 09:43 +0100
57139 [12\18] F From: &lt;&gt;
57140 [13\18]   Subject: this is a test header
57141 [18\18]   X-something: this is another header
57142 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
57143 [16\18] le&gt;
57144 [17\18] B Bcc:
57145 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
57146 </literallayout>
57147 <para>
57148 Log lines that are neither too long nor contain newlines are written to syslog
57149 without modification.
57150 </para>
57151 <para>
57152 If only syslog is being used, the Exim monitor is unable to provide a log tail
57153 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
57154 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
57155 where it is.
57156 </para>
57157 </section>
57158 <section id="SECID250">
57159 <title>Log line flags</title>
57160 <para>
57161 One line is written to the main log for each message received, and for each
57162 successful, unsuccessful, and delayed delivery. These lines can readily be
57163 picked out by the distinctive two-character flags that immediately follow the
57164 timestamp. The flags are:
57165 </para>
57166 <literallayout>
57167 <literal>&lt;=</literal>     message arrival
57168 <literal>=&gt;</literal>     normal message delivery
57169 <literal>-&gt;</literal>     additional address in same delivery
57170 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
57171 <literal>**</literal>     delivery failed; address bounced
57172 <literal>==</literal>     delivery deferred; temporary problem
57173 </literallayout>
57174 </section>
57175 <section id="SECID251">
57176 <title>Logging message reception</title>
57177 <para>
57178 <indexterm role="concept">
57179 <primary>log</primary>
57180 <secondary>reception line</secondary>
57181 </indexterm>
57182 The format of the single-line entry in the main log that is written for every
57183 message received is shown in the basic example below, which is split over
57184 several lines in order to fit it on the page:
57185 </para>
57186 <literallayout class="monospaced">
57187 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
57188   H=mailer.fict.example [192.168.123.123] U=exim
57189   P=smtp S=5678 id=&lt;incoming message id&gt;
57190 </literallayout>
57191 <para>
57192 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
57193 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
57194 generated, this is followed by an item of the form
57195 </para>
57196 <literallayout class="monospaced">
57197 R=&lt;message id&gt;
57198 </literallayout>
57199 <para>
57200 which is a reference to the message that caused the bounce to be sent.
57201 </para>
57202 <para>
57203 <indexterm role="concept">
57204 <primary>HELO</primary>
57205 </indexterm>
57206 <indexterm role="concept">
57207 <primary>EHLO</primary>
57208 </indexterm>
57209 For messages from other hosts, the H and U fields identify the remote host and
57210 record the RFC 1413 identity of the user that sent the message, if one was
57211 received. The number given in square brackets is the IP address of the sending
57212 host. If there is a single, unparenthesized  host name in the H field, as
57213 above, it has been verified to correspond to the IP address (see the
57214 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
57215 by the remote host in the SMTP HELO or EHLO command, and has not been
57216 verified. If verification yields a different name to that given for HELO or
57217 EHLO, the verified name appears first, followed by the HELO or EHLO
57218 name in parentheses.
57219 </para>
57220 <para>
57221 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
57222 without brackets, in the HELO or EHLO command, leading to entries in
57223 the log containing text like these examples:
57224 </para>
57225 <literallayout class="monospaced">
57226 H=(10.21.32.43) [192.168.8.34]
57227 H=([10.21.32.43]) [192.168.8.34]
57228 </literallayout>
57229 <para>
57230 This can be confusing. Only the final address in square brackets can be relied
57231 on.
57232 </para>
57233 <para>
57234 For locally generated messages (that is, messages not received over TCP/IP),
57235 the H field is omitted, and the U field contains the login name of the caller
57236 of Exim.
57237 </para>
57238 <para>
57239 <indexterm role="concept">
57240 <primary>authentication</primary>
57241 <secondary>logging</secondary>
57242 </indexterm>
57243 <indexterm role="concept">
57244 <primary>AUTH</primary>
57245 <secondary>logging</secondary>
57246 </indexterm>
57247 For all messages, the P field specifies the protocol used to receive the
57248 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
57249 of incoming SMTP messages, the value indicates whether or not any SMTP
57250 extensions (ESMTP), encryption, or authentication were used. If the SMTP
57251 session was encrypted, there is an additional X field that records the cipher
57252 suite that was used.
57253 </para>
57254 <para>
57255 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
57256 hosts that have authenticated themselves using the SMTP AUTH command. The first
57257 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
57258 there is an additional item A= followed by the name of the authenticator that
57259 was used. If an authenticated identification was set up by the authenticator&#x2019;s
57260 <option>server_set_id</option> option, this is logged too, separated by a colon from the
57261 authenticator name.
57262 </para>
57263 <para>
57264 <indexterm role="concept">
57265 <primary>size</primary>
57266 <secondary>of message</secondary>
57267 </indexterm>
57268 The id field records the existing message id, if present. The size of the
57269 received message is given by the S field. When the message is delivered,
57270 headers may be removed or added, so that the size of delivered copies of the
57271 message may not correspond with this value (and indeed may be different to each
57272 other).
57273 </para>
57274 <para>
57275 The <option>log_selector</option> option can be used to request the logging of additional
57276 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
57277 </para>
57278 </section>
57279 <section id="SECID252">
57280 <title>Logging deliveries</title>
57281 <para>
57282 <indexterm role="concept">
57283 <primary>log</primary>
57284 <secondary>delivery line</secondary>
57285 </indexterm>
57286 The format of the single-line entry in the main log that is written for every
57287 delivery is shown in one of the examples below, for local and remote
57288 deliveries, respectively. Each example has been split into two lines in order
57289 to fit it on the page:
57290 </para>
57291 <literallayout class="monospaced">
57292 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
57293   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
57294 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
57295   monk@holistic.fict.example R=dnslookup T=remote_smtp
57296   H=holistic.fict.example [192.168.234.234]
57297 </literallayout>
57298 <para>
57299 For ordinary local deliveries, the original address is given in angle brackets
57300 after the final delivery address, which might be a pipe or a file. If
57301 intermediate address(es) exist between the original and the final address, the
57302 last of these is given in parentheses after the final address. The R and T
57303 fields record the router and transport that were used to process the address.
57304 </para>
57305 <para>
57306 If a shadow transport was run after a successful local delivery, the log line
57307 for the successful delivery has an item added on the end, of the form
57308 </para>
57309 <literallayout>
57310 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
57311 </literallayout>
57312 <para>
57313 If the shadow transport did not succeed, the error message is put in
57314 parentheses afterwards.
57315 </para>
57316 <para>
57317 <indexterm role="concept">
57318 <primary>asterisk</primary>
57319 <secondary>after IP address</secondary>
57320 </indexterm>
57321 When more than one address is included in a single delivery (for example, two
57322 SMTP RCPT commands in one transaction) the second and subsequent addresses are
57323 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
57324 down a single SMTP connection, an asterisk follows the IP address in the log
57325 lines for the second and subsequent messages.
57326 </para>
57327 <para>
57328 The generation of a reply message by a filter file gets logged as a
57329 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
57330 </para>
57331 <para>
57332 The <option>log_selector</option> option can be used to request the logging of additional
57333 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
57334 </para>
57335 </section>
57336 <section id="SECID253">
57337 <title>Discarded deliveries</title>
57338 <para>
57339 <indexterm role="concept">
57340 <primary>discarded messages</primary>
57341 </indexterm>
57342 <indexterm role="concept">
57343 <primary>message</primary>
57344 <secondary>discarded</secondary>
57345 </indexterm>
57346 <indexterm role="concept">
57347 <primary>delivery</primary>
57348 <secondary>discarded; logging</secondary>
57349 </indexterm>
57350 When a message is discarded as a result of the command <quote>seen finish</quote> being
57351 obeyed in a filter file which generates no deliveries, a log entry of the form
57352 </para>
57353 <literallayout class="monospaced">
57354 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
57355   &lt;low.club@bridge.example&gt; R=userforward
57356 </literallayout>
57357 <para>
57358 is written, to record why no deliveries are logged. When a message is discarded
57359 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
57360 </para>
57361 <literallayout class="monospaced">
57362 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
57363   &lt;hole@nowhere.example&gt; R=blackhole_router
57364 </literallayout>
57365 </section>
57366 <section id="SECID254">
57367 <title>Deferred deliveries</title>
57368 <para>
57369 When a delivery is deferred, a line of the following form is logged:
57370 </para>
57371 <literallayout class="monospaced">
57372 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
57373   R=dnslookup T=smtp defer (146): Connection refused
57374 </literallayout>
57375 <para>
57376 In the case of remote deliveries, the error is the one that was given for the
57377 last IP address that was tried. Details of individual SMTP failures are also
57378 written to the log, so the above line would be preceded by something like
57379 </para>
57380 <literallayout class="monospaced">
57381 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
57382   mail1.endrest.example [192.168.239.239]: Connection refused
57383 </literallayout>
57384 <para>
57385 When a deferred address is skipped because its retry time has not been reached,
57386 a message is written to the log, but this can be suppressed by setting an
57387 appropriate value in <option>log_selector</option>.
57388 </para>
57389 </section>
57390 <section id="SECID255">
57391 <title>Delivery failures</title>
57392 <para>
57393 <indexterm role="concept">
57394 <primary>delivery</primary>
57395 <secondary>failure; logging</secondary>
57396 </indexterm>
57397 If a delivery fails because an address cannot be routed, a line of the
57398 following form is logged:
57399 </para>
57400 <literallayout class="monospaced">
57401 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
57402   &lt;jim@trek99.example&gt;: unknown mail domain
57403 </literallayout>
57404 <para>
57405 If a delivery fails at transport time, the router and transport are shown, and
57406 the response from the remote host is included, as in this example:
57407 </para>
57408 <literallayout class="monospaced">
57409 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
57410   R=dnslookup T=remote_smtp: SMTP error from remote mailer
57411   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
57412   pbmail3.py.example [192.168.63.111]: 553 5.3.0
57413   &lt;ace400@pb.example&gt;...Addressee unknown
57414 </literallayout>
57415 <para>
57416 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
57417 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
57418 disabling PIPELINING. The log lines for all forms of delivery failure are
57419 flagged with <literal>**</literal>.
57420 </para>
57421 </section>
57422 <section id="SECID256">
57423 <title>Fake deliveries</title>
57424 <para>
57425 <indexterm role="concept">
57426 <primary>delivery</primary>
57427 <secondary>fake; logging</secondary>
57428 </indexterm>
57429 If a delivery does not actually take place because the <option>-N</option> option has been
57430 used to suppress it, a normal delivery line is written to the log, except that
57431 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
57432 </para>
57433 </section>
57434 <section id="SECID257">
57435 <title>Completion</title>
57436 <para>
57437 A line of the form
57438 </para>
57439 <literallayout class="monospaced">
57440 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
57441 </literallayout>
57442 <para>
57443 is written to the main log when a message is about to be removed from the spool
57444 at the end of its processing.
57445 </para>
57446 </section>
57447 <section id="SECID258">
57448 <title>Summary of Fields in Log Lines</title>
57449 <para>
57450 <indexterm role="concept">
57451 <primary>log</primary>
57452 <secondary>summary of fields</secondary>
57453 </indexterm>
57454 A summary of the field identifiers that are used in log lines is shown in
57455 the following table:
57456 </para>
57457 <literallayout>
57458 <literal>A   </literal>        authenticator name (and optional id)
57459 <literal>C   </literal>        SMTP confirmation on delivery
57460 <phrase revisionflag="changed"><literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
57461 </phrase><literal>CV  </literal>        certificate verification status
57462 <phrase revisionflag="changed"><literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
57463 </phrase><literal>DN  </literal>        distinguished name from peer certificate
57464 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
57465 <literal>F   </literal>        sender address (on delivery lines)
57466 <literal>H   </literal>        host name and IP address
57467 <literal>I   </literal>        local interface used
57468 <literal>id  </literal>        message id for incoming message
57469 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
57470 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
57471 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
57472 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
57473 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
57474 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
57475 <literal>S   </literal>        size of message
57476 <literal>ST  </literal>        shadow transport name
57477 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
57478 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
57479 <literal>U   </literal>        local user or RFC 1413 identity
57480 <literal>X   </literal>        TLS cipher suite
57481 </literallayout>
57482 </section>
57483 <section id="SECID259">
57484 <title>Other log entries</title>
57485 <para>
57486 Various other types of log entry are written from time to time. Most should be
57487 self-explanatory. Among the more common are:
57488 </para>
57489 <itemizedlist>
57490 <listitem>
57491 <para>
57492 <indexterm role="concept">
57493 <primary>retry</primary>
57494 <secondary>time not reached</secondary>
57495 </indexterm>
57496 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
57497 during routing or local delivery, and the time to retry has not yet arrived.
57498 This message is not written to an individual message log file unless it happens
57499 during the first delivery attempt.
57500 </para>
57501 </listitem>
57502 <listitem>
57503 <para>
57504 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
57505 temporary errors during remote delivery, and the retry time has not yet arrived
57506 for any of the hosts to which it is routed.
57507 </para>
57508 </listitem>
57509 <listitem>
57510 <para>
57511 <indexterm role="concept">
57512 <primary>spool directory</primary>
57513 <secondary>file locked</secondary>
57514 </indexterm>
57515 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
57516 some other Exim process is already working on the message. This can be quite
57517 common if queue running processes are started at frequent intervals. The
57518 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
57519 doing.
57520 </para>
57521 </listitem>
57522 <listitem>
57523 <para>
57524 <indexterm role="concept">
57525 <primary>error</primary>
57526 <secondary>ignored</secondary>
57527 </indexterm>
57528 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
57529 message:
57530 </para>
57531 <orderedlist numeration="arabic">
57532 <listitem>
57533 <para>
57534 Exim failed to deliver a bounce message whose age was greater than
57535 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
57536 </para>
57537 </listitem>
57538 <listitem>
57539 <para>
57540 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
57541 failed. The delivery was discarded.
57542 </para>
57543 </listitem>
57544 <listitem>
57545 <para>
57546 A delivery set up by a router configured with
57547 </para>
57548 <literallayout class="monospaced">
57549     errors_to = &lt;&gt;
57550 </literallayout>
57551 <para>
57552 failed. The delivery was discarded.
57553 </para>
57554 </listitem>
57555 </orderedlist>
57556 </listitem>
57557 </itemizedlist>
57558 </section>
57559 <section id="SECTlogselector">
57560 <title>Reducing or increasing what is logged</title>
57561 <para>
57562 <indexterm role="concept">
57563 <primary>log</primary>
57564 <secondary>selectors</secondary>
57565 </indexterm>
57566 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
57567 default logging, or you can request additional logging. The value of
57568 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
57569 example:
57570 </para>
57571 <literallayout class="monospaced">
57572 log_selector = +arguments -retry_defer
57573 </literallayout>
57574 <para>
57575 The list of optional log items is in the following table, with the default
57576 selection marked by asterisks:
57577 </para>
57578 <literallayout>
57579 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
57580 <literal> address_rewrite            </literal>  address rewriting
57581 <literal> all_parents                </literal>  all parents in =&gt; lines
57582 <literal> arguments                  </literal>  command line arguments
57583 <literal>*connection_reject          </literal>  connection rejections
57584 <literal>*delay_delivery             </literal>  immediate delivery delayed
57585 <literal> deliver_time               </literal>  time taken to perform delivery
57586 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
57587 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
57588 <literal>*etrn                       </literal>  ETRN commands
57589 <literal>*host_lookup_failed         </literal>  as it says
57590 <literal> ident_timeout              </literal>  timeout for ident connection
57591 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
57592 <literal> incoming_port              </literal>  incoming port on &lt;= lines
57593 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
57594 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
57595 <literal>*queue_run                  </literal>  start and end queue runs
57596 <literal> queue_time                 </literal>  time on queue for one recipient
57597 <literal> queue_time_overall         </literal>  time on queue for whole message
57598 <phrase revisionflag="changed"><literal> pid                        </literal>  Exim process id
57599 </phrase><literal> received_recipients        </literal>  recipients on &lt;= lines
57600 <literal> received_sender            </literal>  sender on &lt;= lines
57601 <literal>*rejected_header            </literal>  header contents on reject log
57602 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
57603 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
57604 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
57605 <literal>*sender_verify_fail         </literal>  sender verification failures
57606 <literal>*size_reject                </literal>  rejection because too big
57607 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
57608 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
57609 <literal> smtp_connection            </literal>  SMTP connections
57610 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
57611 <phrase revisionflag="changed"><literal> smtp_no_mail               </literal>  session with no MAIL commands
57612 </phrase><literal> smtp_protocol_error        </literal>  SMTP protocol errors
57613 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
57614 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
57615 <literal> tls_certificate_verified   </literal>  certificate verification status
57616 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
57617 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
57618 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
57619
57620 <literal> all                        </literal>  all of the above
57621 </literallayout>
57622 <para>
57623 More details on each of these items follows:
57624 </para>
57625 <itemizedlist>
57626 <listitem>
57627 <para>
57628 <indexterm role="concept">
57629 <primary><option>warn</option> ACL verb</primary>
57630 <secondary>log when skipping</secondary>
57631 </indexterm>
57632 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
57633 its conditions cannot be evaluated, a log line to this effect is written if
57634 this log selector is set.
57635 </para>
57636 </listitem>
57637 <listitem>
57638 <para>
57639 <indexterm role="concept">
57640 <primary>log</primary>
57641 <secondary>rewriting</secondary>
57642 </indexterm>
57643 <indexterm role="concept">
57644 <primary>rewriting</primary>
57645 <secondary>logging</secondary>
57646 </indexterm>
57647 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
57648 rewrites, but not to rewrites in filters run as an unprivileged user (because
57649 such users cannot access the log).
57650 </para>
57651 </listitem>
57652 <listitem>
57653 <para>
57654 <indexterm role="concept">
57655 <primary>log</primary>
57656 <secondary>full parentage</secondary>
57657 </indexterm>
57658 <option>all_parents</option>: Normally only the original and final addresses are logged on
57659 delivery lines; with this selector, intermediate parents are given in
57660 parentheses between them.
57661 </para>
57662 </listitem>
57663 <listitem>
57664 <para>
57665 <indexterm role="concept">
57666 <primary>log</primary>
57667 <secondary>Exim arguments</secondary>
57668 </indexterm>
57669 <indexterm role="concept">
57670 <primary>Exim arguments, logging</primary>
57671 </indexterm>
57672 <option>arguments</option>: This causes Exim to write the arguments with which it was called
57673 to the main log, preceded by the current working directory. This is a debugging
57674 feature, added to make it easier to find out how certain MUAs call
57675 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
57676 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
57677 that are empty or that contain white space are quoted. Non-printing characters
57678 are shown as escape sequences. This facility cannot log unrecognized arguments,
57679 because the arguments are checked before the configuration file is read. The
57680 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
57681 between the caller and Exim.
57682 </para>
57683 </listitem>
57684 <listitem>
57685 <para>
57686 <indexterm role="concept">
57687 <primary>log</primary>
57688 <secondary>connection rejections</secondary>
57689 </indexterm>
57690 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
57691 connection is rejected, for whatever reason.
57692 </para>
57693 </listitem>
57694 <listitem>
57695 <para>
57696 <indexterm role="concept">
57697 <primary>log</primary>
57698 <secondary>delayed delivery</secondary>
57699 </indexterm>
57700 <indexterm role="concept">
57701 <primary>delayed delivery, logging</primary>
57702 </indexterm>
57703 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
57704 started for an incoming message because the load is too high or too many
57705 messages were received on one connection. Logging does not occur if no delivery
57706 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
57707 </para>
57708 </listitem>
57709 <listitem>
57710 <para>
57711 <indexterm role="concept">
57712 <primary>log</primary>
57713 <secondary>delivery duration</secondary>
57714 </indexterm>
57715 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
57716 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
57717 </para>
57718 </listitem>
57719 <listitem>
57720 <para>
57721 <indexterm role="concept">
57722 <primary>log</primary>
57723 <secondary>message size on delivery</secondary>
57724 </indexterm>
57725 <indexterm role="concept">
57726 <primary>size</primary>
57727 <secondary>of message</secondary>
57728 </indexterm>
57729 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
57730 the <quote>=&gt;</quote> line, tagged with S=.
57731 </para>
57732 </listitem>
57733 <listitem>
57734 <para>
57735 <indexterm role="concept">
57736 <primary>log</primary>
57737 <secondary>dnslist defer</secondary>
57738 </indexterm>
57739 <indexterm role="concept">
57740 <primary>DNS list</primary>
57741 <secondary>logging defer</secondary>
57742 </indexterm>
57743 <indexterm role="concept">
57744 <primary>black list (DNS)</primary>
57745 </indexterm>
57746 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
57747 DNS black list suffers a temporary error.
57748 </para>
57749 </listitem>
57750 <listitem>
57751 <para>
57752 <indexterm role="concept">
57753 <primary>log</primary>
57754 <secondary>ETRN commands</secondary>
57755 </indexterm>
57756 <indexterm role="concept">
57757 <primary>ETRN</primary>
57758 <secondary>logging</secondary>
57759 </indexterm>
57760 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
57761 is run to determine whether or not it is actually accepted. An invalid ETRN
57762 command, or one received within a message transaction is not logged by this
57763 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
57764 </para>
57765 </listitem>
57766 <listitem>
57767 <para>
57768 <indexterm role="concept">
57769 <primary>log</primary>
57770 <secondary>host lookup failure</secondary>
57771 </indexterm>
57772 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
57773 any addresses, or when a lookup of an IP address fails to find a host name, a
57774 log line is written. This logging does not apply to direct DNS lookups when
57775 routing email addresses, but it does apply to <quote>byname</quote> lookups.
57776 </para>
57777 </listitem>
57778 <listitem>
57779 <para>
57780 <indexterm role="concept">
57781 <primary>log</primary>
57782 <secondary>ident timeout</secondary>
57783 </indexterm>
57784 <indexterm role="concept">
57785 <primary>RFC 1413</primary>
57786 <secondary>logging timeout</secondary>
57787 </indexterm>
57788 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
57789 client&#x2019;s ident port times out.
57790 </para>
57791 </listitem>
57792 <listitem>
57793 <para>
57794 <indexterm role="concept">
57795 <primary>log</primary>
57796 <secondary>incoming interface</secondary>
57797 </indexterm>
57798 <indexterm role="concept">
57799 <primary>interface</primary>
57800 <secondary>logging</secondary>
57801 </indexterm>
57802 <option>incoming_interface</option>: The interface on which a message was received is added
57803 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
57804 followed by a colon and the port number. The local interface and port are also
57805 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
57806 rejection lines.
57807 </para>
57808 </listitem>
57809 <listitem>
57810 <para>
57811 <indexterm role="concept">
57812 <primary>log</primary>
57813 <secondary>incoming remote port</secondary>
57814 </indexterm>
57815 <indexterm role="concept">
57816 <primary>port</primary>
57817 <secondary>logging remote</secondary>
57818 </indexterm>
57819 <indexterm role="concept">
57820 <primary>TCP/IP</primary>
57821 <secondary>logging incoming remote port</secondary>
57822 </indexterm>
57823 <indexterm role="variable">
57824 <primary><varname>$sender_fullhost</varname></primary>
57825 </indexterm>
57826 <indexterm role="variable">
57827 <primary><varname>$sender_rcvhost</varname></primary>
57828 </indexterm>
57829 <option>incoming_port</option>: The remote port number from which a message was received is
57830 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
57831 in square brackets, and separated from it by a colon. This is implemented by
57832 changing the value that is put in the <varname>$sender_fullhost</varname> and
57833 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
57834 important with the widening use of NAT (see RFC 2505).
57835 </para>
57836 </listitem>
57837 <listitem>
57838 <para>
57839 <indexterm role="concept">
57840 <primary>log</primary>
57841 <secondary>dropped connection</secondary>
57842 </indexterm>
57843 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
57844 connection is unexpectedly dropped.
57845 </para>
57846 </listitem>
57847 <listitem>
57848 <para>
57849 <indexterm role="concept">
57850 <primary>log</primary>
57851 <secondary>outgoing remote port</secondary>
57852 </indexterm>
57853 <indexterm role="concept">
57854 <primary>port</primary>
57855 <secondary>logging outgoint remote</secondary>
57856 </indexterm>
57857 <indexterm role="concept">
57858 <primary>TCP/IP</primary>
57859 <secondary>logging ougtoing remote port</secondary>
57860 </indexterm>
57861 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
57862 containing =&gt; tags) following the IP address. This option is not included in
57863 the default setting, because for most ordinary configurations, the remote port
57864 number is always 25 (the SMTP port).
57865 </para>
57866 </listitem>
57867 <listitem>
57868 <para revisionflag="changed">
57869 <indexterm role="concept">
57870 <primary>log</primary>
57871 <secondary>process ids in</secondary>
57872 </indexterm>
57873 <indexterm role="concept">
57874 <primary>pid (process id)</primary>
57875 <secondary>in log lines</secondary>
57876 </indexterm>
57877 <option>pid</option>: The current process id is added to every log line, in square brackets,
57878 immediately after the time and date.
57879 </para>
57880 </listitem>
57881 <listitem>
57882 <para>
57883 <indexterm role="concept">
57884 <primary>log</primary>
57885 <secondary>queue run</secondary>
57886 </indexterm>
57887 <indexterm role="concept">
57888 <primary>queue runner</primary>
57889 <secondary>logging</secondary>
57890 </indexterm>
57891 <option>queue_run</option>: The start and end of every queue run are logged.
57892 </para>
57893 </listitem>
57894 <listitem>
57895 <para>
57896 <indexterm role="concept">
57897 <primary>log</primary>
57898 <secondary>queue time</secondary>
57899 </indexterm>
57900 <option>queue_time</option>: The amount of time the message has been in the queue on the
57901 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
57902 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
57903 includes reception time as well as the delivery time for the current address.
57904 This means that it may be longer than the difference between the arrival and
57905 delivery log line times, because the arrival log line is not written until the
57906 message has been successfully received.
57907 </para>
57908 </listitem>
57909 <listitem>
57910 <para>
57911 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
57912 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
57913 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
57914 message, so it includes reception time as well as the total delivery time.
57915 </para>
57916 </listitem>
57917 <listitem>
57918 <para>
57919 <indexterm role="concept">
57920 <primary>log</primary>
57921 <secondary>recipients</secondary>
57922 </indexterm>
57923 <option>received_recipients</option>: The recipients of a message are listed in the main log
57924 as soon as the message is received. The list appears at the end of the log line
57925 that is written when a message is received, preceded by the word <quote>for</quote>. The
57926 addresses are listed after they have been qualified, but before any rewriting
57927 has taken place.
57928 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
57929 in the list.
57930 </para>
57931 </listitem>
57932 <listitem>
57933 <para>
57934 <indexterm role="concept">
57935 <primary>log</primary>
57936 <secondary>sender reception</secondary>
57937 </indexterm>
57938 <option>received_sender</option>: The unrewritten original sender of a message is added to
57939 the end of the log line that records the message&#x2019;s arrival, after the word
57940 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
57941 </para>
57942 </listitem>
57943 <listitem>
57944 <para>
57945 <indexterm role="concept">
57946 <primary>log</primary>
57947 <secondary>header lines for rejection</secondary>
57948 </indexterm>
57949 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
57950 rejection is written to the reject log, the complete header is added to the
57951 log. Header logging can be turned off individually for messages that are
57952 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
57953 </para>
57954 </listitem>
57955 <listitem>
57956 <para>
57957 <indexterm role="concept">
57958 <primary>log</primary>
57959 <secondary>retry defer</secondary>
57960 </indexterm>
57961 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
57962 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
57963 message is always omitted from individual message logs after the first delivery
57964 attempt.
57965 </para>
57966 </listitem>
57967 <listitem>
57968 <para>
57969 <indexterm role="concept">
57970 <primary>log</primary>
57971 <secondary>return path</secondary>
57972 </indexterm>
57973 <option>return_path_on_delivery</option>: The return path that is being transmitted with
57974 the message is included in delivery and bounce lines, using the tag P=.
57975 This is omitted if no delivery actually happens, for example, if routing fails,
57976 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
57977 </para>
57978 </listitem>
57979 <listitem>
57980 <para>
57981 <indexterm role="concept">
57982 <primary>log</primary>
57983 <secondary>sender on delivery</secondary>
57984 </indexterm>
57985 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
57986 and bounce line, tagged by F= (for <quote>from</quote>).
57987 This is the original sender that was received with the message; it is not
57988 necessarily the same as the outgoing return path.
57989 </para>
57990 </listitem>
57991 <listitem>
57992 <para>
57993 <indexterm role="concept">
57994 <primary>log</primary>
57995 <secondary>sender verify failure</secondary>
57996 </indexterm>
57997 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
57998 gives details of a sender verification failure is not written. Log lines for
57999 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
58000 detail is lost.
58001 </para>
58002 </listitem>
58003 <listitem>
58004 <para>
58005 <indexterm role="concept">
58006 <primary>log</primary>
58007 <secondary>size rejection</secondary>
58008 </indexterm>
58009 <option>size_reject</option>: A log line is written whenever a message is rejected because
58010 it is too big.
58011 </para>
58012 </listitem>
58013 <listitem>
58014 <para>
58015 <indexterm role="concept">
58016 <primary>log</primary>
58017 <secondary>frozen messages; skipped</secondary>
58018 </indexterm>
58019 <indexterm role="concept">
58020 <primary>frozen messages</primary>
58021 <secondary>logging skipping</secondary>
58022 </indexterm>
58023 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
58024 queue run because it is frozen or because another process is already delivering
58025 it.
58026 <indexterm role="concept">
58027 <primary><quote>spool file is locked</quote></primary>
58028 </indexterm>
58029 The message that is written is <quote>spool file is locked</quote>.
58030 </para>
58031 </listitem>
58032 <listitem>
58033 <para>
58034 <indexterm role="concept">
58035 <primary>log</primary>
58036 <secondary>smtp confirmation</secondary>
58037 </indexterm>
58038 <indexterm role="concept">
58039 <primary>SMTP</primary>
58040 <secondary>logging confirmation</secondary>
58041 </indexterm>
58042 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
58043 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
58044 A number of MTAs (including Exim) return an identifying string in this
58045 response.
58046 </para>
58047 </listitem>
58048 <listitem>
58049 <para>
58050 <indexterm role="concept">
58051 <primary>log</primary>
58052 <secondary>SMTP connections</secondary>
58053 </indexterm>
58054 <indexterm role="concept">
58055 <primary>SMTP</primary>
58056 <secondary>logging connections</secondary>
58057 </indexterm>
58058 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
58059 established or closed, unless the connection is from a host that matches
58060 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
58061 only when the closure is unexpected.) This applies to connections from local
58062 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
58063 dropped in the middle of a message, a log line is always written, whether or
58064 not this selector is set, but otherwise nothing is written at the start and end
58065 of connections unless this selector is enabled.
58066 </para>
58067 <para>
58068 For TCP/IP connections to an Exim daemon, the current number of connections is
58069 included in the log message for each new connection, but note that the count is
58070 reset if the daemon is restarted.
58071 Also, because connections are closed (and the closure is logged) in
58072 subprocesses, the count may not include connections that have been closed but
58073 whose termination the daemon has not yet noticed. Thus, while it is possible to
58074 match up the opening and closing of connections in the log, the value of the
58075 logged counts may not be entirely accurate.
58076 </para>
58077 </listitem>
58078 <listitem>
58079 <para>
58080 <indexterm role="concept">
58081 <primary>log</primary>
58082 <secondary>SMTP transaction; incomplete</secondary>
58083 </indexterm>
58084 <indexterm role="concept">
58085 <primary>SMTP</primary>
58086 <secondary>logging incomplete transactions</secondary>
58087 </indexterm>
58088 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
58089 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
58090 and the message sender plus any accepted recipients are included in the log
58091 line. This can provide evidence of dictionary attacks.
58092 </para>
58093 </listitem>
58094 <listitem>
58095 <para revisionflag="changed">
58096 <indexterm role="concept">
58097 <primary>log</primary>
58098 <secondary>non-MAIL SMTP sessions</secondary>
58099 </indexterm>
58100 <indexterm role="concept">
58101 <primary>MAIL</primary>
58102 <secondary>logging session without</secondary>
58103 </indexterm>
58104 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
58105 connection terminates without having issued a MAIL command. This includes both
58106 the case when the connection is dropped, and the case when QUIT is used. It
58107 does not include cases where the connection is rejected right at the start (by
58108 an ACL, or because there are too many connections, or whatever). These cases
58109 already have their own log lines.
58110 </para>
58111 <para revisionflag="changed">
58112 The log line that is written contains the identity of the client in the usual
58113 way, followed by D= and a time, which records the duration of the connection.
58114 If the connection was authenticated, this fact is logged exactly as it is for
58115 an incoming message, with an A= item. If the connection was encrypted, CV=,
58116 DN=, and X= items may appear as they do for an incoming message, controlled by
58117 the same logging options.
58118 </para>
58119 <para revisionflag="changed">
58120 Finally, if any SMTP commands were issued during the connection, a C= item
58121 is added to the line, listing the commands that were used. For example,
58122 </para>
58123 <literallayout class="monospaced" revisionflag="changed">
58124 C=EHLO,QUIT
58125 </literallayout>
58126 <para revisionflag="changed">
58127 shows that the client issued QUIT straight after EHLO. If there were fewer
58128 than 20 commands, they are all listed. If there were more than 20 commands,
58129 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
58130 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
58131 have been aborted before 20 non-mail commands are processed.
58132 </para>
58133 </listitem>
58134 <listitem>
58135 <para>
58136 <indexterm role="concept">
58137 <primary>log</primary>
58138 <secondary>SMTP protocol error</secondary>
58139 </indexterm>
58140 <indexterm role="concept">
58141 <primary>SMTP</primary>
58142 <secondary>logging protocol error</secondary>
58143 </indexterm>
58144 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
58145 encountered. Exim does not have perfect detection of all protocol errors
58146 because of transmission delays and the use of pipelining. If PIPELINING has
58147 been advertised to a client, an Exim server assumes that the client will use
58148 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
58149 received after rejecting MAIL) as protocol errors.
58150 </para>
58151 </listitem>
58152 <listitem>
58153 <para>
58154 <indexterm role="concept">
58155 <primary>SMTP</primary>
58156 <secondary>logging syntax errors</secondary>
58157 </indexterm>
58158 <indexterm role="concept">
58159 <primary>SMTP</primary>
58160 <secondary>syntax errors; logging</secondary>
58161 </indexterm>
58162 <indexterm role="concept">
58163 <primary>SMTP</primary>
58164 <secondary>unknown command; logging</secondary>
58165 </indexterm>
58166 <indexterm role="concept">
58167 <primary>log</primary>
58168 <secondary>unknown SMTP command</secondary>
58169 </indexterm>
58170 <indexterm role="concept">
58171 <primary>log</primary>
58172 <secondary>SMTP syntax error</secondary>
58173 </indexterm>
58174 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
58175 encountered. An unrecognized command is treated as a syntax error. For an
58176 external connection, the host identity is given; for an internal connection
58177 using <option>-bs</option> the sender identification (normally the calling user) is given.
58178 </para>
58179 </listitem>
58180 <listitem>
58181 <para>
58182 <indexterm role="concept">
58183 <primary>log</primary>
58184 <secondary>subject</secondary>
58185 </indexterm>
58186 <indexterm role="concept">
58187 <primary>subject, logging</primary>
58188 </indexterm>
58189 <option>subject</option>: The subject of the message is added to the arrival log line,
58190 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
58191 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
58192 specifies whether characters with values greater than 127 should be logged
58193 unchanged, or whether they should be rendered as escape sequences.
58194 </para>
58195 </listitem>
58196 <listitem>
58197 <para>
58198 <indexterm role="concept">
58199 <primary>log</primary>
58200 <secondary>certificate verification</secondary>
58201 </indexterm>
58202 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
58203 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
58204 verified, and <literal>CV=no</literal> if not.
58205 </para>
58206 </listitem>
58207 <listitem>
58208 <para>
58209 <indexterm role="concept">
58210 <primary>log</primary>
58211 <secondary>TLS cipher</secondary>
58212 </indexterm>
58213 <indexterm role="concept">
58214 <primary>TLS</primary>
58215 <secondary>logging cipher</secondary>
58216 </indexterm>
58217 <option>tls_cipher</option>: When a message is sent or received over an encrypted
58218 connection, the cipher suite used is added to the log line, preceded by X=.
58219 </para>
58220 </listitem>
58221 <listitem>
58222 <para>
58223 <indexterm role="concept">
58224 <primary>log</primary>
58225 <secondary>TLS peer DN</secondary>
58226 </indexterm>
58227 <indexterm role="concept">
58228 <primary>TLS</primary>
58229 <secondary>logging peer DN</secondary>
58230 </indexterm>
58231 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
58232 connection, and a certificate is supplied by the remote host, the peer DN is
58233 added to the log line, preceded by DN=.
58234 </para>
58235 </listitem>
58236 <listitem>
58237 <para>
58238 <indexterm role="concept">
58239 <primary>log</primary>
58240 <secondary>DNS failure in list</secondary>
58241 </indexterm>
58242 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
58243 result of a list match is failure because a DNS lookup failed.
58244 </para>
58245 </listitem>
58246 </itemizedlist>
58247 </section>
58248 <section id="SECID260">
58249 <title>Message log</title>
58250 <para>
58251 <indexterm role="concept">
58252 <primary>message</primary>
58253 <secondary>log file for</secondary>
58254 </indexterm>
58255 <indexterm role="concept">
58256 <primary>log</primary>
58257 <secondary>message log; description of</secondary>
58258 </indexterm>
58259 <indexterm role="concept">
58260 <primary><filename>msglog</filename> directory</primary>
58261 </indexterm>
58262 <indexterm role="option">
58263 <primary><option>preserve_message_logs</option></primary>
58264 </indexterm>
58265 In addition to the general log files, Exim writes a log file for each message
58266 that it handles. The names of these per-message logs are the message ids, and
58267 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
58268 message log contains copies of the log lines that apply to the message. This
58269 makes it easier to inspect the status of an individual message without having
58270 to search the main log. A message log is deleted when processing of the message
58271 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
58272 only with great care because they can fill up your disk very quickly.
58273 </para>
58274 <para>
58275 On a heavily loaded system, it may be desirable to disable the use of
58276 per-message logs, in order to reduce disk I/O. This can be done by setting the
58277 <option>message_logs</option> option false.
58278 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
58279 </para>
58280 </section>
58281 </chapter>
58282
58283 <chapter id="CHAPutils">
58284 <title>Exim utilities</title>
58285 <para>
58286 <indexterm role="concept" id="IIDutils" class="startofrange">
58287 <primary>utilities</primary>
58288 </indexterm>
58289 A number of utility scripts and programs are supplied with Exim and are
58290 described in this chapter. There is also the Exim Monitor, which is covered in
58291 the next chapter. The utilities described here are:
58292 </para>
58293 <informaltable frame="none">
58294 <tgroup cols="3" colsep="0" rowsep="0">
58295 <colspec colwidth="7*" align="left"/>
58296 <colspec colwidth="15*" align="left"/>
58297 <colspec colwidth="40*" align="left"/>
58298 <tbody>
58299 <row>
58300 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
58301 <entry><emphasis>exiwhat</emphasis></entry>
58302 <entry>list what Exim processes are doing</entry>
58303 </row>
58304 <row>
58305 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
58306 <entry><emphasis>exiqgrep</emphasis></entry>
58307 <entry>grep the queue</entry>
58308 </row>
58309 <row>
58310 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
58311 <entry><emphasis>exiqsumm</emphasis></entry>
58312 <entry>summarize the queue</entry>
58313 </row>
58314 <row>
58315 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
58316 <entry><emphasis>exigrep</emphasis></entry>
58317 <entry>search the main log</entry>
58318 </row>
58319 <row>
58320 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
58321 <entry><emphasis>exipick</emphasis></entry>
58322 <entry>select messages on various criteria</entry>
58323 </row>
58324 <row>
58325 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
58326 <entry><emphasis>exicyclog</emphasis></entry>
58327 <entry>cycle (rotate) log files</entry>
58328 </row>
58329 <row>
58330 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
58331 <entry><emphasis>eximstats</emphasis></entry>
58332 <entry>extract statistics from the log</entry>
58333 </row>
58334 <row>
58335 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
58336 <entry><emphasis>exim_checkaccess</emphasis></entry>
58337 <entry>check address acceptance from given IP</entry>
58338 </row>
58339 <row>
58340 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
58341 <entry><emphasis>exim_dbmbuild</emphasis></entry>
58342 <entry>build a DBM file</entry>
58343 </row>
58344 <row>
58345 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
58346 <entry><emphasis>exinext</emphasis></entry>
58347 <entry>extract retry information</entry>
58348 </row>
58349 <row>
58350 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
58351 <entry><emphasis>exim_dumpdb</emphasis></entry>
58352 <entry>dump a hints database</entry>
58353 </row>
58354 <row>
58355 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
58356 <entry><emphasis>exim_tidydb</emphasis></entry>
58357 <entry>clean up a hints database</entry>
58358 </row>
58359 <row>
58360 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
58361 <entry><emphasis>exim_fixdb</emphasis></entry>
58362 <entry>patch a hints database</entry>
58363 </row>
58364 <row>
58365 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
58366 <entry><emphasis>exim_lock</emphasis></entry>
58367 <entry>lock a mailbox file</entry>
58368 </row>
58369 </tbody>
58370 </tgroup>
58371 </informaltable>
58372 <para>
58373 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
58374 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
58375 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
58376 </para>
58377 <section id="SECTfinoutwha">
58378 <title>Finding out what Exim processes are doing (exiwhat)</title>
58379 <para>
58380 <indexterm role="concept">
58381 <primary><emphasis>exiwhat</emphasis></primary>
58382 </indexterm>
58383 <indexterm role="concept">
58384 <primary>process, querying</primary>
58385 </indexterm>
58386 <indexterm role="concept">
58387 <primary>SIGUSR1</primary>
58388 </indexterm>
58389 On operating systems that can restart a system call after receiving a signal
58390 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
58391 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
58392 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
58393 processes it can find, having first emptied the file. It then waits for one
58394 second to allow the Exim processes to react before displaying the results. In
58395 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
58396 send the signal to the Exim processes, so it is normally run as root.
58397 </para>
58398 <para>
58399 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
58400 use by system administrators. It is not sensible, for example, to set up a
58401 script that sends SIGUSR1 signals to Exim processes at short intervals.
58402 </para>
58403 <para>
58404 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
58405 varies in different operating systems. Not only are different options used,
58406 but the format of the output is different. For this reason, there are some
58407 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
58408 it doesn&#x2019;t seem to be working for you, check the following compile-time
58409 options:
58410 </para>
58411 <literallayout>
58412 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
58413 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
58414 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
58415 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
58416 </literallayout>
58417 <para>
58418 An example of typical output from <emphasis>exiwhat</emphasis> is
58419 </para>
58420 <literallayout class="monospaced">
58421 164 daemon: -q1h, listening on port 25
58422 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
58423 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
58424   [10.19.42.42] (editor@ref.example)
58425 10592 handling incoming call from [192.168.243.242]
58426 10628 accepting a local non-SMTP message
58427 </literallayout>
58428 <para>
58429 The first number in the output line is the process number. The third line has
58430 been split here, in order to fit it on the page.
58431 </para>
58432 </section>
58433 <section id="SECTgreptheque">
58434 <title>Selective queue listing (exiqgrep)</title>
58435 <para>
58436 <indexterm role="concept">
58437 <primary><emphasis>exiqgrep</emphasis></primary>
58438 </indexterm>
58439 <indexterm role="concept">
58440 <primary>queue</primary>
58441 <secondary>grepping</secondary>
58442 </indexterm>
58443 This utility is a Perl script contributed by Matt Hubbard. It runs
58444 </para>
58445 <literallayout class="monospaced">
58446 exim -bpu
58447 </literallayout>
58448 <para>
58449 to obtain a queue listing with undelivered recipients only, and then greps the
58450 output to select messages that match given criteria. The following selection
58451 options are available:
58452 </para>
58453 <variablelist>
58454 <varlistentry>
58455 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
58456 <listitem>
58457 <para>
58458 Match the sender address. The field that is tested is enclosed in angle
58459 brackets, so you can test for bounce messages with
58460 </para>
58461 <literallayout class="monospaced">
58462 exiqgrep -f '^&lt;&gt;$'
58463 </literallayout>
58464 </listitem></varlistentry>
58465 <varlistentry>
58466 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
58467 <listitem>
58468 <para>
58469 Match a recipient address. The field that is tested is not enclosed in angle
58470 brackets.
58471 </para>
58472 </listitem></varlistentry>
58473 <varlistentry>
58474 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
58475 <listitem>
58476 <para>
58477 Match against the size field.
58478 </para>
58479 </listitem></varlistentry>
58480 <varlistentry>
58481 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
58482 <listitem>
58483 <para>
58484 Match messages that are younger than the given time.
58485 </para>
58486 </listitem></varlistentry>
58487 <varlistentry>
58488 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
58489 <listitem>
58490 <para>
58491 Match messages that are older than the given time.
58492 </para>
58493 </listitem></varlistentry>
58494 <varlistentry>
58495 <term><emphasis role="bold">-z</emphasis></term>
58496 <listitem>
58497 <para>
58498 Match only frozen messages.
58499 </para>
58500 </listitem></varlistentry>
58501 <varlistentry>
58502 <term><emphasis role="bold">-x</emphasis></term>
58503 <listitem>
58504 <para>
58505 Match only non-frozen messages.
58506 </para>
58507 </listitem></varlistentry>
58508 </variablelist>
58509 <para>
58510 The following options control the format of the output:
58511 </para>
58512 <variablelist>
58513 <varlistentry>
58514 <term><emphasis role="bold">-c</emphasis></term>
58515 <listitem>
58516 <para>
58517 Display only the count of matching messages.
58518 </para>
58519 </listitem></varlistentry>
58520 <varlistentry>
58521 <term><emphasis role="bold">-l</emphasis></term>
58522 <listitem>
58523 <para>
58524 Long format &ndash; display the full message information as output by Exim. This is
58525 the default.
58526 </para>
58527 </listitem></varlistentry>
58528 <varlistentry>
58529 <term><emphasis role="bold">-i</emphasis></term>
58530 <listitem>
58531 <para>
58532 Display message ids only.
58533 </para>
58534 </listitem></varlistentry>
58535 <varlistentry>
58536 <term><emphasis role="bold">-b</emphasis></term>
58537 <listitem>
58538 <para>
58539 Brief format &ndash; one line per message.
58540 </para>
58541 </listitem></varlistentry>
58542 <varlistentry>
58543 <term><emphasis role="bold">-R</emphasis></term>
58544 <listitem>
58545 <para>
58546 Display messages in reverse order.
58547 </para>
58548 </listitem></varlistentry>
58549 </variablelist>
58550 <para>
58551 There is one more option, <option>-h</option>, which outputs a list of options.
58552 </para>
58553 </section>
58554 <section id="SECTsumtheque">
58555 <title>Summarizing the queue (exiqsumm)</title>
58556 <para>
58557 <indexterm role="concept">
58558 <primary><emphasis>exiqsumm</emphasis></primary>
58559 </indexterm>
58560 <indexterm role="concept">
58561 <primary>queue</primary>
58562 <secondary>summary</secondary>
58563 </indexterm>
58564 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
58565 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
58566 running a command such as
58567 </para>
58568 <literallayout class="monospaced">
58569 exim -bp | exiqsumm
58570 </literallayout>
58571 <para>
58572 The output consists of one line for each domain that has messages waiting for
58573 it, as in the following example:
58574 </para>
58575 <literallayout class="monospaced">
58576 3   2322   74m   66m  msn.com.example
58577 </literallayout>
58578 <para>
58579 Each line lists the number of pending deliveries for a domain, their total
58580 volume, and the length of time that the oldest and the newest messages have
58581 been waiting. Note that the number of pending deliveries is greater than the
58582 number of messages when messages have more than one recipient.
58583 </para>
58584 <para>
58585 A summary line is output at the end. By default the output is sorted on the
58586 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
58587 the output to be sorted by oldest message and by count of messages,
58588 respectively. There are also three options that split the messages for each
58589 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
58590 separates frozen messages, and <option>-s</option> separates messages according to their
58591 sender.
58592 </para>
58593 <para>
58594 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
58595 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
58596 generated by aliasing or forwarding are included (unless the <option>one_time</option>
58597 option of the <command>redirect</command> router has been used to convert them into <quote>top
58598 level</quote> addresses).
58599 </para>
58600 </section>
58601 <section id="SECTextspeinf">
58602 <title>Extracting specific information from the log (exigrep)</title>
58603 <para>
58604 <indexterm role="concept">
58605 <primary><emphasis>exigrep</emphasis></primary>
58606 </indexterm>
58607 <indexterm role="concept">
58608 <primary>log</primary>
58609 <secondary>extracts; grepping for</secondary>
58610 </indexterm>
58611 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
58612 files for entries that match a given pattern. When it finds a match, it
58613 extracts all the log entries for the relevant message, not just those that
58614 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
58615 given message, or all mail for a given user, or for a given host, for example.
58616 The input files can be in Exim log format or syslog format.
58617 </para>
58618 <para revisionflag="changed">
58619 If a matching log line is not associated with a specific message, it is
58620 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
58621 </para>
58622 <literallayout revisionflag="changed">
58623 <literal>exigrep [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] [-I] [-l] [-v] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
58624 </literallayout>
58625 <para revisionflag="changed">
58626 If no log file names are given on the command line, the standard input is read.
58627 </para>
58628 <para revisionflag="changed">
58629 The <option>-t</option> argument specifies a number of seconds. It adds an additional
58630 condition for message selection. Messages that are complete are shown only if
58631 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
58632 </para>
58633 <para revisionflag="changed">
58634 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
58635 makes it case-sensitive. This may give a performance improvement when searching
58636 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
58637 option; with <option>-I</option> they do not. In both cases it is possible to change the
58638 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
58639 </para>
58640 <para revisionflag="changed">
58641 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
58642 pattern as standing for themselves. Otherwise the pattern must be a Perl
58643 regular expression.
58644 </para>
58645 <para revisionflag="changed">
58646 The <option>-v</option> option inverts the matching condition. That is, a line is selected
58647 if it does <emphasis>not</emphasis> match the pattern.
58648 </para>
58649 <para>
58650 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
58651 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
58652 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
58653 </para>
58654 </section>
58655 <section id="SECTexipick">
58656 <title>Selecting messages by various criteria (exipick)</title>
58657 <para>
58658 <indexterm role="concept">
58659 <primary><emphasis>exipick</emphasis></primary>
58660 </indexterm>
58661 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
58662 lists messages from the queue according to a variety of criteria. For details
58663 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
58664 <emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/ToolExipickManPage">http://www.exim.org/eximwiki/ToolExipickManPage</ulink></emphasis> or run <emphasis>exipick</emphasis> with
58665 the <option>--help</option> option.
58666 </para>
58667 </section>
58668 <section id="SECTcyclogfil">
58669 <title>Cycling log files (exicyclog)</title>
58670 <para>
58671 <indexterm role="concept">
58672 <primary>log</primary>
58673 <secondary>cycling local files</secondary>
58674 </indexterm>
58675 <indexterm role="concept">
58676 <primary>cycling logs</primary>
58677 </indexterm>
58678 <indexterm role="concept">
58679 <primary><emphasis>exicyclog</emphasis></primary>
58680 </indexterm>
58681 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
58682 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
58683 you are using log files with datestamps in their names (see section
58684 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
58685 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
58686 There are two command line options for <emphasis>exicyclog</emphasis>:
58687 </para>
58688 <itemizedlist>
58689 <listitem>
58690 <para>
58691 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
58692 default that is set when Exim is built. The default default is 10.
58693 </para>
58694 </listitem>
58695 <listitem>
58696 <para>
58697 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
58698 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
58699 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
58700 configuration.
58701 </para>
58702 </listitem>
58703 </itemizedlist>
58704 <para>
58705 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
58706 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
58707 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
58708 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
58709 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
58710 logs are handled similarly.
58711 </para>
58712 <para>
58713 If the limit is greater than 99, the script uses 3-digit numbers such as
58714 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
58715 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
58716 any existing log files.
58717 </para>
58718 <para>
58719 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
58720 the end are deleted. All files with numbers greater than 01 are compressed,
58721 using a compression command which is configured by the COMPRESS_COMMAND
58722 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
58723 root <option>crontab</option> entry of the form
58724 </para>
58725 <literallayout class="monospaced">
58726 1 0 * * * su exim -c /usr/exim/bin/exicyclog
58727 </literallayout>
58728 <para>
58729 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
58730 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
58731 </para>
58732 </section>
58733 <section id="SECTmailstat">
58734 <title>Mail statistics (eximstats)</title>
58735 <para>
58736 <indexterm role="concept">
58737 <primary>statistics</primary>
58738 </indexterm>
58739 <indexterm role="concept">
58740 <primary><emphasis>eximstats</emphasis></primary>
58741 </indexterm>
58742 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
58743 information from log files. The output is either plain text, or HTML.
58744 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
58745 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
58746 </para>
58747 <para>
58748 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
58749 latest version is the result of some extensive revision by Steve Campbell. A
58750 lot of information is given by default, but there are options for suppressing
58751 various parts of it. Following any options, the arguments to the script are a
58752 list of files, which should be main log files. For example:
58753 </para>
58754 <literallayout class="monospaced">
58755 eximstats -nr /var/spool/exim/log/mainlog.01
58756 </literallayout>
58757 <para>
58758 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
58759 messages received from or delivered to various hosts. The information is sorted
58760 both by message count and by volume, and the top fifty hosts in each category
58761 are listed on the standard output. Similar information, based on email
58762 addresses or domains instead of hosts can be requested by means of various
58763 options. For messages delivered and received locally, similar statistics are
58764 also produced per user.
58765 </para>
58766 <para>
58767 The output also includes total counts and statistics about delivery errors, and
58768 histograms showing the number of messages received and deliveries made in each
58769 hour of the day. A delivery with more than one address in its envelope (for
58770 example, an SMTP transaction with more than one RCPT command) is counted
58771 as a single delivery by <emphasis>eximstats</emphasis>.
58772 </para>
58773 <para>
58774 Though normally more deliveries than receipts are reported (as messages may
58775 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
58776 messages received than delivered, even though the queue is empty at the start
58777 and end of the period in question. If an incoming message contains no valid
58778 recipients, no deliveries are recorded for it. A bounce message is handled as
58779 an entirely separate message.
58780 </para>
58781 <para>
58782 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
58783 of messages received and deliveries made, and the number of hosts involved in
58784 each case. It also outputs the number of messages that were delayed (that is,
58785 not completely delivered at the first attempt), and the number that had at
58786 least one address that failed.
58787 </para>
58788 <para>
58789 The remainder of the output is in sections that can be independently disabled
58790 or modified by various options. It consists of a summary of deliveries by
58791 transport, histograms of messages received and delivered per time interval
58792 (default per hour), information about the time messages spent on the queue,
58793 a list of relayed messages, lists of the top fifty sending hosts, local
58794 senders, destination hosts, and destination local users by count and by volume,
58795 and a list of delivery errors that occurred.
58796 </para>
58797 <para>
58798 The relay information lists messages that were actually relayed, that is, they
58799 came from a remote host and were directly delivered to some other remote host,
58800 without being processed (for example, for aliasing or forwarding) locally.
58801 </para>
58802 <para>
58803 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
58804 outputs. These are documented in the Perl script itself, and can be extracted
58805 by running the command <command>perldoc</command> on the script. For example:
58806 </para>
58807 <literallayout class="monospaced">
58808 perldoc /usr/exim/bin/eximstats
58809 </literallayout>
58810 </section>
58811 <section id="SECTcheckaccess">
58812 <title>Checking access policy (exim_checkaccess)</title>
58813 <para>
58814 <indexterm role="concept">
58815 <primary><emphasis>exim_checkaccess</emphasis></primary>
58816 </indexterm>
58817 <indexterm role="concept">
58818 <primary>policy control</primary>
58819 <secondary>checking access</secondary>
58820 </indexterm>
58821 <indexterm role="concept">
58822 <primary>checking access</primary>
58823 </indexterm>
58824 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
58825 debugging output, in order to check what Exim is doing when it is applying
58826 policy controls to incoming SMTP mail. However, not everybody is sufficiently
58827 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
58828 sometimes you just want to answer the question <quote>Does this address have
58829 access?</quote> without bothering with any further details.
58830 </para>
58831 <para>
58832 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
58833 two arguments, an IP address and an email address:
58834 </para>
58835 <literallayout class="monospaced">
58836 exim_checkaccess 10.9.8.7 A.User@a.domain.example
58837 </literallayout>
58838 <para>
58839 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
58840 given email address would be accepted in a RCPT command in a TCP/IP
58841 connection from the host with the given IP address. The output of the utility
58842 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
58843 </para>
58844 <literallayout class="monospaced">
58845 Rejected:
58846 550 Relay not permitted
58847 </literallayout>
58848 <para>
58849 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
58850 for the MAIL command, but you can change this by providing additional
58851 options. These are passed directly to the Exim command. For example, to specify
58852 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
58853 you can use:
58854 </para>
58855 <literallayout class="monospaced">
58856 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
58857                  -f himself@there.example
58858 </literallayout>
58859 <para>
58860 Note that these additional Exim command line items must be given after the two
58861 mandatory arguments.
58862 </para>
58863 <para>
58864 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
58865 while running its checks. You can run checks that include callouts by using
58866 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
58867 </para>
58868 </section>
58869 <section id="SECTdbmbuild">
58870 <title>Making DBM files (exim_dbmbuild)</title>
58871 <para>
58872 <indexterm role="concept">
58873 <primary>DBM</primary>
58874 <secondary>building dbm files</secondary>
58875 </indexterm>
58876 <indexterm role="concept">
58877 <primary>building DBM files</primary>
58878 </indexterm>
58879 <indexterm role="concept">
58880 <primary><emphasis>exim_dbmbuild</emphasis></primary>
58881 </indexterm>
58882 <indexterm role="concept">
58883 <primary>lower casing</primary>
58884 </indexterm>
58885 <indexterm role="concept">
58886 <primary>binary zero</primary>
58887 <secondary>in lookup key</secondary>
58888 </indexterm>
58889 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
58890 the format used by the <command>lsearch</command> lookup (see section
58891 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
58892 names as keys and the remainder of the information as data. The lower-casing
58893 can be prevented by calling the program with the <option>-nolc</option> option.
58894 </para>
58895 <para>
58896 A terminating zero is included as part of the key string. This is expected by
58897 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
58898 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
58899 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
58900 files.
58901 </para>
58902 <para>
58903 The program requires two arguments: the name of the input file (which can be a
58904 single hyphen to indicate the standard input), and the name of the output file.
58905 It creates the output under a temporary name, and then renames it if all went
58906 well.
58907 </para>
58908 <para>
58909 <indexterm role="concept">
58910 <primary>USE_DB</primary>
58911 </indexterm>
58912 If the native DB interface is in use (USE_DB is set in a compile-time
58913 configuration file &ndash; this is common in free versions of Unix) the two file
58914 names must be different, because in this mode the Berkeley DB functions create
58915 a single output file using exactly the name given. For example,
58916 </para>
58917 <literallayout class="monospaced">
58918 exim_dbmbuild /etc/aliases /etc/aliases.db
58919 </literallayout>
58920 <para>
58921 reads the system alias file and creates a DBM version of it in
58922 <filename>/etc/aliases.db</filename>.
58923 </para>
58924 <para>
58925 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
58926 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
58927 environment, the suffixes are added to the second argument of
58928 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
58929 when the Berkeley functions are used in compatibility mode (though this is not
58930 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
58931 </para>
58932 <para>
58933 If a duplicate key is encountered, the program outputs a warning, and when it
58934 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
58935 option is used. By default, only the first of a set of duplicates is used &ndash;
58936 this makes it compatible with <command>lsearch</command> lookups. There is an option
58937 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
58938 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
58939 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
58940 return code is 2.
58941 </para>
58942 </section>
58943 <section id="SECTfinindret">
58944 <title>Finding individual retry times (exinext)</title>
58945 <para>
58946 <indexterm role="concept">
58947 <primary>retry</primary>
58948 <secondary>times</secondary>
58949 </indexterm>
58950 <indexterm role="concept">
58951 <primary><emphasis>exinext</emphasis></primary>
58952 </indexterm>
58953 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
58954 fish specific information out of the retry database. Given a mail domain (or a
58955 complete address), it looks up the hosts for that domain, and outputs any retry
58956 information for the hosts or for the domain. At present, the retry information
58957 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
58958 output. For example:
58959 </para>
58960 <literallayout class="monospaced">
58961 $ exinext piglet@milne.fict.example
58962 kanga.milne.example:192.168.8.1 error 146: Connection refused
58963   first failed: 21-Feb-1996 14:57:34
58964   last tried:   21-Feb-1996 14:57:34
58965   next try at:  21-Feb-1996 15:02:34
58966 roo.milne.example:192.168.8.3 error 146: Connection refused
58967   first failed: 20-Jan-1996 13:12:08
58968   last tried:   21-Feb-1996 11:42:03
58969   next try at:  21-Feb-1996 19:42:03
58970   past final cutoff time
58971 </literallayout>
58972 <para>
58973 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
58974 will give any retry information for that local part in your default domain.
58975 A message id can be used to obtain retry information pertaining to a specific
58976 message. This exists only when an attempt to deliver a message to a remote host
58977 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
58978 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
58979 run very often.
58980 </para>
58981 <para>
58982 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
58983 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
58984 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
58985 configuration file, and the second sets macros for use within the configuration
58986 file. These features are mainly to help in testing, but might also be useful in
58987 environments where more than one configuration file is in use.
58988 </para>
58989 </section>
58990 <section id="SECThindatmai">
58991 <title>Hints database maintenance</title>
58992 <para>
58993 <indexterm role="concept">
58994 <primary>hints database</primary>
58995 <secondary>maintenance</secondary>
58996 </indexterm>
58997 <indexterm role="concept">
58998 <primary>maintaining Exim&#x2019;s hints database</primary>
58999 </indexterm>
59000 Three utility programs are provided for maintaining the DBM files that Exim
59001 uses to contain its delivery hint information. Each program requires two
59002 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
59003 second is the name of the database it is to operate on. These are as follows:
59004 </para>
59005 <itemizedlist>
59006 <listitem>
59007 <para>
59008 <emphasis>retry</emphasis>: the database of retry information
59009 </para>
59010 </listitem>
59011 <listitem>
59012 <para>
59013 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
59014 for remote hosts
59015 </para>
59016 </listitem>
59017 <listitem>
59018 <para>
59019 <emphasis>callout</emphasis>: the callout cache
59020 </para>
59021 </listitem>
59022 <listitem>
59023 <para>
59024 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
59025 </para>
59026 </listitem>
59027 <listitem>
59028 <para>
59029 <emphasis>misc</emphasis>: other hints data
59030 </para>
59031 </listitem>
59032 </itemizedlist>
59033 <para>
59034 The <emphasis>misc</emphasis> database is used for
59035 </para>
59036 <itemizedlist>
59037 <listitem>
59038 <para>
59039 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
59040 </para>
59041 </listitem>
59042 <listitem>
59043 <para>
59044 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
59045 <command>smtp</command> transport)
59046 </para>
59047 </listitem>
59048 </itemizedlist>
59049 </section>
59050 <section id="SECID261">
59051 <title>exim_dumpdb</title>
59052 <para>
59053 <indexterm role="concept">
59054 <primary><emphasis>exim_dumpdb</emphasis></primary>
59055 </indexterm>
59056 The entire contents of a database are written to the standard output by the
59057 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
59058 spool and database names. For example, to dump the retry database:
59059 </para>
59060 <literallayout class="monospaced">
59061 exim_dumpdb /var/spool/exim retry
59062 </literallayout>
59063 <para>
59064 Two lines of output are produced for each entry:
59065 </para>
59066 <literallayout class="monospaced">
59067 T:mail.ref.example:192.168.242.242 146 77 Connection refused
59068 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
59069 </literallayout>
59070 <para>
59071 The first item on the first line is the key of the record. It starts with one
59072 of the letters R, or T, depending on whether it refers to a routing or
59073 transport retry. For a local delivery, the next part is the local address; for
59074 a remote delivery it is the name of the remote host, followed by its failing IP
59075 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
59076 transport). If the remote port is not the standard one (port 25), it is added
59077 to the IP address. Then there follows an error code, an additional error code,
59078 and a textual description of the error.
59079 </para>
59080 <para>
59081 The three times on the second line are the time of first failure, the time of
59082 the last delivery attempt, and the computed time for the next attempt. The line
59083 ends with an asterisk if the cutoff time for the last retry rule has been
59084 exceeded.
59085 </para>
59086 <para>
59087 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
59088 consists of a host name followed by a list of ids for messages that are or were
59089 waiting to be delivered to that host. If there are a very large number for any
59090 one host, continuation records, with a sequence number added to the host name,
59091 may be seen. The data in these records is often out of date, because a message
59092 may be routed to several alternative hosts, and Exim makes no effort to keep
59093 cross-references.
59094 </para>
59095 </section>
59096 <section id="SECID262">
59097 <title>exim_tidydb</title>
59098 <para>
59099 <indexterm role="concept">
59100 <primary><emphasis>exim_tidydb</emphasis></primary>
59101 </indexterm>
59102 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
59103 database. If run with no options, it removes all records that are more than 30
59104 days old. The age is calculated from the date and time that the record was last
59105 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
59106 since the first delivery failure. Information about a host that has been down
59107 for more than 30 days will remain in the database, provided that the record is
59108 updated sufficiently often.
59109 </para>
59110 <para>
59111 The cutoff date can be altered by means of the <option>-t</option> option, which must be
59112 followed by a time. For example, to remove all records older than a week from
59113 the retry database:
59114 </para>
59115 <literallayout class="monospaced">
59116 exim_tidydb -t 7d /var/spool/exim retry
59117 </literallayout>
59118 <para>
59119 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
59120 message ids. In the former these appear as data in records keyed by host &ndash;
59121 they were messages that were waiting for that host &ndash; and in the latter they
59122 are the keys for retry information for messages that have suffered certain
59123 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
59124 message ids in database records are those of messages that are still on the
59125 queue. Message ids for messages that no longer exist are removed from
59126 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
59127 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
59128 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
59129 whenever it removes information from the database.
59130 </para>
59131 <para>
59132 Certain records are automatically removed by Exim when they are no longer
59133 needed, but others are not. For example, if all the MX hosts for a domain are
59134 down, a retry record is created for each one. If the primary MX host comes back
59135 first, its record is removed when Exim successfully delivers to it, but the
59136 records for the others remain because Exim has not tried to use those hosts.
59137 </para>
59138 <para>
59139 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
59140 hints databases. You should do this at a quiet time of day, because it requires
59141 a database to be locked (and therefore inaccessible to Exim) while it does its
59142 work. Removing records from a DBM file does not normally make the file smaller,
59143 but all the common DBM libraries are able to re-use the space that is released.
59144 After an initial phase of increasing in size, the databases normally reach a
59145 point at which they no longer get any bigger, as long as they are regularly
59146 tidied.
59147 </para>
59148 <para>
59149 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
59150 databases is likely to keep on increasing.
59151 </para>
59152 </section>
59153 <section id="SECID263">
59154 <title>exim_fixdb</title>
59155 <para>
59156 <indexterm role="concept">
59157 <primary><emphasis>exim_fixdb</emphasis></primary>
59158 </indexterm>
59159 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
59160 Its main use is for testing Exim, but it might also be occasionally useful for
59161 getting round problems in a live system. It has no options, and its interface
59162 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
59163 key of a database record can then be entered, and the data for that record is
59164 displayed.
59165 </para>
59166 <para>
59167 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
59168 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
59169 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
59170 data for individual fields can be changed by typing the field number followed
59171 by new data, for example:
59172 </para>
59173 <literallayout class="monospaced">
59174 &gt; 4 951102:1000
59175 </literallayout>
59176 <para>
59177 resets the time of the next delivery attempt. Time values are given as a
59178 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
59179 used as optional separators.
59180 </para>
59181 </section>
59182 <section id="SECTmailboxmaint">
59183 <title>Mailbox maintenance (exim_lock)</title>
59184 <para>
59185 <indexterm role="concept">
59186 <primary>mailbox</primary>
59187 <secondary>maintenance</secondary>
59188 </indexterm>
59189 <indexterm role="concept">
59190 <primary><emphasis>exim_lock</emphasis></primary>
59191 </indexterm>
59192 <indexterm role="concept">
59193 <primary>locking mailboxes</primary>
59194 </indexterm>
59195 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
59196 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
59197 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
59198 a user agent while investigating a problem. The utility requires the name of
59199 the file as its first argument. If the locking is successful, the second
59200 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
59201 second argument, the value of the SHELL environment variable is used; if this
59202 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
59203 is unlocked and the utility ends. The following options are available:
59204 </para>
59205 <variablelist>
59206 <varlistentry>
59207 <term><option>-fcntl</option></term>
59208 <listitem>
59209 <para>
59210 Use <function>fcntl()</function> locking on the open mailbox.
59211 </para>
59212 </listitem></varlistentry>
59213 <varlistentry>
59214 <term><option>-flock</option></term>
59215 <listitem>
59216 <para>
59217 Use <function>flock()</function> locking on the open mailbox, provided the operating system
59218 supports it.
59219 </para>
59220 </listitem></varlistentry>
59221 <varlistentry>
59222 <term><option>-interval</option></term>
59223 <listitem>
59224 <para>
59225 This must be followed by a number, which is a number of seconds; it sets the
59226 interval to sleep between retries (default 3).
59227 </para>
59228 </listitem></varlistentry>
59229 <varlistentry>
59230 <term><option>-lockfile</option></term>
59231 <listitem>
59232 <para>
59233 Create a lock file before opening the mailbox.
59234 </para>
59235 </listitem></varlistentry>
59236 <varlistentry>
59237 <term><option>-mbx</option></term>
59238 <listitem>
59239 <para>
59240 Lock the mailbox using MBX rules.
59241 </para>
59242 </listitem></varlistentry>
59243 <varlistentry>
59244 <term><option>-q</option></term>
59245 <listitem>
59246 <para>
59247 Suppress verification output.
59248 </para>
59249 </listitem></varlistentry>
59250 <varlistentry>
59251 <term><option>-retries</option></term>
59252 <listitem>
59253 <para>
59254 This must be followed by a number; it sets the number of times to try to get
59255 the lock (default 10).
59256 </para>
59257 </listitem></varlistentry>
59258 <varlistentry>
59259 <term><option>-restore_time</option></term>
59260 <listitem>
59261 <para>
59262 This option causes <option>exim_lock</option> to restore the modified and read times to the
59263 locked file before exiting. This allows you to access a locked mailbox (for
59264 example, to take a backup copy) without disturbing the times that the user
59265 subsequently sees.
59266 </para>
59267 </listitem></varlistentry>
59268 <varlistentry>
59269 <term><option>-timeout</option></term>
59270 <listitem>
59271 <para>
59272 This must be followed by a number, which is a number of seconds; it sets a
59273 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
59274 default), a non-blocking call is used.
59275 </para>
59276 </listitem></varlistentry>
59277 <varlistentry>
59278 <term><option>-v</option></term>
59279 <listitem>
59280 <para>
59281 Generate verbose output.
59282 </para>
59283 </listitem></varlistentry>
59284 </variablelist>
59285 <para>
59286 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
59287 default is to create a lock file and also to use <function>fcntl()</function> locking on the
59288 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
59289 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
59290 requires that the directory containing the file be writeable. Locking by lock
59291 file does not last for ever; Exim assumes that a lock file is expired if it is
59292 more than 30 minutes old.
59293 </para>
59294 <para>
59295 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
59296 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
59297 to be taken out on the open mailbox, and an exclusive lock on the file
59298 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
59299 number of the mailbox file. When the locking is released, if an exclusive lock
59300 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
59301 </para>
59302 <para>
59303 The default output contains verification of the locking that takes place. The
59304 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
59305 suppresses all output except error messages.
59306 </para>
59307 <para>
59308 A command such as
59309 </para>
59310 <literallayout class="monospaced">
59311 exim_lock /var/spool/mail/spqr
59312 </literallayout>
59313 <para>
59314 runs an interactive shell while the file is locked, whereas
59315 </para>
59316 <literallayout>
59317 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
59318 &lt;<emphasis>some commands</emphasis>&gt;
59319 <literal>End</literal>
59320 </literallayout>
59321 <para>
59322 runs a specific non-interactive sequence of commands while the file is locked,
59323 suppressing all verification output. A single command can be run by a command
59324 such as
59325 </para>
59326 <literallayout class="monospaced">
59327 exim_lock -q /var/spool/mail/spqr \
59328   "cp /var/spool/mail/spqr /some/where"
59329 </literallayout>
59330 <para>
59331 Note that if a command is supplied, it must be entirely contained within the
59332 second argument &ndash; hence the quotes.
59333 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
59334 </para>
59335 </section>
59336 </chapter>
59337
59338 <chapter id="CHAPeximon">
59339 <title>The Exim monitor</title>
59340 <para>
59341 <indexterm role="concept" id="IIDeximon" class="startofrange">
59342 <primary>Exim monitor</primary>
59343 <secondary>description</secondary>
59344 </indexterm>
59345 <indexterm role="concept">
59346 <primary>X-windows</primary>
59347 </indexterm>
59348 <indexterm role="concept">
59349 <primary><emphasis>eximon</emphasis></primary>
59350 </indexterm>
59351 <indexterm role="concept">
59352 <primary>Local/eximon.conf</primary>
59353 </indexterm>
59354 <indexterm role="concept">
59355 <primary><filename>exim_monitor/EDITME</filename></primary>
59356 </indexterm>
59357 The Exim monitor is an application which displays in an X window information
59358 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
59359 perform certain operations on messages from this GUI interface; however all
59360 such facilities are also available from the command line, and indeed, the
59361 monitor itself makes use of the command line to perform any actions requested.
59362 </para>
59363 <section id="SECID264">
59364 <title>Running the monitor</title>
59365 <para>
59366 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
59367 script that sets up a number of environment variables, and then runs the
59368 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
59369 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
59370 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
59371 parameters are for.
59372 </para>
59373 <para>
59374 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
59375 a particular invocation by setting up environment variables of the same names,
59376 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
59377 </para>
59378 <literallayout class="monospaced">
59379 EXIMON_LOG_DEPTH=400 eximon
59380 </literallayout>
59381 <para>
59382 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
59383 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
59384 overrides the Exim log file configuration. This makes it possible to have
59385 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
59386 syslog messages are routed to a file on the local host.
59387 </para>
59388 <para>
59389 X resources can be used to change the appearance of the window in the normal
59390 way. For example, a resource setting of the form
59391 </para>
59392 <literallayout class="monospaced">
59393 Eximon*background: gray94
59394 </literallayout>
59395 <para>
59396 changes the colour of the background to light grey rather than white. The
59397 stripcharts are drawn with both the data lines and the reference lines in
59398 black. This means that the reference lines are not visible when on top of the
59399 data. However, their colour can be changed by setting a resource called
59400 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
59401 For example, if your X server is running Unix, you could set up lighter
59402 reference lines in the stripcharts by obeying
59403 </para>
59404 <literallayout class="monospaced">
59405 xrdb -merge &lt;&lt;End
59406 Eximon*highlight: gray
59407 End
59408 </literallayout>
59409 <para>
59410 <indexterm role="concept">
59411 <primary>admin user</primary>
59412 </indexterm>
59413 In order to see the contents of messages on the queue, and to operate on them,
59414 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
59415 </para>
59416 <para>
59417 The monitor&#x2019;s window is divided into three parts. The first contains one or
59418 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
59419 main log file, and the third is a display of the queue of messages awaiting
59420 delivery, with two more action buttons. The following sections describe these
59421 different parts of the display.
59422 </para>
59423 </section>
59424 <section id="SECID265">
59425 <title>The stripcharts</title>
59426 <para>
59427 <indexterm role="concept">
59428 <primary>stripchart</primary>
59429 </indexterm>
59430 The first stripchart is always a count of messages on the queue. Its name can
59431 be configured by setting QUEUE_STRIPCHART_NAME in the
59432 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
59433 configuration script by regular expression matches on log file entries, making
59434 it possible to display, for example, counts of messages delivered to certain
59435 hosts or using certain transports. The supplied defaults display counts of
59436 received and delivered messages, and of local and SMTP deliveries. The default
59437 period between stripchart updates is one minute; this can be adjusted by a
59438 parameter in the <filename>Local/eximon.conf</filename> file.
59439 </para>
59440 <para>
59441 The stripchart displays rescale themselves automatically as the value they are
59442 displaying changes. There are always 10 horizontal lines in each chart; the
59443 title string indicates the value of each division when it is greater than one.
59444 For example, <quote>x2</quote> means that each division represents a value of 2.
59445 </para>
59446 <para>
59447 It is also possible to have a stripchart which shows the percentage fullness of
59448 a particular disk partition, which is useful when local deliveries are confined
59449 to a single partition.
59450 </para>
59451 <para>
59452 <indexterm role="concept">
59453 <primary><option>statvfs</option> function</primary>
59454 </indexterm>
59455 This relies on the availability of the <function>statvfs()</function> function or equivalent in
59456 the operating system. Most, but not all versions of Unix that support Exim have
59457 this. For this particular stripchart, the top of the chart always represents
59458 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
59459 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
59460 <filename>Local/eximon.conf</filename> file.
59461 </para>
59462 </section>
59463 <section id="SECID266">
59464 <title>Main action buttons</title>
59465 <para>
59466 <indexterm role="concept">
59467 <primary>size</primary>
59468 <secondary>of monitor window</secondary>
59469 </indexterm>
59470 <indexterm role="concept">
59471 <primary>Exim monitor</primary>
59472 <secondary>window size</secondary>
59473 </indexterm>
59474 <indexterm role="concept">
59475 <primary>window size</primary>
59476 </indexterm>
59477 Below the stripcharts there is an action button for quitting the monitor. Next
59478 to this is another button marked <quote>Size</quote>. They are placed here so that
59479 shrinking the window to its default minimum size leaves just the queue count
59480 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
59481 the window to expand to its maximum size, unless it is already at the maximum,
59482 in which case it is reduced to its minimum.
59483 </para>
59484 <para>
59485 When expanding to the maximum, if the window cannot be fully seen where it
59486 currently is, it is moved back to where it was the last time it was at full
59487 size. When it is expanding from its minimum size, the old position is
59488 remembered, and next time it is reduced to the minimum it is moved back there.
59489 </para>
59490 <para>
59491 The idea is that you can keep a reduced window just showing one or two
59492 stripcharts at a convenient place on your screen, easily expand it to show
59493 the full window when required, and just as easily put it back to what it was.
59494 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
59495 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
59496 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
59497 </para>
59498 <para>
59499 Normally, the monitor starts up with the window at its full size, but it can be
59500 built so that it starts up with the window at its smallest size, by setting
59501 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
59502 </para>
59503 </section>
59504 <section id="SECID267">
59505 <title>The log display</title>
59506 <para>
59507 <indexterm role="concept">
59508 <primary>log</primary>
59509 <secondary>tail of; in monitor</secondary>
59510 </indexterm>
59511 The second section of the window is an area in which a display of the tail of
59512 the main log is maintained.
59513 To save space on the screen, the timestamp on each log line is shortened by
59514 removing the date and, if <option>log_timezone</option> is set, the timezone.
59515 The log tail is not available when the only destination for logging data is
59516 syslog, unless the syslog lines are routed to a local file whose name is passed
59517 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
59518 </para>
59519 <para>
59520 The log sub-window has a scroll bar at its lefthand side which can be used to
59521 move back to look at earlier text, and the up and down arrow keys also have a
59522 scrolling effect. The amount of log that is kept depends on the setting of
59523 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
59524 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
59525 much more efficient than throwing it away line by line. The sub-window also has
59526 a horizontal scroll bar for accessing the ends of long log lines. This is the
59527 only means of horizontal scrolling; the right and left arrow keys are not
59528 available. Text can be cut from this part of the window using the mouse in the
59529 normal way. The size of this subwindow is controlled by parameters in the
59530 configuration file <filename>Local/eximon.conf</filename>.
59531 </para>
59532 <para>
59533 Searches of the text in the log window can be carried out by means of the ^R
59534 and ^S keystrokes, which default to a reverse and a forward search,
59535 respectively. The search covers only the text that is displayed in the window.
59536 It cannot go further back up the log.
59537 </para>
59538 <para>
59539 The point from which the search starts is indicated by a caret marker. This is
59540 normally at the end of the text in the window, but can be positioned explicitly
59541 by pointing and clicking with the left mouse button, and is moved automatically
59542 by a successful search. If new text arrives in the window when it is scrolled
59543 back, the caret remains where it is, but if the window is not scrolled back,
59544 the caret is moved to the end of the new text.
59545 </para>
59546 <para>
59547 Pressing ^R or ^S pops up a window into which the search text can be typed.
59548 There are buttons for selecting forward or reverse searching, for carrying out
59549 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
59550 happens and the window remains so that further searches can be done. If the
59551 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
59552 ^C is typed the search is cancelled.
59553 </para>
59554 <para>
59555 The searching facility is implemented using the facilities of the Athena text
59556 widget. By default this pops up a window containing both <quote>search</quote> and
59557 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
59558 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
59559 However, the linkers in BSDI and HP-UX seem unable to handle an externally
59560 provided version of <option>TextPop</option> when the remaining parts of the text widget
59561 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
59562 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
59563 on these systems, at the expense of having unwanted items in the search popup
59564 window.
59565 </para>
59566 </section>
59567 <section id="SECID268">
59568 <title>The queue display</title>
59569 <para>
59570 <indexterm role="concept">
59571 <primary>queue</primary>
59572 <secondary>display in monitor</secondary>
59573 </indexterm>
59574 The bottom section of the monitor window contains a list of all messages that
59575 are on the queue, which includes those currently being received or delivered,
59576 as well as those awaiting delivery. The size of this subwindow is controlled by
59577 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
59578 at which it is updated is controlled by another parameter in the same file &ndash;
59579 the default is 5 minutes, since queue scans can be quite expensive. However,
59580 there is an <quote>Update</quote> action button just above the display which can be used
59581 to force an update of the queue display at any time.
59582 </para>
59583 <para>
59584 When a host is down for some time, a lot of pending mail can build up for it,
59585 and this can make it hard to deal with other messages on the queue. To help
59586 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
59587 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
59588 type anything in here and press <quote>Return</quote>, the text is added to a chain of
59589 such texts, and if every undelivered address in a message matches at least one
59590 of the texts, the message is not displayed.
59591 </para>
59592 <para>
59593 If there is an address that does not match any of the texts, all the addresses
59594 are displayed as normal. The matching happens on the ends of addresses so, for
59595 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
59596 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
59597 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
59598 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
59599 a hide request is automatically cancelled after one hour.
59600 </para>
59601 <para>
59602 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
59603 else to the monitor window. For this reason, if you want to cut text from the
59604 queue display to use in the dialogue box, you have to do the cutting before
59605 pressing the <quote>Hide</quote> button.
59606 </para>
59607 <para>
59608 The queue display contains, for each unhidden queued message, the length of
59609 time it has been on the queue, the size of the message, the message id, the
59610 message sender, and the first undelivered recipient, all on one line. If it is
59611 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
59612 recipient to which the message has not yet been delivered, subsequent ones are
59613 listed on additional lines, up to a maximum configured number, following which
59614 an ellipsis is displayed. Recipients that have already received the message are
59615 not shown.
59616 </para>
59617 <para>
59618 <indexterm role="concept">
59619 <primary>frozen messages</primary>
59620 <secondary>display</secondary>
59621 </indexterm>
59622 If a message is frozen, an asterisk is displayed at the left-hand side.
59623 </para>
59624 <para>
59625 The queue display has a vertical scroll bar, and can also be scrolled by means
59626 of the arrow keys. Text can be cut from it using the mouse in the normal way.
59627 The text searching facilities, as described above for the log window, are also
59628 available, but the caret is always moved to the end of the text when the queue
59629 display is updated.
59630 </para>
59631 </section>
59632 <section id="SECID269">
59633 <title>The queue menu</title>
59634 <para>
59635 <indexterm role="concept">
59636 <primary>queue</primary>
59637 <secondary>menu in monitor</secondary>
59638 </indexterm>
59639 If the <option>shift</option> key is held down and the left button is clicked when the mouse
59640 pointer is over the text for any message, an action menu pops up, and the first
59641 line of the queue display for the message is highlighted. This does not affect
59642 any selected text.
59643 </para>
59644 <para>
59645 If you want to use some other event for popping up the menu, you can set the
59646 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
59647 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
59648 value set in this parameter is a standard X event description. For example, to
59649 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
59650 </para>
59651 <literallayout class="monospaced">
59652 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
59653 </literallayout>
59654 <para>
59655 The title of the menu is the message id, and it contains entries which act as
59656 follows:
59657 </para>
59658 <itemizedlist>
59659 <listitem>
59660 <para>
59661 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
59662 in a new text window.
59663 </para>
59664 </listitem>
59665 <listitem>
59666 <para>
59667 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
59668 information and headers is displayed in a new text window. See chapter
59669 <xref linkend="CHAPspool"/> for a description of the format of spool files.
59670 </para>
59671 </listitem>
59672 <listitem>
59673 <para>
59674 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
59675 displayed in a new text window. There is a default limit of 20,000 bytes to the
59676 amount of data displayed. This can be changed by setting the BODY_MAX
59677 option at compile time, or the EXIMON_BODY_MAX option at run time.
59678 </para>
59679 </listitem>
59680 <listitem>
59681 <para>
59682 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
59683 delivery of the message. This causes an automatic thaw if the message is
59684 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
59685 a new text window. The delivery is run in a separate process, to avoid holding
59686 up the monitor while the delivery proceeds.
59687 </para>
59688 </listitem>
59689 <listitem>
59690 <para>
59691 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
59692 that the message be frozen.
59693 </para>
59694 </listitem>
59695 <listitem>
59696 <para>
59697 <indexterm role="concept">
59698 <primary>thawing messages</primary>
59699 </indexterm>
59700 <indexterm role="concept">
59701 <primary>unfreezing messages</primary>
59702 </indexterm>
59703 <indexterm role="concept">
59704 <primary>frozen messages</primary>
59705 <secondary>thawing</secondary>
59706 </indexterm>
59707 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
59708 that the message be thawed.
59709 </para>
59710 </listitem>
59711 <listitem>
59712 <para>
59713 <indexterm role="concept">
59714 <primary>delivery</primary>
59715 <secondary>forcing failure</secondary>
59716 </indexterm>
59717 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
59718 that Exim gives up trying to deliver the message. A bounce message is generated
59719 for any remaining undelivered addresses.
59720 </para>
59721 </listitem>
59722 <listitem>
59723 <para>
59724 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
59725 that the message be deleted from the system without generating a bounce
59726 message.
59727 </para>
59728 </listitem>
59729 <listitem>
59730 <para>
59731 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
59732 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
59733 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
59734 Otherwise it must be entered as a fully qualified address. Pressing RETURN
59735 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
59736 additional recipient be added to the message, unless the entry box is empty, in
59737 which case no action is taken.
59738 </para>
59739 </listitem>
59740 <listitem>
59741 <para>
59742 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
59743 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
59744 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
59745 Otherwise it must be entered as a fully qualified address. Pressing RETURN
59746 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
59747 recipient address as already delivered, unless the entry box is empty, in which
59748 case no action is taken.
59749 </para>
59750 </listitem>
59751 <listitem>
59752 <para>
59753 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
59754 mark all recipient addresses as already delivered.
59755 </para>
59756 </listitem>
59757 <listitem>
59758 <para>
59759 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
59760 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
59761 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
59762 in which case no action is taken. If you want to set an empty sender (as in
59763 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
59764 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
59765 the address is qualified with that domain.
59766 </para>
59767 </listitem>
59768 </itemizedlist>
59769 <para>
59770 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
59771 other cases when a call to Exim is made, if there is any output from Exim (in
59772 particular, if the command fails) a window containing the command and the
59773 output is displayed. Otherwise, the results of the action are normally apparent
59774 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
59775 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
59776 if no output is generated.
59777 </para>
59778 <para>
59779 The queue display is automatically updated for actions such as freezing and
59780 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
59781 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
59782 force an update of the display after one of these actions.
59783 </para>
59784 <para>
59785 In any text window that is displayed as result of a menu action, the normal
59786 cut-and-paste facility is available, and searching can be carried out using ^R
59787 and ^S, as described above for the log tail window.
59788 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
59789 </para>
59790 </section>
59791 </chapter>
59792
59793 <chapter id="CHAPsecurity">
59794 <title>Security considerations</title>
59795 <para>
59796 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
59797 <primary>security</primary>
59798 <secondary>discussion of</secondary>
59799 </indexterm>
59800 This chapter discusses a number of issues concerned with security, some of
59801 which are also covered in other parts of this manual.
59802 </para>
59803 <para>
59804 For reasons that this author does not understand, some people have promoted
59805 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
59806 existence of this chapter in the documentation. However, the intent of the
59807 chapter is simply to describe the way Exim works in relation to certain
59808 security concerns, not to make any specific claims about the effectiveness of
59809 its security as compared with other MTAs.
59810 </para>
59811 <para>
59812 What follows is a description of the way Exim is supposed to be. Best efforts
59813 have been made to try to ensure that the code agrees with the theory, but an
59814 absence of bugs can never be guaranteed. Any that are reported will get fixed
59815 as soon as possible.
59816 </para>
59817 <section id="SECID286">
59818 <title>Building a more <quote>hardened</quote> Exim</title>
59819 <para>
59820 <indexterm role="concept">
59821 <primary>security</primary>
59822 <secondary>build-time features</secondary>
59823 </indexterm>
59824 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
59825 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
59826 Exim administrator who does not have the root password, or by someone who has
59827 penetrated the Exim (but not the root) account. These options are as follows:
59828 </para>
59829 <itemizedlist>
59830 <listitem>
59831 <para>
59832 ALT_CONFIG_PREFIX can be set to a string that is required to match the
59833 start of any file names used with the <option>-C</option> option. When it is set, these file
59834 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
59835 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
59836 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
59837 default setting for <option>ALT_CONFIG_PREFIX</option>.
59838 </para>
59839 <para>
59840 If the permitted configuration files are confined to a directory to
59841 which only root has access, this guards against someone who has broken
59842 into the Exim account from running a privileged Exim with an arbitrary
59843 configuration file, and using it to break into other accounts.
59844 </para>
59845 </listitem>
59846 <listitem>
59847 <para>
59848 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
59849 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
59850 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
59851 the possibility of testing a configuration using <option>-C</option> right through message
59852 reception and delivery, even if the caller is root. The reception works, but by
59853 that time, Exim is running as the Exim user, so when it re-execs to regain
59854 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
59855 However, root can test reception and delivery using two separate commands.
59856 ALT_CONFIG_ROOT_ONLY is not set by default.
59857 </para>
59858 </listitem>
59859 <listitem>
59860 <para>
59861 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
59862 is disabled.
59863 </para>
59864 </listitem>
59865 <listitem>
59866 <para>
59867 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
59868 never to be used for any deliveries. This is like the <option>never_users</option> runtime
59869 option, but it cannot be overridden; the runtime option adds additional users
59870 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
59871 is permitted to modify the runtime file from using Exim as a way to get root.
59872 </para>
59873 </listitem>
59874 </itemizedlist>
59875 </section>
59876 <section id="SECID270">
59877 <title>Root privilege</title>
59878 <para>
59879 <indexterm role="concept">
59880 <primary>setuid</primary>
59881 </indexterm>
59882 <indexterm role="concept">
59883 <primary>root privilege</primary>
59884 </indexterm>
59885 The Exim binary is normally setuid to root, which means that it gains root
59886 privilege (runs as root) when it starts execution. In some special cases (for
59887 example, when the daemon is not in use and there are no local deliveries), it
59888 may be possible to run Exim setuid to some user other than root. This is
59889 discussed in the next section. However, in most installations, root privilege
59890 is required for two things:
59891 </para>
59892 <itemizedlist>
59893 <listitem>
59894 <para>
59895 To set up a socket connected to the standard SMTP port (25) when initialising
59896 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
59897 not required.
59898 </para>
59899 </listitem>
59900 <listitem>
59901 <para>
59902 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
59903 perform local deliveries as the receiving user or as specified in the
59904 configuration.
59905 </para>
59906 </listitem>
59907 </itemizedlist>
59908 <para>
59909 It is not necessary to be root to do any of the other things Exim does, such as
59910 receiving messages and delivering them externally over SMTP, and it is
59911 obviously more secure if Exim does not run as root except when necessary.
59912 For this reason, a user and group for Exim to use must be defined in
59913 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
59914 group</quote>. Their values can be changed by the run time configuration, though this
59915 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
59916 <emphasis>mail</emphasis> or another user name altogether.
59917 </para>
59918 <para>
59919 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
59920 abdication; the process cannot regain root afterwards. Prior to release 4.00,
59921 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
59922 </para>
59923 <para>
59924 After a new Exim process has interpreted its command line options, it changes
59925 uid and gid in the following cases:
59926 </para>
59927 <itemizedlist>
59928 <listitem>
59929 <para>
59930 <indexterm role="option">
59931 <primary><option>-C</option></primary>
59932 </indexterm>
59933 <indexterm role="option">
59934 <primary><option>-D</option></primary>
59935 </indexterm>
59936 If the <option>-C</option> option is used to specify an alternate configuration file, or if
59937 the <option>-D</option> option is used to define macro values for the configuration, and the
59938 calling process is not running as root or the Exim user, the uid and gid are
59939 changed to those of the calling process.
59940 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
59941 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
59942 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
59943 </para>
59944 </listitem>
59945 <listitem>
59946 <para>
59947 <indexterm role="option">
59948 <primary><option>-be</option></primary>
59949 </indexterm>
59950 <indexterm role="option">
59951 <primary><option>-bf</option></primary>
59952 </indexterm>
59953 <indexterm role="option">
59954 <primary><option>-bF</option></primary>
59955 </indexterm>
59956 If the expansion test option (<option>-be</option>) or one of the filter testing options
59957 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
59958 calling process.
59959 </para>
59960 </listitem>
59961 <listitem>
59962 <para>
59963 If the process is not a daemon process or a queue runner process or a delivery
59964 process or a process for testing address routing (started with <option>-bt</option>), the
59965 uid and gid are changed to the Exim user and group. This means that Exim always
59966 runs under its own uid and gid when receiving messages. This also applies when
59967 testing address verification
59968 <indexterm role="option">
59969 <primary><option>-bv</option></primary>
59970 </indexterm>
59971 <indexterm role="option">
59972 <primary><option>-bh</option></primary>
59973 </indexterm>
59974 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
59975 option).
59976 </para>
59977 </listitem>
59978 <listitem>
59979 <para>
59980 For a daemon, queue runner, delivery, or address testing process, the uid
59981 remains as root at this stage, but the gid is changed to the Exim group.
59982 </para>
59983 </listitem>
59984 </itemizedlist>
59985 <para>
59986 The processes that initially retain root privilege behave as follows:
59987 </para>
59988 <itemizedlist>
59989 <listitem>
59990 <para>
59991 A daemon process changes the gid to the Exim group and the uid to the Exim
59992 user after setting up one or more listening sockets. The <function>initgroups()</function>
59993 function is called, so that if the Exim user is in any additional groups, they
59994 will be used during message reception.
59995 </para>
59996 </listitem>
59997 <listitem>
59998 <para>
59999 A queue runner process retains root privilege throughout its execution. Its
60000 job is to fork a controlled sequence of delivery processes.
60001 </para>
60002 </listitem>
60003 <listitem>
60004 <para>
60005 A delivery process retains root privilege throughout most of its execution,
60006 but any actual deliveries (that is, the transports themselves) are run in
60007 subprocesses which always change to a non-root uid and gid. For local
60008 deliveries this is typically the uid and gid of the owner of the mailbox; for
60009 remote deliveries, the Exim uid and gid are used. Once all the delivery
60010 subprocesses have been run, a delivery process changes to the Exim uid and gid
60011 while doing post-delivery tidying up such as updating the retry database and
60012 generating bounce and warning messages.
60013 </para>
60014 <para>
60015 While the recipient addresses in a message are being routed, the delivery
60016 process runs as root. However, if a user&#x2019;s filter file has to be processed,
60017 this is done in a subprocess that runs under the individual user&#x2019;s uid and
60018 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
60019 </para>
60020 </listitem>
60021 <listitem>
60022 <para>
60023 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
60024 the routing is done in the same environment as a message delivery.
60025 </para>
60026 </listitem>
60027 </itemizedlist>
60028 </section>
60029 <section id="SECTrunexiwitpri">
60030 <title>Running Exim without privilege</title>
60031 <para>
60032 <indexterm role="concept">
60033 <primary>privilege, running without</primary>
60034 </indexterm>
60035 <indexterm role="concept">
60036 <primary>unprivileged running</primary>
60037 </indexterm>
60038 <indexterm role="concept">
60039 <primary>root privilege</primary>
60040 <secondary>running without</secondary>
60041 </indexterm>
60042 Some installations like to run Exim in an unprivileged state for more of its
60043 operation, for added security. Support for this mode of operation is provided
60044 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
60045 gid are changed to the Exim user and group at the start of a delivery process
60046 (and also queue runner and address testing processes). This means that address
60047 routing is no longer run as root, and the deliveries themselves cannot change
60048 to any other uid.
60049 </para>
60050 <para>
60051 <indexterm role="concept">
60052 <primary>SIGHUP</primary>
60053 </indexterm>
60054 <indexterm role="concept">
60055 <primary>daemon</primary>
60056 <secondary>restarting</secondary>
60057 </indexterm>
60058 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
60059 that the daemon can still be started in the usual way, and it can respond
60060 correctly to SIGHUP because the re-invocation regains root privilege.
60061 </para>
60062 <para>
60063 An alternative approach is to make Exim setuid to the Exim user and also setgid
60064 to the Exim group. If you do this, the daemon must be started from a root
60065 process. (Calling Exim from a root process makes it behave in the way it does
60066 when it is setuid root.) However, the daemon cannot restart itself after a
60067 SIGHUP signal because it cannot regain privilege.
60068 </para>
60069 <para>
60070 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
60071 stops Exim from trying to re-invoke itself to do a delivery after a message has
60072 been received. Such a re-invocation is a waste of resources because it has no
60073 effect.
60074 </para>
60075 <para>
60076 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
60077 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
60078 to the Exim user seems a clean approach, but there is one complication:
60079 </para>
60080 <para>
60081 In this style of operation, Exim is running with the real uid and gid set to
60082 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
60083 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
60084 that is, the real uid/gid should be reset to the effective values so as to
60085 discard any privileges that the caller may have. While some operating systems
60086 have a function that permits this action for a non-root effective uid, quite a
60087 number of them do not. Because of this lack of standardization, Exim does not
60088 address this problem at this time.
60089 </para>
60090 <para>
60091 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
60092 is to keep the Exim binary setuid to root, and to set
60093 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
60094 be used in the most straightforward way.
60095 </para>
60096 <para>
60097 If you configure Exim not to run delivery processes as root, there are a
60098 number of restrictions on what you can do:
60099 </para>
60100 <itemizedlist>
60101 <listitem>
60102 <para>
60103 You can deliver only as the Exim user/group. You should  explicitly use the
60104 <option>user</option> and <option>group</option> options to override routers or local transports that
60105 normally deliver as the recipient. This makes sure that configurations that
60106 work in this mode function the same way in normal mode. Any implicit or
60107 explicit specification of another user causes an error.
60108 </para>
60109 </listitem>
60110 <listitem>
60111 <para>
60112 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
60113 not worthwhile to include them in the configuration.
60114 </para>
60115 </listitem>
60116 <listitem>
60117 <para>
60118 Users who wish to use <filename>.forward</filename> would have to make their home directory and
60119 the file itself accessible to the Exim user. Pipe and append-to-file entries,
60120 and their equivalents in Exim filters, cannot be used. While they could be
60121 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
60122 </para>
60123 </listitem>
60124 <listitem>
60125 <para>
60126 Unless the local user mailboxes are all owned by the Exim user (possible in
60127 some POP3 or IMAP-only environments):
60128 </para>
60129 <orderedlist numeration="arabic">
60130 <listitem>
60131 <para>
60132 They must be owned by the Exim group and be writeable by that group. This
60133 implies you must set <option>mode</option> in the appendfile configuration, as well as the
60134 mode of the mailbox files themselves.
60135 </para>
60136 </listitem>
60137 <listitem>
60138 <para>
60139 You must set <option>no_check_owner</option>, since most or all of the files will not be
60140 owned by the Exim user.
60141 </para>
60142 </listitem>
60143 <listitem>
60144 <para>
60145 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
60146 on a newly created mailbox when unprivileged. This also implies that new
60147 mailboxes need to be created manually.
60148 </para>
60149 </listitem>
60150 </orderedlist>
60151 </listitem>
60152 </itemizedlist>
60153 <para>
60154 These restrictions severely restrict what can be done in local deliveries.
60155 However, there are no restrictions on remote deliveries. If you are running a
60156 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
60157 gives more security at essentially no cost.
60158 </para>
60159 <para>
60160 If you are using the <option>mua_wrapper</option> facility (see chapter
60161 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
60162 </para>
60163 </section>
60164 <section id="SECID271">
60165 <title>Delivering to local files</title>
60166 <para>
60167 Full details of the checks applied by <command>appendfile</command> before it writes to a file
60168 are given in chapter <xref linkend="CHAPappendfile"/>.
60169 </para>
60170 </section>
60171 <section id="SECID272">
60172 <title>IPv4 source routing</title>
60173 <para>
60174 <indexterm role="concept">
60175 <primary>source routing</primary>
60176 <secondary>in IP packets</secondary>
60177 </indexterm>
60178 <indexterm role="concept">
60179 <primary>IP source routing</primary>
60180 </indexterm>
60181 Many operating systems suppress IP source-routed packets in the kernel, but
60182 some cannot be made to do this, so Exim does its own check. It logs incoming
60183 IPv4 source-routed TCP calls, and then drops them. Things are all different in
60184 IPv6. No special checking is currently done.
60185 </para>
60186 </section>
60187 <section id="SECID273">
60188 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
60189 <para>
60190 Support for these SMTP commands is disabled by default. If required, they can
60191 be enabled by defining suitable ACLs.
60192 </para>
60193 </section>
60194 <section id="SECID274">
60195 <title>Privileged users</title>
60196 <para>
60197 <indexterm role="concept">
60198 <primary>trusted users</primary>
60199 </indexterm>
60200 <indexterm role="concept">
60201 <primary>admin user</primary>
60202 </indexterm>
60203 <indexterm role="concept">
60204 <primary>privileged user</primary>
60205 </indexterm>
60206 <indexterm role="concept">
60207 <primary>user</primary>
60208 <secondary>trusted</secondary>
60209 </indexterm>
60210 <indexterm role="concept">
60211 <primary>user</primary>
60212 <secondary>admin</secondary>
60213 </indexterm>
60214 Exim recognizes two sets of users with special privileges. Trusted users are
60215 able to submit new messages to Exim locally, but supply their own sender
60216 addresses and information about a sending host. For other users submitting
60217 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
60218 permit a remote host to be specified.
60219 </para>
60220 <para>
60221 <indexterm role="option">
60222 <primary><option>-f</option></primary>
60223 </indexterm>
60224 However, an untrusted user is permitted to use the <option>-f</option> command line option
60225 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
60226 message should not cause an error report. This affects the message&#x2019;s envelope,
60227 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
60228 permitted to use specific forms of address with the <option>-f</option> option by setting
60229 the <option>untrusted_set_sender</option> option.
60230 </para>
60231 <para>
60232 Trusted users are used to run processes that receive mail messages from some
60233 other mail domain and pass them on to Exim for delivery either locally, or over
60234 the Internet. Exim trusts a caller that is running as root, as the Exim user,
60235 as any user listed in the <option>trusted_users</option> configuration option, or under any
60236 group listed in the <option>trusted_groups</option> option.
60237 </para>
60238 <para>
60239 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
60240 can freeze or thaw messages, cause them to be returned to their senders, remove
60241 them entirely, or modify them in various ways. In addition, admin users can run
60242 the Exim monitor and see all the information it is capable of providing, which
60243 includes the contents of files on the spool.
60244 </para>
60245 <para>
60246 <indexterm role="option">
60247 <primary><option>-M</option></primary>
60248 </indexterm>
60249 <indexterm role="option">
60250 <primary><option>-q</option></primary>
60251 </indexterm>
60252 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
60253 delivery of messages on its queue is restricted to admin users. This
60254 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
60255 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
60256 queue is also restricted to admin users. This restriction can be relaxed by
60257 setting <option>no_queue_list_requires_admin</option>.
60258 </para>
60259 <para>
60260 Exim recognizes an admin user if the calling process is running as root or as
60261 the Exim user or if any of the groups associated with the calling process is
60262 the Exim group. It is not necessary actually to be running under the Exim
60263 group. However, if admin users who are not root or the Exim user are to access
60264 the contents of files on the spool via the Exim monitor (which runs
60265 unprivileged), Exim must be built to allow group read access to its spool
60266 files.
60267 </para>
60268 </section>
60269 <section id="SECID275">
60270 <title>Spool files</title>
60271 <para>
60272 <indexterm role="concept">
60273 <primary>spool directory</primary>
60274 <secondary>files</secondary>
60275 </indexterm>
60276 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
60277 set to the Exim group. The mode for spool files is defined in the
60278 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
60279 any user who is a member of the Exim group can access these files.
60280 </para>
60281 </section>
60282 <section id="SECID276">
60283 <title>Use of argv[0]</title>
60284 <para>
60285 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
60286 of specific strings, Exim assumes certain options. For example, calling Exim
60287 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
60288 to calling it with the option <option>-bS</option>. There are no security implications in
60289 this.
60290 </para>
60291 </section>
60292 <section id="SECID277">
60293 <title>Use of %f formatting</title>
60294 <para>
60295 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
60296 are actually stored in integer variables as 1000 times the load average.
60297 Consequently, their range is limited and so therefore is the length of the
60298 converted output.
60299 </para>
60300 </section>
60301 <section id="SECID278">
60302 <title>Embedded Exim path</title>
60303 <para>
60304 Exim uses its own path name, which is embedded in the code, only when it needs
60305 to re-exec in order to regain root privilege. Therefore, it is not root when it
60306 does so. If some bug allowed the path to get overwritten, it would lead to an
60307 arbitrary program&#x2019;s being run as exim, not as root.
60308 </para>
60309 </section>
60310 <section id="SECID279">
60311 <title>Use of sprintf()</title>
60312 <para>
60313 <indexterm role="concept">
60314 <primary><function>sprintf()</function></primary>
60315 </indexterm>
60316 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
60317 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
60318 The intermediate formatting is done into a large fixed buffer by a function
60319 that runs through the format string itself, and checks the length of each
60320 conversion before performing it, thus preventing buffer overruns.
60321 </para>
60322 <para>
60323 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
60324 the output buffer is known to be sufficiently long to contain the converted
60325 string.
60326 </para>
60327 </section>
60328 <section id="SECID280">
60329 <title>Use of debug_printf() and log_write()</title>
60330 <para>
60331 Arbitrary strings are passed to both these functions, but they do their
60332 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
60333 the format string itself, and checks the length of each conversion.
60334 </para>
60335 </section>
60336 <section id="SECID281">
60337 <title>Use of strcat() and strcpy()</title>
60338 <para>
60339 These are used only in cases where the output buffer is known to be large
60340 enough to hold the result.
60341 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
60342 </para>
60343 </section>
60344 </chapter>
60345
60346 <chapter id="CHAPspool">
60347 <title>Format of spool files</title>
60348 <para>
60349 <indexterm role="concept" id="IIDforspo1" class="startofrange">
60350 <primary>format</primary>
60351 <secondary>spool files</secondary>
60352 </indexterm>
60353 <indexterm role="concept" id="IIDforspo2" class="startofrange">
60354 <primary>spool directory</primary>
60355 <secondary>format of files</secondary>
60356 </indexterm>
60357 <indexterm role="concept" id="IIDforspo3" class="startofrange">
60358 <primary>spool files</primary>
60359 <secondary>format of</secondary>
60360 </indexterm>
60361 <indexterm role="concept">
60362 <primary>spool files</primary>
60363 <secondary>editing</secondary>
60364 </indexterm>
60365 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
60366 followed by -D and -H, respectively. The data portion of the message is kept in
60367 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
60368 kept in the -H file, whose format is described in this chapter. Each of these
60369 two files contains the final component of its own name as its first line. This
60370 is insurance against disk crashes where the directory is lost but the files
60371 themselves are recoverable.
60372 </para>
60373 <para>
60374 Some people are tempted into editing -D files in order to modify messages. You
60375 need to be extremely careful if you do this; it is not recommended and you are
60376 on your own if you do it. Here are some of the pitfalls:
60377 </para>
60378 <itemizedlist>
60379 <listitem>
60380 <para>
60381 You must ensure that Exim does not try to deliver the message while you are
60382 fiddling with it. The safest way is to take out a write lock on the -D file,
60383 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
60384 place, the lock will be retained. If you write a new file and rename it, the
60385 lock will be lost at the instant of rename.
60386 </para>
60387 </listitem>
60388 <listitem>
60389 <para>
60390 <indexterm role="variable">
60391 <primary><varname>$body_linecount</varname></primary>
60392 </indexterm>
60393 If you change the number of lines in the file, the value of
60394 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
60395 present, this value is not used by Exim, but there is no guarantee that this
60396 will always be the case.
60397 </para>
60398 </listitem>
60399 <listitem>
60400 <para>
60401 If the message is in MIME format, you must take care not to break it.
60402 </para>
60403 </listitem>
60404 <listitem>
60405 <para>
60406 If the message is cryptographically signed, any change will invalidate the
60407 signature.
60408 </para>
60409 </listitem>
60410 </itemizedlist>
60411 <para revisionflag="changed">
60412 All in all, modifying -D files is fraught with danger.
60413 </para>
60414 <para revisionflag="changed">
60415 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
60416 its subdirectories when <option>split_spool_directory</option> is set). These are journal
60417 files, used to record addresses to which the message has been delivered during
60418 the course of a delivery attempt. If there are still undelivered recipients at
60419 the end, the -H file is updated, and the -J file is deleted. If, however, there
60420 is some kind of crash (for example, a power outage) before this happens, the -J
60421 file remains in existence. When Exim next processes the message, it notices the
60422 -J file and uses it to update the -H file before starting the next delivery
60423 attempt.
60424 </para>
60425 <section id="SECID282">
60426 <title>Format of the -H file</title>
60427 <para>
60428 <indexterm role="concept">
60429 <primary>uid (user id)</primary>
60430 <secondary>in spool file</secondary>
60431 </indexterm>
60432 <indexterm role="concept">
60433 <primary>gid (group id)</primary>
60434 <secondary>in spool file</secondary>
60435 </indexterm>
60436 The second line of the -H file contains the login name for the uid of the
60437 process that called Exim to read the message, followed by the numerical uid and
60438 gid. For a locally generated message, this is normally the user who sent the
60439 message. For a message received over TCP/IP <phrase revisionflag="changed">via the daemon</phrase>, it is
60440 normally the Exim user.
60441 </para>
60442 <para>
60443 The third line of the file contains the address of the message&#x2019;s sender as
60444 transmitted in the envelope, contained in angle brackets. The sender address is
60445 empty for bounce messages. For incoming SMTP mail, the sender address is given
60446 in the MAIL command. For locally generated mail, the sender address is
60447 created by Exim from the login name of the current user and the configured
60448 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
60449 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
60450 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
60451 </para>
60452 <para>
60453 The fourth line contains two numbers. The first is the time that the message
60454 was received, in the conventional Unix form &ndash; the number of seconds since the
60455 start of the epoch. The second number is a count of the number of messages
60456 warning of delayed delivery that have been sent to the sender.
60457 </para>
60458 <para>
60459 There follow a number of lines starting with a hyphen. These can appear in any
60460 order, and are omitted when not relevant:
60461 </para>
60462 <variablelist>
60463 <varlistentry>
60464 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
60465 <listitem>
60466 <para>
60467 This item is obsolete, and is not generated from Exim release 4.61 onwards;
60468 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
60469 recognized, to provide backward compatibility. In the old format, a line of
60470 this form is present for every ACL variable that is not empty. The number
60471 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
60472 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
60473 the data string for the variable. The string itself starts at the beginning of
60474 the next line, and is followed by a newline character. It may contain internal
60475 newlines.
60476 </para>
60477 </listitem></varlistentry>
60478 <varlistentry>
60479 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
60480 <listitem>
60481 <para>
60482 A line of this form is present for every ACL connection variable that is
60483 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
60484 The length is the length of the data string for the variable. The string itself
60485 starts at the beginning of the next line, and is followed by a newline
60486 character. It may contain internal newlines.
60487 </para>
60488 </listitem></varlistentry>
60489 <varlistentry>
60490 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
60491 <listitem>
60492 <para>
60493 A line of this form is present for every ACL message variable that is defined.
60494 Note that there is a space between <option>-aclm</option> and the rest of the name. The
60495 length is the length of the data string for the variable. The string itself
60496 starts at the beginning of the next line, and is followed by a newline
60497 character. It may contain internal newlines.
60498 </para>
60499 </listitem></varlistentry>
60500 <varlistentry>
60501 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
60502 <listitem>
60503 <para>
60504 This is present if, when the message was received over SMTP, the value of
60505 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
60506 </para>
60507 </listitem></varlistentry>
60508 <varlistentry>
60509 <term><option>-allow_unqualified_recipient</option></term>
60510 <listitem>
60511 <para>
60512 This is present if unqualified recipient addresses are permitted in header
60513 lines (to stop such addresses from being qualified if rewriting occurs at
60514 transport time). Local messages that were input using <option>-bnq</option> and remote
60515 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
60516 </para>
60517 </listitem></varlistentry>
60518 <varlistentry>
60519 <term><option>-allow_unqualified_sender</option></term>
60520 <listitem>
60521 <para>
60522 This is present if unqualified sender addresses are permitted in header lines
60523 (to stop such addresses from being qualified if rewriting occurs at transport
60524 time). Local messages that were input using <option>-bnq</option> and remote messages from
60525 hosts that match <option>sender_unqualified_hosts</option> set this flag.
60526 </para>
60527 </listitem></varlistentry>
60528 <varlistentry>
60529 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60530 <listitem>
60531 <para>
60532 The id information for a message received on an authenticated SMTP connection
60533 &ndash; the value of the <varname>$authenticated_id</varname> variable.
60534 </para>
60535 </listitem></varlistentry>
60536 <varlistentry>
60537 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
60538 <listitem>
60539 <para>
60540 The address of an authenticated sender &ndash; the value of the
60541 <varname>$authenticated_sender</varname> variable.
60542 </para>
60543 </listitem></varlistentry>
60544 <varlistentry>
60545 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
60546 <listitem>
60547 <para>
60548 This records the number of lines in the body of the message, and is always
60549 present.
60550 </para>
60551 </listitem></varlistentry>
60552 <varlistentry>
60553 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
60554 <listitem>
60555 <para>
60556 This records the number of binary zero bytes in the body of the message, and is
60557 present if the number is greater than zero.
60558 </para>
60559 </listitem></varlistentry>
60560 <varlistentry>
60561 <term><option>-deliver_firsttime</option></term>
60562 <listitem>
60563 <para>
60564 This is written when a new message is first added to the spool. When the spool
60565 file is updated after a deferral, it is omitted.
60566 </para>
60567 </listitem></varlistentry>
60568 <varlistentry>
60569 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
60570 <listitem>
60571 <para>
60572 <indexterm role="concept">
60573 <primary>frozen messages</primary>
60574 <secondary>spool data</secondary>
60575 </indexterm>
60576 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
60577 </para>
60578 </listitem></varlistentry>
60579 <varlistentry>
60580 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60581 <listitem>
60582 <para>
60583 This records the host name as specified by a remote host in a HELO or EHLO
60584 command.
60585 </para>
60586 </listitem></varlistentry>
60587 <varlistentry>
60588 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
60589 <listitem>
60590 <para>
60591 This records the IP address of the host from which the message was received and
60592 the remote port number that was used. It is omitted for locally generated
60593 messages.
60594 </para>
60595 </listitem></varlistentry>
60596 <varlistentry>
60597 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60598 <listitem>
60599 <para>
60600 If the message was received on an authenticated SMTP connection, this records
60601 the name of the authenticator &ndash; the value of the
60602 <varname>$sender_host_authenticated</varname> variable.
60603 </para>
60604 </listitem></varlistentry>
60605 <varlistentry>
60606 <term><option>-host_lookup_failed</option></term>
60607 <listitem>
60608 <para>
60609 This is present if an attempt to look up the sending host&#x2019;s name from its IP
60610 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
60611 </para>
60612 </listitem></varlistentry>
60613 <varlistentry>
60614 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60615 <listitem>
60616 <para>
60617 <indexterm role="concept">
60618 <primary>reverse DNS lookup</primary>
60619 </indexterm>
60620 <indexterm role="concept">
60621 <primary>DNS</primary>
60622 <secondary>reverse lookup</secondary>
60623 </indexterm>
60624 This records the name of the remote host from which the message was received,
60625 if the host name was looked up from the IP address when the message was being
60626 received. It is not present if no reverse lookup was done.
60627 </para>
60628 </listitem></varlistentry>
60629 <varlistentry>
60630 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60631 <listitem>
60632 <para>
60633 For locally submitted messages, this records the login of the originating user,
60634 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
60635 ident value. For messages received over TCP/IP, this records the ident string
60636 supplied by the remote host, if any.
60637 </para>
60638 </listitem></varlistentry>
60639 <varlistentry>
60640 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
60641 <listitem>
60642 <para>
60643 This records the IP address of the local interface and the port number through
60644 which a message was received from a remote host. It is omitted for locally
60645 generated messages.
60646 </para>
60647 </listitem></varlistentry>
60648 <varlistentry>
60649 <term><option>-local</option></term>
60650 <listitem>
60651 <para>
60652 The message is from a local sender.
60653 </para>
60654 </listitem></varlistentry>
60655 <varlistentry>
60656 <term><option>-localerror</option></term>
60657 <listitem>
60658 <para>
60659 The message is a locally-generated bounce message.
60660 </para>
60661 </listitem></varlistentry>
60662 <varlistentry>
60663 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
60664 <listitem>
60665 <para>
60666 This records the data string that was returned by the <function>local_scan()</function> function
60667 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
60668 variable. It is omitted if no data was returned.
60669 </para>
60670 </listitem></varlistentry>
60671 <varlistentry>
60672 <term><option>-manual_thaw</option></term>
60673 <listitem>
60674 <para>
60675 The message was frozen but has been thawed manually, that is, by an explicit
60676 Exim command rather than via the auto-thaw process.
60677 </para>
60678 </listitem></varlistentry>
60679 <varlistentry>
60680 <term><option>-N</option></term>
60681 <listitem>
60682 <para>
60683 A testing delivery process was started using the <option>-N</option> option to suppress any
60684 actual deliveries, but delivery was deferred. At any further delivery attempts,
60685 <option>-N</option> is assumed.
60686 </para>
60687 </listitem></varlistentry>
60688 <varlistentry>
60689 <term><option>-received_protocol</option></term>
60690 <listitem>
60691 <para>
60692 This records the value of the <varname>$received_protocol</varname> variable, which contains
60693 the name of the protocol by which the message was received.
60694 </para>
60695 </listitem></varlistentry>
60696 <varlistentry>
60697 <term><option>-sender_set_untrusted</option></term>
60698 <listitem>
60699 <para>
60700 The envelope sender of this message was set by an untrusted local caller (used
60701 to ensure that the caller is displayed in queue listings).
60702 </para>
60703 </listitem></varlistentry>
60704 <varlistentry>
60705 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
60706 <listitem>
60707 <para>
60708 If a message was scanned by SpamAssassin, this is present. It records the value
60709 of <varname>$spam_score_int</varname>.
60710 </para>
60711 </listitem></varlistentry>
60712 <varlistentry>
60713 <term><option>-tls_certificate_verified</option></term>
60714 <listitem>
60715 <para>
60716 A TLS certificate was received from the client that sent this message, and the
60717 certificate was verified by the server.
60718 </para>
60719 </listitem></varlistentry>
60720 <varlistentry>
60721 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
60722 <listitem>
60723 <para>
60724 When the message was received over an encrypted connection, this records the
60725 name of the cipher suite that was used.
60726 </para>
60727 </listitem></varlistentry>
60728 <varlistentry>
60729 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
60730 <listitem>
60731 <para>
60732 When the message was received over an encrypted connection, and a certificate
60733 was received from the client, this records the Distinguished Name from that
60734 certificate.
60735 </para>
60736 </listitem></varlistentry>
60737 </variablelist>
60738 <para>
60739 Following the options there is a list of those addresses to which the message
60740 is not to be delivered. This set of addresses is initialized from the command
60741 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
60742 is set; otherwise it starts out empty. Whenever a successful delivery is made,
60743 the address is added to this set. The addresses are kept internally as a
60744 balanced binary tree, and it is a representation of that tree which is written
60745 to the spool file. If an address is expanded via an alias or forward file, the
60746 original address is added to the tree when deliveries to all its child
60747 addresses are complete.
60748 </para>
60749 <para>
60750 If the tree is empty, there is a single line in the spool file containing just
60751 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
60752 Y or N, followed by an address. The address is the value for the node of the
60753 tree, and the letters indicate whether the node has a left branch and/or a
60754 right branch attached to it, respectively. If branches exist, they immediately
60755 follow. Here is an example of a three-node tree:
60756 </para>
60757 <literallayout class="monospaced">
60758 YY darcy@austen.fict.example
60759 NN alice@wonderland.fict.example
60760 NN editor@thesaurus.ref.example
60761 </literallayout>
60762 <para>
60763 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
60764 This is a simple list, preceded by a count. It includes all the original
60765 recipients of the message, including those to whom the message has already been
60766 delivered. In the simplest case, the list contains one address per line. For
60767 example:
60768 </para>
60769 <literallayout class="monospaced">
60770 4
60771 editor@thesaurus.ref.example
60772 darcy@austen.fict.example
60773 rdo@foundation
60774 alice@wonderland.fict.example
60775 </literallayout>
60776 <para>
60777 However, when a child address has been added to the top-level addresses as a
60778 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
60779 line is of the following form:
60780 </para>
60781 <literallayout>
60782 &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;
60783 </literallayout>
60784 <para>
60785 The 01 flag bit indicates the presence of the three other fields that follow
60786 the top-level address. Other bits may be used in future to support additional
60787 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
60788 original parent of the <quote>one time</quote> address. The first two fields are the
60789 envelope sender that is associated with this address and its length. If the
60790 length is zero, there is no special envelope sender (there are then two space
60791 characters in the line). A non-empty field can arise from a <command>redirect</command> router
60792 that has an <option>errors_to</option> setting.
60793 </para>
60794 <para>
60795 A blank line separates the envelope and status information from the headers
60796 which follow. A header may occupy several lines of the file, and to save effort
60797 when reading it in, each header is preceded by a number and an identifying
60798 character. The number is the number of characters in the header, including any
60799 embedded newlines and the terminating newline. The character is one of the
60800 following:
60801 </para>
60802 <informaltable frame="none">
60803 <tgroup cols="2" colsep="0" rowsep="0">
60804 <colspec colwidth="50pt" align="left"/>
60805 <colspec colwidth="254pt" align="left"/>
60806 <tbody>
60807 <row>
60808 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
60809 <entry>header in which Exim has no special interest</entry>
60810 </row>
60811 <row>
60812 <entry><literal>B</literal></entry>
60813 <entry><emphasis>Bcc:</emphasis> header</entry>
60814 </row>
60815 <row>
60816 <entry><literal>C</literal></entry>
60817 <entry><emphasis>Cc:</emphasis> header</entry>
60818 </row>
60819 <row>
60820 <entry><literal>F</literal></entry>
60821 <entry><emphasis>From:</emphasis> header</entry>
60822 </row>
60823 <row>
60824 <entry><literal>I</literal></entry>
60825 <entry><emphasis>Message-id:</emphasis> header</entry>
60826 </row>
60827 <row>
60828 <entry><literal>P</literal></entry>
60829 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
60830 </row>
60831 <row>
60832 <entry><literal>R</literal></entry>
60833 <entry><emphasis>Reply-To:</emphasis> header</entry>
60834 </row>
60835 <row>
60836 <entry><literal>S</literal></entry>
60837 <entry><emphasis>Sender:</emphasis> header</entry>
60838 </row>
60839 <row>
60840 <entry><literal>T</literal></entry>
60841 <entry><emphasis>To:</emphasis> header</entry>
60842 </row>
60843 <row>
60844 <entry><literal>*</literal></entry>
60845 <entry>replaced or deleted header</entry>
60846 </row>
60847 </tbody>
60848 </tgroup>
60849 </informaltable>
60850 <para>
60851 Deleted or replaced (rewritten) headers remain in the spool file for debugging
60852 purposes. They are not transmitted when the message is delivered. Here is a
60853 typical set of headers:
60854 </para>
60855 <literallayout class="monospaced">
60856 111P Received: by hobbit.fict.example with local (Exim 4.00)
60857 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
60858 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
60859 038* X-rewrote-sender: bb@hobbit.fict.example
60860 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
60861 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
60862 099* To: alice@wonderland.fict.example, rdo@foundation,
60863 darcy@austen.fict.example, editor@thesaurus.ref.example
60864 104T To: alice@wonderland.fict.example, rdo@foundation.example,
60865 darcy@austen.fict.example, editor@thesaurus.ref.example
60866 038  Date: Fri, 11 May 2001 10:28:59 +0100
60867 </literallayout>
60868 <para>
60869 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
60870 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
60871 unqualified domain <emphasis>foundation</emphasis>.
60872 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
60873 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
60874 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
60875 </para>
60876 </section>
60877 </chapter>
60878
60879 <chapter id="CHID12">
60880 <title>Adding new drivers or lookup types</title>
60881 <titleabbrev>Adding drivers or lookups</titleabbrev>
60882 <para>
60883 <indexterm role="concept">
60884 <primary>adding drivers</primary>
60885 </indexterm>
60886 <indexterm role="concept">
60887 <primary>new drivers, adding</primary>
60888 </indexterm>
60889 <indexterm role="concept">
60890 <primary>drivers</primary>
60891 <secondary>adding new</secondary>
60892 </indexterm>
60893 The following actions have to be taken in order to add a new router, transport,
60894 authenticator, or lookup type to Exim:
60895 </para>
60896 <orderedlist numeration="arabic">
60897 <listitem>
60898 <para>
60899 Choose a name for the driver or lookup type that does not conflict with any
60900 existing name; I will use <quote>newdriver</quote> in what follows.
60901 </para>
60902 </listitem>
60903 <listitem>
60904 <para>
60905 Add to <filename>src/EDITME</filename> the line:
60906 </para>
60907 <literallayout>
60908 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
60909 </literallayout>
60910 <para>
60911 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
60912 code is not to be included in the binary by default, comment this line out. You
60913 should also add any relevant comments about the driver or lookup type.
60914 </para>
60915 </listitem>
60916 <listitem>
60917 <para>
60918 Add to <filename>src/config.h.defaults</filename> the line:
60919 </para>
60920 <literallayout class="monospaced">
60921 #define &lt;type&gt;_NEWDRIVER
60922 </literallayout>
60923 </listitem>
60924 <listitem>
60925 <para>
60926 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
60927 and create a table entry as is done for all the other drivers and lookup types.
60928 </para>
60929 </listitem>
60930 <listitem>
60931 <para>
60932 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
60933 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
60934 driver or lookup type and add it to the definition of OBJ.
60935 </para>
60936 </listitem>
60937 <listitem>
60938 <para>
60939 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
60940 <filename>src</filename>.
60941 </para>
60942 </listitem>
60943 <listitem>
60944 <para>
60945 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
60946 as for other drivers and lookups.
60947 </para>
60948 </listitem>
60949 </orderedlist>
60950 <para>
60951 Then all you need to do is write the code! A good way to start is to make a
60952 proforma by copying an existing module of the same type, globally changing all
60953 occurrences of the name, and cutting out most of the code. Note that any
60954 options you create must be listed in alphabetical order, because the tables are
60955 searched using a binary chop procedure.
60956 </para>
60957 <para>
60958 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
60959 the interface that is expected.
60960 </para>
60961 <?sdop
60962   format="newpage"
60963   foot_right_recto="&chaptertitle;"
60964   foot_right_verso="&chaptertitle;"
60965 ?>
60966 </chapter>
60967
60968 <index role="option">
60969 <title>Options index</title>
60970 </index>
60971
60972 <index role="variable">
60973 <title>Variables index</title>
60974 </index>
60975
60976 <index role="concept">
60977 <title>Concept index</title>
60978 </index>
60979
60980 </book>