Merge branch 'security/4.92.1'
[exim-website.git] / docbook / 4.68 / 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_overflow="overprint"
10 ?>
11 <book>
12 <bookinfo>
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>23 August 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.68</revnumber>
22   <date>23 August 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   <seealso><emphasis>limit</emphasis></seealso>
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.68 of Exim.
204 Substantive changes from the 4.67 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> (second edition, 2007), 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 As well as Exim distribution tar files, the Exim web site contains a number of
352 differently formatted versions of the documentation. A recent addition to the
353 online information is the Exim wiki <phrase revisionflag="changed">(<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>)</phrase>,
354 which contains what used to be a separate FAQ, as well as various other
355 examples, tips, and know-how that have been contributed by Exim users.
356 </para>
357 <para>
358 <indexterm role="concept">
359 <primary>Bugzilla</primary>
360 </indexterm>
361 An Exim Bugzilla exists at <phrase revisionflag="changed"><emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis></phrase>. You can use
362 this to report bugs, and also to add items to the wish list. Please search
363 first to check that you are not duplicating a previous entry.
364 </para>
365 </section>
366 <section id="SECID3">
367 <title>Mailing lists</title>
368 <para>
369 <indexterm role="concept">
370 <primary>mailing lists</primary>
371 <secondary>for Exim users</secondary>
372 </indexterm>
373 The following Exim mailing lists exist:
374 </para>
375 <informaltable frame="none">
376 <tgroup cols="2" colsep="0" rowsep="0">
377 <colspec colwidth="140pt" align="left"/>
378 <colspec colwidth="254pt" align="left"/>
379 <tbody>
380 <row>
381 <entry><emphasis>exim-users@exim.org</emphasis></entry>
382 <entry>General discussion list</entry>
383 </row>
384 <row>
385 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
386 <entry>Discussion of bugs, enhancements, etc.</entry>
387 </row>
388 <row>
389 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
390 <entry>Moderated, low volume announcements list</entry>
391 </row>
392 <row>
393 <entry><emphasis>exim-future@exim.org</emphasis></entry>
394 <entry>Discussion of long-term development</entry>
395 </row>
396 </tbody>
397 </tgroup>
398 </informaltable>
399 <para>
400 You can subscribe to these lists, change your existing subscriptions, and view
401 or search the archives via the mailing lists link on the Exim home page.
402 <indexterm role="concept">
403 <primary>Debian</primary>
404 <secondary>mailing list for</secondary>
405 </indexterm>
406 If you are using a Debian distribution of Exim, you may wish to subscribe to
407 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
408 via this web page:
409 </para>
410 <literallayout>
411 <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>
412 </literallayout>
413 <para>
414 Please ask Debian-specific questions on this list and not on the general Exim
415 lists.
416 </para>
417 </section>
418 <section id="SECID4">
419 <title>Exim training</title>
420 <para revisionflag="changed">
421 <indexterm role="concept">
422 <primary>training courses</primary>
423 </indexterm>
424 Training courses in Cambridge (UK) used to be run annually by the author of
425 Exim, before he retired. At the time of writing, there are no plans to run
426 further Exim courses in Cambridge. However, if that changes, relevant
427 information will be posted at <emphasis role="bold"><ulink url="http://www-tus.csx.cam.ac.uk/courses/exim/">http://www-tus.csx.cam.ac.uk/courses/exim/</ulink></emphasis>.
428 </para>
429 </section>
430 <section id="SECID5">
431 <title>Bug reports</title>
432 <para>
433 <indexterm role="concept">
434 <primary>bug reports</primary>
435 </indexterm>
436 <indexterm role="concept">
437 <primary>reporting bugs</primary>
438 </indexterm>
439 Reports of obvious bugs <phrase revisionflag="changed">can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
440 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>).</phrase> However, if you are unsure
441 whether some behaviour is a bug or not, the best thing to do is to post a
442 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
443 </para>
444 </section>
445 <section id="SECTavail">
446 <title>Where to find the Exim distribution</title>
447 <para>
448 <indexterm role="concept">
449 <primary>FTP site</primary>
450 </indexterm>
451 <indexterm role="concept">
452 <primary>distribution</primary>
453 <secondary>ftp site</secondary>
454 </indexterm>
455 The master ftp site for the Exim distribution is
456 </para>
457 <literallayout>
458 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
459 </literallayout>
460 <para>
461 This is mirrored by
462 </para>
463 <literallayout>
464 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
465 </literallayout>
466 <para>
467 The file references that follow are relative to the <filename>exim</filename> directories at
468 these sites. There are now quite a number of independent mirror sites around
469 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
470 </para>
471 <para>
472 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
473 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
474 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
475 subdirectory, the current release can always be found in files called
476 </para>
477 <literallayout>
478 <filename>exim-n.nn.tar.gz</filename>
479 <filename>exim-n.nn.tar.bz2</filename>
480 </literallayout>
481 <para>
482 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
483 files contain identical data; the only difference is the type of compression.
484 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
485 </para>
486 <para>
487 <indexterm role="concept">
488 <primary>distribution</primary>
489 <secondary>signing details</secondary>
490 </indexterm>
491 <indexterm role="concept">
492 <primary>distribution</primary>
493 <secondary>public key</secondary>
494 </indexterm>
495 <indexterm role="concept">
496 <primary>public key for signed distribution</primary>
497 </indexterm>
498 The distributions are currently signed with Philip Hazel&#x2019;s GPG key. The
499 corresponding public key is available from a number of keyservers, and there is
500 also a copy in the file <filename>Public-Key</filename>. The signatures for the tar bundles are
501 in:
502 </para>
503 <literallayout>
504 <filename>exim-n.nn.tar.gz.sig</filename>
505 <filename>exim-n.nn.tar.bz2.sig</filename>
506 </literallayout>
507 <para>
508 For each released version, the log of changes is made separately available in a
509 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
510 find out what has changed without having to download the entire distribution.
511 </para>
512 <para>
513 <indexterm role="concept">
514 <primary>documentation</primary>
515 <secondary>available formats</secondary>
516 </indexterm>
517 The main distribution contains ASCII versions of this specification and other
518 documentation; other formats of the documents are available in separate files
519 inside the <filename>exim4</filename> directory of the FTP site:
520 </para>
521 <literallayout>
522 <filename>exim-html-n.nn.tar.gz</filename>
523 <filename>exim-pdf-n.nn.tar.gz</filename>
524 <filename>exim-postscript-n.nn.tar.gz</filename>
525 <filename>exim-texinfo-n.nn.tar.gz</filename>
526 </literallayout>
527 <para>
528 These tar files contain only the <filename>doc</filename> directory, not the complete
529 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
530 </para>
531 </section>
532 <section id="SECID6">
533 <title>Limitations</title>
534 <itemizedlist>
535 <listitem>
536 <para>
537 <indexterm role="concept">
538 <primary>limitations of Exim</primary>
539 </indexterm>
540 <indexterm role="concept">
541 <primary>bang paths</primary>
542 <secondary>not handled by Exim</secondary>
543 </indexterm>
544 Exim is designed for use as an Internet MTA, and therefore handles addresses in
545 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
546 simple two-component bang paths can be converted by a straightforward rewriting
547 configuration. This restriction does not prevent Exim from being interfaced to
548 UUCP as a transport mechanism, provided that domain addresses are used.
549 </para>
550 </listitem>
551 <listitem>
552 <para>
553 <indexterm role="concept">
554 <primary>domainless addresses</primary>
555 </indexterm>
556 <indexterm role="concept">
557 <primary>address</primary>
558 <secondary>without domain</secondary>
559 </indexterm>
560 Exim insists that every address it handles has a domain attached. For incoming
561 local messages, domainless addresses are automatically qualified with a
562 configured domain value. Configuration options specify from which remote
563 systems unqualified addresses are acceptable. These are then qualified on
564 arrival.
565 </para>
566 </listitem>
567 <listitem>
568 <para>
569 <indexterm role="concept">
570 <primary>transport</primary>
571 <secondary>external</secondary>
572 </indexterm>
573 <indexterm role="concept">
574 <primary>external transports</primary>
575 </indexterm>
576 The only external transport mechanisms that are currently implemented are SMTP
577 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
578 transport is available, and there are facilities for writing messages to files
579 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
580 to send messages to other transport mechanisms such as UUCP, provided they can
581 handle domain-style addresses. Batched SMTP input is also catered for.
582 </para>
583 </listitem>
584 <listitem>
585 <para>
586 Exim is not designed for storing mail for dial-in hosts. When the volumes of
587 such mail are large, it is better to get the messages <quote>delivered</quote> into files
588 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
589 other means.
590 </para>
591 </listitem>
592 <listitem>
593 <para>
594 Although Exim does have basic facilities for scanning incoming messages, these
595 are not comprehensive enough to do full virus or spam scanning. Such operations
596 are best carried out using additional specialized software packages. If you
597 compile Exim with the content-scanning extension, straightforward interfaces to
598 a number of common scanners are provided.
599 </para>
600 </listitem>
601 </itemizedlist>
602 </section>
603 <section id="SECID7">
604 <title>Run time configuration</title>
605 <para>
606 Exim&#x2019;s run time configuration is held in a single text file that is divided
607 into a number of sections. The entries in this file consist of keywords and
608 values, in the style of Smail 3 configuration files. A default configuration
609 file which is suitable for simple online installations is provided in the
610 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
611 </para>
612 </section>
613 <section id="SECID8">
614 <title>Calling interface</title>
615 <para>
616 <indexterm role="concept">
617 <primary>Sendmail compatibility</primary>
618 <secondary>command line interface</secondary>
619 </indexterm>
620 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
621 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
622 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
623 about Sendmail in order to run Exim. For actions other than sending messages,
624 Sendmail-compatible options also exist, but those that produce output (for
625 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
626 format. There are also some additional options that are compatible with Smail
627 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
628 documents all Exim&#x2019;s command line options. This information is automatically
629 made into the man page that forms part of the Exim distribution.
630 </para>
631 <para>
632 Control of messages on the queue can be done via certain privileged command
633 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
634 which displays current information in an X window, and which contains a menu
635 interface to Exim&#x2019;s command line administration options.
636 </para>
637 </section>
638 <section id="SECID9">
639 <title>Terminology</title>
640 <para>
641 <indexterm role="concept">
642 <primary>terminology definitions</primary>
643 </indexterm>
644 <indexterm role="concept">
645 <primary>body of message</primary>
646 <secondary>definition of</secondary>
647 </indexterm>
648 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
649 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
650 below) by a blank line.
651 </para>
652 <para>
653 <indexterm role="concept">
654 <primary>bounce message</primary>
655 <secondary>definition of</secondary>
656 </indexterm>
657 When a message cannot be delivered, it is normally returned to the sender in a
658 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
659 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
660 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
661 failure error report</quote>. Such messages have an empty sender address in the
662 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
663 rise to further bounce messages.
664 </para>
665 <para>
666 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
667 value which is used in the absence of any setting in the configuration. It may
668 also qualify an action which is taken unless a configuration setting specifies
669 otherwise.
670 </para>
671 <para>
672 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
673 destination cannot immediately take place for some reason (a remote host may be
674 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
675 until a later time.
676 </para>
677 <para>
678 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
679 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
680 the part of an email address following the @ sign.
681 </para>
682 <para>
683 <indexterm role="concept">
684 <primary>envelope, definition of</primary>
685 </indexterm>
686 <indexterm role="concept">
687 <primary>sender</primary>
688 <secondary>definition of</secondary>
689 </indexterm>
690 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
691 body. The envelope contains a sender address (to which bounce messages should
692 be delivered), and any number of recipient addresses. References to the
693 sender or the recipients of a message usually mean the addresses in the
694 envelope. An MTA uses these addresses for delivery, and for returning bounce
695 messages, not the addresses that appear in the header lines.
696 </para>
697 <para>
698 <indexterm role="concept">
699 <primary>message</primary>
700 <secondary>header, definition of</secondary>
701 </indexterm>
702 <indexterm role="concept">
703 <primary>header section</primary>
704 <secondary>definition of</secondary>
705 </indexterm>
706 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
707 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
708 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
709 indenting the continuations. The header is separated from the body by a blank
710 line.
711 </para>
712 <para>
713 <indexterm role="concept">
714 <primary>local part</primary>
715 <secondary>definition of</secondary>
716 </indexterm>
717 <indexterm role="concept">
718 <primary>domain</primary>
719 <secondary>definition of</secondary>
720 </indexterm>
721 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
722 part of an email address that precedes the @ sign. The part that follows the
723 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
724 </para>
725 <para>
726 <indexterm role="concept">
727 <primary>local delivery</primary>
728 <secondary>definition of</secondary>
729 </indexterm>
730 <indexterm role="concept">
731 <primary>remote delivery, definition of</primary>
732 </indexterm>
733 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
734 delivery to a file or a pipe on the local host from delivery by SMTP over
735 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
736 host it is running on are <emphasis>remote</emphasis>.
737 </para>
738 <para>
739 <indexterm role="concept">
740 <primary>return path</primary>
741 <secondary>definition of</secondary>
742 </indexterm>
743 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
744 message&#x2019;s envelope.
745 </para>
746 <para>
747 <indexterm role="concept">
748 <primary>queue</primary>
749 <secondary>definition of</secondary>
750 </indexterm>
751 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
752 because this term is in widespread use in the context of MTAs. However, in
753 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
754 normally no ordering of waiting messages.
755 </para>
756 <para>
757 <indexterm role="concept">
758 <primary>queue runner</primary>
759 <secondary>definition of</secondary>
760 </indexterm>
761 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
762 and attempts to deliver those messages whose retry times have come. This term
763 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
764 the waiting messages are normally processed in an unpredictable order.
765 </para>
766 <para>
767 <indexterm role="concept">
768 <primary>spool directory</primary>
769 <secondary>definition of</secondary>
770 </indexterm>
771 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
772 messages on its queue &ndash; that is, those that it is in the process of
773 delivering. This should not be confused with the directory in which local
774 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
775 the Exim documentation, <quote>spool</quote> is always used in the first sense.
776 </para>
777 </section>
778 </chapter>
779
780 <chapter id="CHID2">
781 <title>Incorporated code</title>
782 <para>
783 <indexterm role="concept">
784 <primary>incorporated code</primary>
785 </indexterm>
786 <indexterm role="concept">
787 <primary>regular expressions</primary>
788 <secondary>library</secondary>
789 </indexterm>
790 <indexterm role="concept">
791 <primary>PCRE</primary>
792 </indexterm>
793 A number of pieces of external code are included in the Exim distribution.
794 </para>
795 <itemizedlist>
796 <listitem>
797 <para>
798 Regular expressions are supported in the main Exim program and in the Exim
799 monitor using the freely-distributable PCRE library, copyright &copy;
800 University of Cambridge. The source is distributed in the directory
801 <filename>src/pcre</filename>. However, this is a cut-down version of PCRE. If you want to use
802 the PCRE library in other programs, you should obtain and install the full
803 version of the library from
804 <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>.
805 </para>
806 </listitem>
807 <listitem>
808 <para>
809 <indexterm role="concept">
810 <primary>cdb</primary>
811 <secondary>acknowledgment</secondary>
812 </indexterm>
813 Support for the cdb (Constant DataBase) lookup method is provided by code
814 contributed by Nigel Metheringham of (at the time he contributed it) Planet
815 Online Ltd. The implementation is completely contained within the code of Exim.
816 It does not link against an external cdb library. The code contains the
817 following statements:
818 </para>
819 <blockquote>
820 <para>
821 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
822 </para>
823 <para>
824 This program is free software; you can redistribute it and/or modify it under
825 the terms of the GNU General Public License as published by the Free Software
826 Foundation; either version 2 of the License, or (at your option) any later
827 version.
828 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
829 the spec and sample code for cdb can be obtained from
830 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
831 some code from Dan Bernstein&#x2019;s implementation (which has no license
832 restrictions applied to it).
833 </para>
834 </blockquote>
835 </listitem>
836 <listitem>
837 <para>
838 <indexterm role="concept">
839 <primary>SPA authentication</primary>
840 </indexterm>
841 <indexterm role="concept">
842 <primary>Samba project</primary>
843 </indexterm>
844 <indexterm role="concept">
845 <primary>Microsoft Secure Password Authentication</primary>
846 </indexterm>
847 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
848 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
849 Tom Kistner. This includes code taken from the Samba project, which is released
850 under the Gnu GPL.
851 </para>
852 </listitem>
853 <listitem>
854 <para>
855 <indexterm role="concept">
856 <primary>Cyrus</primary>
857 </indexterm>
858 <indexterm role="concept">
859 <primary><emphasis>pwcheck</emphasis> daemon</primary>
860 </indexterm>
861 <indexterm role="concept">
862 <primary><emphasis>pwauthd</emphasis> daemon</primary>
863 </indexterm>
864 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
865 by code taken from the Cyrus-SASL library and adapted by Alexander S.
866 Sabourenkov. The permission notice appears below, in accordance with the
867 conditions expressed therein.
868 </para>
869 <blockquote>
870 <para>
871 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
872 </para>
873 <para>
874 Redistribution and use in source and binary forms, with or without
875 modification, are permitted provided that the following conditions
876 are met:
877 </para>
878 <orderedlist numeration="arabic">
879 <listitem>
880 <para>
881 Redistributions of source code must retain the above copyright
882 notice, this list of conditions and the following disclaimer.
883 </para>
884 </listitem>
885 <listitem>
886 <para>
887 Redistributions in binary form must reproduce the above copyright
888 notice, this list of conditions and the following disclaimer in
889 the documentation and/or other materials provided with the
890 distribution.
891 </para>
892 </listitem>
893 <listitem>
894 <para>
895 The name <quote>Carnegie Mellon University</quote> must not be used to
896 endorse or promote products derived from this software without
897 prior written permission. For permission or any other legal
898 details, please contact
899 </para>
900 <literallayout>
901               Office of Technology Transfer
902               Carnegie Mellon University
903               5000 Forbes Avenue
904               Pittsburgh, PA  15213-3890
905               (412) 268-4387, fax: (412) 268-7395
906               tech-transfer@andrew.cmu.edu
907 </literallayout>
908 </listitem>
909 <listitem>
910 <para>
911 Redistributions of any form whatsoever must retain the following
912 acknowledgment:
913 </para>
914 <para>
915 <quote>This product includes software developed by Computing Services
916 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
917 </para>
918 <para>
919 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
920 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
921 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
922 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
923 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
924 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
925 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
926 </para>
927 </listitem>
928 </orderedlist>
929 </blockquote>
930 </listitem>
931 <listitem>
932 <para>
933 <indexterm role="concept">
934 <primary>Exim monitor</primary>
935 <secondary>acknowledgment</secondary>
936 </indexterm>
937 <indexterm role="concept">
938 <primary>X-windows</primary>
939 </indexterm>
940 <indexterm role="concept">
941 <primary>Athena</primary>
942 </indexterm>
943 The Exim Monitor program, which is an X-Window application, includes
944 modified versions of the Athena StripChart and TextPop widgets.
945 This code is copyright by DEC and MIT, and their permission notice appears
946 below, in accordance with the conditions expressed therein.
947 </para>
948 <blockquote>
949 <para>
950 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
951 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
952 </para>
953 <para>
954 All Rights Reserved
955 </para>
956 <para>
957 Permission to use, copy, modify, and distribute this software and its
958 documentation for any purpose and without fee is hereby granted,
959 provided that the above copyright notice appear in all copies and that
960 both that copyright notice and this permission notice appear in
961 supporting documentation, and that the names of Digital or MIT not be
962 used in advertising or publicity pertaining to distribution of the
963 software without specific, written prior permission.
964 </para>
965 <para>
966 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
967 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
968 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
969 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
970 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
971 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
972 SOFTWARE.
973 </para>
974 </blockquote>
975 </listitem>
976 <listitem>
977 <para>
978 Many people have contributed code fragments, some large, some small, that were
979 not covered by any specific licence requirements. It is assumed that the
980 contributors are happy to see their code incorporated into Exim under the GPL.
981 </para>
982 </listitem>
983 </itemizedlist>
984 </chapter>
985
986 <chapter id="CHID11">
987 <title>How Exim receives and delivers mail</title>
988 <titleabbrev>Receiving and delivering mail</titleabbrev>
989 <section id="SECID10">
990 <title>Overall philosophy</title>
991 <para>
992 <indexterm role="concept">
993 <primary>design philosophy</primary>
994 </indexterm>
995 Exim is designed to work efficiently on systems that are permanently connected
996 to the Internet and are handling a general mix of mail. In such circumstances,
997 most messages can be delivered immediately. Consequently, Exim does not
998 maintain independent queues of messages for specific domains or hosts, though
999 it does try to send several messages in a single SMTP connection after a host
1000 has been down, and it also maintains per-host retry information.
1001 </para>
1002 </section>
1003 <section id="SECID11">
1004 <title>Policy control</title>
1005 <para>
1006 <indexterm role="concept">
1007 <primary>policy control</primary>
1008 <secondary>overview</secondary>
1009 </indexterm>
1010 Policy controls are now an important feature of MTAs that are connected to the
1011 Internet. Perhaps their most important job is to stop MTAs being abused as
1012 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1013 unsolicited junk, and want to disguise its source. Exim provides flexible
1014 facilities for specifying policy controls on incoming mail:
1015 </para>
1016 <itemizedlist>
1017 <listitem>
1018 <para>
1019 <indexterm role="concept">
1020 <primary>access control lists (ACLs)</primary>
1021 <secondary>introduction</secondary>
1022 </indexterm>
1023 Exim 4 (unlike previous versions of Exim) implements policy controls on
1024 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1025 series of statements that may either grant or deny access. ACLs can be used at
1026 several places in the SMTP dialogue while receiving a message from a remote
1027 host. However, the most common places are after each RCPT command, and at the
1028 very end of the message. The sysadmin can specify conditions for accepting or
1029 rejecting individual recipients or the entire message, respectively, at these
1030 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1031 error code.
1032 </para>
1033 </listitem>
1034 <listitem>
1035 <para>
1036 An ACL is also available for locally generated, non-SMTP messages. In this
1037 case, the only available actions are to accept or deny the entire message.
1038 </para>
1039 </listitem>
1040 <listitem>
1041 <para>
1042 When Exim is compiled with the content-scanning extension, facilities are
1043 provided in the ACL mechanism for passing the message to external virus and/or
1044 spam scanning software. The result of such a scan is passed back to the ACL,
1045 which can then use it to decide what to do with the message.
1046 </para>
1047 </listitem>
1048 <listitem>
1049 <para>
1050 When a message has been received, either from a remote host or from the local
1051 host, but before the final acknowledgment has been sent, a locally supplied C
1052 function called <function>local_scan()</function> can be run to inspect the message and decide
1053 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1054 is accepted, the list of recipients can be modified by the function.
1055 </para>
1056 </listitem>
1057 <listitem>
1058 <para>
1059 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1060 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1061 Exim to be compiled with the content-scanning extension.
1062 </para>
1063 </listitem>
1064 <listitem>
1065 <para>
1066 After a message has been accepted, a further checking mechanism is available in
1067 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1068 runs at the start of every delivery process.
1069 </para>
1070 </listitem>
1071 </itemizedlist>
1072 </section>
1073 <section id="SECID12">
1074 <title>User filters</title>
1075 <para>
1076 <indexterm role="concept">
1077 <primary>filter</primary>
1078 <secondary>introduction</secondary>
1079 </indexterm>
1080 <indexterm role="concept">
1081 <primary>Sieve filter</primary>
1082 </indexterm>
1083 In a conventional Exim configuration, users are able to run private filters by
1084 setting up appropriate <filename>.forward</filename> files in their home directories. See
1085 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1086 configuration needed to support this, and the separate document entitled
1087 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1088 of filtering are available:
1089 </para>
1090 <itemizedlist>
1091 <listitem>
1092 <para>
1093 Sieve filters are written in the standard filtering language that is defined
1094 by RFC 3028.
1095 </para>
1096 </listitem>
1097 <listitem>
1098 <para>
1099 Exim filters are written in a syntax that is unique to Exim, but which is more
1100 powerful than Sieve, which it pre-dates.
1101 </para>
1102 </listitem>
1103 </itemizedlist>
1104 <para>
1105 User filters are run as part of the routing process, described below.
1106 </para>
1107 </section>
1108 <section id="SECTmessiden">
1109 <title>Message identification</title>
1110 <para>
1111 <indexterm role="concept">
1112 <primary>message ids</primary>
1113 <secondary>details of format</secondary>
1114 </indexterm>
1115 <indexterm role="concept">
1116 <primary>format</primary>
1117 <secondary>of message id</secondary>
1118 </indexterm>
1119 <indexterm role="concept">
1120 <primary>id of message</primary>
1121 </indexterm>
1122 <indexterm role="concept">
1123 <primary>base62</primary>
1124 </indexterm>
1125 <indexterm role="concept">
1126 <primary>base36</primary>
1127 </indexterm>
1128 <indexterm role="concept">
1129 <primary>Darwin</primary>
1130 </indexterm>
1131 <indexterm role="concept">
1132 <primary>Cygwin</primary>
1133 </indexterm>
1134 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1135 characters long. It is divided into three parts, separated by hyphens, for
1136 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1137 normally encoding numbers in base 62. However, in the Darwin operating
1138 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1139 (avoiding the use of lower case letters) is used instead, because the message
1140 id is used to construct file names, and the names of files in those systems are
1141 not always case-sensitive.
1142 </para>
1143 <para>
1144 <indexterm role="concept">
1145 <primary>pid (process id)</primary>
1146 <secondary>re-use of</secondary>
1147 </indexterm>
1148 The detail of the contents of the message id have changed as Exim has evolved.
1149 Earlier versions relied on the operating system not re-using a process id (pid)
1150 within one second. On modern operating systems, this assumption can no longer
1151 be made, so the algorithm had to be changed. To retain backward compatibility,
1152 the format of the message id was retained, which is why the following rules are
1153 somewhat eccentric:
1154 </para>
1155 <itemizedlist>
1156 <listitem>
1157 <para>
1158 The first six characters of the message id are the time at which the message
1159 started to be received, to a granularity of one second. That is, this field
1160 contains the number of seconds since the start of the epoch (the normal Unix
1161 way of representing the date and time of day).
1162 </para>
1163 </listitem>
1164 <listitem>
1165 <para>
1166 After the first hyphen, the next six characters are the id of the process that
1167 received the message.
1168 </para>
1169 </listitem>
1170 <listitem>
1171 <para>
1172 There are two different possibilities for the final two characters:
1173 </para>
1174 <orderedlist numeration="arabic">
1175 <listitem>
1176 <para>
1177 <indexterm role="option">
1178 <primary><option>localhost_number</option></primary>
1179 </indexterm>
1180 If <option>localhost_number</option> is not set, this value is the fractional part of the
1181 time of reception, normally in units of 1/2000 of a second, but for systems
1182 that must use base 36 instead of base 62 (because of case-insensitive file
1183 systems), the units are 1/1000 of a second.
1184 </para>
1185 </listitem>
1186 <listitem>
1187 <para>
1188 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1189 the fractional part of the time, which in this case is in units of 1/200
1190 (1/100) of a second.
1191 </para>
1192 </listitem>
1193 </orderedlist>
1194 </listitem>
1195 </itemizedlist>
1196 <para>
1197 After a message has been received, Exim waits for the clock to tick at the
1198 appropriate resolution before proceeding, so that if another message is
1199 received by the same process, or by another process with the same (re-used)
1200 pid, it is guaranteed that the time will be different. In most cases, the clock
1201 will already have ticked while the message was being received.
1202 </para>
1203 </section>
1204 <section id="SECID13">
1205 <title>Receiving mail</title>
1206 <para>
1207 <indexterm role="concept">
1208 <primary>receiving mail</primary>
1209 </indexterm>
1210 <indexterm role="concept">
1211 <primary>message</primary>
1212 <secondary>reception</secondary>
1213 </indexterm>
1214 The only way Exim can receive mail from another host is using SMTP over
1215 TCP/IP, in which case the sender and recipient addresses are transferred using
1216 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1217 there are several possibilities:
1218 </para>
1219 <itemizedlist>
1220 <listitem>
1221 <para>
1222 If the process runs Exim with the <option>-bm</option> option, the message is read
1223 non-interactively (usually via a pipe), with the recipients taken from the
1224 command line, or from the body of the message if <option>-t</option> is also used.
1225 </para>
1226 </listitem>
1227 <listitem>
1228 <para>
1229 If the process runs Exim with the <option>-bS</option> option, the message is also read
1230 non-interactively, but in this case the recipients are listed at the start of
1231 the message in a series of SMTP RCPT commands, terminated by a DATA
1232 command. This is so-called <quote>batch SMTP</quote> format,
1233 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1234 envelope addresses in a non-interactive submission.
1235 </para>
1236 </listitem>
1237 <listitem>
1238 <para>
1239 If the process runs Exim with the <option>-bs</option> option, the message is read
1240 interactively, using the SMTP protocol. A two-way pipe is normally used for
1241 passing data between the local process and the Exim process.
1242 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1243 example, the ACLs for SMTP commands are used for this form of submission.
1244 </para>
1245 </listitem>
1246 <listitem>
1247 <para>
1248 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1249 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1250 does not treat the loopback address specially. It treats all such connections
1251 in the same way as connections from other hosts.
1252 </para>
1253 </listitem>
1254 </itemizedlist>
1255 <para>
1256 <indexterm role="concept">
1257 <primary>message sender, constructed by Exim</primary>
1258 </indexterm>
1259 <indexterm role="concept">
1260 <primary>sender</primary>
1261 <secondary>constructed by Exim</secondary>
1262 </indexterm>
1263 In the three cases that do not involve TCP/IP, the sender address is
1264 constructed from the login name of the user that called Exim and a default
1265 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1266 option). For local or batch SMTP, a sender address that is passed using the
1267 SMTP MAIL command is ignored. However, the system administrator may allow
1268 certain users (<quote>trusted users</quote>) to specify a different sender address
1269 unconditionally, or all users to specify certain forms of different sender
1270 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1271 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1272 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1273 users to change sender addresses.
1274 </para>
1275 <para>
1276 Messages received by either of the non-interactive mechanisms are subject to
1277 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1278 (either over TCP/IP, or interacting with a local process) can be checked by a
1279 number of ACLs that operate at different times during the SMTP session. Either
1280 individual recipients, or the entire message, can be rejected if local policy
1281 requirements are not met. The <function>local_scan()</function> function (see chapter
1282 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1283 </para>
1284 <para>
1285 Exim can be configured not to start a delivery process when a message is
1286 received; this can be unconditional, or depend on the number of incoming SMTP
1287 connections or the system load. In these situations, new messages wait on the
1288 queue until a queue runner process picks them up. However, in standard
1289 configurations under normal conditions, delivery is started as soon as a
1290 message is received.
1291 </para>
1292 </section>
1293 <section id="SECID14">
1294 <title>Handling an incoming message</title>
1295 <para>
1296 <indexterm role="concept">
1297 <primary>spool directory</primary>
1298 <secondary>files that hold a message</secondary>
1299 </indexterm>
1300 <indexterm role="concept">
1301 <primary>file</primary>
1302 <secondary>how a message is held</secondary>
1303 </indexterm>
1304 When Exim accepts a message, it writes two files in its spool directory. The
1305 first contains the envelope information, the current status of the message, and
1306 the header lines, and the second contains the body of the message. The names of
1307 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1308 file containing the envelope and header, and <literal>-D</literal> for the data file.
1309 </para>
1310 <para>
1311 <indexterm role="concept">
1312 <primary>spool directory</primary>
1313 <secondary><filename>input</filename> sub-directory</secondary>
1314 </indexterm>
1315 By default all these message files are held in a single directory called
1316 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1317 not perform very well if the number of files in a directory gets large; to
1318 improve performance in such cases, the <option>split_spool_directory</option> option can be
1319 used. This causes Exim to split up the input files into 62 sub-directories
1320 whose names are single letters or digits. When this is done, the queue is
1321 processed one sub-directory at a time instead of all at once, which can improve
1322 overall performance even when there are not enough files in each directory to
1323 affect file system performance.
1324 </para>
1325 <para>
1326 The envelope information consists of the address of the message&#x2019;s sender and
1327 the addresses of the recipients. This information is entirely separate from
1328 any addresses contained in the header lines. The status of the message includes
1329 a list of recipients who have already received the message. The format of the
1330 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1331 </para>
1332 <para>
1333 <indexterm role="concept">
1334 <primary>rewriting</primary>
1335 <secondary>addresses</secondary>
1336 </indexterm>
1337 Address rewriting that is specified in the rewrite section of the configuration
1338 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1339 both in the header lines and the envelope, at the time the message is accepted.
1340 If during the course of delivery additional addresses are generated (for
1341 example, via aliasing), these new addresses are rewritten as soon as they are
1342 generated. At the time a message is actually delivered (transported) further
1343 rewriting can take place; because this is a transport option, it can be
1344 different for different forms of delivery. It is also possible to specify the
1345 addition or removal of certain header lines at the time the message is
1346 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1347 <xref linkend="CHAPtransportgeneric"/>).
1348 </para>
1349 </section>
1350 <section id="SECID15">
1351 <title>Life of a message</title>
1352 <para>
1353 <indexterm role="concept">
1354 <primary>message</primary>
1355 <secondary>life of</secondary>
1356 </indexterm>
1357 <indexterm role="concept">
1358 <primary>message</primary>
1359 <secondary>frozen</secondary>
1360 </indexterm>
1361 A message remains in the spool directory until it is completely delivered to
1362 its recipients or to an error address, or until it is deleted by an
1363 administrator or by the user who originally created it. In cases when delivery
1364 cannot proceed &ndash; for example, when a message can neither be delivered to its
1365 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1366 spool, and no more deliveries are attempted.
1367 </para>
1368 <para>
1369 <indexterm role="concept">
1370 <primary>frozen messages</primary>
1371 <secondary>thawing</secondary>
1372 </indexterm>
1373 <indexterm role="concept">
1374 <primary>message</primary>
1375 <secondary>thawing frozen</secondary>
1376 </indexterm>
1377 An administrator can <quote>thaw</quote> such messages when the problem has been
1378 corrected, and can also freeze individual messages by hand if necessary. In
1379 addition, an administrator can force a delivery error, causing a bounce message
1380 to be sent.
1381 </para>
1382 <para>
1383 <indexterm role="option">
1384 <primary><option>timeout_frozen_after</option></primary>
1385 </indexterm>
1386 <indexterm role="option">
1387 <primary><option>ignore_bounce_errors_after</option></primary>
1388 </indexterm>
1389 There are options called <option>ignore_bounce_errors_after</option> and
1390 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1391 The first applies only to frozen bounces, the second to any frozen messages.
1392 </para>
1393 <para>
1394 <indexterm role="concept">
1395 <primary>message</primary>
1396 <secondary>log file for</secondary>
1397 </indexterm>
1398 <indexterm role="concept">
1399 <primary>log</primary>
1400 <secondary>file for each message</secondary>
1401 </indexterm>
1402 While Exim is working on a message, it writes information about each delivery
1403 attempt to its main log file. This includes successful, unsuccessful, and
1404 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1405 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1406 These logs are solely for the benefit of the administrator, and are normally
1407 deleted along with the spool files when processing of a message is complete.
1408 The use of individual message logs can be disabled by setting
1409 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1410 systems.
1411 </para>
1412 <para>
1413 <indexterm role="concept">
1414 <primary>journal file</primary>
1415 </indexterm>
1416 <indexterm role="concept">
1417 <primary>file</primary>
1418 <secondary>journal</secondary>
1419 </indexterm>
1420 All the information Exim itself needs to set up a delivery is kept in the first
1421 spool file, along with the header lines. When a successful delivery occurs, the
1422 address is immediately written at the end of a journal file, whose name is the
1423 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1424 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1425 is updated to indicate which these are, and the journal file is then deleted.
1426 Updating the spool file is done by writing a new file and renaming it, to
1427 minimize the possibility of data loss.
1428 </para>
1429 <para>
1430 Should the system or the program crash after a successful delivery but before
1431 the spool file has been updated, the journal is left lying around. The next
1432 time Exim attempts to deliver the message, it reads the journal file and
1433 updates the spool file before proceeding. This minimizes the chances of double
1434 deliveries caused by crashes.
1435 </para>
1436 </section>
1437 <section id="SECTprocaddress">
1438 <title>Processing an address for delivery</title>
1439 <para>
1440 <indexterm role="concept">
1441 <primary>drivers</primary>
1442 <secondary>definition of</secondary>
1443 </indexterm>
1444 <indexterm role="concept">
1445 <primary>router</primary>
1446 <secondary>definition of</secondary>
1447 </indexterm>
1448 <indexterm role="concept">
1449 <primary>transport</primary>
1450 <secondary>definition of</secondary>
1451 </indexterm>
1452 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1453 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1454 number of them is provided in the source distribution, and compile-time options
1455 specify which ones are included in the binary. Run time options specify which
1456 ones are actually used for delivering messages.
1457 </para>
1458 <para>
1459 <indexterm role="concept">
1460 <primary>drivers</primary>
1461 <secondary>instance definition</secondary>
1462 </indexterm>
1463 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1464 of that particular driver type. Multiple instances are allowed; for example,
1465 you can set up several different <command>smtp</command> transports, each with different
1466 option values that might specify different ports or different timeouts. Each
1467 instance has its own identifying name. In what follows we will normally use the
1468 instance name when discussing one particular instance (that is, one specific
1469 configuration of the driver), and the generic driver name when discussing
1470 the driver&#x2019;s features in general.
1471 </para>
1472 <para>
1473 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1474 its delivery should happen, by assigning it to a specific transport, or
1475 converting the address into one or more new addresses (for example, via an
1476 alias file). A router may also explicitly choose to fail an address, causing it
1477 to be bounced.
1478 </para>
1479 <para>
1480 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1481 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1482 transport, the destination is a file or a pipe on the local host, whereas for a
1483 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1484 to a specific transport as a result of successful routing. If a message has
1485 several recipients, it may be passed to a number of different transports.
1486 </para>
1487 <para>
1488 <indexterm role="concept">
1489 <primary>preconditions</primary>
1490 <secondary>definition of</secondary>
1491 </indexterm>
1492 An address is processed by passing it to each configured router instance in
1493 turn, subject to certain preconditions, until a router accepts the address or
1494 specifies that it should be bounced. We will describe this process in more
1495 detail shortly. First, as a simple example, we consider how each recipient
1496 address in a message is processed in a small configuration of three routers.
1497 </para>
1498 <para>
1499 To make this a more concrete example, it is described in terms of some actual
1500 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1501 routers in many different ways, and there may be any number of routers in a
1502 configuration.
1503 </para>
1504 <para>
1505 The first router that is specified in a configuration is often one that handles
1506 addresses in domains that are not recognized specially by the local host. These
1507 are typically addresses for arbitrary domains on the Internet. A precondition
1508 is set up which looks for the special domains known to the host (for example,
1509 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1510 match. Typically, this is a router that looks up domains in the DNS in order to
1511 find the hosts to which this address routes. If it succeeds, the address is
1512 assigned to a suitable SMTP transport; if it does not succeed, the router is
1513 configured to fail the address.
1514 </para>
1515 <para>
1516 The second router is reached only when the domain is recognized as one that
1517 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1518 aliasing and forwarding. When it generates one or more new addresses from the
1519 original, each of them is routed independently from the start. Otherwise, the
1520 router may cause an address to fail, or it may simply decline to handle the
1521 address, in which case the address is passed to the next router.
1522 </para>
1523 <para>
1524 The final router in many configurations is one that checks to see if the
1525 address belongs to a local mailbox. The precondition may involve a check to
1526 see if the local part is the name of a login account, or it may look up the
1527 local part in a file or a database. If its preconditions are not met, or if
1528 the router declines, we have reached the end of the routers. When this happens,
1529 the address is bounced.
1530 </para>
1531 </section>
1532 <section id="SECID16">
1533 <title>Processing an address for verification</title>
1534 <para>
1535 <indexterm role="concept">
1536 <primary>router</primary>
1537 <secondary>for verification</secondary>
1538 </indexterm>
1539 <indexterm role="concept">
1540 <primary>verifying address</primary>
1541 <secondary>overview</secondary>
1542 </indexterm>
1543 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1544 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1545 one of the checks to be performed in an ACL for incoming messages, on both
1546 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1547 <option>-bvs</option> command line options.
1548 </para>
1549 <para>
1550 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1551 does not affect the way the routers work, but it is a state that can be
1552 detected. By this means, a router can be skipped or made to behave differently
1553 when verifying. A common example is a configuration in which the first router
1554 sends all messages to a message-scanning program, unless they have been
1555 previously scanned. Thus, the first router accepts all addresses without any
1556 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1557 would be set for such a router, causing it to be skipped in verify mode.
1558 </para>
1559 </section>
1560 <section id="SECTrunindrou">
1561 <title>Running an individual router</title>
1562 <para>
1563 <indexterm role="concept">
1564 <primary>router</primary>
1565 <secondary>running details</secondary>
1566 </indexterm>
1567 <indexterm role="concept">
1568 <primary>preconditions</primary>
1569 <secondary>checking</secondary>
1570 </indexterm>
1571 <indexterm role="concept">
1572 <primary>router</primary>
1573 <secondary>result of running</secondary>
1574 </indexterm>
1575 As explained in the example above, a number of preconditions are checked before
1576 running a router. If any are not met, the router is skipped, and the address is
1577 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1578 the router is run. What happens next depends on the outcome, which is one of
1579 the following:
1580 </para>
1581 <itemizedlist>
1582 <listitem>
1583 <para>
1584 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1585 transport, or generates one or more <quote>child</quote> addresses. Processing the
1586 original address ceases,
1587 <indexterm role="option">
1588 <primary><option>unseen</option></primary>
1589 </indexterm>
1590 unless the <option>unseen</option> option is set on the router. This option
1591 can be used to set up multiple deliveries with different routing (for example,
1592 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1593 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1594 end of routing.
1595 </para>
1596 <para>
1597 Any child addresses generated by the router are processed independently,
1598 starting with the first router by default. It is possible to change this by
1599 setting the <option>redirect_router</option> option to specify which router to start at for
1600 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1601 <option>redirect_router</option> may be anywhere in the router configuration.
1602 </para>
1603 </listitem>
1604 <listitem>
1605 <para>
1606 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1607 requests that the address be passed to another router. By default the address
1608 is passed to the next router, but this can be changed by setting the
1609 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1610 must be below the current router (to avoid loops).
1611 </para>
1612 </listitem>
1613 <listitem>
1614 <para>
1615 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1616 recognize it at all. By default, the address is passed to the next router, but
1617 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1618 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1619 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1620 </para>
1621 </listitem>
1622 <listitem>
1623 <para>
1624 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1625 the generation of a bounce message. There is no further processing of the
1626 original address unless <option>unseen</option> is set on the router.
1627 </para>
1628 </listitem>
1629 <listitem>
1630 <para>
1631 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1632 database may be offline, or a DNS lookup may have timed out.) No further
1633 processing of the address happens in this delivery attempt. It is tried again
1634 next time the message is considered for delivery.
1635 </para>
1636 </listitem>
1637 <listitem>
1638 <para>
1639 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1640 its configuration). The action is as for defer.
1641 </para>
1642 </listitem>
1643 </itemizedlist>
1644 <para>
1645 If an address reaches the end of the routers without having been accepted by
1646 any of them, it is bounced as unrouteable. The default error message in this
1647 situation is <quote>unrouteable address</quote>, but you can set your own message by
1648 making use of the <option>cannot_route_message</option> option. This can be set for any
1649 router; the value from the last router that <quote>saw</quote> the address is used.
1650 </para>
1651 <para>
1652 Sometimes while routing you want to fail a delivery when some conditions are
1653 met but others are not, instead of passing the address on for further routing.
1654 You can do this by having a second router that explicitly fails the delivery
1655 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1656 facility for this purpose.
1657 </para>
1658 </section>
1659 <section id="SECID17">
1660 <title>Duplicate addresses</title>
1661 <para>
1662 <indexterm role="concept">
1663 <primary>case of local parts</primary>
1664 </indexterm>
1665 <indexterm role="concept">
1666 <primary>address duplicate, discarding</primary>
1667 </indexterm>
1668 <indexterm role="concept">
1669 <primary>duplicate addresses</primary>
1670 </indexterm>
1671 Once routing is complete, Exim scans the addresses that are assigned to local
1672 and remote transports, and discards any duplicates that it finds. During this
1673 check, local parts are treated as case-sensitive. This happens only when
1674 actually delivering a message; when testing routers with <option>-bt</option>, all the
1675 routed addresses are shown.
1676 </para>
1677 </section>
1678 <section id="SECTrouprecon">
1679 <title>Router preconditions</title>
1680 <para>
1681 <indexterm role="concept">
1682 <primary>router</primary>
1683 <secondary>preconditions, order of processing</secondary>
1684 </indexterm>
1685 <indexterm role="concept">
1686 <primary>preconditions</primary>
1687 <secondary>order of processing</secondary>
1688 </indexterm>
1689 The preconditions that are tested for each router are listed below, in the
1690 order in which they are tested. The individual configuration options are
1691 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1692 </para>
1693 <itemizedlist>
1694 <listitem>
1695 <para>
1696 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1697 the local parts handled by the router may or must have certain prefixes and/or
1698 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1699 skipped. These conditions are tested first. When an affix is present, it is
1700 removed from the local part before further processing, including the evaluation
1701 of any other conditions.
1702 </para>
1703 </listitem>
1704 <listitem>
1705 <para>
1706 Routers can be designated for use only when not verifying an address, that is,
1707 only when routing it for delivery (or testing its delivery routing). If the
1708 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1709 address.
1710 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1711 <option>verify_recipient</option>, which independently control the use of the router for
1712 sender and recipient verification. You can set these options directly if
1713 you want a router to be used for only one type of verification.
1714 </para>
1715 </listitem>
1716 <listitem>
1717 <para>
1718 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1719 run with the <option>-bt</option> option to test an address routing. This can be helpful
1720 when the first router sends all new messages to a scanner of some sort; it
1721 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1722 having to simulate the effect of the scanner.
1723 </para>
1724 </listitem>
1725 <listitem>
1726 <para>
1727 Routers can be designated for use only when verifying an address, as
1728 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1729 </para>
1730 </listitem>
1731 <listitem>
1732 <para>
1733 Individual routers can be explicitly skipped when running the routers to
1734 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1735 </para>
1736 </listitem>
1737 <listitem>
1738 <para>
1739 If the <option>domains</option> option is set, the domain of the address must be in the set
1740 of domains that it defines.
1741 </para>
1742 </listitem>
1743 <listitem>
1744 <para>
1745 <indexterm role="variable">
1746 <primary><varname>$local_part_prefix</varname></primary>
1747 </indexterm>
1748 <indexterm role="variable">
1749 <primary><varname>$local_part</varname></primary>
1750 </indexterm>
1751 <indexterm role="variable">
1752 <primary><varname>$local_part_suffix</varname></primary>
1753 </indexterm>
1754 If the <option>local_parts</option> option is set, the local part of the address must be in
1755 the set of local parts that it defines. If <option>local_part_prefix</option> or
1756 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1757 part before this check. If you want to do precondition tests on local parts
1758 that include affixes, you can do so by using a <option>condition</option> option (see below)
1759 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1760 <varname>$local_part_suffix</varname> as necessary.
1761 </para>
1762 </listitem>
1763 <listitem>
1764 <para>
1765 <indexterm role="variable">
1766 <primary><varname>$local_user_uid</varname></primary>
1767 </indexterm>
1768 <indexterm role="variable">
1769 <primary><varname>$local_user_gid</varname></primary>
1770 </indexterm>
1771 <indexterm role="variable">
1772 <primary><varname>$home</varname></primary>
1773 </indexterm>
1774 If the <option>check_local_user</option> option is set, the local part must be the name of
1775 an account on the local host. If this check succeeds, the uid and gid of the
1776 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1777 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1778 remaining preconditions.
1779 </para>
1780 </listitem>
1781 <listitem>
1782 <para>
1783 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1784 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1785 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1786 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1787 could lead to confusion.
1788 </para>
1789 </listitem>
1790 <listitem>
1791 <para>
1792 If the <option>senders</option> option is set, the envelope sender address must be in the
1793 set of addresses that it defines.
1794 </para>
1795 </listitem>
1796 <listitem>
1797 <para>
1798 If the <option>require_files</option> option is set, the existence or non-existence of
1799 specified files is tested.
1800 </para>
1801 </listitem>
1802 <listitem>
1803 <para>
1804 <indexterm role="concept">
1805 <primary>customizing</primary>
1806 <secondary>precondition</secondary>
1807 </indexterm>
1808 If the <option>condition</option> option is set, it is evaluated and tested. This option
1809 uses an expanded string to allow you to set up your own custom preconditions.
1810 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1811 </para>
1812 </listitem>
1813 </itemizedlist>
1814 <para>
1815 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1816 it to check for the existence of a file in which to lookup up a domain, local
1817 part, or sender. However, as these options are all expanded, you can use the
1818 <option>exists</option> expansion condition to make such tests within each condition. The
1819 <option>require_files</option> option is intended for checking files that the router may be
1820 going to use internally, or which are needed by a specific transport (for
1821 example, <filename>.procmailrc</filename>).
1822 </para>
1823 </section>
1824 <section id="SECID18">
1825 <title>Delivery in detail</title>
1826 <para>
1827 <indexterm role="concept">
1828 <primary>delivery</primary>
1829 <secondary>in detail</secondary>
1830 </indexterm>
1831 When a message is to be delivered, the sequence of events is as follows:
1832 </para>
1833 <itemizedlist>
1834 <listitem>
1835 <para>
1836 If a system-wide filter file is specified, the message is passed to it. The
1837 filter may add recipients to the message, replace the recipients, discard the
1838 message, cause a new message to be generated, or cause the message delivery to
1839 fail. The format of the system filter file is the same as for Exim user filter
1840 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1841 filtering</emphasis>.
1842 <indexterm role="concept">
1843 <primary>Sieve filter</primary>
1844 <secondary>not available for system filter</secondary>
1845 </indexterm>
1846 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1847 </para>
1848 <para>
1849 Some additional features are available in system filters &ndash; see chapter
1850 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1851 filter only once per delivery attempt, however many recipients it has. However,
1852 if there are several delivery attempts because one or more addresses could not
1853 be immediately delivered, the system filter is run each time. The filter
1854 condition <option>first_delivery</option> can be used to detect the first run of the system
1855 filter.
1856 </para>
1857 </listitem>
1858 <listitem>
1859 <para>
1860 Each recipient address is offered to each configured router in turn, subject to
1861 its preconditions, until one is able to handle it. If no router can handle the
1862 address, that is, if they all decline, the address is failed. Because routers
1863 can be targeted at particular domains, several locally handled domains can be
1864 processed entirely independently of each other.
1865 </para>
1866 </listitem>
1867 <listitem>
1868 <para>
1869 <indexterm role="concept">
1870 <primary>routing</primary>
1871 <secondary>loops in</secondary>
1872 </indexterm>
1873 <indexterm role="concept">
1874 <primary>loop</primary>
1875 <secondary>while routing</secondary>
1876 </indexterm>
1877 A router that accepts an address may assign it to a local or a remote
1878 transport. However, the transport is not run at this time. Instead, the address
1879 is placed on a list for the particular transport, which will be run later.
1880 Alternatively, the router may generate one or more new addresses (typically
1881 from alias, forward, or filter files). New addresses are fed back into this
1882 process from the top, but in order to avoid loops, a router ignores any address
1883 which has an identically-named ancestor that was processed by itself.
1884 </para>
1885 </listitem>
1886 <listitem>
1887 <para>
1888 When all the routing has been done, addresses that have been successfully
1889 handled are passed to their assigned transports. When local transports are
1890 doing real local deliveries, they handle only one address at a time, but if a
1891 local transport is being used as a pseudo-remote transport (for example, to
1892 collect batched SMTP messages for transmission by some other means) multiple
1893 addresses can be handled. Remote transports can always handle more than one
1894 address at a time, but can be configured not to do so, or to restrict multiple
1895 addresses to the same domain.
1896 </para>
1897 </listitem>
1898 <listitem>
1899 <para>
1900 Each local delivery to a file or a pipe runs in a separate process under a
1901 non-privileged uid, and these deliveries are run one at a time. Remote
1902 deliveries also run in separate processes, normally under a uid that is private
1903 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1904 run in parallel. The maximum number of simultaneous remote deliveries for any
1905 one message is set by the <option>remote_max_parallel</option> option.
1906 The order in which deliveries are done is not defined, except that all local
1907 deliveries happen before any remote deliveries.
1908 </para>
1909 </listitem>
1910 <listitem>
1911 <para>
1912 <indexterm role="concept">
1913 <primary>queue runner</primary>
1914 </indexterm>
1915 When it encounters a local delivery during a queue run, Exim checks its retry
1916 database to see if there has been a previous temporary delivery failure for the
1917 address before running the local transport. If there was a previous failure,
1918 Exim does not attempt a new delivery until the retry time for the address is
1919 reached. However, this happens only for delivery attempts that are part of a
1920 queue run. Local deliveries are always attempted when delivery immediately
1921 follows message reception, even if retry times are set for them. This makes for
1922 better behaviour if one particular message is causing problems (for example,
1923 causing quota overflow, or provoking an error in a filter file).
1924 </para>
1925 </listitem>
1926 <listitem>
1927 <para>
1928 <indexterm role="concept">
1929 <primary>delivery</primary>
1930 <secondary>retry in remote transports</secondary>
1931 </indexterm>
1932 Remote transports do their own retry handling, since an address may be
1933 deliverable to one of a number of hosts, each of which may have a different
1934 retry time. If there have been previous temporary failures and no host has
1935 reached its retry time, no delivery is attempted, whether in a queue run or
1936 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1937 </para>
1938 </listitem>
1939 <listitem>
1940 <para>
1941 If there were any permanent errors, a bounce message is returned to an
1942 appropriate address (the sender in the common case), with details of the error
1943 for each failing address. Exim can be configured to send copies of bounce
1944 messages to other addresses.
1945 </para>
1946 </listitem>
1947 <listitem>
1948 <para>
1949 <indexterm role="concept">
1950 <primary>delivery</primary>
1951 <secondary>deferral</secondary>
1952 </indexterm>
1953 If one or more addresses suffered a temporary failure, the message is left on
1954 the queue, to be tried again later. Delivery of these addresses is said to be
1955 <emphasis>deferred</emphasis>.
1956 </para>
1957 </listitem>
1958 <listitem>
1959 <para>
1960 When all the recipient addresses have either been delivered or bounced,
1961 handling of the message is complete. The spool files and message log are
1962 deleted, though the message log can optionally be preserved if required.
1963 </para>
1964 </listitem>
1965 </itemizedlist>
1966 </section>
1967 <section id="SECID19">
1968 <title>Retry mechanism</title>
1969 <para>
1970 <indexterm role="concept">
1971 <primary>delivery</primary>
1972 <secondary>retry mechanism</secondary>
1973 </indexterm>
1974 <indexterm role="concept">
1975 <primary>retry</primary>
1976 <secondary>description of mechanism</secondary>
1977 </indexterm>
1978 <indexterm role="concept">
1979 <primary>queue runner</primary>
1980 </indexterm>
1981 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
1982 attempt is the queue runner process. You must either run an Exim daemon that
1983 uses the <option>-q</option> option with a time interval to start queue runners at regular
1984 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
1985 not arrange for queue runners to be run, messages that fail temporarily at the
1986 first attempt will remain on your queue for ever. A queue runner process works
1987 its way through the queue, one message at a time, trying each delivery that has
1988 passed its retry time.
1989 You can run several queue runners at once.
1990 </para>
1991 <para>
1992 Exim uses a set of configured rules to determine when next to retry the failing
1993 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
1994 should give up trying to deliver to the address, at which point it generates a
1995 bounce message. If no retry rules are set for a particular host, address, and
1996 error combination, no retries are attempted, and temporary errors are treated
1997 as permanent.
1998 </para>
1999 </section>
2000 <section id="SECID20">
2001 <title>Temporary delivery failure</title>
2002 <para>
2003 <indexterm role="concept">
2004 <primary>delivery</primary>
2005 <secondary>temporary failure</secondary>
2006 </indexterm>
2007 There are many reasons why a message may not be immediately deliverable to a
2008 particular address. Failure to connect to a remote machine (because it, or the
2009 connection to it, is down) is one of the most common. Temporary failures may be
2010 detected during routing as well as during the transport stage of delivery.
2011 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2012 is on a file system where the user is over quota. Exim can be configured to
2013 impose its own quotas on local mailboxes; where system quotas are set they will
2014 also apply.
2015 </para>
2016 <para>
2017 If a host is unreachable for a period of time, a number of messages may be
2018 waiting for it by the time it recovers, and sending them in a single SMTP
2019 connection is clearly beneficial. Whenever a delivery to a remote host is
2020 deferred,
2021 </para>
2022 <para>
2023 <indexterm role="concept">
2024 <primary>hints database</primary>
2025 </indexterm>
2026 Exim makes a note in its hints database, and whenever a successful
2027 SMTP delivery has happened, it looks to see if any other messages are waiting
2028 for the same host. If any are found, they are sent over the same SMTP
2029 connection, subject to a configuration limit as to the maximum number in any
2030 one connection.
2031 </para>
2032 </section>
2033 <section id="SECID21">
2034 <title>Permanent delivery failure</title>
2035 <para>
2036 <indexterm role="concept">
2037 <primary>delivery</primary>
2038 <secondary>permanent failure</secondary>
2039 </indexterm>
2040 <indexterm role="concept">
2041 <primary>bounce message</primary>
2042 <secondary>when generated</secondary>
2043 </indexterm>
2044 When a message cannot be delivered to some or all of its intended recipients, a
2045 bounce message is generated. Temporary delivery failures turn into permanent
2046 errors when their timeout expires. All the addresses that fail in a given
2047 delivery attempt are listed in a single message. If the original message has
2048 many recipients, it is possible for some addresses to fail in one delivery
2049 attempt and others to fail subsequently, giving rise to more than one bounce
2050 message. The wording of bounce messages can be customized by the administrator.
2051 See chapter <xref linkend="CHAPemsgcust"/> for details.
2052 </para>
2053 <para>
2054 <indexterm role="concept">
2055 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2056 </indexterm>
2057 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2058 failed addresses, for the benefit of programs that try to analyse such messages
2059 automatically.
2060 </para>
2061 <para>
2062 <indexterm role="concept">
2063 <primary>bounce message</primary>
2064 <secondary>recipient of</secondary>
2065 </indexterm>
2066 A bounce message is normally sent to the sender of the original message, as
2067 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2068 address given in the MAIL command. However, when an address is expanded via a
2069 forward or alias file, an alternative address can be specified for delivery
2070 failures of the generated addresses. For a mailing list expansion (see section
2071 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2072 of the list.
2073 </para>
2074 </section>
2075 <section id="SECID22">
2076 <title>Failures to deliver bounce messages</title>
2077 <para>
2078 <indexterm role="concept">
2079 <primary>bounce message</primary>
2080 <secondary>failure to deliver</secondary>
2081 </indexterm>
2082 If a bounce message (either locally generated or received from a remote host)
2083 itself suffers a permanent delivery failure, the message is left on the queue,
2084 but it is frozen, awaiting the attention of an administrator. There are options
2085 that can be used to make Exim discard such failed messages, or to keep them
2086 for only a short time (see <option>timeout_frozen_after</option> and
2087 <option>ignore_bounce_errors_after</option>).
2088 </para>
2089 </section>
2090 </chapter>
2091
2092 <chapter id="CHID3">
2093 <title>Building and installing Exim</title>
2094 <para>
2095 <indexterm role="concept" id="IIDbuex" class="startofrange">
2096 <primary>building Exim</primary>
2097 </indexterm>
2098 </para>
2099 <section id="SECID23">
2100 <title>Unpacking</title>
2101 <para>
2102 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2103 creates a directory with the name of the current release (for example,
2104 <filename>exim-4.68</filename>) into which the following files are placed:
2105 </para>
2106 <informaltable frame="none">
2107 <tgroup cols="2" colsep="0" rowsep="0">
2108 <colspec colwidth="140pt" align="left"/>
2109 <colspec colwidth="254pt" align="left"/>
2110 <tbody>
2111 <row>
2112 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2113 <entry>contains some acknowledgments</entry>
2114 </row>
2115 <row>
2116 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2117 <entry>contains a reference to where changes are documented</entry>
2118 </row>
2119 <row>
2120 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2121 <entry>the GNU General Public Licence</entry>
2122 </row>
2123 <row>
2124 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2125 <entry>top-level make file</entry>
2126 </row>
2127 <row>
2128 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2129 <entry>conditions for the use of Exim</entry>
2130 </row>
2131 <row>
2132 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2133 <entry>list of files, directories and simple build instructions</entry>
2134 </row>
2135 </tbody>
2136 </tgroup>
2137 </informaltable>
2138 <para>
2139 Other files whose names begin with <filename>README</filename> may also be present. The
2140 following subdirectories are created:
2141 </para>
2142 <informaltable frame="none">
2143 <tgroup cols="2" colsep="0" rowsep="0">
2144 <colspec colwidth="140pt" align="left"/>
2145 <colspec colwidth="254pt" align="left"/>
2146 <tbody>
2147 <row>
2148 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2149 <entry>an empty directory for local configuration files</entry>
2150 </row>
2151 <row>
2152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2153 <entry>OS-specific files</entry>
2154 </row>
2155 <row>
2156 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2157 <entry>documentation files</entry>
2158 </row>
2159 <row>
2160 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2161 <entry>source files for the Exim monitor</entry>
2162 </row>
2163 <row>
2164 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2165 <entry>scripts used in the build process</entry>
2166 </row>
2167 <row>
2168 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2169 <entry>remaining source files</entry>
2170 </row>
2171 <row>
2172 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2173 <entry>independent utilities</entry>
2174 </row>
2175 </tbody>
2176 </tgroup>
2177 </informaltable>
2178 <para>
2179 The main utility programs are contained in the <filename>src</filename> directory, and are built
2180 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2181 that may be useful to some sites.
2182 </para>
2183 </section>
2184 <section id="SECID24">
2185 <title>Multiple machine architectures and operating systems</title>
2186 <para>
2187 <indexterm role="concept">
2188 <primary>building Exim</primary>
2189 <secondary>multiple OS/architectures</secondary>
2190 </indexterm>
2191 The building process for Exim is arranged to make it easy to build binaries for
2192 a number of different architectures and operating systems from the same set of
2193 source files. Compilation does not take place in the <filename>src</filename> directory.
2194 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2195 system.
2196 <indexterm role="concept">
2197 <primary>symbolic link</primary>
2198 <secondary>to build directory</secondary>
2199 </indexterm>
2200 Symbolic links to the sources are installed in this directory, which is where
2201 the actual building takes place. In most cases, Exim can discover the machine
2202 architecture and operating system for itself, but the defaults can be
2203 overridden if necessary.
2204 </para>
2205 </section>
2206 <section id="SECTdb">
2207 <title>DBM libraries</title>
2208 <para>
2209 <indexterm role="concept">
2210 <primary>DBM libraries</primary>
2211 <secondary>discussion of</secondary>
2212 </indexterm>
2213 <indexterm role="concept">
2214 <primary>hints database</primary>
2215 <secondary>DBM files used for</secondary>
2216 </indexterm>
2217 Even if you do not use any DBM files in your configuration, Exim still needs a
2218 DBM library in order to operate, because it uses indexed files for its hints
2219 databases. Unfortunately, there are a number of DBM libraries in existence, and
2220 different operating systems often have different ones installed.
2221 </para>
2222 <para>
2223 <indexterm role="concept">
2224 <primary>Solaris</primary>
2225 <secondary>DBM library for</secondary>
2226 </indexterm>
2227 <indexterm role="concept">
2228 <primary>IRIX, DBM library for</primary>
2229 </indexterm>
2230 <indexterm role="concept">
2231 <primary>BSD, DBM library for</primary>
2232 </indexterm>
2233 <indexterm role="concept">
2234 <primary>Linux, DBM library for</primary>
2235 </indexterm>
2236 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2237 Linux distribution, the DBM configuration should happen automatically, and you
2238 may be able to ignore this section. Otherwise, you may have to learn more than
2239 you would like about DBM libraries from what follows.
2240 </para>
2241 <para>
2242 <indexterm role="concept">
2243 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2244 </indexterm>
2245 Licensed versions of Unix normally contain a library of DBM functions operating
2246 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2247 versions of Unix seem to vary in what they contain as standard. In particular,
2248 some early versions of Linux have no default DBM library, and different
2249 distributors have chosen to bundle different libraries with their packaged
2250 versions. However, the more recent releases seem to have standardized on the
2251 Berkeley DB library.
2252 </para>
2253 <para>
2254 Different DBM libraries have different conventions for naming the files they
2255 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2256 possibilities:
2257 </para>
2258 <orderedlist numeration="arabic">
2259 <listitem>
2260 <para>
2261 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2262 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2263 </para>
2264 </listitem>
2265 <listitem>
2266 <para>
2267 <indexterm role="concept">
2268 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2269 </indexterm>
2270 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2271 compatibility interface it makes two different hard links to it with names
2272 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2273 file name is used unmodified.
2274 </para>
2275 </listitem>
2276 <listitem>
2277 <para>
2278 <indexterm role="concept">
2279 <primary>Berkeley DB library</primary>
2280 </indexterm>
2281 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2282 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2283 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2284 </para>
2285 </listitem>
2286 <listitem>
2287 <para>
2288 If the Berkeley package is used in its native mode, it operates on a single
2289 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2290 the traditional <emphasis>ndbm</emphasis> interface.
2291 </para>
2292 </listitem>
2293 <listitem>
2294 <para>
2295 To complicate things further, there are several very different versions of the
2296 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2297 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2298 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2299 versions of Berkeley DB can be obtained from
2300 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2301 </para>
2302 </listitem>
2303 <listitem>
2304 <para>
2305 <indexterm role="concept">
2306 <primary><emphasis>tdb</emphasis> DBM library</primary>
2307 </indexterm>
2308 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2309 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2310 operates on a single file.
2311 </para>
2312 </listitem>
2313 </orderedlist>
2314 <para>
2315 <indexterm role="concept">
2316 <primary>USE_DB</primary>
2317 </indexterm>
2318 <indexterm role="concept">
2319 <primary>DBM libraries</primary>
2320 <secondary>configuration for building</secondary>
2321 </indexterm>
2322 Exim and its utilities can be compiled to use any of these interfaces. In order
2323 to use any version of the Berkeley DB package in native mode, you must set
2324 USE_DB in an appropriate configuration file (typically
2325 <filename>Local/Makefile</filename>). For example:
2326 </para>
2327 <literallayout class="monospaced">
2328 USE_DB=yes
2329 </literallayout>
2330 <para>
2331 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2332 error is diagnosed if you set more than one of these.
2333 </para>
2334 <para>
2335 At the lowest level, the build-time configuration sets none of these options,
2336 thereby assuming an interface of type (1). However, some operating system
2337 configuration files (for example, those for the BSD operating systems and
2338 Linux) assume type (4) by setting USE_DB as their default, and the
2339 configuration files for Cygwin set USE_GDBM. Anything you set in
2340 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2341 </para>
2342 <para>
2343 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2344 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2345 in one of these lines:
2346 </para>
2347 <literallayout class="monospaced">
2348 DBMLIB = -ldb
2349 DBMLIB = -ltdb
2350 </literallayout>
2351 <para>
2352 Settings like that will work if the DBM library is installed in the standard
2353 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2354 the default path. You may need to set INCLUDE to specify where the header
2355 file is, and to specify the path to the library more fully in DBMLIB, as in
2356 this example:
2357 </para>
2358 <literallayout class="monospaced">
2359 INCLUDE=-I/usr/local/include/db-4.1
2360 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2361 </literallayout>
2362 <para>
2363 There is further detailed discussion about the various DBM libraries in the
2364 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2365 </para>
2366 </section>
2367 <section id="SECID25">
2368 <title>Pre-building configuration</title>
2369 <para>
2370 <indexterm role="concept">
2371 <primary>building Exim</primary>
2372 <secondary>pre-building configuration</secondary>
2373 </indexterm>
2374 <indexterm role="concept">
2375 <primary>configuration for building Exim</primary>
2376 </indexterm>
2377 <indexterm role="concept">
2378 <primary><filename>Local/Makefile</filename></primary>
2379 </indexterm>
2380 <indexterm role="concept">
2381 <primary><filename>src/EDITME</filename></primary>
2382 </indexterm>
2383 Before building Exim, a local configuration file that specifies options
2384 independent of any operating system has to be created with the name
2385 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2386 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2387 therein. These descriptions are therefore not repeated here. If you are
2388 building Exim for the first time, the simplest thing to do is to copy
2389 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2390 </para>
2391 <para>
2392 There are three settings that you must supply, because Exim will not build
2393 without them. They are the location of the run time configuration file
2394 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2395 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2396 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2397 a colon-separated list of file names; Exim uses the first of them that exists.
2398 </para>
2399 <para>
2400 There are a few other parameters that can be specified either at build time or
2401 at run time, to enable the same binary to be used on a number of different
2402 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2403 directory (if not within the spool directory) are fixed, it is recommended that
2404 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2405 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2406 be logged.
2407 </para>
2408 <para>
2409 <indexterm role="concept">
2410 <primary>content scanning</primary>
2411 <secondary>specifying at build time</secondary>
2412 </indexterm>
2413 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2414 access control lists are not compiled by default. If you want to include these
2415 facilities, you need to set
2416 </para>
2417 <literallayout class="monospaced">
2418 WITH_CONTENT_SCAN=yes
2419 </literallayout>
2420 <para>
2421 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2422 chapter <xref linkend="CHAPexiscan"/>.
2423 </para>
2424 <para>
2425 <indexterm role="concept">
2426 <primary><filename>Local/eximon.conf</filename></primary>
2427 </indexterm>
2428 <indexterm role="concept">
2429 <primary><filename>exim_monitor/EDITME</filename></primary>
2430 </indexterm>
2431 If you are going to build the Exim monitor, a similar configuration process is
2432 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2433 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2434 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2435 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2436 </para>
2437 <para>
2438 This is all the configuration that is needed in straightforward cases for known
2439 operating systems. However, the building process is set up so that it is easy
2440 to override options that are set by default or by operating-system-specific
2441 configuration files, for example to change the name of the C compiler, which
2442 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2443 do this.
2444 </para>
2445 </section>
2446 <section id="SECID26">
2447 <title>Support for iconv()</title>
2448 <para>
2449 <indexterm role="concept">
2450 <primary><function>iconv()</function> support</primary>
2451 </indexterm>
2452 <indexterm role="concept">
2453 <primary>RFC 2047</primary>
2454 </indexterm>
2455 The contents of header lines in messages may be encoded according to the rules
2456 described RFC 2047. This makes it possible to transmit characters that are not
2457 in the ASCII character set, and to label them as being in a particular
2458 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2459 mechanism, it decodes them, and translates them into a specified character set
2460 (default ISO-8859-1). The translation is possible only if the operating system
2461 supports the <function>iconv()</function> function.
2462 </para>
2463 <para>
2464 However, some of the operating systems that supply <function>iconv()</function> do not support
2465 very many conversions. The GNU <option>libiconv</option> library (available from
2466 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2467 systems to remedy this deficiency, as well as on systems that do not supply
2468 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2469 </para>
2470 <literallayout class="monospaced">
2471 HAVE_ICONV=yes
2472 </literallayout>
2473 <para>
2474 to your <filename>Local/Makefile</filename> and rebuild Exim.
2475 </para>
2476 </section>
2477 <section id="SECTinctlsssl">
2478 <title>Including TLS/SSL encryption support</title>
2479 <para>
2480 <indexterm role="concept">
2481 <primary>TLS</primary>
2482 <secondary>including support for TLS</secondary>
2483 </indexterm>
2484 <indexterm role="concept">
2485 <primary>encryption</primary>
2486 <secondary>including support for</secondary>
2487 </indexterm>
2488 <indexterm role="concept">
2489 <primary>SUPPORT_TLS</primary>
2490 </indexterm>
2491 <indexterm role="concept">
2492 <primary>OpenSSL</primary>
2493 <secondary>building Exim with</secondary>
2494 </indexterm>
2495 <indexterm role="concept">
2496 <primary>GnuTLS</primary>
2497 <secondary>building Exim with</secondary>
2498 </indexterm>
2499 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2500 command as per RFC 2487. It can also support legacy clients that expect to
2501 start a TLS session immediately on connection to a non-standard port (see the
2502 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2503 line option).
2504 </para>
2505 <para>
2506 If you want to build Exim with TLS support, you must first install either the
2507 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2508 implementing SSL.
2509 </para>
2510 <para>
2511 If OpenSSL is installed, you should set
2512 </para>
2513 <literallayout class="monospaced">
2514 SUPPORT_TLS=yes
2515 TLS_LIBS=-lssl -lcrypto
2516 </literallayout>
2517 <para>
2518 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2519 OpenSSL library and include files. For example:
2520 </para>
2521 <literallayout class="monospaced">
2522 SUPPORT_TLS=yes
2523 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2524 TLS_INCLUDE=-I/usr/local/openssl/include/
2525 </literallayout>
2526 <para>
2527 <indexterm role="concept">
2528 <primary>USE_GNUTLS</primary>
2529 </indexterm>
2530 If GnuTLS is installed, you should set
2531 </para>
2532 <literallayout class="monospaced">
2533 SUPPORT_TLS=yes
2534 USE_GNUTLS=yes
2535 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2536 </literallayout>
2537 <para>
2538 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2539 library and include files. For example:
2540 </para>
2541 <literallayout class="monospaced">
2542 SUPPORT_TLS=yes
2543 USE_GNUTLS=yes
2544 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2545 TLS_INCLUDE=-I/usr/gnu/include
2546 </literallayout>
2547 <para>
2548 You do not need to set TLS_INCLUDE if the relevant directory is already
2549 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2550 given in chapter <xref linkend="CHAPTLS"/>.
2551 </para>
2552 </section>
2553 <section id="SECID27">
2554 <title>Use of tcpwrappers</title>
2555 <para>
2556 <indexterm role="concept">
2557 <primary>tcpwrappers, building Exim to support</primary>
2558 </indexterm>
2559 <indexterm role="concept">
2560 <primary>USE_TCP_WRAPPERS</primary>
2561 </indexterm>
2562 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2563 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2564 alternative to Exim&#x2019;s own checking facilities for installations that are
2565 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2566 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2567 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2568 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2569 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2570 you might have
2571 </para>
2572 <literallayout class="monospaced">
2573 USE_TCP_WRAPPERS=yes
2574 CFLAGS=-O -I/usr/local/include
2575 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2576 </literallayout>
2577 <para>
2578 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2579 <quote>exim</quote>. For example, the line
2580 </para>
2581 <literallayout class="monospaced">
2582 exim : LOCAL  192.168.1.  .friendly.domain.example
2583 </literallayout>
2584 <para>
2585 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2586 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2587 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2588 further details.
2589 </para>
2590 </section>
2591 <section id="SECID28">
2592 <title>Including support for IPv6</title>
2593 <para>
2594 <indexterm role="concept">
2595 <primary>IPv6</primary>
2596 <secondary>including support for</secondary>
2597 </indexterm>
2598 Exim contains code for use on systems that have IPv6 support. Setting
2599 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2600 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2601 where the IPv6 support is not fully integrated into the normal include and
2602 library files.
2603 </para>
2604 <para>
2605 Two different types of DNS record for handling IPv6 addresses have been
2606 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2607 currently seen as the mainstream. Another record type called A6 was proposed
2608 as better than AAAA because it had more flexibility. However, it was felt to be
2609 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2610 if anyone is actually using A6 records. Exim has support for A6 records, but
2611 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2612 support has not been tested for some time.
2613 </para>
2614 </section>
2615 <section id="SECID29">
2616 <title>The building process</title>
2617 <para>
2618 <indexterm role="concept">
2619 <primary>build directory</primary>
2620 </indexterm>
2621 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2622 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2623 operating system types, and creates a build directory if one does not exist.
2624 For example, on a Sun system running Solaris 8, the directory
2625 <filename>build-SunOS5-5.8-sparc</filename> is created.
2626 <indexterm role="concept">
2627 <primary>symbolic link</primary>
2628 <secondary>to source files</secondary>
2629 </indexterm>
2630 Symbolic links to relevant source files are installed in the build directory.
2631 </para>
2632 <para>
2633 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2634 building process fails if it is set.
2635 </para>
2636 <para>
2637 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2638 a make file inside the build directory, using the configuration files from the
2639 <filename>Local</filename> directory. The new make file is then passed to another instance of
2640 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2641 then compiling and linking the binaries for the Exim monitor (if configured), a
2642 number of utility programs, and finally Exim itself. The command <literal>make
2643 makefile</literal> can be used to force a rebuild of the make file in the build
2644 directory, should this ever be necessary.
2645 </para>
2646 <para>
2647 If you have problems building Exim, check for any comments there may be in the
2648 <filename>README</filename> file concerning your operating system, and also take a look at the
2649 FAQ, where some common problems are covered.
2650 </para>
2651 </section>
2652 <section id="SECID283">
2653 <title>Output from <quote>make</quote></title>
2654 <para>
2655 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2656 unreadable, because these lines can be very long. For this reason, the normal
2657 output is suppressed by default, and instead output similar to that which
2658 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2659 each module that is being compiled or linked. However, it is still possible to
2660 get the full output, by calling <emphasis>make</emphasis> like this:
2661 </para>
2662 <literallayout class="monospaced">
2663 FULLECHO='' make -e
2664 </literallayout>
2665 <para>
2666 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2667 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2668 given in addition to the short output.
2669 </para>
2670 </section>
2671 <section id="SECToverride">
2672 <title>Overriding build-time options for Exim</title>
2673 <para>
2674 <indexterm role="concept">
2675 <primary>build-time options, overriding</primary>
2676 </indexterm>
2677 The main make file that is created at the beginning of the building process
2678 consists of the concatenation of a number of files which set configuration
2679 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2680 more than once, the last setting overrides any previous ones. This provides a
2681 convenient way of overriding defaults. The files that are concatenated are, in
2682 order:
2683 </para>
2684 <literallayout>
2685 <filename>OS/Makefile-Default</filename>
2686 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2687 <filename>Local/Makefile</filename>
2688 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2689 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2690 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2691 <filename>OS/Makefile-Base</filename>
2692 </literallayout>
2693 <para>
2694 <indexterm role="concept">
2695 <primary><filename>Local/Makefile</filename></primary>
2696 </indexterm>
2697 <indexterm role="concept">
2698 <primary>building Exim</primary>
2699 <secondary>operating system type</secondary>
2700 </indexterm>
2701 <indexterm role="concept">
2702 <primary>building Exim</primary>
2703 <secondary>architecture type</secondary>
2704 </indexterm>
2705 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2706 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2707 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2708 and are often not needed.
2709 </para>
2710 <para>
2711 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2712 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2713 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2714 values are used, thereby providing a means of forcing particular settings.
2715 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2716 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2717 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2718 that Exim expects. You can run these scripts directly from the shell in order
2719 to find out what values are being used on your system.
2720 </para>
2721 <para>
2722 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2723 therein. Some (but not all) are mentioned below. If there is something that
2724 needs changing, review the contents of this file and the contents of the make
2725 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2726 default values are.
2727 </para>
2728 <para>
2729 <indexterm role="concept">
2730 <primary>building Exim</primary>
2731 <secondary>overriding default settings</secondary>
2732 </indexterm>
2733 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2734 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2735 need to change the original files. Instead, you should make the changes by
2736 putting the new values in an appropriate <filename>Local</filename> file. For example,
2737 <indexterm role="concept">
2738 <primary>Tru64-Unix build-time settings</primary>
2739 </indexterm>
2740 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2741 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2742 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2743 called with the option <option>-std1</option>, to make it recognize some of the features of
2744 Standard C that Exim uses. (Most other compilers recognize Standard C by
2745 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2746 containing the lines
2747 </para>
2748 <literallayout class="monospaced">
2749 CC=cc
2750 CFLAGS=-std1
2751 </literallayout>
2752 <para>
2753 If you are compiling for just one operating system, it may be easier to put
2754 these lines directly into <filename>Local/Makefile</filename>.
2755 </para>
2756 <para>
2757 Keeping all your local configuration settings separate from the distributed
2758 files makes it easy to transfer them to new versions of Exim simply by copying
2759 the contents of the <filename>Local</filename> directory.
2760 </para>
2761 <para>
2762 <indexterm role="concept">
2763 <primary>NIS lookup type</primary>
2764 <secondary>including support for</secondary>
2765 </indexterm>
2766 <indexterm role="concept">
2767 <primary>NIS+ lookup type</primary>
2768 <secondary>including support for</secondary>
2769 </indexterm>
2770 <indexterm role="concept">
2771 <primary>LDAP</primary>
2772 <secondary>including support for</secondary>
2773 </indexterm>
2774 <indexterm role="concept">
2775 <primary>lookup</primary>
2776 <secondary>inclusion in binary</secondary>
2777 </indexterm>
2778 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2779 lookup, but not all systems have these components installed, so the default is
2780 not to include the relevant code in the binary. All the different kinds of file
2781 and database lookup that Exim supports are implemented as separate code modules
2782 which are included only if the relevant compile-time options are set. In the
2783 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2784 </para>
2785 <literallayout class="monospaced">
2786 LOOKUP_LDAP=yes
2787 LOOKUP_NIS=yes
2788 LOOKUP_NISPLUS=yes
2789 </literallayout>
2790 <para>
2791 and similar settings apply to the other lookup types. They are all listed in
2792 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2793 libraries need to be installed before compiling Exim.
2794 <indexterm role="concept">
2795 <primary>cdb</primary>
2796 <secondary>including support for</secondary>
2797 </indexterm>
2798 However, there are some optional lookup types (such as cdb) for which
2799 the code is entirely contained within Exim, and no external include
2800 files or libraries are required. When a lookup type is not included in the
2801 binary, attempts to configure Exim to use it cause run time configuration
2802 errors.
2803 </para>
2804 <para>
2805 <indexterm role="concept">
2806 <primary>Perl</primary>
2807 <secondary>including support for</secondary>
2808 </indexterm>
2809 Exim can be linked with an embedded Perl interpreter, allowing Perl
2810 subroutines to be called during string expansion. To enable this facility,
2811 </para>
2812 <literallayout class="monospaced">
2813 EXIM_PERL=perl.o
2814 </literallayout>
2815 <para>
2816 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2817 chapter <xref linkend="CHAPperl"/>.
2818 </para>
2819 <para>
2820 <indexterm role="concept">
2821 <primary>X11 libraries, location of</primary>
2822 </indexterm>
2823 The location of the X11 libraries is something that varies a lot between
2824 operating systems, and there may be different versions of X11 to cope
2825 with. Exim itself makes no use of X11, but if you are compiling the Exim
2826 monitor, the X11 libraries must be available.
2827 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2828 </para>
2829 <literallayout class="monospaced">
2830 X11=/usr/X11R6
2831 XINCLUDE=-I$(X11)/include
2832 XLFLAGS=-L$(X11)/lib
2833 </literallayout>
2834 <para>
2835 These are overridden in some of the operating-system configuration files. For
2836 example, in <filename>OS/Makefile-SunOS5</filename> there is
2837 </para>
2838 <literallayout class="monospaced">
2839 X11=/usr/openwin
2840 XINCLUDE=-I$(X11)/include
2841 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2842 </literallayout>
2843 <para>
2844 If you need to override the default setting for your operating system, place a
2845 definition of all three of these variables into your
2846 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2847 </para>
2848 <para>
2849 <indexterm role="concept">
2850 <primary>EXTRALIBS</primary>
2851 </indexterm>
2852 If you need to add any extra libraries to the link steps, these can be put in a
2853 variable called EXTRALIBS, which appears in all the link commands, but by
2854 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2855 command for linking the main Exim binary, and not for any associated utilities.
2856 </para>
2857 <para>
2858 <indexterm role="concept">
2859 <primary>DBM libraries</primary>
2860 <secondary>configuration for building</secondary>
2861 </indexterm>
2862 There is also DBMLIB, which appears in the link commands for binaries that
2863 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2864 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2865 binary, and which can be used, for example, to include additional X11
2866 libraries.
2867 </para>
2868 <para>
2869 <indexterm role="concept">
2870 <primary>configuration file</primary>
2871 <secondary>editing</secondary>
2872 </indexterm>
2873 The make file copes with rebuilding Exim correctly if any of the configuration
2874 files are edited. However, if an optional configuration file is deleted, it is
2875 necessary to touch the associated non-optional file (that is,
2876 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2877 </para>
2878 </section>
2879 <section id="SECID30">
2880 <title>OS-specific header files</title>
2881 <para>
2882 <indexterm role="concept">
2883 <primary><filename>os.h</filename></primary>
2884 </indexterm>
2885 <indexterm role="concept">
2886 <primary>building Exim</primary>
2887 <secondary>OS-specific C header files</secondary>
2888 </indexterm>
2889 The <filename>OS</filename> directory contains a number of files with names of the form
2890 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
2891 normally need to be changed. There is a list of macro settings that are
2892 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2893 are porting Exim to a new operating system.
2894 </para>
2895 </section>
2896 <section id="SECID31">
2897 <title>Overriding build-time options for the monitor</title>
2898 <para>
2899 <indexterm role="concept">
2900 <primary>building Eximon</primary>
2901 </indexterm>
2902 A similar process is used for overriding things when building the Exim monitor,
2903 where the files that are involved are
2904 </para>
2905 <literallayout>
2906 <filename>OS/eximon.conf-Default</filename>
2907 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2908 <filename>Local/eximon.conf</filename>
2909 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2910 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2911 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2912 </literallayout>
2913 <para>
2914 <indexterm role="concept">
2915 <primary><filename>Local/eximon.conf</filename></primary>
2916 </indexterm>
2917 As with Exim itself, the final three files need not exist, and in this case the
2918 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
2919 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2920 variables of the same name, preceded by EXIMON_. For example, setting
2921 EXIMON_LOG_DEPTH in the environment overrides the value of
2922 LOG_DEPTH at run time.
2923 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2924 </para>
2925 </section>
2926 <section id="SECID32">
2927 <title>Installing Exim binaries and scripts</title>
2928 <para>
2929 <indexterm role="concept">
2930 <primary>installing Exim</primary>
2931 </indexterm>
2932 <indexterm role="concept">
2933 <primary>BIN_DIRECTORY</primary>
2934 </indexterm>
2935 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2936 arguments. The script copies binaries and utility scripts into the directory
2937 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2938 <indexterm role="concept">
2939 <primary>setuid</primary>
2940 <secondary>installing Exim with</secondary>
2941 </indexterm>
2942 The install script copies files only if they are newer than the files they are
2943 going to replace. The Exim binary is required to be owned by root and have the
2944 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2945 install</literal> as root so that it can set up the Exim binary in this way. However, in
2946 some special situations (for example, if a host is doing no local deliveries)
2947 it may be possible to run Exim without making the binary setuid root (see
2948 chapter <xref linkend="CHAPsecurity"/> for details).
2949 </para>
2950 <para>
2951 <indexterm role="concept">
2952 <primary>CONFIGURE_FILE</primary>
2953 </indexterm>
2954 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
2955 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2956 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2957 by the installation script. If a run time configuration file already exists, it
2958 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2959 alternative files, no default is installed.
2960 </para>
2961 <para>
2962 <indexterm role="concept">
2963 <primary>system aliases file</primary>
2964 </indexterm>
2965 <indexterm role="concept">
2966 <primary><filename>/etc/aliases</filename></primary>
2967 </indexterm>
2968 One change is made to the default configuration file when it is installed: the
2969 default configuration contains a router that references a system aliases file.
2970 The path to this file is set to the value specified by
2971 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
2972 If the system aliases file does not exist, the installation script creates it,
2973 and outputs a comment to the user.
2974 </para>
2975 <para>
2976 The created file contains no aliases, but it does contain comments about the
2977 aliases a site should normally have. Mail aliases have traditionally been
2978 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
2979 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
2980 Exim&#x2019;s configuration if necessary.
2981 </para>
2982 <para>
2983 The default configuration uses the local host&#x2019;s name as the only local domain,
2984 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
2985 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
2986 directories are supported, but no NIS or NIS+ support is configured. Domains
2987 other than the name of the local host are routed using the DNS, with delivery
2988 over SMTP.
2989 </para>
2990 <para>
2991 It is possible to install Exim for special purposes (such as building a binary
2992 distribution) in a private part of the file system. You can do this by a
2993 command such as
2994 </para>
2995 <literallayout class="monospaced">
2996 make DESTDIR=/some/directory/ install
2997 </literallayout>
2998 <para>
2999 This has the effect of pre-pending the specified directory to all the file
3000 paths, except the name of the system aliases file that appears in the default
3001 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3002 For backwards compatibility, ROOT is used if DESTDIR is not set,
3003 but this usage is deprecated.
3004 </para>
3005 <para>
3006 <indexterm role="concept">
3007 <primary>installing Exim</primary>
3008 <secondary>what is not installed</secondary>
3009 </indexterm>
3010 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3011 <emphasis>convert4r4</emphasis>, or the <emphasis>pcretest</emphasis> test program. You will probably run the
3012 first of these only once (if you are upgrading from Exim 3), and the second
3013 isn&#x2019;t really part of Exim. None of the documentation files in the <filename>doc</filename>
3014 directory are copied, except for the info files when you have set
3015 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3016 </para>
3017 <para>
3018 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3019 to their names. The Exim binary itself, however, is handled differently. It is
3020 installed under a name that includes the version number and the compile number,
3021 for example <filename>exim-4.68-1</filename>. The script then arranges for a symbolic link
3022 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3023 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3024 from the directory (as seen by other processes).
3025 </para>
3026 <para>
3027 <indexterm role="concept">
3028 <primary>installing Exim</primary>
3029 <secondary>testing the script</secondary>
3030 </indexterm>
3031 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3032 real, you can pass the <option>-n</option> option to the installation script by this
3033 command:
3034 </para>
3035 <literallayout class="monospaced">
3036 make INSTALL_ARG=-n install
3037 </literallayout>
3038 <para>
3039 The contents of the variable INSTALL_ARG are passed to the installation
3040 script. You do not need to be root to run this test. Alternatively, you can run
3041 the installation script directly, but this must be from within the build
3042 directory. For example, from the top-level Exim directory you could use this
3043 command:
3044 </para>
3045 <literallayout class="monospaced">
3046 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3047 </literallayout>
3048 <para>
3049 <indexterm role="concept">
3050 <primary>installing Exim</primary>
3051 <secondary>install script options</secondary>
3052 </indexterm>
3053 There are two other options that can be supplied to the installation script.
3054 </para>
3055 <itemizedlist>
3056 <listitem>
3057 <para>
3058 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3059 to root, and the call to make it a setuid binary.
3060 </para>
3061 </listitem>
3062 <listitem>
3063 <para>
3064 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3065 installed binary.
3066 </para>
3067 </listitem>
3068 </itemizedlist>
3069 <para>
3070 INSTALL_ARG can be used to pass these options to the script. For example:
3071 </para>
3072 <literallayout class="monospaced">
3073 make INSTALL_ARG=-no_symlink install
3074 </literallayout>
3075 <para>
3076 The installation script can also be given arguments specifying which files are
3077 to be copied. For example, to install just the Exim binary, and nothing else,
3078 without creating the symbolic link, you could use:
3079 </para>
3080 <literallayout class="monospaced">
3081 make INSTALL_ARG='-no_symlink exim' install
3082 </literallayout>
3083 </section>
3084 <section id="SECTinsinfdoc">
3085 <title>Installing info documentation</title>
3086 <para>
3087 <indexterm role="concept">
3088 <primary>installing Exim</primary>
3089 <secondary><emphasis>info</emphasis> documentation</secondary>
3090 </indexterm>
3091 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3092 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3093 distribution. Instead it is available separately from the ftp site (see section
3094 <xref linkend="SECTavail"/>).
3095 </para>
3096 <para>
3097 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3098 source of the documentation is found in the source tree, running <literal>make
3099 install</literal> automatically builds the info files and installs them.
3100 </para>
3101 </section>
3102 <section id="SECID33">
3103 <title>Setting up the spool directory</title>
3104 <para>
3105 <indexterm role="concept">
3106 <primary>spool directory</primary>
3107 <secondary>creating</secondary>
3108 </indexterm>
3109 When it starts up, Exim tries to create its spool directory if it does not
3110 exist. The Exim uid and gid are used for the owner and group of the spool
3111 directory. Sub-directories are automatically created in the spool directory as
3112 necessary.
3113 </para>
3114 </section>
3115 <section id="SECID34">
3116 <title>Testing</title>
3117 <para>
3118 <indexterm role="concept">
3119 <primary>testing</primary>
3120 <secondary>installation</secondary>
3121 </indexterm>
3122 Having installed Exim, you can check that the run time configuration file is
3123 syntactically valid by running the following command, which assumes that the
3124 Exim binary directory is within your PATH environment variable:
3125 </para>
3126 <literallayout class="monospaced">
3127 exim -bV
3128 </literallayout>
3129 <para>
3130 If there are any errors in the configuration file, Exim outputs error messages.
3131 Otherwise it outputs the version number and build date,
3132 the DBM library that is being used, and information about which drivers and
3133 other optional code modules are included in the binary.
3134 Some simple routing tests can be done by using the address testing option. For
3135 example,
3136 </para>
3137 <literallayout>
3138 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3139 </literallayout>
3140 <para>
3141 should verify that it recognizes a local mailbox, and
3142 </para>
3143 <literallayout>
3144 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3145 </literallayout>
3146 <para>
3147 a remote one. Then try getting it to deliver mail, both locally and remotely.
3148 This can be done by passing messages directly to Exim, without going through a
3149 user agent. For example:
3150 </para>
3151 <literallayout class="monospaced">
3152 exim -v postmaster@your.domain.example
3153 From: user@your.domain.example
3154 To: postmaster@your.domain.example
3155 Subject: Testing Exim
3156
3157 This is a test message.
3158 ^D
3159 </literallayout>
3160 <para>
3161 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3162 In this case you should see copies of three log lines, one for the message&#x2019;s
3163 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3164 </para>
3165 <para>
3166 <indexterm role="concept">
3167 <primary>delivery</primary>
3168 <secondary>problems with</secondary>
3169 </indexterm>
3170 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3171 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3172 of information is running Exim with debugging turned on, by specifying the
3173 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3174 with debugging turned on by a command of the form
3175 </para>
3176 <literallayout>
3177 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3178 </literallayout>
3179 <para>
3180 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3181 produces rather a lot of output, but you can cut this down to specific areas.
3182 For example, if you use <option>-d-all+route</option> only the debugging information
3183 relevant to routing is included. (See the <option>-d</option> option in chapter
3184 <xref linkend="CHAPcommandline"/> for more details.)
3185 </para>
3186 <para>
3187 <indexterm role="concept">
3188 <primary><quote>sticky</quote> bit</primary>
3189 </indexterm>
3190 <indexterm role="concept">
3191 <primary>lock files</primary>
3192 </indexterm>
3193 One specific problem that has shown up on some sites is the inability to do
3194 local deliveries into a shared mailbox directory, because it does not have the
3195 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3196 writing to a mailbox file, and if it cannot create the lock file, the delivery
3197 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3198 directory, or by setting a specific group for local deliveries and allowing
3199 that group to create files in the directory (see the comments above the
3200 <command>local_delivery</command> transport in the default configuration file). Another
3201 approach is to configure Exim not to use lock files, but just to rely on
3202 <function>fcntl()</function> locking instead. However, you should do this only if all user
3203 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3204 see chapter <xref linkend="CHAPappendfile"/>.
3205 </para>
3206 <para>
3207 One thing that cannot be tested on a system that is already running an MTA is
3208 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3209 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3210 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3211 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3212 incoming SMTP mail.
3213 </para>
3214 <para>
3215 Testing a new version on a system that is already running Exim can most easily
3216 be done by building a binary with a different CONFIGURE_FILE setting. From
3217 within the run time configuration, all other file and directory names
3218 that Exim uses can be altered, in order to keep it entirely clear of the
3219 production version.
3220 </para>
3221 </section>
3222 <section id="SECID35">
3223 <title>Replacing another MTA with Exim</title>
3224 <para>
3225 <indexterm role="concept">
3226 <primary>replacing another MTA</primary>
3227 </indexterm>
3228 Building and installing Exim for the first time does not of itself put it in
3229 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3230 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3231 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3232 binary in order to get the user agents to pass messages to Exim. This is
3233 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3234 or <filename>/usr/lib/sendmail</filename>
3235 <indexterm role="concept">
3236 <primary>symbolic link</primary>
3237 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3238 </indexterm>
3239 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3240 privilege and executable status from the old MTA. It is then necessary to stop
3241 and restart the mailer daemon, if one is running.
3242 </para>
3243 <para>
3244 <indexterm role="concept">
3245 <primary>FreeBSD, MTA indirection</primary>
3246 </indexterm>
3247 <indexterm role="concept">
3248 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3249 </indexterm>
3250 Some operating systems have introduced alternative ways of switching MTAs. For
3251 example, if you are running FreeBSD, you need to edit the file
3252 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3253 described. A typical example of the contents of this file for running Exim is
3254 as follows:
3255 </para>
3256 <literallayout class="monospaced">
3257 sendmail            /usr/exim/bin/exim
3258 send-mail           /usr/exim/bin/exim
3259 mailq               /usr/exim/bin/exim -bp
3260 newaliases          /usr/bin/true
3261 </literallayout>
3262 <para>
3263 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3264 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3265 favourite user agent.
3266 </para>
3267 <para>
3268 You should consider what to tell your users about the change of MTA. Exim may
3269 have different capabilities to what was previously running, and there are
3270 various operational differences such as the text of messages produced by
3271 command line options and in bounce messages. If you allow your users to make
3272 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3273 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3274 </para>
3275 </section>
3276 <section id="SECID36">
3277 <title>Upgrading Exim</title>
3278 <para>
3279 <indexterm role="concept">
3280 <primary>upgrading Exim</primary>
3281 </indexterm>
3282 If you are already running Exim on your host, building and installing a new
3283 version automatically makes it available to MUAs, or any other programs that
3284 call the MTA directly. However, if you are running an Exim daemon, you do need
3285 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3286 new binary. You do not need to stop processing mail in order to install a new
3287 version of Exim. The install script does not modify an existing runtime
3288 configuration file.
3289 </para>
3290 </section>
3291 <section id="SECID37">
3292 <title>Stopping the Exim daemon on Solaris</title>
3293 <para>
3294 <indexterm role="concept">
3295 <primary>Solaris</primary>
3296 <secondary>stopping Exim on</secondary>
3297 </indexterm>
3298 The standard command for stopping the mailer daemon on Solaris is
3299 </para>
3300 <literallayout class="monospaced">
3301 /etc/init.d/sendmail stop
3302 </literallayout>
3303 <para>
3304 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3305 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3306 for the text <quote>sendmail</quote>; this is not present because the actual program name
3307 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3308 solution is to replace the line that finds the process id with something like
3309 </para>
3310 <literallayout class="monospaced">
3311 pid=`cat /var/spool/exim/exim-daemon.pid`
3312 </literallayout>
3313 <para>
3314 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3315 </para>
3316 <para>
3317 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3318 still be received from local processes, and if automatic delivery is configured
3319 (the normal case), deliveries will still occur.
3320 </para>
3321 </section>
3322 </chapter>
3323
3324 <chapter id="CHAPcommandline">
3325 <title>The Exim command line</title>
3326 <para>
3327 <indexterm role="concept" id="IIDclo1" class="startofrange">
3328 <primary>command line</primary>
3329 <secondary>options</secondary>
3330 </indexterm>
3331 <indexterm role="concept" id="IIDclo2" class="startofrange">
3332 <primary>options</primary>
3333 <secondary>command line</secondary>
3334 </indexterm>
3335 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3336 each starting with a hyphen character, followed by a number of arguments. The
3337 options are compatible with the main options of Sendmail, and there are also
3338 some additional options, some of which are compatible with Smail 3. Certain
3339 combinations of options do not make sense, and provoke an error if used.
3340 The form of the arguments depends on which options are set.
3341 </para>
3342 <section id="SECID38">
3343 <title>Setting options by program name</title>
3344 <para>
3345 <indexterm role="concept">
3346 <primary><emphasis>mailq</emphasis></primary>
3347 </indexterm>
3348 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3349 were present before any other options.
3350 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3351 standard output.
3352 This feature is for compatibility with some systems that contain a command of
3353 that name in one of the standard libraries, symbolically linked to
3354 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3355 </para>
3356 <para>
3357 <indexterm role="concept">
3358 <primary><emphasis>rsmtp</emphasis></primary>
3359 </indexterm>
3360 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3361 were present before any other options, for compatibility with Smail. The
3362 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3363 format.
3364 </para>
3365 <para>
3366 <indexterm role="concept">
3367 <primary><emphasis>rmail</emphasis></primary>
3368 </indexterm>
3369 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3370 <option>-oee</option> options were present before any other options, for compatibility with
3371 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3372 </para>
3373 <para>
3374 <indexterm role="concept">
3375 <primary><emphasis>runq</emphasis></primary>
3376 </indexterm>
3377 <indexterm role="concept">
3378 <primary>queue runner</primary>
3379 </indexterm>
3380 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3381 were present before any other options, for compatibility with Smail. The <option>-q</option>
3382 option causes a single queue runner process to be started.
3383 </para>
3384 <para>
3385 <indexterm role="concept">
3386 <primary><emphasis>newaliases</emphasis></primary>
3387 </indexterm>
3388 <indexterm role="concept">
3389 <primary>alias file</primary>
3390 <secondary>building</secondary>
3391 </indexterm>
3392 <indexterm role="concept">
3393 <primary>Sendmail compatibility</primary>
3394 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3395 </indexterm>
3396 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3397 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3398 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3399 the concept of a single alias file, but can be configured to run a given
3400 command if called with the <option>-bi</option> option.
3401 </para>
3402 </section>
3403 <section id="SECTtrustedadmin">
3404 <title>Trusted and admin users</title>
3405 <para>
3406 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3407 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3408 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3409 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3410 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3411 </para>
3412 <itemizedlist>
3413 <listitem>
3414 <para>
3415 <indexterm role="concept">
3416 <primary>trusted users</primary>
3417 <secondary>definition of</secondary>
3418 </indexterm>
3419 <indexterm role="concept">
3420 <primary>user</primary>
3421 <secondary>trusted definition of</secondary>
3422 </indexterm>
3423 The trusted users are root, the Exim user, any user listed in the
3424 <option>trusted_users</option> configuration option, and any user whose current group or any
3425 supplementary group is one of those listed in the <option>trusted_groups</option>
3426 configuration option. Note that the Exim group is not automatically trusted.
3427 </para>
3428 <para>
3429 <indexterm role="concept">
3430 <primary><quote>From</quote> line</primary>
3431 </indexterm>
3432 <indexterm role="concept">
3433 <primary>envelope sender</primary>
3434 </indexterm>
3435 Trusted users are always permitted to use the <option>-f</option> option or a leading
3436 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3437 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3438 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3439 users to set envelope senders.
3440 </para>
3441 <para>
3442 <indexterm role="concept">
3443 <primary><emphasis>From:</emphasis> header line</primary>
3444 </indexterm>
3445 <indexterm role="concept">
3446 <primary><emphasis>Sender:</emphasis> header line</primary>
3447 </indexterm>
3448 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3449 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3450 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3451 </para>
3452 <para>
3453 Trusted users may also specify a host name, host address, interface address,
3454 protocol name, ident value, and authentication data when submitting a message
3455 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3456 have the characteristics of messages received from a remote host. Untrusted
3457 users may in some circumstances use <option>-f</option>, but can never set the other values
3458 that are available to trusted users.
3459 </para>
3460 </listitem>
3461 <listitem>
3462 <para>
3463 <indexterm role="concept">
3464 <primary>user</primary>
3465 <secondary>admin definition of</secondary>
3466 </indexterm>
3467 <indexterm role="concept">
3468 <primary>admin user</primary>
3469 <secondary>definition of</secondary>
3470 </indexterm>
3471 The admin users are root, the Exim user, and any user that is a member of the
3472 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3473 The current group does not have to be one of these groups.
3474 </para>
3475 <para>
3476 Admin users are permitted to list the queue, and to carry out certain
3477 operations on messages, for example, to force delivery failures. It is also
3478 necessary to be an admin user in order to see the full information provided by
3479 the Exim monitor, and full debugging output.
3480 </para>
3481 <para>
3482 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3483 Exim to attempt delivery of messages on its queue is restricted to admin users.
3484 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3485 option false (that is, specifying <option>no_prod_requires_admin</option>).
3486 </para>
3487 <para>
3488 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3489 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3490 false.
3491 </para>
3492 </listitem>
3493 </itemizedlist>
3494 <para>
3495 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3496 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3497 getting root. There is further discussion of this issue at the start of chapter
3498 <xref linkend="CHAPconf"/>.
3499 </para>
3500 </section>
3501 <section id="SECID39">
3502 <title>Command line options</title>
3503 <para>
3504 Exim&#x2019;s command line options are described in alphabetical order below. If none
3505 of the options that specifies a specific action (such as starting the daemon or
3506 a queue runner, or testing an address, or receiving a message in a specific
3507 format, or listing the queue) are present, and there is at least one argument
3508 on the command line, <option>-bm</option> (accept a local message on the standard input,
3509 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3510 outputs a brief message about itself and exits.
3511 </para>
3512 <!-- === Start of command line options === -->
3513 <variablelist>
3514 <varlistentry>
3515 <term><option>--</option></term>
3516 <listitem>
3517 <para>
3518 <indexterm role="option">
3519 <primary>--</primary>
3520 </indexterm>
3521 <indexterm role="concept">
3522 <primary>options</primary>
3523 <secondary>command line; terminating</secondary>
3524 </indexterm>
3525 This is a pseudo-option whose only purpose is to terminate the options and
3526 therefore to cause subsequent command line items to be treated as arguments
3527 rather than options, even if they begin with hyphens.
3528 </para>
3529 </listitem></varlistentry>
3530 <varlistentry>
3531 <term><option>--help</option></term>
3532 <listitem>
3533 <para>
3534 <indexterm role="option">
3535 <primary><option>--help</option></primary>
3536 </indexterm>
3537 This option causes Exim to output a few sentences stating what it is.
3538 The same output is generated if the Exim binary is called with no options and
3539 no arguments.
3540 </para>
3541 </listitem></varlistentry>
3542 <varlistentry>
3543 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3544 <listitem>
3545 <para>
3546 <indexterm role="option">
3547 <primary><option>-B</option></primary>
3548 </indexterm>
3549 <indexterm role="concept">
3550 <primary>8-bit characters</primary>
3551 </indexterm>
3552 <indexterm role="concept">
3553 <primary>Sendmail compatibility</primary>
3554 <secondary>8-bit characters</secondary>
3555 </indexterm>
3556 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3557 clean; it ignores this option.
3558 </para>
3559 </listitem></varlistentry>
3560 <varlistentry>
3561 <term><option>-bd</option></term>
3562 <listitem>
3563 <para>
3564 <indexterm role="option">
3565 <primary><option>-bd</option></primary>
3566 </indexterm>
3567 <indexterm role="concept">
3568 <primary>daemon</primary>
3569 </indexterm>
3570 <indexterm role="concept">
3571 <primary>SMTP</primary>
3572 <secondary>listener</secondary>
3573 </indexterm>
3574 <indexterm role="concept">
3575 <primary>queue runner</primary>
3576 </indexterm>
3577 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3578 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3579 that the daemon should also initiate periodic queue runs.
3580 </para>
3581 <para>
3582 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3583 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3584 disconnect from the controlling terminal. When running this way, it can be
3585 stopped by pressing ctrl-C.
3586 </para>
3587 <para>
3588 By default, Exim listens for incoming connections to the standard SMTP port on
3589 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3590 ports, on multiple ports, and only on specific interfaces. Chapter
3591 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3592 </para>
3593 <para>
3594 When a listening daemon
3595 <indexterm role="concept">
3596 <primary>daemon</primary>
3597 <secondary>process id (pid)</secondary>
3598 </indexterm>
3599 <indexterm role="concept">
3600 <primary>pid (process id)</primary>
3601 <secondary>of daemon</secondary>
3602 </indexterm>
3603 is started without the use of <option>-oX</option> (that is, without overriding the normal
3604 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3605 in Exim&#x2019;s spool directory. This location can be overridden by setting
3606 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3607 running as root.
3608 </para>
3609 <para>
3610 When <option>-oX</option> is used on the command line to start a listening daemon, the
3611 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3612 used to specify a path on the command line if a pid file is required.
3613 </para>
3614 <para>
3615 The SIGHUP signal
3616 <indexterm role="concept">
3617 <primary>SIGHUP</primary>
3618 </indexterm>
3619 <indexterm role="concept">
3620 <primary>daemon</primary>
3621 <secondary>restarting</secondary>
3622 </indexterm>
3623 can be used to cause the daemon to re-execute itself. This should be done
3624 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3625 means of the <option>.include</option> facility, is changed, and also whenever a new version
3626 of Exim is installed. It is not necessary to do this when other files that are
3627 referenced from the configuration (for example, alias files) are changed,
3628 because these are reread each time they are used.
3629 </para>
3630 </listitem></varlistentry>
3631 <varlistentry>
3632 <term><option>-bdf</option></term>
3633 <listitem>
3634 <para>
3635 <indexterm role="option">
3636 <primary><option>-bdf</option></primary>
3637 </indexterm>
3638 This option has the same effect as <option>-bd</option> except that it never disconnects
3639 from the controlling terminal, even when no debugging is specified.
3640 </para>
3641 </listitem></varlistentry>
3642 <varlistentry>
3643 <term><option>-be</option></term>
3644 <listitem>
3645 <para>
3646 <indexterm role="option">
3647 <primary><option>-be</option></primary>
3648 </indexterm>
3649 <indexterm role="concept">
3650 <primary>testing</primary>
3651 <secondary>string expansion</secondary>
3652 </indexterm>
3653 <indexterm role="concept">
3654 <primary>expansion</primary>
3655 <secondary>testing</secondary>
3656 </indexterm>
3657 Run Exim in expansion testing mode. Exim discards its root privilege, to
3658 prevent ordinary users from using this mode to read otherwise inaccessible
3659 files. If no arguments are given, Exim runs interactively, prompting for lines
3660 of data. Otherwise, it processes each argument in turn.
3661 </para>
3662 <para>
3663 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3664 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3665 used without command line arguments. If successful, it uses the <function>readline()</function>
3666 function, which provides extensive line-editing facilities, for reading the
3667 test data. A line history is supported.
3668 </para>
3669 <para>
3670 Long expansion expressions can be split over several lines by using backslash
3671 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3672 continuation lines is ignored. Each argument or data line is passed through the
3673 string expansion mechanism, and the result is output. Variable values from the
3674 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3675 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3676 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3677 </para>
3678 <para>
3679 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3680 files or databases you are using, you must exit and restart Exim before trying
3681 the same lookup again. Otherwise, because each Exim process caches the results
3682 of lookups, you will just get the same result as before.
3683 </para>
3684 </listitem></varlistentry>
3685 <varlistentry>
3686 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3687 <listitem>
3688 <para>
3689 <indexterm role="option">
3690 <primary><option>-bem</option></primary>
3691 </indexterm>
3692 <indexterm role="concept">
3693 <primary>testing</primary>
3694 <secondary>string expansion</secondary>
3695 </indexterm>
3696 <indexterm role="concept">
3697 <primary>expansion</primary>
3698 <secondary>testing</secondary>
3699 </indexterm>
3700 This option operates like <option>-be</option> except that it must be followed by the name
3701 of a file. For example:
3702 </para>
3703 <literallayout class="monospaced">
3704 exim -bem /tmp/testmessage
3705 </literallayout>
3706 <para>
3707 The file is read as a message (as if receiving a locally-submitted non-SMTP
3708 message) before any of the test expansions are done. Thus, message-specific
3709 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3710 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3711 recipients are read from the headers in the normal way, and are shown in the
3712 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3713 line, because further arguments are taken as strings to expand (just like
3714 <option>-be</option>).
3715 </para>
3716 </listitem></varlistentry>
3717 <varlistentry>
3718 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3719 <listitem>
3720 <para>
3721 <indexterm role="option">
3722 <primary><option>-bF</option></primary>
3723 </indexterm>
3724 <indexterm role="concept">
3725 <primary>system filter</primary>
3726 <secondary>testing</secondary>
3727 </indexterm>
3728 <indexterm role="concept">
3729 <primary>testing</primary>
3730 <secondary>system filter</secondary>
3731 </indexterm>
3732 This option is the same as <option>-bf</option> except that it assumes that the filter being
3733 tested is a system filter. The additional commands that are available only in
3734 system filters are recognized.
3735 </para>
3736 </listitem></varlistentry>
3737 <varlistentry>
3738 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3739 <listitem>
3740 <para>
3741 <indexterm role="option">
3742 <primary><option>-bf</option></primary>
3743 </indexterm>
3744 <indexterm role="concept">
3745 <primary>filter</primary>
3746 <secondary>testing</secondary>
3747 </indexterm>
3748 <indexterm role="concept">
3749 <primary>testing</primary>
3750 <secondary>filter file</secondary>
3751 </indexterm>
3752 <indexterm role="concept">
3753 <primary>forward file</primary>
3754 <secondary>testing</secondary>
3755 </indexterm>
3756 <indexterm role="concept">
3757 <primary>testing</primary>
3758 <secondary>forward file</secondary>
3759 </indexterm>
3760 <indexterm role="concept">
3761 <primary>Sieve filter</primary>
3762 <secondary>testing</secondary>
3763 </indexterm>
3764 This option runs Exim in user filter testing mode; the file is the filter file
3765 to be tested, and a test message must be supplied on the standard input. If
3766 there are no message-dependent tests in the filter, an empty file can be
3767 supplied.
3768 </para>
3769 <para>
3770 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3771 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3772 filter and a user filter in the same run. For example:
3773 </para>
3774 <literallayout class="monospaced">
3775 exim -bF /system/filter -bf /user/filter &lt;/test/message
3776 </literallayout>
3777 <para>
3778 This is helpful when the system filter adds header lines or sets filter
3779 variables that are used by the user filter.
3780 </para>
3781 <para>
3782 If the test filter file does not begin with one of the special lines
3783 </para>
3784 <literallayout class="monospaced">
3785 # Exim filter
3786 # Sieve filter
3787 </literallayout>
3788 <para>
3789 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3790 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3791 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3792 redirection lists.
3793 </para>
3794 <para>
3795 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3796 detected, is a list of the actions that Exim would try to take if presented
3797 with the message for real. More details of filter testing are given in the
3798 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3799 </para>
3800 <para>
3801 When testing a filter file,
3802 <indexterm role="concept">
3803 <primary><quote>From</quote> line</primary>
3804 </indexterm>
3805 <indexterm role="concept">
3806 <primary>envelope sender</primary>
3807 </indexterm>
3808 <indexterm role="option">
3809 <primary><option>-f</option></primary>
3810 <secondary>for filter testing</secondary>
3811 </indexterm>
3812 the envelope sender can be set by the <option>-f</option> option,
3813 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3814 that would normally be taken from the envelope recipient address of the message
3815 can be set by means of additional command line options (see the next four
3816 options).
3817 </para>
3818 </listitem></varlistentry>
3819 <varlistentry>
3820 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3821 <listitem>
3822 <para>
3823 <indexterm role="option">
3824 <primary><option>-bfd</option></primary>
3825 </indexterm>
3826 <indexterm role="variable">
3827 <primary><varname>$qualify_domain</varname></primary>
3828 </indexterm>
3829 This sets the domain of the recipient address when a filter file is being
3830 tested by means of the <option>-bf</option> option. The default is the value of
3831 <varname>$qualify_domain</varname>.
3832 </para>
3833 </listitem></varlistentry>
3834 <varlistentry>
3835 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
3836 <listitem>
3837 <para>
3838 <indexterm role="option">
3839 <primary><option>-bfl</option></primary>
3840 </indexterm>
3841 This sets the local part of the recipient address when a filter file is being
3842 tested by means of the <option>-bf</option> option. The default is the username of the
3843 process that calls Exim. A local part should be specified with any prefix or
3844 suffix stripped, because that is how it appears to the filter when a message is
3845 actually being delivered.
3846 </para>
3847 </listitem></varlistentry>
3848 <varlistentry>
3849 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
3850 <listitem>
3851 <para>
3852 <indexterm role="option">
3853 <primary><option>-bfp</option></primary>
3854 </indexterm>
3855 This sets the prefix of the local part of the recipient address when a filter
3856 file is being tested by means of the <option>-bf</option> option. The default is an empty
3857 prefix.
3858 </para>
3859 </listitem></varlistentry>
3860 <varlistentry>
3861 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
3862 <listitem>
3863 <para>
3864 <indexterm role="option">
3865 <primary><option>-bfs</option></primary>
3866 </indexterm>
3867 This sets the suffix of the local part of the recipient address when a filter
3868 file is being tested by means of the <option>-bf</option> option. The default is an empty
3869 suffix.
3870 </para>
3871 </listitem></varlistentry>
3872 <varlistentry>
3873 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3874 <listitem>
3875 <para>
3876 <indexterm role="option">
3877 <primary><option>-bh</option></primary>
3878 </indexterm>
3879 <indexterm role="concept">
3880 <primary>testing</primary>
3881 <secondary>incoming SMTP</secondary>
3882 </indexterm>
3883 <indexterm role="concept">
3884 <primary>SMTP</primary>
3885 <secondary>testing incoming</secondary>
3886 </indexterm>
3887 <indexterm role="concept">
3888 <primary>testing</primary>
3889 <secondary>relay control</secondary>
3890 </indexterm>
3891 <indexterm role="concept">
3892 <primary>relaying</primary>
3893 <secondary>testing configuration</secondary>
3894 </indexterm>
3895 <indexterm role="concept">
3896 <primary>policy control</primary>
3897 <secondary>testing</secondary>
3898 </indexterm>
3899 <indexterm role="concept">
3900 <primary>debugging</primary>
3901 <secondary><option>-bh</option> option</secondary>
3902 </indexterm>
3903 This option runs a fake SMTP session as if from the given IP address, using the
3904 standard input and output. The IP address may include a port number at the end,
3905 after a full stop. For example:
3906 </para>
3907 <literallayout class="monospaced">
3908 exim -bh 10.9.8.7.1234
3909 exim -bh fe80::a00:20ff:fe86:a061.5678
3910 </literallayout>
3911 <para>
3912 When an IPv6 address is given, it is converted into canonical form. In the case
3913 of the second example above, the value of <varname>$sender_host_address</varname> after
3914 conversion to the canonical form is
3915 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3916 </para>
3917 <para>
3918 Comments as to what is going on are written to the standard error file. These
3919 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3920 This facility is provided for testing configuration options for incoming
3921 messages, to make sure they implement the required policy. For example, you can
3922 test your relay controls using <option>-bh</option>.
3923 </para>
3924 <para>
3925 <emphasis role="bold">Warning 1</emphasis>:
3926 <indexterm role="concept">
3927 <primary>RFC 1413</primary>
3928 </indexterm>
3929 You can test features of the configuration that rely on ident (RFC 1413)
3930 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3931 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3932 connection.
3933 </para>
3934 <para>
3935 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3936 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3937 occur, use <option>-bhc</option> instead.
3938 </para>
3939 <para>
3940 Messages supplied during the testing session are discarded, and nothing is
3941 written to any of the real log files. There may be pauses when DNS (and other)
3942 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3943 can be used to specify a specific IP interface and port if this is important,
3944 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3945 session were authenticated.
3946 </para>
3947 <para>
3948 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3949 output just states whether a given recipient address from a given host is
3950 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3951 </para>
3952 <para>
3953 Features such as authentication and encryption, where the client input is not
3954 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
3955 specialized SMTP test program such as
3956 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
3957 </para>
3958 </listitem></varlistentry>
3959 <varlistentry>
3960 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3961 <listitem>
3962 <para>
3963 <indexterm role="option">
3964 <primary><option>-bhc</option></primary>
3965 </indexterm>
3966 This option operates in the same way as <option>-bh</option>, except that address
3967 verification callouts are performed if required. This includes consulting and
3968 updating the callout cache database.
3969 </para>
3970 </listitem></varlistentry>
3971 <varlistentry>
3972 <term><option>-bi</option></term>
3973 <listitem>
3974 <para>
3975 <indexterm role="option">
3976 <primary><option>-bi</option></primary>
3977 </indexterm>
3978 <indexterm role="concept">
3979 <primary>alias file</primary>
3980 <secondary>building</secondary>
3981 </indexterm>
3982 <indexterm role="concept">
3983 <primary>building alias file</primary>
3984 </indexterm>
3985 <indexterm role="concept">
3986 <primary>Sendmail compatibility</primary>
3987 <secondary><option>-bi</option> option</secondary>
3988 </indexterm>
3989 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
3990 Exim does not have the concept of a single alias file, and so it cannot mimic
3991 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
3992 tend to appear in various scripts such as NIS make files, so the option must be
3993 recognized.
3994 </para>
3995 <para>
3996 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
3997 configuration option is run, under the uid and gid of the caller of Exim. If
3998 the <option>-oA</option> option is used, its value is passed to the command as an argument.
3999 The command set by <option>bi_command</option> may not contain arguments. The command can
4000 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4001 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4002 <option>-bi</option> is a no-op.
4003 </para>
4004 </listitem></varlistentry>
4005 <varlistentry>
4006 <term><option>-bm</option></term>
4007 <listitem>
4008 <para>
4009 <indexterm role="option">
4010 <primary><option>-bm</option></primary>
4011 </indexterm>
4012 <indexterm role="concept">
4013 <primary>local message reception</primary>
4014 </indexterm>
4015 This option runs an Exim receiving process that accepts an incoming,
4016 locally-generated message on the current input. The recipients are given as the
4017 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4018 argument can be a comma-separated list of RFC 2822 addresses. This is the
4019 default option for selecting the overall action of an Exim call; it is assumed
4020 if no other conflicting option is present.
4021 </para>
4022 <para>
4023 If any addresses in the message are unqualified (have no domain), they are
4024 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4025 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4026 suppressing this for special cases.
4027 </para>
4028 <para>
4029 Policy checks on the contents of local messages can be enforced by means of
4030 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4031 </para>
4032 <para>
4033 <indexterm role="concept">
4034 <primary>return code</primary>
4035 <secondary>for <option>-bm</option></secondary>
4036 </indexterm>
4037 The return code is zero if the message is successfully accepted. Otherwise, the
4038 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4039 </para>
4040 <para>
4041 The format
4042 <indexterm role="concept">
4043 <primary>message</primary>
4044 <secondary>format</secondary>
4045 </indexterm>
4046 <indexterm role="concept">
4047 <primary>format</primary>
4048 <secondary>message</secondary>
4049 </indexterm>
4050 <indexterm role="concept">
4051 <primary><quote>From</quote> line</primary>
4052 </indexterm>
4053 <indexterm role="concept">
4054 <primary>UUCP</primary>
4055 <secondary><quote>From</quote> line</secondary>
4056 </indexterm>
4057 <indexterm role="concept">
4058 <primary>Sendmail compatibility</primary>
4059 <secondary><quote>From</quote> line</secondary>
4060 </indexterm>
4061 of the message must be as defined in RFC 2822, except that, for
4062 compatibility with Sendmail and Smail, a line in one of the forms
4063 </para>
4064 <literallayout class="monospaced">
4065 From sender Fri Jan  5 12:55 GMT 1997
4066 From sender Fri, 5 Jan 97 12:55:01
4067 </literallayout>
4068 <para>
4069 (with the weekday optional, and possibly with additional text after the date)
4070 is permitted to appear at the start of the message. There appears to be no
4071 authoritative specification of the format of this line. Exim recognizes it by
4072 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4073 option, which can be changed if necessary.
4074 </para>
4075 <para>
4076 <indexterm role="option">
4077 <primary><option>-f</option></primary>
4078 <secondary>overriding <quote>From</quote> line</secondary>
4079 </indexterm>
4080 The specified sender is treated as if it were given as the argument to the
4081 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4082 preference to the address taken from the message. The caller of Exim must be a
4083 trusted user for the sender of a message to be set in this way.
4084 </para>
4085 </listitem></varlistentry>
4086 <varlistentry>
4087 <term><option>-bnq</option></term>
4088 <listitem>
4089 <para>
4090 <indexterm role="option">
4091 <primary><option>-bnq</option></primary>
4092 </indexterm>
4093 <indexterm role="concept">
4094 <primary>address qualification, suppressing</primary>
4095 </indexterm>
4096 By default, Exim automatically qualifies unqualified addresses (those
4097 without domains) that appear in messages that are submitted locally (that
4098 is, not over TCP/IP). This qualification applies both to addresses in
4099 envelopes, and addresses in header lines. Sender addresses are qualified using
4100 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4101 defaults to the value of <option>qualify_domain</option>).
4102 </para>
4103 <para>
4104 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4105 being used to re-submit messages that originally came from remote hosts after
4106 content scanning, you probably do not want to qualify unqualified addresses in
4107 header lines. (Such lines will be present only if you have not enabled a header
4108 syntax check in the appropriate ACL.)
4109 </para>
4110 <para>
4111 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4112 messages that originate on the local host. When this is used, unqualified
4113 addresses in the envelope provoke errors (causing message rejection) and
4114 unqualified addresses in header lines are left alone.
4115 </para>
4116 </listitem></varlistentry>
4117 <varlistentry>
4118 <term><option>-bP</option></term>
4119 <listitem>
4120 <para>
4121 <indexterm role="option">
4122 <primary><option>-bP</option></primary>
4123 </indexterm>
4124 <indexterm role="concept">
4125 <primary>configuration options</primary>
4126 <secondary>extracting</secondary>
4127 </indexterm>
4128 <indexterm role="concept">
4129 <primary>options</primary>
4130 <secondary>configuration &ndash; extracting</secondary>
4131 </indexterm>
4132 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4133 main configuration options to be written to the standard output. The values
4134 of one or more specific options can be requested by giving their names as
4135 arguments, for example:
4136 </para>
4137 <literallayout class="monospaced">
4138 exim -bP qualify_domain hold_domains
4139 </literallayout>
4140 <para>
4141 <indexterm role="concept">
4142 <primary>hiding configuration option values</primary>
4143 </indexterm>
4144 <indexterm role="concept">
4145 <primary>configuration options</primary>
4146 <secondary>hiding value of</secondary>
4147 </indexterm>
4148 <indexterm role="concept">
4149 <primary>options</primary>
4150 <secondary>hiding value of</secondary>
4151 </indexterm>
4152 However, any option setting that is preceded by the word <quote>hide</quote> in the
4153 configuration file is not shown in full, except to an admin user. For other
4154 users, the output is as in this example:
4155 </para>
4156 <literallayout class="monospaced">
4157 mysql_servers = &lt;value not displayable&gt;
4158 </literallayout>
4159 <para>
4160 If <option>configure_file</option> is given as an argument, the name of the run time
4161 configuration file is output.
4162 If a list of configuration files was supplied, the value that is output here
4163 is the name of the file that was actually used.
4164 </para>
4165 <para>
4166 <indexterm role="concept">
4167 <primary>daemon</primary>
4168 <secondary>process id (pid)</secondary>
4169 </indexterm>
4170 <indexterm role="concept">
4171 <primary>pid (process id)</primary>
4172 <secondary>of daemon</secondary>
4173 </indexterm>
4174 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4175 directories where log files and daemon pid files are written are output,
4176 respectively. If these values are unset, log files are written in a
4177 sub-directory of the spool directory called <option>log</option>, and the pid file is
4178 written directly into the spool directory.
4179 </para>
4180 <para>
4181 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4182 </para>
4183 <literallayout class="monospaced">
4184 exim -bP +local_domains
4185 </literallayout>
4186 <para>
4187 it searches for a matching named list of any type (domain, host, address, or
4188 local part) and outputs what it finds.
4189 </para>
4190 <para>
4191 <indexterm role="concept">
4192 <primary>options</primary>
4193 <secondary>router &ndash; extracting</secondary>
4194 </indexterm>
4195 <indexterm role="concept">
4196 <primary>options</primary>
4197 <secondary>transport &ndash; extracting</secondary>
4198 </indexterm>
4199 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4200 followed by the name of an appropriate driver instance, the option settings for
4201 that driver are output. For example:
4202 </para>
4203 <literallayout class="monospaced">
4204 exim -bP transport local_delivery
4205 </literallayout>
4206 <para>
4207 The generic driver options are output first, followed by the driver&#x2019;s private
4208 options. A list of the names of drivers of a particular type can be obtained by
4209 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4210 <option>authenticator_list</option>, and a complete list of all drivers with their option
4211 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4212 <option>authenticators</option>.
4213 </para>
4214 </listitem></varlistentry>
4215 <varlistentry>
4216 <term><option>-bp</option></term>
4217 <listitem>
4218 <para>
4219 <indexterm role="option">
4220 <primary><option>-bp</option></primary>
4221 </indexterm>
4222 <indexterm role="concept">
4223 <primary>queue</primary>
4224 <secondary>listing messages on</secondary>
4225 </indexterm>
4226 <indexterm role="concept">
4227 <primary>listing</primary>
4228 <secondary>messages on the queue</secondary>
4229 </indexterm>
4230 This option requests a listing of the contents of the mail queue on the
4231 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4232 just those messages are listed. By default, this option can be used only by an
4233 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4234 to allow any user to see the queue.
4235 </para>
4236 <para>
4237 Each message on the queue is displayed as in the following example:
4238 </para>
4239 <literallayout class="monospaced">
4240 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4241           red.king@looking-glass.fict.example
4242           &lt;other addresses&gt;
4243 </literallayout>
4244 <para>
4245 <indexterm role="concept">
4246 <primary>message</primary>
4247 <secondary>size in queue listing</secondary>
4248 </indexterm>
4249 <indexterm role="concept">
4250 <primary>size</primary>
4251 <secondary>of message</secondary>
4252 </indexterm>
4253 The first line contains the length of time the message has been on the queue
4254 (in this case 25 minutes), the size of the message (2.9K), the unique local
4255 identifier for the message, and the message sender, as contained in the
4256 envelope. For bounce messages, the sender address is empty, and appears as
4257 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4258 the default sender address, the user&#x2019;s login name is shown in parentheses
4259 before the sender address.
4260 </para>
4261 <para>
4262 <indexterm role="concept">
4263 <primary>frozen messages</primary>
4264 <secondary>in queue listing</secondary>
4265 </indexterm>
4266 If the message is frozen (attempts to deliver it are suspended) then the text
4267 <quote>*** frozen ***</quote> is displayed at the end of this line.
4268 </para>
4269 <para>
4270 The recipients of the message (taken from the envelope, not the headers) are
4271 displayed on subsequent lines. Those addresses to which the message has already
4272 been delivered are marked with the letter D. If an original address gets
4273 expanded into several addresses via an alias or forward file, the original is
4274 displayed with a D only when deliveries for all of its child addresses are
4275 complete.
4276 </para>
4277 </listitem></varlistentry>
4278 <varlistentry>
4279 <term><option>-bpa</option></term>
4280 <listitem>
4281 <para>
4282 <indexterm role="option">
4283 <primary><option>-bpa</option></primary>
4284 </indexterm>
4285 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4286 that were generated from the original top level address(es) in each message by
4287 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4288 of just <quote>D</quote>.
4289 </para>
4290 </listitem></varlistentry>
4291 <varlistentry>
4292 <term><option>-bpc</option></term>
4293 <listitem>
4294 <para>
4295 <indexterm role="option">
4296 <primary><option>-bpc</option></primary>
4297 </indexterm>
4298 <indexterm role="concept">
4299 <primary>queue</primary>
4300 <secondary>count of messages on</secondary>
4301 </indexterm>
4302 This option counts the number of messages on the queue, and writes the total
4303 to the standard output. It is restricted to admin users, unless
4304 <option>queue_list_requires_admin</option> is set false.
4305 </para>
4306 </listitem></varlistentry>
4307 <varlistentry>
4308 <term><option>-bpr</option></term>
4309 <listitem>
4310 <para>
4311 <indexterm role="option">
4312 <primary><option>-bpr</option></primary>
4313 </indexterm>
4314 This option operates like <option>-bp</option>, but the output is not sorted into
4315 chronological order of message arrival. This can speed it up when there are
4316 lots of messages on the queue, and is particularly useful if the output is
4317 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4318 </para>
4319 </listitem></varlistentry>
4320 <varlistentry>
4321 <term><option>-bpra</option></term>
4322 <listitem>
4323 <para>
4324 <indexterm role="option">
4325 <primary><option>-bpra</option></primary>
4326 </indexterm>
4327 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4328 </para>
4329 </listitem></varlistentry>
4330 <varlistentry>
4331 <term><option>-bpru</option></term>
4332 <listitem>
4333 <para>
4334 <indexterm role="option">
4335 <primary><option>-bpru</option></primary>
4336 </indexterm>
4337 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4338 </para>
4339 </listitem></varlistentry>
4340 <varlistentry>
4341 <term><option>-bpu</option></term>
4342 <listitem>
4343 <para>
4344 <indexterm role="option">
4345 <primary><option>-bpu</option></primary>
4346 </indexterm>
4347 This option operates like <option>-bp</option> but shows only undelivered top-level
4348 addresses for each message displayed. Addresses generated by aliasing or
4349 forwarding are not shown, unless the message was deferred after processing by a
4350 router with the <option>one_time</option> option set.
4351 </para>
4352 </listitem></varlistentry>
4353 <varlistentry>
4354 <term><option>-brt</option></term>
4355 <listitem>
4356 <para>
4357 <indexterm role="option">
4358 <primary><option>-brt</option></primary>
4359 </indexterm>
4360 <indexterm role="concept">
4361 <primary>testing</primary>
4362 <secondary>retry configuration</secondary>
4363 </indexterm>
4364 <indexterm role="concept">
4365 <primary>retry</primary>
4366 <secondary>configuration testing</secondary>
4367 </indexterm>
4368 This option is for testing retry rules, and it must be followed by up to three
4369 arguments. It causes Exim to look for a retry rule that matches the values
4370 and to write it to the standard output. For example:
4371 </para>
4372 <literallayout class="monospaced">
4373 exim -brt bach.comp.mus.example
4374 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4375 </literallayout>
4376 <para>
4377 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4378 argument, which is required, can be a complete address in the form
4379 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4380 contains a dot, it is interpreted as an optional second domain name; if no
4381 retry rule is found for the first argument, the second is tried. This ties in
4382 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4383 rule is found that matches the host, one that matches the mail domain is
4384 sought. Finally, an argument that is the name of a specific delivery error, as
4385 used in setting up retry rules, can be given. For example:
4386 </para>
4387 <literallayout class="monospaced">
4388 exim -brt haydn.comp.mus.example quota_3d
4389 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4390 </literallayout>
4391 </listitem></varlistentry>
4392 <varlistentry>
4393 <term><option>-brw</option></term>
4394 <listitem>
4395 <para>
4396 <indexterm role="option">
4397 <primary><option>-brw</option></primary>
4398 </indexterm>
4399 <indexterm role="concept">
4400 <primary>testing</primary>
4401 <secondary>rewriting</secondary>
4402 </indexterm>
4403 <indexterm role="concept">
4404 <primary>rewriting</primary>
4405 <secondary>testing</secondary>
4406 </indexterm>
4407 This option is for testing address rewriting rules, and it must be followed by
4408 a single argument, consisting of either a local part without a domain, or a
4409 complete address with a fully qualified domain. Exim outputs how this address
4410 would be rewritten for each possible place it might appear. See chapter
4411 <xref linkend="CHAPrewrite"/> for further details.
4412 </para>
4413 </listitem></varlistentry>
4414 <varlistentry>
4415 <term><option>-bS</option></term>
4416 <listitem>
4417 <para>
4418 <indexterm role="option">
4419 <primary><option>-bS</option></primary>
4420 </indexterm>
4421 <indexterm role="concept">
4422 <primary>SMTP</primary>
4423 <secondary>batched incoming</secondary>
4424 </indexterm>
4425 <indexterm role="concept">
4426 <primary>batched SMTP input</primary>
4427 </indexterm>
4428 This option is used for batched SMTP input, which is an alternative interface
4429 for non-interactive local message submission. A number of messages can be
4430 submitted in a single run. However, despite its name, this is not really SMTP
4431 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4432 input, but generates no responses. If the caller is trusted, or
4433 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4434 believed; otherwise the sender is always the caller of Exim.
4435 </para>
4436 <para>
4437 The message itself is read from the standard input, in SMTP format (leading
4438 dots doubled), terminated by a line containing just a single dot. An error is
4439 provoked if the terminating dot is missing. A further message may then follow.
4440 </para>
4441 <para>
4442 As for other local message submissions, the contents of incoming batch SMTP
4443 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4444 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4445 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4446 </para>
4447 <para>
4448 Some other SMTP commands are recognized in the input. HELO and EHLO act
4449 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4450 QUIT quits, ignoring the rest of the standard input.
4451 </para>
4452 <para>
4453 <indexterm role="concept">
4454 <primary>return code</primary>
4455 <secondary>for <option>-bS</option></secondary>
4456 </indexterm>
4457 If any error is encountered, reports are written to the standard output and
4458 error streams, and Exim gives up immediately. The return code is 0 if no error
4459 was detected; it is 1 if one or more messages were accepted before the error
4460 was detected; otherwise it is 2.
4461 </para>
4462 <para>
4463 More details of input using batched SMTP are given in section
4464 <xref linkend="SECTincomingbatchedSMTP"/>.
4465 </para>
4466 </listitem></varlistentry>
4467 <varlistentry>
4468 <term><option>-bs</option></term>
4469 <listitem>
4470 <para>
4471 <indexterm role="option">
4472 <primary><option>-bs</option></primary>
4473 </indexterm>
4474 <indexterm role="concept">
4475 <primary>SMTP</primary>
4476 <secondary>local input</secondary>
4477 </indexterm>
4478 <indexterm role="concept">
4479 <primary>local SMTP input</primary>
4480 </indexterm>
4481 This option causes Exim to accept one or more messages by reading SMTP commands
4482 on the standard input, and producing SMTP replies on the standard output. SMTP
4483 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4484 Some user agents use this interface as a way of passing locally-generated
4485 messages to the MTA.
4486 </para>
4487 <para>
4488 In
4489 <indexterm role="concept">
4490 <primary>sender</primary>
4491 <secondary>source of</secondary>
4492 </indexterm>
4493 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4494 set, the senders of messages are taken from the SMTP MAIL commands.
4495 Otherwise the content of these commands is ignored and the sender is set up as
4496 the calling user. Unqualified addresses are automatically qualified using
4497 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4498 <option>-bnq</option> option is used.
4499 </para>
4500 <para>
4501 <indexterm role="concept">
4502 <primary>inetd</primary>
4503 </indexterm>
4504 The
4505 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4506 using a listening daemon. Exim can distinguish the two cases by checking
4507 whether the standard input is a TCP/IP socket. When Exim is called from
4508 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4509 above concerning senders and qualification do not apply. In this situation,
4510 Exim behaves in exactly the same way as it does when receiving a message via
4511 the listening daemon.
4512 </para>
4513 </listitem></varlistentry>
4514 <varlistentry>
4515 <term><option>-bt</option></term>
4516 <listitem>
4517 <para>
4518 <indexterm role="option">
4519 <primary><option>-bt</option></primary>
4520 </indexterm>
4521 <indexterm role="concept">
4522 <primary>testing</primary>
4523 <secondary>addresses</secondary>
4524 </indexterm>
4525 <indexterm role="concept">
4526 <primary>address</primary>
4527 <secondary>testing</secondary>
4528 </indexterm>
4529 This option runs Exim in address testing mode, in which each argument is taken
4530 as a recipient address to be tested for deliverability. The results are
4531 written to the standard output. If a test fails, and the caller is not an admin
4532 user, no details of the failure are output, because these might contain
4533 sensitive information such as usernames and passwords for database lookups.
4534 </para>
4535 <para>
4536 If no arguments are given, Exim runs in an interactive manner, prompting with a
4537 right angle bracket for addresses to be tested.
4538 </para>
4539 <para>
4540 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4541 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4542 security issues.
4543 </para>
4544 <para>
4545 Each address is handled as if it were the recipient address of a message
4546 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4547 written to the standard output. However, any router that has
4548 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4549 genuine routing tests if your first router passes everything to a scanner
4550 program.
4551 </para>
4552 <para>
4553 <indexterm role="concept">
4554 <primary>return code</primary>
4555 <secondary>for <option>-bt</option></secondary>
4556 </indexterm>
4557 The return code is 2 if any address failed outright; it is 1 if no address
4558 failed outright but at least one could not be resolved for some reason. Return
4559 code 0 is given only when all addresses succeed.
4560 </para>
4561 <para>
4562 <indexterm role="concept">
4563 <primary>duplicate addresses</primary>
4564 </indexterm>
4565 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4566 addresses after routing is complete, so that only one delivery takes place.
4567 This does not happen when testing with <option>-bt</option>; the full results of routing are
4568 always shown.
4569 </para>
4570 <para>
4571 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4572 routers in the configuration makes any tests on the sender address of a
4573 message,
4574 <indexterm role="option">
4575 <primary><option>-f</option></primary>
4576 <secondary>for address testing</secondary>
4577 </indexterm>
4578 you can use the <option>-f</option> option to set an appropriate sender when running
4579 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4580 default qualifying domain. However, if you have set up (for example) routers
4581 whose behaviour depends on the contents of an incoming message, you cannot test
4582 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4583 doing such tests.
4584 </para>
4585 </listitem></varlistentry>
4586 <varlistentry>
4587 <term><option>-bV</option></term>
4588 <listitem>
4589 <para>
4590 <indexterm role="option">
4591 <primary><option>-bV</option></primary>
4592 </indexterm>
4593 <indexterm role="concept">
4594 <primary>version number of Exim</primary>
4595 </indexterm>
4596 This option causes Exim to write the current version number, compilation
4597 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4598 It also lists the DBM library this is being used, the optional modules (such as
4599 specific lookup types), the drivers that are included in the binary, and the
4600 name of the run time configuration file that is in use.
4601 </para>
4602 <para>
4603 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4604 configuration file. However, this is a static check only. It cannot check
4605 values that are to be expanded. For example, although a misspelt ACL verb is
4606 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4607 alone to discover (for example) all the typos in the configuration; some
4608 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4609 dynamic testing facilities.
4610 </para>
4611 </listitem></varlistentry>
4612 <varlistentry>
4613 <term><option>-bv</option></term>
4614 <listitem>
4615 <para>
4616 <indexterm role="option">
4617 <primary><option>-bv</option></primary>
4618 </indexterm>
4619 <indexterm role="concept">
4620 <primary>verifying address</primary>
4621 <secondary>using <option>-bv</option></secondary>
4622 </indexterm>
4623 <indexterm role="concept">
4624 <primary>address</primary>
4625 <secondary>verification</secondary>
4626 </indexterm>
4627 This option runs Exim in address verification mode, in which each argument is
4628 taken as a recipient address to be verified by the routers. (This does
4629 not involve any verification callouts). During normal operation, verification
4630 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4631 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4632 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4633 </para>
4634 <para>
4635 If verification fails, and the caller is not an admin user, no details of the
4636 failure are output, because these might contain sensitive information such as
4637 usernames and passwords for database lookups.
4638 </para>
4639 <para>
4640 If no arguments are given, Exim runs in an interactive manner, prompting with a
4641 right angle bracket for addresses to be verified.
4642 </para>
4643 <para>
4644 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4645 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4646 security issues.
4647 </para>
4648 <para>
4649 Verification differs from address testing (the <option>-bt</option> option) in that routers
4650 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4651 router that has <option>fail_verify</option> set, verification fails. The address is
4652 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4653 address, <option>-bvs</option> should be used.
4654 </para>
4655 <para>
4656 If the <option>-v</option> option is not set, the output consists of a single line for each
4657 address, stating whether it was verified or not, and giving a reason in the
4658 latter case. Without <option>-v</option>, generating more than one address by redirection
4659 causes verification to end successfully, without considering the generated
4660 addresses. However, if just one address is generated, processing continues,
4661 and the generated address must verify successfully for the overall verification
4662 to succeed.
4663 </para>
4664 <para>
4665 When <option>-v</option> is set, more details are given of how the address has been handled,
4666 and in the case of address redirection, all the generated addresses are also
4667 considered. Verification may succeed for some and fail for others.
4668 </para>
4669 <para>
4670 The
4671 <indexterm role="concept">
4672 <primary>return code</primary>
4673 <secondary>for <option>-bv</option></secondary>
4674 </indexterm>
4675 return code is 2 if any address failed outright; it is 1 if no address
4676 failed outright but at least one could not be resolved for some reason. Return
4677 code 0 is given only when all addresses succeed.
4678 </para>
4679 <para>
4680 If any of the routers in the configuration makes any tests on the sender
4681 address of a message, you should use the <option>-f</option> option to set an appropriate
4682 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4683 calling user at the default qualifying domain.
4684 </para>
4685 </listitem></varlistentry>
4686 <varlistentry>
4687 <term><option>-bvs</option></term>
4688 <listitem>
4689 <para>
4690 <indexterm role="option">
4691 <primary><option>-bvs</option></primary>
4692 </indexterm>
4693 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4694 than a recipient address. This affects any rewriting and qualification that
4695 might happen.
4696 </para>
4697 </listitem></varlistentry>
4698 <varlistentry>
4699 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
4700 <listitem>
4701 <para>
4702 <indexterm role="option">
4703 <primary><option>-C</option></primary>
4704 </indexterm>
4705 <indexterm role="concept">
4706 <primary>configuration file</primary>
4707 <secondary>alternate</secondary>
4708 </indexterm>
4709 <indexterm role="concept">
4710 <primary>CONFIGURE_FILE</primary>
4711 </indexterm>
4712 <indexterm role="concept">
4713 <primary>alternate configuration file</primary>
4714 </indexterm>
4715 This option causes Exim to find the run time configuration file from the given
4716 list instead of from the list specified by the CONFIGURE_FILE
4717 compile-time setting. Usually, the list will consist of just a single file
4718 name, but it can be a colon-separated list of names. In this case, the first
4719 file that exists is used. Failure to open an existing file stops Exim from
4720 proceeding any further along the list, and an error is generated.
4721 </para>
4722 <para>
4723 When this option is used by a caller other than root or the Exim user, and the
4724 list is different from the compiled-in list, Exim gives up its root privilege
4725 immediately, and runs with the real and effective uid and gid set to those of
4726 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4727 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4728 Exim is root.
4729 </para>
4730 <para>
4731 That is, the Exim user is no longer privileged in this regard. This build-time
4732 option is not set by default in the Exim source distribution tarbundle.
4733 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4734 the packagers might have enabled it.
4735 </para>
4736 <para>
4737 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4738 configuration using <option>-C</option> right through message reception and delivery, even
4739 if the caller is root. The reception works, but by that time, Exim is running
4740 as the Exim user, so when it re-executes to regain privilege for the delivery,
4741 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4742 and delivery using two separate commands (one to put a message on the queue,
4743 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4744 </para>
4745 <para>
4746 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4747 prefix string with which any file named in a <option>-C</option> command line option
4748 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4749 However, if the value of the <option>-C</option> option is identical to the value of
4750 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4751 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4752 unset, any file name can be used with <option>-C</option>.
4753 </para>
4754 <para>
4755 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4756 to a directory to which only root has access. This prevents someone who has
4757 broken into the Exim account from running a privileged Exim with an arbitrary
4758 configuration file.
4759 </para>
4760 <para>
4761 The <option>-C</option> facility is useful for ensuring that configuration files are
4762 syntactically correct, but cannot be used for test deliveries, unless the
4763 caller is privileged, or unless it is an exotic configuration that does not
4764 require privilege. No check is made on the owner or group of the files
4765 specified by this option.
4766 </para>
4767 </listitem></varlistentry>
4768 <varlistentry>
4769 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
4770 <listitem>
4771 <para>
4772 <indexterm role="option">
4773 <primary><option>-D</option></primary>
4774 </indexterm>
4775 <indexterm role="concept">
4776 <primary>macro</primary>
4777 <secondary>setting on command line</secondary>
4778 </indexterm>
4779 This option can be used to override macro definitions in the configuration file
4780 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4781 unprivileged caller, it causes Exim to give up its root privilege.
4782 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4783 completely disabled, and its use causes an immediate error exit.
4784 </para>
4785 <para>
4786 The entire option (including equals sign if present) must all be within one
4787 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4788 string, in which case the equals sign is optional. These two commands are
4789 synonymous:
4790 </para>
4791 <literallayout class="monospaced">
4792 exim -DABC  ...
4793 exim -DABC= ...
4794 </literallayout>
4795 <para>
4796 To include spaces in a macro definition item, quotes must be used. If you use
4797 quotes, spaces are permitted around the macro name and the equals sign. For
4798 example:
4799 </para>
4800 <literallayout class="monospaced">
4801 exim '-D ABC = something' ...
4802 </literallayout>
4803 <para>
4804 <option>-D</option> may be repeated up to 10 times on a command line.
4805 </para>
4806 </listitem></varlistentry>
4807 <varlistentry>
4808 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4809 <listitem>
4810 <para>
4811 <indexterm role="option">
4812 <primary><option>-d</option></primary>
4813 </indexterm>
4814 <indexterm role="concept">
4815 <primary>debugging</primary>
4816 <secondary>list of selectors</secondary>
4817 </indexterm>
4818 <indexterm role="concept">
4819 <primary>debugging</primary>
4820 <secondary><option>-d</option> option</secondary>
4821 </indexterm>
4822 This option causes debugging information to be written to the standard
4823 error stream. It is restricted to admin users because debugging output may show
4824 database queries that contain password information. Also, the details of users&#x2019;
4825 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
4826 writes an error message to the standard error stream and exits with a non-zero
4827 return code.
4828 </para>
4829 <para>
4830 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4831 standard debugging data is output. This can be reduced, or increased to include
4832 some more rarely needed information, by directly following <option>-d</option> with a string
4833 made up of names preceded by plus or minus characters. These add or remove sets
4834 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4835 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4836 no spaces are allowed in the debug setting. The available debugging categories
4837 are:
4838 </para>
4839 <literallayout>
4840 <literal>acl            </literal> ACL interpretation
4841 <literal>auth           </literal> authenticators
4842 <literal>deliver        </literal> general delivery logic
4843 <literal>dns            </literal> DNS lookups (see also resolver)
4844 <literal>dnsbl          </literal> DNS black list (aka RBL) code
4845 <literal>exec           </literal> arguments for <function>execv()</function> calls
4846 <literal>expand         </literal> detailed debugging for string expansions
4847 <literal>filter         </literal> filter handling
4848 <literal>hints_lookup   </literal> hints data lookups
4849 <literal>host_lookup    </literal> all types of name-to-IP address handling
4850 <literal>ident          </literal> ident lookup
4851 <literal>interface      </literal> lists of local interfaces
4852 <literal>lists          </literal> matching things in lists
4853 <literal>load           </literal> system load checks
4854 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4855 <literal>lookup         </literal> general lookup code and all lookups
4856 <literal>memory         </literal> memory handling
4857 <literal>pid            </literal> add pid to debug output lines
4858 <literal>process_info   </literal> setting info for the process log
4859 <literal>queue_run      </literal> queue runs
4860 <literal>receive        </literal> general message reception logic
4861 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
4862 <literal>retry          </literal> retry handling
4863 <literal>rewrite        </literal> address rewriting
4864 <literal>route          </literal> address routing
4865 <literal>timestamp      </literal> add timestamp to debug output lines
4866 <literal>tls            </literal> TLS logic
4867 <literal>transport      </literal> transports
4868 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
4869 <literal>verify         </literal> address verification logic
4870 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
4871 </literallayout>
4872 <para>
4873 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4874 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4875 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4876 is included, an awful lot of output that is very rarely of interest is
4877 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4878 turn everything off.
4879 </para>
4880 <para>
4881 <indexterm role="concept">
4882 <primary>resolver, debugging output</primary>
4883 </indexterm>
4884 <indexterm role="concept">
4885 <primary>DNS resolver, debugging output</primary>
4886 </indexterm>
4887 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4888 with DEBUG enabled. This is not the case in some operating systems. Also,
4889 unfortunately, debugging output from the DNS resolver is written to stdout
4890 rather than stderr.
4891 </para>
4892 <para>
4893 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4894 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4895 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4896 daemon, which then passes it on to any re-executed Exims. Exim also
4897 automatically adds the pid to debug lines when several remote deliveries are
4898 run in parallel.
4899 </para>
4900 <para>
4901 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4902 of all debug output lines. This can be useful when trying to track down delays
4903 in processing.
4904 </para>
4905 <para>
4906 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4907 any debugging is selected, or if <option>-v</option> is used.
4908 </para>
4909 </listitem></varlistentry>
4910 <varlistentry>
4911 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4912 <listitem>
4913 <para>
4914 <indexterm role="option">
4915 <primary><option>-dd</option></primary>
4916 </indexterm>
4917 This option behaves exactly like <option>-d</option> except when used on a command that
4918 starts a daemon process. In that case, debugging is turned off for the
4919 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4920 behaviour of the daemon without creating as much output as full debugging does.
4921 </para>
4922 </listitem></varlistentry>
4923 <varlistentry>
4924 <term><option>-dropcr</option></term>
4925 <listitem>
4926 <para>
4927 <indexterm role="option">
4928 <primary><option>-dropcr</option></primary>
4929 </indexterm>
4930 This is an obsolete option that is now a no-op. It used to affect the way Exim
4931 handled CR and LF characters in incoming messages. What happens now is
4932 described in section <xref linkend="SECTlineendings"/>.
4933 </para>
4934 </listitem></varlistentry>
4935 <varlistentry>
4936 <term><option>-E</option></term>
4937 <listitem>
4938 <para>
4939 <indexterm role="option">
4940 <primary><option>-E</option></primary>
4941 </indexterm>
4942 <indexterm role="concept">
4943 <primary>bounce message</primary>
4944 <secondary>generating</secondary>
4945 </indexterm>
4946 This option specifies that an incoming message is a locally-generated delivery
4947 failure report. It is used internally by Exim when handling delivery failures
4948 and is not intended for external use. Its only effect is to stop Exim
4949 generating certain messages to the postmaster, as otherwise message cascades
4950 could occur in some situations. As part of the same option, a message id may
4951 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4952 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4953 </para>
4954 </listitem></varlistentry>
4955 <varlistentry>
4956 <term><option>-e</option><emphasis>x</emphasis></term>
4957 <listitem>
4958 <para>
4959 <indexterm role="option">
4960 <primary><option>-e</option><emphasis>x</emphasis></primary>
4961 </indexterm>
4962 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4963 called by various programs without the leading <option>o</option> in the option. For
4964 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4965 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
4966 </para>
4967 </listitem></varlistentry>
4968 <varlistentry>
4969 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
4970 <listitem>
4971 <para>
4972 <indexterm role="option">
4973 <primary><option>-F</option></primary>
4974 </indexterm>
4975 <indexterm role="concept">
4976 <primary>sender</primary>
4977 <secondary>name</secondary>
4978 </indexterm>
4979 <indexterm role="concept">
4980 <primary>name</primary>
4981 <secondary>of sender</secondary>
4982 </indexterm>
4983 This option sets the sender&#x2019;s full name for use when a locally-generated
4984 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
4985 entry from the password data is used. As users are generally permitted to alter
4986 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
4987 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
4988 </para>
4989 </listitem></varlistentry>
4990 <varlistentry>
4991 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
4992 <listitem>
4993 <para>
4994 <indexterm role="option">
4995 <primary><option>-f</option></primary>
4996 </indexterm>
4997 <indexterm role="concept">
4998 <primary>sender</primary>
4999 <secondary>address</secondary>
5000 </indexterm>
5001 <indexterm role="concept">
5002 <primary>address</primary>
5003 <secondary>sender</secondary>
5004 </indexterm>
5005 <indexterm role="concept">
5006 <primary>trusted users</primary>
5007 </indexterm>
5008 <indexterm role="concept">
5009 <primary>envelope sender</primary>
5010 </indexterm>
5011 <indexterm role="concept">
5012 <primary>user</primary>
5013 <secondary>trusted</secondary>
5014 </indexterm>
5015 This option sets the address of the envelope sender of a locally-generated
5016 message (also known as the return path). The option can normally be used only
5017 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5018 users to use it.
5019 </para>
5020 <para>
5021 Processes running as root or the Exim user are always trusted. Other
5022 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5023 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5024 of a local message is set to the caller&#x2019;s login name at the default qualify
5025 domain.
5026 </para>
5027 <para>
5028 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5029 can be specified by any user, trusted or not, to create a message that can
5030 never provoke a bounce. An empty sender can be specified either as an empty
5031 string, or as a pair of angle brackets with nothing between them, as in these
5032 examples of shell commands:
5033 </para>
5034 <literallayout class="monospaced">
5035 exim -f '&lt;&gt;' user@domain
5036 exim -f "" user@domain
5037 </literallayout>
5038 <para>
5039 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5040 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5041 <option>-bv</option> options.
5042 </para>
5043 <para>
5044 Allowing untrusted users to change the sender address does not of itself make
5045 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5046 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5047 though this can be overridden by setting <option>no_local_from_check</option>.
5048 </para>
5049 <para>
5050 White
5051 <indexterm role="concept">
5052 <primary><quote>From</quote> line</primary>
5053 </indexterm>
5054 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5055 given as two arguments or one combined argument). The sender of a
5056 locally-generated message can also be set (when permitted) by an initial
5057 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5058 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5059 </para>
5060 </listitem></varlistentry>
5061 <varlistentry>
5062 <term><option>-G</option></term>
5063 <listitem>
5064 <para>
5065 <indexterm role="option">
5066 <primary><option>-G</option></primary>
5067 </indexterm>
5068 <indexterm role="concept">
5069 <primary>Sendmail compatibility</primary>
5070 <secondary><option>-G</option> option ignored</secondary>
5071 </indexterm>
5072 This is a Sendmail option which is ignored by Exim.
5073 </para>
5074 </listitem></varlistentry>
5075 <varlistentry>
5076 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5077 <listitem>
5078 <para>
5079 <indexterm role="option">
5080 <primary><option>-h</option></primary>
5081 </indexterm>
5082 <indexterm role="concept">
5083 <primary>Sendmail compatibility</primary>
5084 <secondary><option>-h</option> option ignored</secondary>
5085 </indexterm>
5086 This option is accepted for compatibility with Sendmail, but has no effect. (In
5087 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5088 headers.)
5089 </para>
5090 </listitem></varlistentry>
5091 <varlistentry>
5092 <term><option>-i</option></term>
5093 <listitem>
5094 <para>
5095 <indexterm role="option">
5096 <primary><option>-i</option></primary>
5097 </indexterm>
5098 <indexterm role="concept">
5099 <primary>Solaris</primary>
5100 <secondary><emphasis>mail</emphasis> command</secondary>
5101 </indexterm>
5102 <indexterm role="concept">
5103 <primary>dot</primary>
5104 <secondary>in incoming non-SMTP message</secondary>
5105 </indexterm>
5106 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5107 line by itself should not terminate an incoming, non-SMTP message. I can find
5108 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5109 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5110 </para>
5111 </listitem></varlistentry>
5112 <varlistentry>
5113 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5114 <listitem>
5115 <para>
5116 <indexterm role="option">
5117 <primary><option>-M</option></primary>
5118 </indexterm>
5119 <indexterm role="concept">
5120 <primary>forcing delivery</primary>
5121 </indexterm>
5122 <indexterm role="concept">
5123 <primary>delivery</primary>
5124 <secondary>forcing attempt</secondary>
5125 </indexterm>
5126 <indexterm role="concept">
5127 <primary>frozen messages</primary>
5128 <secondary>forcing delivery</secondary>
5129 </indexterm>
5130 This option requests Exim to run a delivery attempt on each message in turn. If
5131 any of the messages are frozen, they are automatically thawed before the
5132 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5133 and <option>hold_domains</option> are ignored.
5134 </para>
5135 <para>
5136 Retry
5137 <indexterm role="concept">
5138 <primary>hints database</primary>
5139 <secondary>overriding retry hints</secondary>
5140 </indexterm>
5141 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5142 the normal retry time has not yet been reached. This option requires the caller
5143 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5144 which can be set false to relax this restriction (and also the same requirement
5145 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5146 </para>
5147 <para>
5148 The deliveries happen synchronously, that is, the original Exim process does
5149 not terminate until all the delivery attempts have finished. No output is
5150 produced unless there is a serious error. If you want to see what is happening,
5151 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5152 </para>
5153 </listitem></varlistentry>
5154 <varlistentry>
5155 <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>
5156 <listitem>
5157 <para>
5158 <indexterm role="option">
5159 <primary><option>-Mar</option></primary>
5160 </indexterm>
5161 <indexterm role="concept">
5162 <primary>message</primary>
5163 <secondary>adding recipients</secondary>
5164 </indexterm>
5165 <indexterm role="concept">
5166 <primary>recipient</primary>
5167 <secondary>adding</secondary>
5168 </indexterm>
5169 This option requests Exim to add the addresses to the list of recipients of the
5170 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5171 id, and the remaining ones must be email addresses. However, if the message is
5172 active (in the middle of a delivery attempt), it is not altered. This option
5173 can be used only by an admin user.
5174 </para>
5175 </listitem></varlistentry>
5176 <varlistentry>
5177 <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>
5178 <listitem>
5179 <para>
5180 <indexterm role="option">
5181 <primary><option>-MC</option></primary>
5182 </indexterm>
5183 <indexterm role="concept">
5184 <primary>SMTP</primary>
5185 <secondary>passed connection</secondary>
5186 </indexterm>
5187 <indexterm role="concept">
5188 <primary>SMTP</primary>
5189 <secondary>multiple deliveries</secondary>
5190 </indexterm>
5191 <indexterm role="concept">
5192 <primary>multiple SMTP deliveries</primary>
5193 </indexterm>
5194 This option is not intended for use by external callers. It is used internally
5195 by Exim to invoke another instance of itself to deliver a waiting message using
5196 an existing SMTP connection, which is passed as the standard input. Details are
5197 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5198 must be root or the Exim user in order to use it.
5199 </para>
5200 </listitem></varlistentry>
5201 <varlistentry>
5202 <term><option>-MCA</option></term>
5203 <listitem>
5204 <para>
5205 <indexterm role="option">
5206 <primary><option>-MCA</option></primary>
5207 </indexterm>
5208 This option is not intended for use by external callers. It is used internally
5209 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5210 connection to the remote host has been authenticated.
5211 </para>
5212 </listitem></varlistentry>
5213 <varlistentry>
5214 <term><option>-MCP</option></term>
5215 <listitem>
5216 <para>
5217 <indexterm role="option">
5218 <primary><option>-MCP</option></primary>
5219 </indexterm>
5220 This option is not intended for use by external callers. It is used internally
5221 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5222 which Exim is connected supports pipelining.
5223 </para>
5224 </listitem></varlistentry>
5225 <varlistentry>
5226 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5227 <listitem>
5228 <para>
5229 <indexterm role="option">
5230 <primary><option>-MCQ</option></primary>
5231 </indexterm>
5232 This option is not intended for use by external callers. It is used internally
5233 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5234 started by a queue runner. It passes on the process id of the queue runner,
5235 together with the file descriptor number of an open pipe. Closure of the pipe
5236 signals the final completion of the sequence of processes that are passing
5237 messages through the same SMTP connection.
5238 </para>
5239 </listitem></varlistentry>
5240 <varlistentry>
5241 <term><option>-MCS</option></term>
5242 <listitem>
5243 <para>
5244 <indexterm role="option">
5245 <primary><option>-MCS</option></primary>
5246 </indexterm>
5247 This option is not intended for use by external callers. It is used internally
5248 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5249 SMTP SIZE option should be used on messages delivered down the existing
5250 connection.
5251 </para>
5252 </listitem></varlistentry>
5253 <varlistentry>
5254 <term><option>-MCT</option></term>
5255 <listitem>
5256 <para>
5257 <indexterm role="option">
5258 <primary><option>-MCT</option></primary>
5259 </indexterm>
5260 This option is not intended for use by external callers. It is used internally
5261 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5262 host to which Exim is connected supports TLS encryption.
5263 </para>
5264 </listitem></varlistentry>
5265 <varlistentry>
5266 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5267 <listitem>
5268 <para>
5269 <indexterm role="option">
5270 <primary><option>-Mc</option></primary>
5271 </indexterm>
5272 <indexterm role="concept">
5273 <primary>hints database</primary>
5274 <secondary>not overridden by <option>-Mc</option></secondary>
5275 </indexterm>
5276 <indexterm role="concept">
5277 <primary>delivery</primary>
5278 <secondary>manually started &ndash; not forced</secondary>
5279 </indexterm>
5280 This option requests Exim to run a delivery attempt on each message in turn,
5281 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5282 that are found. This option is not very useful to external callers. It is
5283 provided mainly for internal use by Exim when it needs to re-invoke itself in
5284 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5285 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5286 respects retry times and other options such as <option>hold_domains</option> that are
5287 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5288 If you want to run a specific delivery as if in a queue run, you should use
5289 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5290 and other deliveries is made in one or two places.
5291 </para>
5292 </listitem></varlistentry>
5293 <varlistentry>
5294 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5295 <listitem>
5296 <para>
5297 <indexterm role="option">
5298 <primary><option>-Mes</option></primary>
5299 </indexterm>
5300 <indexterm role="concept">
5301 <primary>message</primary>
5302 <secondary>changing sender</secondary>
5303 </indexterm>
5304 <indexterm role="concept">
5305 <primary>sender</primary>
5306 <secondary>changing</secondary>
5307 </indexterm>
5308 This option requests Exim to change the sender address in the message to the
5309 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5310 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5311 be a message id, and the second one an email address. However, if the message
5312 is active (in the middle of a delivery attempt), its status is not altered.
5313 This option can be used only by an admin user.
5314 </para>
5315 </listitem></varlistentry>
5316 <varlistentry>
5317 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5318 <listitem>
5319 <para>
5320 <indexterm role="option">
5321 <primary><option>-Mf</option></primary>
5322 </indexterm>
5323 <indexterm role="concept">
5324 <primary>freezing messages</primary>
5325 </indexterm>
5326 <indexterm role="concept">
5327 <primary>message</primary>
5328 <secondary>manually freezing</secondary>
5329 </indexterm>
5330 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5331 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5332 either manually or as a result of the <option>auto_thaw</option> configuration option.
5333 However, if any of the messages are active (in the middle of a delivery
5334 attempt), their status is not altered. This option can be used only by an admin
5335 user.
5336 </para>
5337 </listitem></varlistentry>
5338 <varlistentry>
5339 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5340 <listitem>
5341 <para>
5342 <indexterm role="option">
5343 <primary><option>-Mg</option></primary>
5344 </indexterm>
5345 <indexterm role="concept">
5346 <primary>giving up on messages</primary>
5347 </indexterm>
5348 <indexterm role="concept">
5349 <primary>message</primary>
5350 <secondary>abandoning delivery attempts</secondary>
5351 </indexterm>
5352 <indexterm role="concept">
5353 <primary>delivery</primary>
5354 <secondary>abandoning further attempts</secondary>
5355 </indexterm>
5356 This option requests Exim to give up trying to deliver the listed messages,
5357 including any that are frozen. However, if any of the messages are active,
5358 their status is not altered. For non-bounce messages, a delivery error message
5359 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5360 Bounce messages are just discarded. This option can be used only by an admin
5361 user.
5362 </para>
5363 </listitem></varlistentry>
5364 <varlistentry>
5365 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5366 <listitem>
5367 <para>
5368 <indexterm role="option">
5369 <primary><option>-Mmad</option></primary>
5370 </indexterm>
5371 <indexterm role="concept">
5372 <primary>delivery</primary>
5373 <secondary>cancelling all</secondary>
5374 </indexterm>
5375 This option requests Exim to mark all the recipient addresses in the messages
5376 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5377 message is active (in the middle of a delivery attempt), its status is not
5378 altered. This option can be used only by an admin user.
5379 </para>
5380 </listitem></varlistentry>
5381 <varlistentry>
5382 <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>
5383 <listitem>
5384 <para>
5385 <indexterm role="option">
5386 <primary><option>-Mmd</option></primary>
5387 </indexterm>
5388 <indexterm role="concept">
5389 <primary>delivery</primary>
5390 <secondary>cancelling by address</secondary>
5391 </indexterm>
5392 <indexterm role="concept">
5393 <primary>recipient</primary>
5394 <secondary>removing</secondary>
5395 </indexterm>
5396 <indexterm role="concept">
5397 <primary>removing recipients</primary>
5398 </indexterm>
5399 This option requests Exim to mark the given addresses as already delivered
5400 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5401 the remaining ones must be email addresses. These are matched to recipient
5402 addresses in the message in a case-sensitive manner. If the message is active
5403 (in the middle of a delivery attempt), its status is not altered. This option
5404 can be used only by an admin user.
5405 </para>
5406 </listitem></varlistentry>
5407 <varlistentry>
5408 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5409 <listitem>
5410 <para>
5411 <indexterm role="option">
5412 <primary><option>-Mrm</option></primary>
5413 </indexterm>
5414 <indexterm role="concept">
5415 <primary>removing messages</primary>
5416 </indexterm>
5417 <indexterm role="concept">
5418 <primary>abandoning mail</primary>
5419 </indexterm>
5420 <indexterm role="concept">
5421 <primary>message</primary>
5422 <secondary>manually discarding</secondary>
5423 </indexterm>
5424 This option requests Exim to remove the given messages from the queue. No
5425 bounce messages are sent; each message is simply forgotten. However, if any of
5426 the messages are active, their status is not altered. This option can be used
5427 only by an admin user or by the user who originally caused the message to be
5428 placed on the queue.
5429 </para>
5430 </listitem></varlistentry>
5431 <varlistentry>
5432 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5433 <listitem>
5434 <para>
5435 <indexterm role="option">
5436 <primary><option>-Mset</option></primary>
5437 </indexterm>
5438 <indexterm role="concept">
5439 <primary>testing</primary>
5440 <secondary>string expansion</secondary>
5441 </indexterm>
5442 <indexterm role="concept">
5443 <primary>expansion</primary>
5444 <secondary>testing</secondary>
5445 </indexterm>
5446 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5447 string expansions). Exim loads the given message from its spool before doing
5448 the test expansions, thus setting message-specific variables such as
5449 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5450 available. This feature is provided to make it easier to test expansions that
5451 make use of these variables. However, this option can be used only by an admin
5452 user. See also <option>-bem</option>.
5453 </para>
5454 </listitem></varlistentry>
5455 <varlistentry>
5456 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5457 <listitem>
5458 <para>
5459 <indexterm role="option">
5460 <primary><option>-Mt</option></primary>
5461 </indexterm>
5462 <indexterm role="concept">
5463 <primary>thawing messages</primary>
5464 </indexterm>
5465 <indexterm role="concept">
5466 <primary>unfreezing messages</primary>
5467 </indexterm>
5468 <indexterm role="concept">
5469 <primary>frozen messages</primary>
5470 <secondary>thawing</secondary>
5471 </indexterm>
5472 <indexterm role="concept">
5473 <primary>message</primary>
5474 <secondary>thawing frozen</secondary>
5475 </indexterm>
5476 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5477 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5478 messages are active, their status is not altered. This option can be used only
5479 by an admin user.
5480 </para>
5481 </listitem></varlistentry>
5482 <varlistentry>
5483 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5484 <listitem>
5485 <para>
5486 <indexterm role="option">
5487 <primary><option>-Mvb</option></primary>
5488 </indexterm>
5489 <indexterm role="concept">
5490 <primary>listing</primary>
5491 <secondary>message body</secondary>
5492 </indexterm>
5493 <indexterm role="concept">
5494 <primary>message</primary>
5495 <secondary>listing body of</secondary>
5496 </indexterm>
5497 This option causes the contents of the message body (-D) spool file to be
5498 written to the standard output. This option can be used only by an admin user.
5499 </para>
5500 </listitem></varlistentry>
5501 <varlistentry revisionflag="changed">
5502 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5503 <listitem>
5504 <para revisionflag="changed">
5505 <indexterm role="option">
5506 <primary><option>-Mvc</option></primary>
5507 </indexterm>
5508 <indexterm role="concept">
5509 <primary>message</primary>
5510 <secondary>listing in RFC 2822 format</secondary>
5511 </indexterm>
5512 <indexterm role="concept">
5513 <primary>listing</primary>
5514 <secondary>message in RFC 2922 format</secondary>
5515 </indexterm>
5516 This option causes a copy of the complete message (header lines plus body) to
5517 be written to the standard output in RFC 2822 format. This option can be used
5518 only by an admin user.
5519 </para>
5520 </listitem></varlistentry>
5521 <varlistentry>
5522 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5523 <listitem>
5524 <para>
5525 <indexterm role="option">
5526 <primary><option>-Mvh</option></primary>
5527 </indexterm>
5528 <indexterm role="concept">
5529 <primary>listing</primary>
5530 <secondary>message headers</secondary>
5531 </indexterm>
5532 <indexterm role="concept">
5533 <primary>header lines</primary>
5534 <secondary>listing</secondary>
5535 </indexterm>
5536 <indexterm role="concept">
5537 <primary>message</primary>
5538 <secondary>listing header lines</secondary>
5539 </indexterm>
5540 This option causes the contents of the message headers (-H) spool file to be
5541 written to the standard output. This option can be used only by an admin user.
5542 </para>
5543 </listitem></varlistentry>
5544 <varlistentry>
5545 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5546 <listitem>
5547 <para>
5548 <indexterm role="option">
5549 <primary><option>-Mvl</option></primary>
5550 </indexterm>
5551 <indexterm role="concept">
5552 <primary>listing</primary>
5553 <secondary>message log</secondary>
5554 </indexterm>
5555 <indexterm role="concept">
5556 <primary>message</primary>
5557 <secondary>listing message log</secondary>
5558 </indexterm>
5559 This option causes the contents of the message log spool file to be written to
5560 the standard output. This option can be used only by an admin user.
5561 </para>
5562 </listitem></varlistentry>
5563 <varlistentry>
5564 <term><option>-m</option></term>
5565 <listitem>
5566 <para>
5567 <indexterm role="option">
5568 <primary><option>-m</option></primary>
5569 </indexterm>
5570 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5571 treats it that way too.
5572 </para>
5573 </listitem></varlistentry>
5574 <varlistentry>
5575 <term><option>-N</option></term>
5576 <listitem>
5577 <para>
5578 <indexterm role="option">
5579 <primary><option>-N</option></primary>
5580 </indexterm>
5581 <indexterm role="concept">
5582 <primary>debugging</primary>
5583 <secondary><option>-N</option> option</secondary>
5584 </indexterm>
5585 <indexterm role="concept">
5586 <primary>debugging</primary>
5587 <secondary>suppressing delivery</secondary>
5588 </indexterm>
5589 This is a debugging option that inhibits delivery of a message at the transport
5590 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5591 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5592 had successfully done so. However, it does not make any updates to the retry
5593 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5594 than <quote>=&gt;</quote>.
5595 </para>
5596 <para>
5597 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5598 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5599 words, an ordinary user can use it only when supplying an incoming message to
5600 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5601 address may be deferred because of a configuration problem on a transport, or a
5602 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5603 the message, and applies to any subsequent delivery attempts that may happen
5604 for that message.
5605 </para>
5606 </listitem></varlistentry>
5607 <varlistentry>
5608 <term><option>-n</option></term>
5609 <listitem>
5610 <para>
5611 <indexterm role="option">
5612 <primary><option>-n</option></primary>
5613 </indexterm>
5614 <indexterm role="concept">
5615 <primary>Sendmail compatibility</primary>
5616 <secondary><option>-n</option> option ignored</secondary>
5617 </indexterm>
5618 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5619 by Exim.
5620 </para>
5621 </listitem></varlistentry>
5622 <varlistentry>
5623 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5624 <listitem>
5625 <para>
5626 <indexterm role="option">
5627 <primary><option>-O</option></primary>
5628 </indexterm>
5629 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5630 Exim.
5631 </para>
5632 </listitem></varlistentry>
5633 <varlistentry>
5634 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5635 <listitem>
5636 <para>
5637 <indexterm role="option">
5638 <primary><option>-oA</option></primary>
5639 </indexterm>
5640 <indexterm role="concept">
5641 <primary>Sendmail compatibility</primary>
5642 <secondary><option>-oA</option> option</secondary>
5643 </indexterm>
5644 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5645 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5646 description above.
5647 </para>
5648 </listitem></varlistentry>
5649 <varlistentry>
5650 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5651 <listitem>
5652 <para>
5653 <indexterm role="option">
5654 <primary><option>-oB</option></primary>
5655 </indexterm>
5656 <indexterm role="concept">
5657 <primary>SMTP</primary>
5658 <secondary>passed connection</secondary>
5659 </indexterm>
5660 <indexterm role="concept">
5661 <primary>SMTP</primary>
5662 <secondary>multiple deliveries</secondary>
5663 </indexterm>
5664 <indexterm role="concept">
5665 <primary>multiple SMTP deliveries</primary>
5666 </indexterm>
5667 This is a debugging option which limits the maximum number of messages that can
5668 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5669 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
5670 </para>
5671 </listitem></varlistentry>
5672 <varlistentry>
5673 <term><option>-odb</option></term>
5674 <listitem>
5675 <para>
5676 <indexterm role="option">
5677 <primary><option>-odb</option></primary>
5678 </indexterm>
5679 <indexterm role="concept">
5680 <primary>background delivery</primary>
5681 </indexterm>
5682 <indexterm role="concept">
5683 <primary>delivery</primary>
5684 <secondary>in the background</secondary>
5685 </indexterm>
5686 This option applies to all modes in which Exim accepts incoming messages,
5687 including the listening daemon. It requests <quote>background</quote> delivery of such
5688 messages, which means that the accepting process automatically starts a
5689 delivery process for each message received, but does not wait for the delivery
5690 processes to finish.
5691 </para>
5692 <para>
5693 When all the messages have been received, the reception process exits,
5694 leaving the delivery processes to finish in their own time. The standard output
5695 and error streams are closed at the start of each delivery process.
5696 This is the default action if none of the <option>-od</option> options are present.
5697 </para>
5698 <para>
5699 If one of the queueing options in the configuration file
5700 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5701 overrides it if <option>queue_only_override</option> is set true, which is the default
5702 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5703 </para>
5704 </listitem></varlistentry>
5705 <varlistentry>
5706 <term><option>-odf</option></term>
5707 <listitem>
5708 <para>
5709 <indexterm role="option">
5710 <primary><option>-odf</option></primary>
5711 </indexterm>
5712 <indexterm role="concept">
5713 <primary>foreground delivery</primary>
5714 </indexterm>
5715 <indexterm role="concept">
5716 <primary>delivery</primary>
5717 <secondary>in the foreground</secondary>
5718 </indexterm>
5719 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5720 accepted a locally-generated message. (For the daemon it is exactly the same as
5721 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5722 and Exim waits for it to complete before proceeding.
5723 </para>
5724 <para>
5725 The original Exim reception process does not finish until the delivery
5726 process for the final message has ended. The standard error stream is left open
5727 during deliveries.
5728 </para>
5729 <para>
5730 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5731 false and one of the queueing options in the configuration file is in effect.
5732 </para>
5733 <para>
5734 If there is a temporary delivery error during foreground delivery, the
5735 message is left on the queue for later delivery, and the original reception
5736 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5737 restricted configuration that never queues messages.
5738 </para>
5739 </listitem></varlistentry>
5740 <varlistentry>
5741 <term><option>-odi</option></term>
5742 <listitem>
5743 <para>
5744 <indexterm role="option">
5745 <primary><option>-odi</option></primary>
5746 </indexterm>
5747 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5748 Sendmail.
5749 </para>
5750 </listitem></varlistentry>
5751 <varlistentry>
5752 <term><option>-odq</option></term>
5753 <listitem>
5754 <para>
5755 <indexterm role="option">
5756 <primary><option>-odq</option></primary>
5757 </indexterm>
5758 <indexterm role="concept">
5759 <primary>non-immediate delivery</primary>
5760 </indexterm>
5761 <indexterm role="concept">
5762 <primary>delivery</primary>
5763 <secondary>suppressing immediate</secondary>
5764 </indexterm>
5765 <indexterm role="concept">
5766 <primary>queueing incoming messages</primary>
5767 </indexterm>
5768 This option applies to all modes in which Exim accepts incoming messages,
5769 including the listening daemon. It specifies that the accepting process should
5770 not automatically start a delivery process for each message received. Messages
5771 are placed on the queue, and remain there until a subsequent queue runner
5772 process encounters them. There are several configuration options (such as
5773 <option>queue_only</option>) that can be used to queue incoming messages under certain
5774 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5775 forces queueing.
5776 </para>
5777 </listitem></varlistentry>
5778 <varlistentry>
5779 <term><option>-odqs</option></term>
5780 <listitem>
5781 <para>
5782 <indexterm role="option">
5783 <primary><option>-odqs</option></primary>
5784 </indexterm>
5785 <indexterm role="concept">
5786 <primary>SMTP</primary>
5787 <secondary>delaying delivery</secondary>
5788 </indexterm>
5789 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5790 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5791 <option>queue_only_override</option> is false and one of the queueing options in the
5792 configuration file is in effect.
5793 </para>
5794 <para>
5795 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5796 message, in the background by default, but in the foreground if <option>-odi</option> is
5797 also present. The recipient addresses are routed, and local deliveries are done
5798 in the normal way. However, if any SMTP deliveries are required, they are not
5799 done at this time, so the message remains on the queue until a subsequent queue
5800 runner process encounters it. Because routing was done, Exim knows which
5801 messages are waiting for which hosts, and so a number of messages for the same
5802 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5803 configuration option has the same effect for specific domains. See also the
5804 <option>-qq</option> option.
5805 </para>
5806 </listitem></varlistentry>
5807 <varlistentry>
5808 <term><option>-oee</option></term>
5809 <listitem>
5810 <para>
5811 <indexterm role="option">
5812 <primary><option>-oee</option></primary>
5813 </indexterm>
5814 <indexterm role="concept">
5815 <primary>error</primary>
5816 <secondary>reporting</secondary>
5817 </indexterm>
5818 If an error is detected while a non-SMTP message is being received (for
5819 example, a malformed address), the error is reported to the sender in a mail
5820 message.
5821 </para>
5822 <para>
5823 <indexterm role="concept">
5824 <primary>return code</primary>
5825 <secondary>for <option>-oee</option></secondary>
5826 </indexterm>
5827 Provided
5828 this error message is successfully sent, the Exim receiving process
5829 exits with a return code of zero. If not, the return code is 2 if the problem
5830 is that the original message has no recipients, or 1 any other error. This is
5831 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5832 </para>
5833 </listitem></varlistentry>
5834 <varlistentry>
5835 <term><option>-oem</option></term>
5836 <listitem>
5837 <para>
5838 <indexterm role="option">
5839 <primary><option>-oem</option></primary>
5840 </indexterm>
5841 <indexterm role="concept">
5842 <primary>error</primary>
5843 <secondary>reporting</secondary>
5844 </indexterm>
5845 <indexterm role="concept">
5846 <primary>return code</primary>
5847 <secondary>for <option>-oem</option></secondary>
5848 </indexterm>
5849 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5850 return code, whether or not the error message was successfully sent.
5851 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5852 </para>
5853 </listitem></varlistentry>
5854 <varlistentry>
5855 <term><option>-oep</option></term>
5856 <listitem>
5857 <para>
5858 <indexterm role="option">
5859 <primary><option>-oep</option></primary>
5860 </indexterm>
5861 <indexterm role="concept">
5862 <primary>error</primary>
5863 <secondary>reporting</secondary>
5864 </indexterm>
5865 If an error is detected while a non-SMTP message is being received, the
5866 error is reported by writing a message to the standard error file (stderr).
5867 <indexterm role="concept">
5868 <primary>return code</primary>
5869 <secondary>for <option>-oep</option></secondary>
5870 </indexterm>
5871 The return code is 1 for all errors.
5872 </para>
5873 </listitem></varlistentry>
5874 <varlistentry>
5875 <term><option>-oeq</option></term>
5876 <listitem>
5877 <para>
5878 <indexterm role="option">
5879 <primary><option>-oeq</option></primary>
5880 </indexterm>
5881 <indexterm role="concept">
5882 <primary>error</primary>
5883 <secondary>reporting</secondary>
5884 </indexterm>
5885 This option is supported for compatibility with Sendmail, but has the same
5886 effect as <option>-oep</option>.
5887 </para>
5888 </listitem></varlistentry>
5889 <varlistentry>
5890 <term><option>-oew</option></term>
5891 <listitem>
5892 <para>
5893 <indexterm role="option">
5894 <primary><option>-oew</option></primary>
5895 </indexterm>
5896 <indexterm role="concept">
5897 <primary>error</primary>
5898 <secondary>reporting</secondary>
5899 </indexterm>
5900 This option is supported for compatibility with Sendmail, but has the same
5901 effect as <option>-oem</option>.
5902 </para>
5903 </listitem></varlistentry>
5904 <varlistentry>
5905 <term><option>-oi</option></term>
5906 <listitem>
5907 <para>
5908 <indexterm role="option">
5909 <primary><option>-oi</option></primary>
5910 </indexterm>
5911 <indexterm role="concept">
5912 <primary>dot</primary>
5913 <secondary>in incoming non-SMTP message</secondary>
5914 </indexterm>
5915 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5916 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5917 single dot does terminate, though Exim does no special processing for other
5918 lines that start with a dot. This option is set by default if Exim is called as
5919 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5920 </para>
5921 </listitem></varlistentry>
5922 <varlistentry>
5923 <term><option>-oitrue</option></term>
5924 <listitem>
5925 <para>
5926 <indexterm role="option">
5927 <primary><option>-oitrue</option></primary>
5928 </indexterm>
5929 This option is treated as synonymous with <option>-oi</option>.
5930 </para>
5931 </listitem></varlistentry>
5932 <varlistentry>
5933 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
5934 <listitem>
5935 <para>
5936 <indexterm role="option">
5937 <primary><option>-oMa</option></primary>
5938 </indexterm>
5939 <indexterm role="concept">
5940 <primary>sender</primary>
5941 <secondary>host address, specifying for local message</secondary>
5942 </indexterm>
5943 A number of options starting with <option>-oM</option> can be used to set values associated
5944 with remote hosts on locally-submitted messages (that is, messages not received
5945 over TCP/IP). These options can be used by any caller in conjunction with the
5946 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5947 other circumstances, they are ignored unless the caller is trusted.
5948 </para>
5949 <para>
5950 The <option>-oMa</option> option sets the sender host address. This may include a port
5951 number at the end, after a full stop (period). For example:
5952 </para>
5953 <literallayout class="monospaced">
5954 exim -bs -oMa 10.9.8.7.1234
5955 </literallayout>
5956 <para>
5957 An alternative syntax is to enclose the IP address in square brackets,
5958 followed by a colon and the port number:
5959 </para>
5960 <literallayout class="monospaced">
5961 exim -bs -oMa [10.9.8.7]:1234
5962 </literallayout>
5963 <para>
5964 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5965 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
5966 are present on the command line, the sender host IP address is taken from
5967 whichever one is last.
5968 </para>
5969 </listitem></varlistentry>
5970 <varlistentry>
5971 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
5972 <listitem>
5973 <para>
5974 <indexterm role="option">
5975 <primary><option>-oMaa</option></primary>
5976 </indexterm>
5977 <indexterm role="concept">
5978 <primary>authentication</primary>
5979 <secondary>name, specifying for local message</secondary>
5980 </indexterm>
5981 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
5982 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
5983 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
5984 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
5985 authenticated SMTP session without actually using the SMTP AUTH command.
5986 </para>
5987 </listitem></varlistentry>
5988 <varlistentry>
5989 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5990 <listitem>
5991 <para>
5992 <indexterm role="option">
5993 <primary><option>-oMai</option></primary>
5994 </indexterm>
5995 <indexterm role="concept">
5996 <primary>authentication</primary>
5997 <secondary>id, specifying for local message</secondary>
5998 </indexterm>
5999 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6000 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6001 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6002 where there is no default) for messages from local sources. See chapter
6003 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6004 </para>
6005 </listitem></varlistentry>
6006 <varlistentry>
6007 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6008 <listitem>
6009 <para>
6010 <indexterm role="option">
6011 <primary><option>-oMas</option></primary>
6012 </indexterm>
6013 <indexterm role="concept">
6014 <primary>authentication</primary>
6015 <secondary>sender, specifying for local message</secondary>
6016 </indexterm>
6017 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6018 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6019 overrides the sender address that is created from the caller&#x2019;s login id for
6020 messages from local sources, except when <option>-bh</option> is used, when there is no
6021 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6022 specified on a MAIL command overrides this value. See chapter
6023 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6024 </para>
6025 </listitem></varlistentry>
6026 <varlistentry>
6027 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6028 <listitem>
6029 <para>
6030 <indexterm role="option">
6031 <primary><option>-oMi</option></primary>
6032 </indexterm>
6033 <indexterm role="concept">
6034 <primary>interface</primary>
6035 <secondary>address, specifying for local message</secondary>
6036 </indexterm>
6037 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6038 option sets the IP interface address value. A port number may be included,
6039 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6040 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6041 </para>
6042 </listitem></varlistentry>
6043 <varlistentry>
6044 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6045 <listitem>
6046 <para>
6047 <indexterm role="option">
6048 <primary><option>-oMr</option></primary>
6049 </indexterm>
6050 <indexterm role="concept">
6051 <primary>protocol, specifying for local message</primary>
6052 </indexterm>
6053 <indexterm role="variable">
6054 <primary><varname>$received_protocol</varname></primary>
6055 </indexterm>
6056 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6057 option sets the received protocol value that is stored in
6058 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6059 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6060 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6061 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6062 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6063 be set by <option>-oMr</option>.
6064 </para>
6065 </listitem></varlistentry>
6066 <varlistentry>
6067 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6068 <listitem>
6069 <para>
6070 <indexterm role="option">
6071 <primary><option>-oMs</option></primary>
6072 </indexterm>
6073 <indexterm role="concept">
6074 <primary>sender</primary>
6075 <secondary>host name, specifying for local message</secondary>
6076 </indexterm>
6077 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6078 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6079 present, Exim does not attempt to look up a host name from an IP address; it
6080 uses the name it is given.
6081 </para>
6082 </listitem></varlistentry>
6083 <varlistentry>
6084 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6085 <listitem>
6086 <para>
6087 <indexterm role="option">
6088 <primary><option>-oMt</option></primary>
6089 </indexterm>
6090 <indexterm role="concept">
6091 <primary>sender</primary>
6092 <secondary>ident string, specifying for local message</secondary>
6093 </indexterm>
6094 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6095 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6096 local callers is the login id of the calling process, except when <option>-bh</option> is
6097 used, when there is no default.
6098 </para>
6099 </listitem></varlistentry>
6100 <varlistentry>
6101 <term><option>-om</option></term>
6102 <listitem>
6103 <para>
6104 <indexterm role="option">
6105 <primary><option>-om</option></primary>
6106 </indexterm>
6107 <indexterm role="concept">
6108 <primary>Sendmail compatibility</primary>
6109 <secondary><option>-om</option> option ignored</secondary>
6110 </indexterm>
6111 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6112 message should receive a copy of the message if the sender appears in an alias
6113 expansion. Exim always does this, so the option does nothing.
6114 </para>
6115 </listitem></varlistentry>
6116 <varlistentry>
6117 <term><option>-oo</option></term>
6118 <listitem>
6119 <para>
6120 <indexterm role="option">
6121 <primary><option>-oo</option></primary>
6122 </indexterm>
6123 <indexterm role="concept">
6124 <primary>Sendmail compatibility</primary>
6125 <secondary><option>-oo</option> option ignored</secondary>
6126 </indexterm>
6127 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6128 whatever that means.
6129 </para>
6130 </listitem></varlistentry>
6131 <varlistentry>
6132 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6133 <listitem>
6134 <para>
6135 <indexterm role="option">
6136 <primary><option>-oP</option></primary>
6137 </indexterm>
6138 <indexterm role="concept">
6139 <primary>pid (process id)</primary>
6140 <secondary>of daemon</secondary>
6141 </indexterm>
6142 <indexterm role="concept">
6143 <primary>daemon</primary>
6144 <secondary>process id (pid)</secondary>
6145 </indexterm>
6146 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6147 value. The option specifies the file to which the process id of the daemon is
6148 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6149 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6150 because in those cases, the normal pid file is not used.
6151 </para>
6152 </listitem></varlistentry>
6153 <varlistentry>
6154 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6155 <listitem>
6156 <para>
6157 <indexterm role="option">
6158 <primary><option>-or</option></primary>
6159 </indexterm>
6160 <indexterm role="concept">
6161 <primary>timeout</primary>
6162 <secondary>for non-SMTP input</secondary>
6163 </indexterm>
6164 This option sets a timeout value for incoming non-SMTP messages. If it is not
6165 set, Exim will wait forever for the standard input. The value can also be set
6166 by the <option>receive_timeout</option> option. The format used for specifying times is
6167 described in section <xref linkend="SECTtimeformat"/>.
6168 </para>
6169 </listitem></varlistentry>
6170 <varlistentry>
6171 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6172 <listitem>
6173 <para>
6174 <indexterm role="option">
6175 <primary><option>-os</option></primary>
6176 </indexterm>
6177 <indexterm role="concept">
6178 <primary>timeout</primary>
6179 <secondary>for SMTP input</secondary>
6180 </indexterm>
6181 <indexterm role="concept">
6182 <primary>SMTP</primary>
6183 <secondary>input timeout</secondary>
6184 </indexterm>
6185 This option sets a timeout value for incoming SMTP messages. The timeout
6186 applies to each SMTP command and block of data. The value can also be set by
6187 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6188 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6189 </para>
6190 </listitem></varlistentry>
6191 <varlistentry>
6192 <term><option>-ov</option></term>
6193 <listitem>
6194 <para>
6195 <indexterm role="option">
6196 <primary><option>-ov</option></primary>
6197 </indexterm>
6198 This option has exactly the same effect as <option>-v</option>.
6199 </para>
6200 </listitem></varlistentry>
6201 <varlistentry>
6202 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6203 <listitem>
6204 <para>
6205 <indexterm role="option">
6206 <primary><option>-oX</option></primary>
6207 </indexterm>
6208 <indexterm role="concept">
6209 <primary>TCP/IP</primary>
6210 <secondary>setting listening ports</secondary>
6211 </indexterm>
6212 <indexterm role="concept">
6213 <primary>TCP/IP</primary>
6214 <secondary>setting listening interfaces</secondary>
6215 </indexterm>
6216 <indexterm role="concept">
6217 <primary>port</primary>
6218 <secondary>receiving TCP/IP</secondary>
6219 </indexterm>
6220 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6221 is also given. It controls which ports and interfaces the daemon uses. Details
6222 of the syntax, and how it interacts with configuration file options, are given
6223 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6224 file is written unless <option>-oP</option> is also present to specify a pid file name.
6225 </para>
6226 </listitem></varlistentry>
6227 <varlistentry>
6228 <term><option>-pd</option></term>
6229 <listitem>
6230 <para>
6231 <indexterm role="option">
6232 <primary><option>-pd</option></primary>
6233 </indexterm>
6234 <indexterm role="concept">
6235 <primary>Perl</primary>
6236 <secondary>starting the interpreter</secondary>
6237 </indexterm>
6238 This option applies when an embedded Perl interpreter is linked with Exim (see
6239 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6240 option, forcing the starting of the interpreter to be delayed until it is
6241 needed.
6242 </para>
6243 </listitem></varlistentry>
6244 <varlistentry>
6245 <term><option>-ps</option></term>
6246 <listitem>
6247 <para>
6248 <indexterm role="option">
6249 <primary><option>-ps</option></primary>
6250 </indexterm>
6251 <indexterm role="concept">
6252 <primary>Perl</primary>
6253 <secondary>starting the interpreter</secondary>
6254 </indexterm>
6255 This option applies when an embedded Perl interpreter is linked with Exim (see
6256 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6257 option, forcing the starting of the interpreter to occur as soon as Exim is
6258 started.
6259 </para>
6260 </listitem></varlistentry>
6261 <varlistentry>
6262 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6263 <listitem>
6264 <para>
6265 <indexterm role="option">
6266 <primary><option>-p</option></primary>
6267 </indexterm>
6268 For compatibility with Sendmail, this option is equivalent to
6269 </para>
6270 <literallayout>
6271 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6272 </literallayout>
6273 <para>
6274 It sets the incoming protocol and host name (for trusted callers). The
6275 host name and its colon can be omitted when only the protocol is to be set.
6276 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6277 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6278 or <literal>s</literal> using this option (but that does not seem a real limitation).
6279 </para>
6280 </listitem></varlistentry>
6281 <varlistentry>
6282 <term><option>-q</option></term>
6283 <listitem>
6284 <para>
6285 <indexterm role="option">
6286 <primary><option>-q</option></primary>
6287 </indexterm>
6288 <indexterm role="concept">
6289 <primary>queue runner</primary>
6290 <secondary>starting manually</secondary>
6291 </indexterm>
6292 This option is normally restricted to admin users. However, there is a
6293 configuration option called <option>prod_requires_admin</option> which can be set false to
6294 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6295 and <option>-S</option> options).
6296 </para>
6297 <para>
6298 <indexterm role="concept">
6299 <primary>queue runner</primary>
6300 <secondary>description of operation</secondary>
6301 </indexterm>
6302 The <option>-q</option> option starts one queue runner process. This scans the queue of
6303 waiting messages, and runs a delivery process for each one in turn. It waits
6304 for each delivery process to finish before starting the next one. A delivery
6305 process may not actually do any deliveries if the retry times for the addresses
6306 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6307 </para>
6308 <para>
6309 If
6310 <indexterm role="concept">
6311 <primary>SMTP</primary>
6312 <secondary>passed connection</secondary>
6313 </indexterm>
6314 <indexterm role="concept">
6315 <primary>SMTP</primary>
6316 <secondary>multiple deliveries</secondary>
6317 </indexterm>
6318 <indexterm role="concept">
6319 <primary>multiple SMTP deliveries</primary>
6320 </indexterm>
6321 the delivery process spawns other processes to deliver other messages down
6322 passed SMTP connections, the queue runner waits for these to finish before
6323 proceeding.
6324 </para>
6325 <para>
6326 When all the queued messages have been considered, the original queue runner
6327 process terminates. In other words, a single pass is made over the waiting
6328 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6329 this to be repeated periodically.
6330 </para>
6331 <para>
6332 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6333 random, but it is likely to be different each time, which is all that matters.
6334 If one particular message screws up a remote MTA, other messages to the same
6335 MTA have a chance of getting through if they get tried first.
6336 </para>
6337 <para>
6338 It is possible to cause the messages to be processed in lexical message id
6339 order, which is essentially the order in which they arrived, by setting the
6340 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6341 </para>
6342 </listitem></varlistentry>
6343 <varlistentry>
6344 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6345 <listitem>
6346 <para>
6347 The <option>-q</option> option may be followed by one or more flag letters that change its
6348 behaviour. They are all optional, but if more than one is present, they must
6349 appear in the correct order. Each flag is described in a separate item below.
6350 </para>
6351 </listitem></varlistentry>
6352 <varlistentry>
6353 <term><option>-qq...</option></term>
6354 <listitem>
6355 <para>
6356 <indexterm role="option">
6357 <primary><option>-qq</option></primary>
6358 </indexterm>
6359 <indexterm role="concept">
6360 <primary>queue</primary>
6361 <secondary>double scanning</secondary>
6362 </indexterm>
6363 <indexterm role="concept">
6364 <primary>queue</primary>
6365 <secondary>routing</secondary>
6366 </indexterm>
6367 <indexterm role="concept">
6368 <primary>routing</primary>
6369 <secondary>whole queue before delivery</secondary>
6370 </indexterm>
6371 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6372 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6373 every domain. Addresses are routed, local deliveries happen, but no remote
6374 transports are run.
6375 </para>
6376 <para>
6377 <indexterm role="concept">
6378 <primary>hints database</primary>
6379 <secondary>remembering routing</secondary>
6380 </indexterm>
6381 The hints database that remembers which messages are waiting for specific hosts
6382 is updated, as if delivery to those hosts had been deferred. After this is
6383 complete, a second, normal queue scan happens, with routing and delivery taking
6384 place as normal. Messages that are routed to the same host should mostly be
6385 delivered down a single SMTP
6386 <indexterm role="concept">
6387 <primary>SMTP</primary>
6388 <secondary>passed connection</secondary>
6389 </indexterm>
6390 <indexterm role="concept">
6391 <primary>SMTP</primary>
6392 <secondary>multiple deliveries</secondary>
6393 </indexterm>
6394 <indexterm role="concept">
6395 <primary>multiple SMTP deliveries</primary>
6396 </indexterm>
6397 connection because of the hints that were set up during the first queue scan.
6398 This option may be useful for hosts that are connected to the Internet
6399 intermittently.
6400 </para>
6401 </listitem></varlistentry>
6402 <varlistentry>
6403 <term><option>-q[q]i...</option></term>
6404 <listitem>
6405 <para>
6406 <indexterm role="option">
6407 <primary><option>-qi</option></primary>
6408 </indexterm>
6409 <indexterm role="concept">
6410 <primary>queue</primary>
6411 <secondary>initial delivery</secondary>
6412 </indexterm>
6413 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6414 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6415 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6416 <option>-odq</option> and want a queue runner just to process the new messages.
6417 </para>
6418 </listitem></varlistentry>
6419 <varlistentry>
6420 <term><option>-q[q][i]f...</option></term>
6421 <listitem>
6422 <para>
6423 <indexterm role="option">
6424 <primary><option>-qf</option></primary>
6425 </indexterm>
6426 <indexterm role="concept">
6427 <primary>queue</primary>
6428 <secondary>forcing delivery</secondary>
6429 </indexterm>
6430 <indexterm role="concept">
6431 <primary>delivery</primary>
6432 <secondary>forcing in queue run</secondary>
6433 </indexterm>
6434 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6435 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6436 their retry times are tried.
6437 </para>
6438 </listitem></varlistentry>
6439 <varlistentry>
6440 <term><option>-q[q][i]ff...</option></term>
6441 <listitem>
6442 <para>
6443 <indexterm role="option">
6444 <primary><option>-qff</option></primary>
6445 </indexterm>
6446 <indexterm role="concept">
6447 <primary>frozen messages</primary>
6448 <secondary>forcing delivery</secondary>
6449 </indexterm>
6450 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6451 frozen or not.
6452 </para>
6453 </listitem></varlistentry>
6454 <varlistentry>
6455 <term><option>-q[q][i][f[f]]l</option></term>
6456 <listitem>
6457 <para>
6458 <indexterm role="option">
6459 <primary><option>-ql</option></primary>
6460 </indexterm>
6461 <indexterm role="concept">
6462 <primary>queue</primary>
6463 <secondary>local deliveries only</secondary>
6464 </indexterm>
6465 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6466 be done. If a message requires any remote deliveries, it remains on the queue
6467 for later delivery.
6468 </para>
6469 </listitem></varlistentry>
6470 <varlistentry>
6471 <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>
6472 <listitem>
6473 <para>
6474 <indexterm role="concept">
6475 <primary>queue</primary>
6476 <secondary>delivering specific messages</secondary>
6477 </indexterm>
6478 When scanning the queue, Exim can be made to skip over messages whose ids are
6479 lexically less than a given value by following the <option>-q</option> option with a
6480 starting message id. For example:
6481 </para>
6482 <literallayout class="monospaced">
6483 exim -q 0t5C6f-0000c8-00
6484 </literallayout>
6485 <para>
6486 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6487 second message id is given, messages whose ids are lexically greater than it
6488 are also skipped. If the same id is given twice, for example,
6489 </para>
6490 <literallayout class="monospaced">
6491 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6492 </literallayout>
6493 <para>
6494 just one delivery process is started, for that message. This differs from
6495 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6496 that it counts as a delivery from a queue run. Note that the selection
6497 mechanism does not affect the order in which the messages are scanned. There
6498 are also other ways of selecting specific sets of messages for delivery in a
6499 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6500 </para>
6501 </listitem></varlistentry>
6502 <varlistentry>
6503 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6504 <listitem>
6505 <para>
6506 <indexterm role="concept">
6507 <primary>queue runner</primary>
6508 <secondary>starting periodically</secondary>
6509 </indexterm>
6510 <indexterm role="concept">
6511 <primary>periodic queue running</primary>
6512 </indexterm>
6513 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6514 starting a queue runner process at intervals specified by the given time value
6515 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6516 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6517 single daemon process handles both functions. A common way of starting up a
6518 combined daemon at system boot time is to use a command such as
6519 </para>
6520 <literallayout class="monospaced">
6521 /usr/exim/bin/exim -bd -q30m
6522 </literallayout>
6523 <para>
6524 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6525 process every 30 minutes.
6526 </para>
6527 <para>
6528 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6529 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6530 </para>
6531 </listitem></varlistentry>
6532 <varlistentry>
6533 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6534 <listitem>
6535 <para>
6536 <indexterm role="option">
6537 <primary><option>-qR</option></primary>
6538 </indexterm>
6539 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6540 compatibility.
6541 </para>
6542 </listitem></varlistentry>
6543 <varlistentry>
6544 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6545 <listitem>
6546 <para>
6547 <indexterm role="option">
6548 <primary><option>-qS</option></primary>
6549 </indexterm>
6550 This option is synonymous with <option>-S</option>.
6551 </para>
6552 </listitem></varlistentry>
6553 <varlistentry>
6554 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6555 <listitem>
6556 <para>
6557 <indexterm role="option">
6558 <primary><option>-R</option></primary>
6559 </indexterm>
6560 <indexterm role="concept">
6561 <primary>queue runner</primary>
6562 <secondary>for specific recipients</secondary>
6563 </indexterm>
6564 <indexterm role="concept">
6565 <primary>delivery</primary>
6566 <secondary>to given domain</secondary>
6567 </indexterm>
6568 <indexterm role="concept">
6569 <primary>domain</primary>
6570 <secondary>delivery to</secondary>
6571 </indexterm>
6572 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6573 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6574 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6575 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6576 </para>
6577 <para>
6578 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6579 perform a single queue run, except that, when scanning the messages on the
6580 queue, Exim processes only those that have at least one undelivered recipient
6581 address containing the given string, which is checked in a case-independent
6582 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6583 regular expression; otherwise it is a literal string.
6584 </para>
6585 <para>
6586 If you want to do periodic queue runs for messages with specific recipients,
6587 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6588 </para>
6589 <literallayout class="monospaced">
6590 exim -q25m -R @special.domain.example
6591 </literallayout>
6592 <para>
6593 This example does a queue run for messages with recipients in the given domain
6594 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6595 applied to each queue run.
6596 </para>
6597 <para>
6598 Once a message is selected for delivery by this mechanism, all its addresses
6599 are processed. For the first selected message, Exim overrides any retry
6600 information and forces a delivery attempt for each undelivered address. This
6601 means that if delivery of any address in the first message is successful, any
6602 existing retry information is deleted, and so delivery attempts for that
6603 address in subsequently selected messages (which are processed without forcing)
6604 will run. However, if delivery of any address does not succeed, the retry
6605 information is updated, and in subsequently selected messages, the failing
6606 address will be skipped.
6607 </para>
6608 <para>
6609 <indexterm role="concept">
6610 <primary>frozen messages</primary>
6611 <secondary>forcing delivery</secondary>
6612 </indexterm>
6613 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6614 all selected messages, not just the first; frozen messages are included when
6615 <emphasis>ff</emphasis> is present.
6616 </para>
6617 <para>
6618 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6619 to a given domain after a host has been down for some time. When the SMTP
6620 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6621 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6622 an arbitrary command instead.
6623 </para>
6624 </listitem></varlistentry>
6625 <varlistentry>
6626 <term><option>-r</option></term>
6627 <listitem>
6628 <para>
6629 <indexterm role="option">
6630 <primary><option>-r</option></primary>
6631 </indexterm>
6632 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6633 </para>
6634 </listitem></varlistentry>
6635 <varlistentry>
6636 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6637 <listitem>
6638 <para>
6639 <indexterm role="option">
6640 <primary><option>-S</option></primary>
6641 </indexterm>
6642 <indexterm role="concept">
6643 <primary>delivery</primary>
6644 <secondary>from given sender</secondary>
6645 </indexterm>
6646 <indexterm role="concept">
6647 <primary>queue runner</primary>
6648 <secondary>for specific senders</secondary>
6649 </indexterm>
6650 This option acts like <option>-R</option> except that it checks the string against each
6651 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6652 conditions must be met for a message to be selected. If either of the options
6653 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6654 </para>
6655 </listitem></varlistentry>
6656 <varlistentry>
6657 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
6658 <listitem>
6659 <para>
6660 <indexterm role="option">
6661 <primary><option>-Tqt</option></primary>
6662 </indexterm>
6663 This an option that is exclusively for use by the Exim testing suite. It is not
6664 recognized when Exim is run normally. It allows for the setting up of explicit
6665 <quote>queue times</quote> so that various warning/retry features can be tested.
6666 </para>
6667 </listitem></varlistentry>
6668 <varlistentry>
6669 <term><option>-t</option></term>
6670 <listitem>
6671 <para>
6672 <indexterm role="option">
6673 <primary><option>-t</option></primary>
6674 </indexterm>
6675 <indexterm role="concept">
6676 <primary>recipient</primary>
6677 <secondary>extracting from header lines</secondary>
6678 </indexterm>
6679 <indexterm role="concept">
6680 <primary><emphasis>Bcc:</emphasis> header line</primary>
6681 </indexterm>
6682 <indexterm role="concept">
6683 <primary><emphasis>Cc:</emphasis> header line</primary>
6684 </indexterm>
6685 <indexterm role="concept">
6686 <primary><emphasis>To:</emphasis> header line</primary>
6687 </indexterm>
6688 When Exim is receiving a locally-generated, non-SMTP message on its standard
6689 input, the <option>-t</option> option causes the recipients of the message to be obtained
6690 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6691 from the command arguments. The addresses are extracted before any rewriting
6692 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6693 </para>
6694 <para>
6695 <indexterm role="concept">
6696 <primary>Sendmail compatibility</primary>
6697 <secondary><option>-t</option> option</secondary>
6698 </indexterm>
6699 If the command has any arguments, they specify addresses to which the message
6700 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6701 the recipients list obtained from the headers. This is compatible with Smail 3
6702 and in accordance with the documented behaviour of several versions of
6703 Sendmail, as described in man pages on a number of operating systems (e.g.
6704 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6705 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
6706 Sendmail book documents it that way. Exim can be made to add argument addresses
6707 instead of subtracting them by setting the option
6708 <option>extract_addresses_remove_arguments</option> false.
6709 </para>
6710 <para>
6711 <indexterm role="concept">
6712 <primary><option>Resent-</option> header lines</primary>
6713 <secondary>with <option>-t</option></secondary>
6714 </indexterm>
6715 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6716 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6717 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6718 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6719 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6720 </para>
6721 <para>
6722 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6723 message is resent several times). The RFC also specifies that they should be
6724 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6725 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6726 nor indeed exactly what constitutes a <quote>set</quote>.
6727 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6728 are often added at the end of the header, and if a message is resent more than
6729 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6730 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6731 </para>
6732 </listitem></varlistentry>
6733 <varlistentry>
6734 <term><option>-ti</option></term>
6735 <listitem>
6736 <para>
6737 <indexterm role="option">
6738 <primary><option>-ti</option></primary>
6739 </indexterm>
6740 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6741 compatibility with Sendmail.
6742 </para>
6743 </listitem></varlistentry>
6744 <varlistentry>
6745 <term><option>-tls-on-connect</option></term>
6746 <listitem>
6747 <para>
6748 <indexterm role="option">
6749 <primary><option>-tls-on-connect</option></primary>
6750 </indexterm>
6751 <indexterm role="concept">
6752 <primary>TLS</primary>
6753 <secondary>use without STARTTLS</secondary>
6754 </indexterm>
6755 <indexterm role="concept">
6756 <primary>TLS</primary>
6757 <secondary>automatic start</secondary>
6758 </indexterm>
6759 This option is available when Exim is compiled with TLS support. It forces all
6760 incoming SMTP connections to behave as if the incoming port is listed in the
6761 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6762 <xref linkend="CHAPTLS"/> for further details.
6763 </para>
6764 </listitem></varlistentry>
6765 <varlistentry>
6766 <term><option>-U</option></term>
6767 <listitem>
6768 <para>
6769 <indexterm role="option">
6770 <primary><option>-U</option></primary>
6771 </indexterm>
6772 <indexterm role="concept">
6773 <primary>Sendmail compatibility</primary>
6774 <secondary><option>-U</option> option ignored</secondary>
6775 </indexterm>
6776 Sendmail uses this option for <quote>initial message submission</quote>, and its
6777 documentation states that in future releases, it may complain about
6778 syntactically invalid messages rather than fixing them when this flag is not
6779 set. Exim ignores this option.
6780 </para>
6781 </listitem></varlistentry>
6782 <varlistentry>
6783 <term><option>-v</option></term>
6784 <listitem>
6785 <para>
6786 <indexterm role="option">
6787 <primary><option>-v</option></primary>
6788 </indexterm>
6789 This option causes Exim to write information to the standard error stream,
6790 describing what it is doing. In particular, it shows the log lines for
6791 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6792 dialogue is shown. Some of the log lines shown may not actually be written to
6793 the log if the setting of <option>log_selector</option> discards them. Any relevant
6794 selectors are shown with each log line. If none are shown, the logging is
6795 unconditional.
6796 </para>
6797 </listitem></varlistentry>
6798 <varlistentry>
6799 <term><option>-x</option></term>
6800 <listitem>
6801 <para>
6802 <indexterm role="option">
6803 <primary><option>-x</option></primary>
6804 </indexterm>
6805 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6806 National Language Support extended characters in the body of the mail item</quote>).
6807 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6808 this option.
6809 </para>
6810 </listitem></varlistentry>
6811 </variablelist>
6812 <para>
6813 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6814 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6815 </para>
6816 <!-- === End of command line options === -->
6817 </section>
6818 </chapter>
6819
6820 <chapter id="CHAPconf">
6821 <title>The Exim run time configuration file</title>
6822 <titleabbrev>The runtime configuration file</titleabbrev>
6823 <para>
6824 <indexterm role="concept">
6825 <primary>run time configuration</primary>
6826 </indexterm>
6827 <indexterm role="concept">
6828 <primary>configuration file</primary>
6829 <secondary>general description</secondary>
6830 </indexterm>
6831 <indexterm role="concept">
6832 <primary>CONFIGURE_FILE</primary>
6833 </indexterm>
6834 <indexterm role="concept">
6835 <primary>configuration file</primary>
6836 <secondary>errors in</secondary>
6837 </indexterm>
6838 <indexterm role="concept">
6839 <primary>error</primary>
6840 <secondary>in configuration file</secondary>
6841 </indexterm>
6842 <indexterm role="concept">
6843 <primary>return code</primary>
6844 <secondary>for bad configuration</secondary>
6845 </indexterm>
6846 Exim uses a single run time configuration file that is read whenever an Exim
6847 binary is executed. Note that in normal operation, this happens frequently,
6848 because Exim is designed to operate in a distributed manner, without central
6849 control.
6850 </para>
6851 <para>
6852 If a syntax error is detected while reading the configuration file, Exim
6853 writes a message on the standard error, and exits with a non-zero return code.
6854 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6855 errors can be detected at this time. The values of any expanded options are
6856 not checked until the expansion happens, even when the expansion does not
6857 actually alter the string.
6858 </para>
6859 <para>
6860 The name of the configuration file is compiled into the binary for security
6861 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6862 most configurations, this specifies a single file. However, it is permitted to
6863 give a colon-separated list of file names, in which case Exim uses the first
6864 existing file in the list.
6865 </para>
6866 <para>
6867 <indexterm role="concept">
6868 <primary>EXIM_USER</primary>
6869 </indexterm>
6870 <indexterm role="concept">
6871 <primary>EXIM_GROUP</primary>
6872 </indexterm>
6873 <indexterm role="concept">
6874 <primary>CONFIGURE_OWNER</primary>
6875 </indexterm>
6876 <indexterm role="concept">
6877 <primary>CONFIGURE_GROUP</primary>
6878 </indexterm>
6879 <indexterm role="concept">
6880 <primary>configuration file</primary>
6881 <secondary>ownership</secondary>
6882 </indexterm>
6883 <indexterm role="concept">
6884 <primary>ownership</primary>
6885 <secondary>configuration file</secondary>
6886 </indexterm>
6887 The run time configuration file must be owned by root or by the user that is
6888 specified at compile time by the EXIM_USER option, or by the user that is
6889 specified at compile time by the CONFIGURE_OWNER option (if set). The
6890 configuration file must not be world-writeable or group-writeable, unless its
6891 group is the one specified at compile time by the EXIM_GROUP option or by the
6892 CONFIGURE_GROUP option.
6893 </para>
6894 <para>
6895 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6896 to root, anybody who is able to edit the run time configuration file has an
6897 easy way to run commands as root. If you make your mail administrators members
6898 of the Exim group, but do not trust them with root, make sure that the run time
6899 configuration is not group writeable.
6900 </para>
6901 <para>
6902 A default configuration file, which will work correctly in simple situations,
6903 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6904 defines just one file name, the installation process copies the default
6905 configuration to a new file of that name if it did not previously exist. If
6906 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6907 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6908 configuration.
6909 </para>
6910 <section id="SECID40">
6911 <title>Using a different configuration file</title>
6912 <para>
6913 <indexterm role="concept">
6914 <primary>configuration file</primary>
6915 <secondary>alternate</secondary>
6916 </indexterm>
6917 A one-off alternate configuration can be specified by the <option>-C</option> command line
6918 option, which may specify a single file or a list of files. However, when
6919 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6920 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6921 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6922 configuration files before installing them. No owner or group checks are done
6923 on a configuration file specified by <option>-C</option>.
6924 </para>
6925 <para>
6926 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6927 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6928 if you do this, you also lock out the possibility of testing a
6929 configuration using <option>-C</option> right through message reception and delivery, even
6930 if the caller is root. The reception works, but by that time, Exim is running
6931 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6932 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6933 delivery using two separate commands (one to put a message on the queue, using
6934 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6935 </para>
6936 <para>
6937 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6938 prefix string with which any file named in a <option>-C</option> command line option must
6939 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6940 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6941 name can be used with <option>-C</option>.
6942 </para>
6943 <para>
6944 One-off changes to a configuration can be specified by the <option>-D</option> command line
6945 option, which defines and overrides values for macros used inside the
6946 configuration file. However, like <option>-C</option>, the use of this option by a
6947 non-privileged user causes Exim to discard its root privilege.
6948 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6949 completely disabled, and its use causes an immediate error exit.
6950 </para>
6951 <para>
6952 Some sites may wish to use the same Exim binary on different machines that
6953 share a file system, but to use different configuration files on each machine.
6954 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6955 looks for a file whose name is the configuration file name followed by a dot
6956 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
6957 file does not exist, the standard name is tried. This processing occurs for
6958 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6959 </para>
6960 <para>
6961 In some esoteric situations different versions of Exim may be run under
6962 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6963 help with this. See the comments in <filename>src/EDITME</filename> for details.
6964 </para>
6965 </section>
6966 <section id="SECTconffilfor">
6967 <title>Configuration file format</title>
6968 <para>
6969 <indexterm role="concept">
6970 <primary>configuration file</primary>
6971 <secondary>format of</secondary>
6972 </indexterm>
6973 <indexterm role="concept">
6974 <primary>format</primary>
6975 <secondary>configuration file</secondary>
6976 </indexterm>
6977 Exim&#x2019;s configuration file is divided into a number of different parts. General
6978 option settings must always appear at the start of the file. The other parts
6979 are all optional, and may appear in any order. Each part other than the first
6980 is introduced by the word <quote>begin</quote> followed by the name of the part. The
6981 optional parts are:
6982 </para>
6983 <itemizedlist>
6984 <listitem>
6985 <para>
6986 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
6987 <xref linkend="CHAPACL"/>).
6988 </para>
6989 </listitem>
6990 <listitem>
6991 <para>
6992 <indexterm role="concept">
6993 <primary>AUTH</primary>
6994 <secondary>configuration</secondary>
6995 </indexterm>
6996 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
6997 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
6998 </para>
6999 </listitem>
7000 <listitem>
7001 <para>
7002 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7003 addresses and determine how the message is to be delivered (see chapters
7004 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7005 </para>
7006 </listitem>
7007 <listitem>
7008 <para>
7009 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7010 define mechanisms for copying messages to destinations (see chapters
7011 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7012 </para>
7013 </listitem>
7014 <listitem>
7015 <para revisionflag="changed">
7016 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7017 If there is no retry section, or if it is empty (that is, no retry rules are
7018 defined), Exim will not retry deliveries. In this situation, temporary errors
7019 are treated the same as permanent errors. Retry rules are discussed in chapter
7020 <xref linkend="CHAPretry"/>.
7021 </para>
7022 </listitem>
7023 <listitem>
7024 <para>
7025 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7026 when new addresses are generated during delivery. Rewriting is discussed in
7027 chapter <xref linkend="CHAPrewrite"/>.
7028 </para>
7029 </listitem>
7030 <listitem>
7031 <para>
7032 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7033 want to use this feature, you must set
7034 </para>
7035 <literallayout class="monospaced">
7036 LOCAL_SCAN_HAS_OPTIONS=yes
7037 </literallayout>
7038 <para>
7039 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7040 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7041 </para>
7042 </listitem>
7043 </itemizedlist>
7044 <para>
7045 <indexterm role="concept">
7046 <primary>configuration file</primary>
7047 <secondary>leading white space in</secondary>
7048 </indexterm>
7049 <indexterm role="concept">
7050 <primary>configuration file</primary>
7051 <secondary>trailing white space in</secondary>
7052 </indexterm>
7053 <indexterm role="concept">
7054 <primary>white space</primary>
7055 <secondary>in configuration file</secondary>
7056 </indexterm>
7057 Leading and trailing white space in configuration lines is always ignored.
7058 </para>
7059 <para>
7060 Blank lines in the file, and lines starting with a # character (ignoring
7061 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7062 # character other than at the beginning of a line is not treated specially,
7063 and does not introduce a comment.
7064 </para>
7065 <para>
7066 Any non-comment line can be continued by ending it with a backslash. Note that
7067 the general rule for white space means that trailing white space after the
7068 backslash and leading white space at the start of continuation
7069 lines is ignored. Comment lines beginning with # (but not empty lines) may
7070 appear in the middle of a sequence of continuation lines.
7071 </para>
7072 <para>
7073 A convenient way to create a configuration file is to start from the
7074 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7075 change settings as required.
7076 </para>
7077 <para>
7078 The ACLs, retry rules, and rewriting rules have their own syntax which is
7079 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7080 respectively. The other parts of the configuration file have some syntactic
7081 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7082 onwards. Before that, the inclusion, macro, and conditional facilities are
7083 described.
7084 </para>
7085 </section>
7086 <section id="SECID41">
7087 <title>File inclusions in the configuration file</title>
7088 <para>
7089 <indexterm role="concept">
7090 <primary>inclusions in configuration file</primary>
7091 </indexterm>
7092 <indexterm role="concept">
7093 <primary>configuration file</primary>
7094 <secondary>including other files</secondary>
7095 </indexterm>
7096 <indexterm role="concept">
7097 <primary><literal>.include</literal> in configuration file</primary>
7098 </indexterm>
7099 <indexterm role="concept">
7100 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7101 </indexterm>
7102 You can include other files inside Exim&#x2019;s run time configuration file by
7103 using this syntax:
7104 </para>
7105 <literallayout>
7106 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7107 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7108 </literallayout>
7109 <para>
7110 on a line by itself. Double quotes round the file name are optional. If you use
7111 the first form, a configuration error occurs if the file does not exist; the
7112 second form does nothing for non-existent files. In all cases, an absolute file
7113 name is required.
7114 </para>
7115 <para>
7116 Includes may be nested to any depth, but remember that Exim reads its
7117 configuration file often, so it is a good idea to keep them to a minimum.
7118 If you change the contents of an included file, you must HUP the daemon,
7119 because an included file is read only when the configuration itself is read.
7120 </para>
7121 <para>
7122 The processing of inclusions happens early, at a physical line level, so, like
7123 comment lines, an inclusion can be used in the middle of an option setting,
7124 for example:
7125 </para>
7126 <literallayout class="monospaced">
7127 hosts_lookup = a.b.c \
7128                .include /some/file
7129 </literallayout>
7130 <para>
7131 Include processing happens after macro processing (see below). Its effect is to
7132 process the lines of the included file as if they occurred inline where the
7133 inclusion appears.
7134 </para>
7135 </section>
7136 <section id="SECTmacrodefs">
7137 <title>Macros in the configuration file</title>
7138 <para>
7139 <indexterm role="concept">
7140 <primary>macro</primary>
7141 <secondary>description of</secondary>
7142 </indexterm>
7143 <indexterm role="concept">
7144 <primary>configuration file</primary>
7145 <secondary>macros</secondary>
7146 </indexterm>
7147 If a line in the main part of the configuration (that is, before the first
7148 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7149 definition, and must be of the form
7150 </para>
7151 <literallayout>
7152 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7153 </literallayout>
7154 <para>
7155 The name must consist of letters, digits, and underscores, and need not all be
7156 in upper case, though that is recommended. The rest of the line, including any
7157 continuations, is the replacement text, and has leading and trailing white
7158 space removed. Quotes are not removed. The replacement text can never end with
7159 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7160 </para>
7161 <para>
7162 Macros may also be defined between router, transport, authenticator, or ACL
7163 definitions. They may not, however, be defined within an individual driver or
7164 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7165 </para>
7166 </section>
7167 <section id="SECID42">
7168 <title>Macro substitution</title>
7169 <para>
7170 Once a macro is defined, all subsequent lines in the file (and any included
7171 files) are scanned for the macro name; if there are several macros, the line is
7172 scanned for each in turn, in the order in which the macros are defined. The
7173 replacement text is not re-scanned for the current macro, though it is scanned
7174 for subsequently defined macros. For this reason, a macro name may not contain
7175 the name of a previously defined macro as a substring. You could, for example,
7176 define
7177 </para>
7178 <literallayout>
7179 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7180 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7181 </literallayout>
7182 <para>
7183 but putting the definitions in the opposite order would provoke a configuration
7184 error. Macro expansion is applied to individual physical lines from the file,
7185 before checking for line continuation or file inclusion (see above). If a line
7186 consists solely of a macro name, and the expansion of the macro is empty, the
7187 line is ignored. A macro at the start of a line may turn the line into a
7188 comment line or a <literal>.include</literal> line.
7189 </para>
7190 </section>
7191 <section id="SECID43">
7192 <title>Redefining macros</title>
7193 <para>
7194 Once defined, the value of a macro can be redefined later in the configuration
7195 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7196 <emphasis>=</emphasis>. For example:
7197 </para>
7198 <literallayout class="monospaced">
7199 MAC =  initial value
7200 ...
7201 MAC == updated value
7202 </literallayout>
7203 <para>
7204 Redefinition does not alter the order in which the macros are applied to the
7205 subsequent lines of the configuration file. It is still the same order in which
7206 the macros were originally defined. All that changes is the macro&#x2019;s value.
7207 Redefinition makes it possible to accumulate values. For example:
7208 </para>
7209 <literallayout class="monospaced">
7210 MAC =  initial value
7211 ...
7212 MAC == MAC and something added
7213 </literallayout>
7214 <para>
7215 This can be helpful in situations where the configuration file is built
7216 from a number of other files.
7217 </para>
7218 </section>
7219 <section id="SECID44">
7220 <title>Overriding macro values</title>
7221 <para>
7222 The values set for macros in the configuration file can be overridden by the
7223 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7224 used, unless called by root or the Exim user. A definition on the command line
7225 using the <option>-D</option> option causes all definitions and redefinitions within the
7226 file to be ignored.
7227 </para>
7228 </section>
7229 <section id="SECID45">
7230 <title>Example of macro usage</title>
7231 <para>
7232 As an example of macro usage, consider a configuration where aliases are looked
7233 up in a MySQL database. It helps to keep the file less cluttered if long
7234 strings such as SQL statements are defined separately as macros, for example:
7235 </para>
7236 <literallayout class="monospaced">
7237 ALIAS_QUERY = select mailbox from user where \
7238               login=${quote_mysql:$local_part};
7239 </literallayout>
7240 <para>
7241 This can then be used in a <command>redirect</command> router setting like this:
7242 </para>
7243 <literallayout class="monospaced">
7244 data = ${lookup mysql{ALIAS_QUERY}}
7245 </literallayout>
7246 <para>
7247 In earlier versions of Exim macros were sometimes used for domain, host, or
7248 address lists. In Exim 4 these are handled better by named lists &ndash; see
7249 section <xref linkend="SECTnamedlists"/>.
7250 </para>
7251 </section>
7252 <section id="SECID46">
7253 <title>Conditional skips in the configuration file</title>
7254 <para>
7255 <indexterm role="concept">
7256 <primary>configuration file</primary>
7257 <secondary>conditional skips</secondary>
7258 </indexterm>
7259 <indexterm role="concept">
7260 <primary><literal>.ifdef</literal></primary>
7261 </indexterm>
7262 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7263 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7264 portions of the configuration file. The processing happens whenever the file is
7265 read (that is, when an Exim binary starts to run).
7266 </para>
7267 <para>
7268 The implementation is very simple. Instances of the first four directives must
7269 be followed by text that includes the names of one or macros. The condition
7270 that is tested is whether or not any macro substitution has taken place in the
7271 line. Thus:
7272 </para>
7273 <literallayout class="monospaced">
7274 .ifdef AAA
7275 message_size_limit = 50M
7276 .else
7277 message_size_limit = 100M
7278 .endif
7279 </literallayout>
7280 <para>
7281 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7282 otherwise. If there is more than one macro named on the line, the condition
7283 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7284 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7285 </para>
7286 <para>
7287 Although you can use a macro expansion to generate one of these directives,
7288 it is not very useful, because the condition <quote>there was a macro substitution
7289 in this line</quote> will always be true.
7290 </para>
7291 <para>
7292 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7293 to clarify complicated nestings.
7294 </para>
7295 </section>
7296 <section id="SECTcos">
7297 <title>Common option syntax</title>
7298 <para>
7299 <indexterm role="concept">
7300 <primary>common option syntax</primary>
7301 </indexterm>
7302 <indexterm role="concept">
7303 <primary>syntax of common options</primary>
7304 </indexterm>
7305 <indexterm role="concept">
7306 <primary>configuration file</primary>
7307 <secondary>common option syntax</secondary>
7308 </indexterm>
7309 For the main set of options, driver options, and <function>local_scan()</function> options,
7310 each setting is on a line by itself, and starts with a name consisting of
7311 lower-case letters and underscores. Many options require a data value, and in
7312 these cases the name must be followed by an equals sign (with optional white
7313 space) and then the value. For example:
7314 </para>
7315 <literallayout class="monospaced">
7316 qualify_domain = mydomain.example.com
7317 </literallayout>
7318 <para>
7319 <indexterm role="concept">
7320 <primary>hiding configuration option values</primary>
7321 </indexterm>
7322 <indexterm role="concept">
7323 <primary>configuration options</primary>
7324 <secondary>hiding value of</secondary>
7325 </indexterm>
7326 <indexterm role="concept">
7327 <primary>options</primary>
7328 <secondary>hiding value of</secondary>
7329 </indexterm>
7330 Some option settings may contain sensitive data, for example, passwords for
7331 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7332 line option to read these values, you can precede the option settings with the
7333 word <quote>hide</quote>. For example:
7334 </para>
7335 <literallayout class="monospaced">
7336 hide mysql_servers = localhost/users/admin/secret-password
7337 </literallayout>
7338 <para>
7339 For non-admin users, such options are displayed like this:
7340 </para>
7341 <literallayout class="monospaced">
7342 mysql_servers = &lt;value not displayable&gt;
7343 </literallayout>
7344 <para>
7345 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7346 all instances of the same driver.
7347 </para>
7348 <para>
7349 The following sections describe the syntax used for the different data types
7350 that are found in option settings.
7351 </para>
7352 </section>
7353 <section id="SECID47">
7354 <title>Boolean options</title>
7355 <para>
7356 <indexterm role="concept">
7357 <primary>format</primary>
7358 <secondary>boolean</secondary>
7359 </indexterm>
7360 <indexterm role="concept">
7361 <primary>boolean configuration values</primary>
7362 </indexterm>
7363 <indexterm role="option">
7364 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7365 </indexterm>
7366 <indexterm role="option">
7367 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7368 </indexterm>
7369 Options whose type is given as boolean are on/off switches. There are two
7370 different ways of specifying such options: with and without a data value. If
7371 the option name is specified on its own without data, the switch is turned on;
7372 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7373 boolean options may be followed by an equals sign and one of the words
7374 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7375 the following two settings have exactly the same effect:
7376 </para>
7377 <literallayout class="monospaced">
7378 queue_only
7379 queue_only = true
7380 </literallayout>
7381 <para>
7382 The following two lines also have the same (opposite) effect:
7383 </para>
7384 <literallayout class="monospaced">
7385 no_queue_only
7386 queue_only = false
7387 </literallayout>
7388 <para>
7389 You can use whichever syntax you prefer.
7390 </para>
7391 </section>
7392 <section id="SECID48">
7393 <title>Integer values</title>
7394 <para>
7395 <indexterm role="concept">
7396 <primary>integer configuration values</primary>
7397 </indexterm>
7398 <indexterm role="concept">
7399 <primary>format</primary>
7400 <secondary>integer</secondary>
7401 </indexterm>
7402 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7403 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7404 number is assumed. Otherwise, it is treated as an octal number unless it starts
7405 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7406 hexadecimal number.
7407 </para>
7408 <para>
7409 If an integer value is followed by the letter K, it is multiplied by 1024; if
7410 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7411 of integer option settings are output, values which are an exact multiple of
7412 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7413 and M. The printing style is independent of the actual input format that was
7414 used.
7415 </para>
7416 </section>
7417 <section id="SECID49">
7418 <title>Octal integer values</title>
7419 <para>
7420 <indexterm role="concept">
7421 <primary>integer format</primary>
7422 </indexterm>
7423 <indexterm role="concept">
7424 <primary>format</primary>
7425 <secondary>octal integer</secondary>
7426 </indexterm>
7427 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7428 interpreted as an octal number, whether or not it starts with the digit zero.
7429 Such options are always output in octal.
7430 </para>
7431 </section>
7432 <section id="SECID50">
7433 <title>Fixed point numbers</title>
7434 <para>
7435 <indexterm role="concept">
7436 <primary>fixed point configuration values</primary>
7437 </indexterm>
7438 <indexterm role="concept">
7439 <primary>format</primary>
7440 <secondary>fixed point</secondary>
7441 </indexterm>
7442 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7443 integer, optionally followed by a decimal point and up to three further digits.
7444 </para>
7445 </section>
7446 <section id="SECTtimeformat">
7447 <title>Time intervals</title>
7448 <para>
7449 <indexterm role="concept">
7450 <primary>time interval</primary>
7451 <secondary>specifying in configuration</secondary>
7452 </indexterm>
7453 <indexterm role="concept">
7454 <primary>format</primary>
7455 <secondary>time interval</secondary>
7456 </indexterm>
7457 A time interval is specified as a sequence of numbers, each followed by one of
7458 the following letters, with no intervening white space:
7459 </para>
7460 <informaltable frame="none">
7461 <tgroup cols="2" colsep="0" rowsep="0">
7462 <colspec colwidth="30pt" align="left"/>
7463 <colspec colwidth="254pt" align="left"/>
7464 <tbody>
7465 <row>
7466 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7467 <entry>seconds</entry>
7468 </row>
7469 <row>
7470 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7471 <entry>minutes</entry>
7472 </row>
7473 <row>
7474 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7475 <entry>hours</entry>
7476 </row>
7477 <row>
7478 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7479 <entry>days</entry>
7480 </row>
7481 <row>
7482 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7483 <entry>weeks</entry>
7484 </row>
7485 </tbody>
7486 </tgroup>
7487 </informaltable>
7488 <para>
7489 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7490 intervals are output in the same format. Exim does not restrict the values; it
7491 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7492 </para>
7493 </section>
7494 <section id="SECTstrings">
7495 <title>String values</title>
7496 <para>
7497 <indexterm role="concept">
7498 <primary>string</primary>
7499 <secondary>format of configuration values</secondary>
7500 </indexterm>
7501 <indexterm role="concept">
7502 <primary>format</primary>
7503 <secondary>string</secondary>
7504 </indexterm>
7505 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7506 or without double-quotes. If it does not start with a double-quote, the value
7507 consists of the remainder of the line plus any continuation lines, starting at
7508 the first character after any leading white space, with trailing white space
7509 removed, and with no interpretation of the characters in the string. Because
7510 Exim removes comment lines (those beginning with #) at an early stage, they can
7511 appear in the middle of a multi-line string. The following two settings are
7512 therefore equivalent:
7513 </para>
7514 <literallayout class="monospaced">
7515 trusted_users = uucp:mail
7516 trusted_users = uucp:\
7517                 # This comment line is ignored
7518                 mail
7519 </literallayout>
7520 <para>
7521 <indexterm role="concept">
7522 <primary>string</primary>
7523 <secondary>quoted</secondary>
7524 </indexterm>
7525 <indexterm role="concept">
7526 <primary>escape characters in quoted strings</primary>
7527 </indexterm>
7528 If a string does start with a double-quote, it must end with a closing
7529 double-quote, and any backslash characters other than those used for line
7530 continuation are interpreted as escape characters, as follows:
7531 </para>
7532 <informaltable frame="none">
7533 <tgroup cols="2" colsep="0" rowsep="0">
7534 <colspec colwidth="100pt" align="left"/>
7535 <colspec colwidth="254pt" align="left"/>
7536 <tbody>
7537 <row>
7538 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7539 <entry>single backslash</entry>
7540 </row>
7541 <row>
7542 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7543 <entry>newline</entry>
7544 </row>
7545 <row>
7546 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7547 <entry>carriage return</entry>
7548 </row>
7549 <row>
7550 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7551 <entry>tab</entry>
7552 </row>
7553 <row>
7554 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7555 <entry>up to 3 octal digits specify one character</entry>
7556 </row>
7557 <row>
7558 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7559 <entry>up to 2 hexadecimal digits specify one character</entry>
7560 </row>
7561 </tbody>
7562 </tgroup>
7563 </informaltable>
7564 <para>
7565 If a backslash is followed by some other character, including a double-quote
7566 character, that character replaces the pair.
7567 </para>
7568 <para>
7569 Quoting is necessary only if you want to make use of the backslash escapes to
7570 insert special characters, or if you need to specify a value with leading or
7571 trailing spaces. These cases are rare, so quoting is almost never needed in
7572 current versions of Exim. In versions of Exim before 3.14, quoting was required
7573 in order to continue lines, so you may come across older configuration files
7574 and examples that apparently quote unnecessarily.
7575 </para>
7576 </section>
7577 <section id="SECID51">
7578 <title>Expanded strings</title>
7579 <para>
7580 <indexterm role="concept">
7581 <primary>expansion</primary>
7582 <secondary>definition of</secondary>
7583 </indexterm>
7584 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7585 by which means various parts of the string may be changed according to the
7586 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7587 is as just described; in particular, the handling of backslashes in quoted
7588 strings is done as part of the input process, before expansion takes place.
7589 However, backslash is also an escape character for the expander, so any
7590 backslashes that are required for that reason must be doubled if they are
7591 within a quoted configuration string.
7592 </para>
7593 </section>
7594 <section id="SECID52">
7595 <title>User and group names</title>
7596 <para>
7597 <indexterm role="concept">
7598 <primary>user name</primary>
7599 <secondary>format of</secondary>
7600 </indexterm>
7601 <indexterm role="concept">
7602 <primary>format</primary>
7603 <secondary>user name</secondary>
7604 </indexterm>
7605 <indexterm role="concept">
7606 <primary>groups</primary>
7607 <secondary>name format</secondary>
7608 </indexterm>
7609 <indexterm role="concept">
7610 <primary>format</primary>
7611 <secondary>group name</secondary>
7612 </indexterm>
7613 User and group names are specified as strings, using the syntax described
7614 above, but the strings are interpreted specially. A user or group name must
7615 either consist entirely of digits, or be a name that can be looked up using the
7616 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7617 </para>
7618 </section>
7619 <section id="SECTlistconstruct">
7620 <title>List construction</title>
7621 <para>
7622 <indexterm role="concept">
7623 <primary>list</primary>
7624 <secondary>syntax of in configuration</secondary>
7625 </indexterm>
7626 <indexterm role="concept">
7627 <primary>format</primary>
7628 <secondary>list item in configuration</secondary>
7629 </indexterm>
7630 <indexterm role="concept">
7631 <primary>string</primary>
7632 <secondary>list, definition of</secondary>
7633 </indexterm>
7634 The data for some configuration options is a list of items, with colon as the
7635 default separator. Many of these options are shown with type <quote>string list</quote> in
7636 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7637 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7638 are all the same; however, those other than <quote>string list</quote> are subject to
7639 particular kinds of interpretation, as described in chapter
7640 <xref linkend="CHAPdomhosaddlists"/>.
7641 </para>
7642 <para>
7643 In all these cases, the entire list is treated as a single string as far as the
7644 input syntax is concerned. The <option>trusted_users</option> setting in section
7645 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7646 in a list, it must be entered as two colons. Leading and trailing white space
7647 on each item in a list is ignored. This makes it possible to include items that
7648 start with a colon, and in particular, certain forms of IPv6 address. For
7649 example, the list
7650 </para>
7651 <literallayout class="monospaced">
7652 local_interfaces = 127.0.0.1 : ::::1
7653 </literallayout>
7654 <para>
7655 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7656 </para>
7657 <para>
7658 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7659 list items, it is not ignored when parsing the list. The space after the first
7660 colon in the example above is necessary. If it were not there, the list would
7661 be interpreted as the two items 127.0.0.1:: and 1.
7662 </para>
7663 </section>
7664 <section id="SECID53">
7665 <title>Changing list separators</title>
7666 <para>
7667 <indexterm role="concept">
7668 <primary>list separator</primary>
7669 <secondary>changing</secondary>
7670 </indexterm>
7671 <indexterm role="concept">
7672 <primary>IPv6</primary>
7673 <secondary>addresses in lists</secondary>
7674 </indexterm>
7675 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7676 introduced to allow the separator character to be changed. If a list begins
7677 with a left angle bracket, followed by any punctuation character, that
7678 character is used instead of colon as the list separator. For example, the list
7679 above can be rewritten to use a semicolon separator like this:
7680 </para>
7681 <literallayout class="monospaced">
7682 local_interfaces = &lt;; 127.0.0.1 ; ::1
7683 </literallayout>
7684 <para>
7685 This facility applies to all lists, with the exception of the list in
7686 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7687 confined to circumstances where they really are needed.
7688 </para>
7689 <para>
7690 <indexterm role="concept">
7691 <primary>list separator</primary>
7692 <secondary>newline as</secondary>
7693 </indexterm>
7694 <indexterm role="concept">
7695 <primary>newline</primary>
7696 <secondary>as list separator</secondary>
7697 </indexterm>
7698 It is also possible to use newline and other control characters (those with
7699 code values less than 32, plus DEL) as separators in lists. Such separators
7700 must be provided literally at the time the list is processed. For options that
7701 are string-expanded, you can write the separator using a normal escape
7702 sequence. This will be processed by the expander before the string is
7703 interpreted as a list. For example, if a newline-separated list of domains is
7704 generated by a lookup, you can process it directly by a line such as this:
7705 </para>
7706 <literallayout class="monospaced">
7707 domains = &lt;\n ${lookup mysql{.....}}
7708 </literallayout>
7709 <para>
7710 This avoids having to change the list separator in such data. You are unlikely
7711 to want to use a control character as a separator in an option that is not
7712 expanded, because the value is literal text. However, it can be done by giving
7713 the value in quotes. For example:
7714 </para>
7715 <literallayout class="monospaced">
7716 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
7717 </literallayout>
7718 <para>
7719 Unlike printing character separators, which can be included in list items by
7720 doubling, it is not possible to include a control character as data when it is
7721 set as the separator. Two such characters in succession are interpreted as
7722 enclosing an empty list item.
7723 </para>
7724 </section>
7725 <section id="SECTempitelis">
7726 <title>Empty items in lists</title>
7727 <para>
7728 <indexterm role="concept">
7729 <primary>list</primary>
7730 <secondary>empty item in</secondary>
7731 </indexterm>
7732 An empty item at the end of a list is always ignored. In other words, trailing
7733 separator characters are ignored. Thus, the list in
7734 </para>
7735 <literallayout class="monospaced">
7736 senders = user@domain :
7737 </literallayout>
7738 <para>
7739 contains only a single item. If you want to include an empty string as one item
7740 in a list, it must not be the last item. For example, this list contains three
7741 items, the second of which is empty:
7742 </para>
7743 <literallayout class="monospaced">
7744 senders = user1@domain : : user2@domain
7745 </literallayout>
7746 <para>
7747 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7748 are interpreted as representing a single colon data character (and the list
7749 would then contain just one item). If you want to specify a list that contains
7750 just one, empty item, you can do it as in this example:
7751 </para>
7752 <literallayout class="monospaced">
7753 senders = :
7754 </literallayout>
7755 <para>
7756 In this case, the first item is empty, and the second is discarded because it
7757 is at the end of the list.
7758 </para>
7759 </section>
7760 <section id="SECTfordricon">
7761 <title>Format of driver configurations</title>
7762 <para>
7763 <indexterm role="concept">
7764 <primary>drivers</primary>
7765 <secondary>configuration format</secondary>
7766 </indexterm>
7767 There are separate parts in the configuration for defining routers, transports,
7768 and authenticators. In each part, you are defining a number of driver
7769 instances, each with its own set of options. Each driver instance is defined by
7770 a sequence of lines like this:
7771 </para>
7772 <literallayout>
7773 &lt;<emphasis>instance name</emphasis>&gt;:
7774   &lt;<emphasis>option</emphasis>&gt;
7775   ...
7776   &lt;<emphasis>option</emphasis>&gt;
7777 </literallayout>
7778 <para>
7779 In the following example, the instance name is <command>localuser</command>, and it is
7780 followed by three options settings:
7781 </para>
7782 <literallayout class="monospaced">
7783 localuser:
7784   driver = accept
7785   check_local_user
7786   transport = local_delivery
7787 </literallayout>
7788 <para>
7789 For each driver instance, you specify which Exim code module it uses &ndash; by the
7790 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
7791 settings. For example, in the case of transports, if you want a transport to
7792 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7793 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7794 described in detail in its own separate chapter later in this manual.
7795 </para>
7796 <para>
7797 You can have several routers, transports, or authenticators that are based on
7798 the same underlying driver (each must have a different instance name).
7799 </para>
7800 <para>
7801 The order in which routers are defined is important, because addresses are
7802 passed to individual routers one by one, in order. The order in which
7803 transports are defined does not matter at all. The order in which
7804 authenticators are defined is used only when Exim, as a client, is searching
7805 them to find one that matches an authentication mechanism offered by the
7806 server.
7807 </para>
7808 <para>
7809 <indexterm role="concept">
7810 <primary>generic options</primary>
7811 </indexterm>
7812 <indexterm role="concept">
7813 <primary>options</primary>
7814 <secondary>generic &ndash; definition of</secondary>
7815 </indexterm>
7816 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7817 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7818 same type (that is, all routers, all transports or all authenticators). The
7819 <option>driver</option> option is a generic option that must appear in every definition.
7820 <indexterm role="concept">
7821 <primary>private options</primary>
7822 </indexterm>
7823 The private options are special for each driver, and none need appear, because
7824 they all have default values.
7825 </para>
7826 <para>
7827 The options may appear in any order, except that the <option>driver</option> option must
7828 precede any private options, since these depend on the particular driver. For
7829 this reason, it is recommended that <option>driver</option> always be the first option.
7830 </para>
7831 <para>
7832 Driver instance names, which are used for reference in log entries and
7833 elsewhere, can be any sequence of letters, digits, and underscores (starting
7834 with a letter) and must be unique among drivers of the same type. A router and
7835 a transport (for example) can each have the same name, but no two router
7836 instances can have the same name. The name of a driver instance should not be
7837 confused with the name of the underlying driver module. For example, the
7838 configuration lines:
7839 </para>
7840 <literallayout class="monospaced">
7841 remote_smtp:
7842   driver = smtp
7843 </literallayout>
7844 <para>
7845 create an instance of the <command>smtp</command> transport driver whose name is
7846 <command>remote_smtp</command>. The same driver code can be used more than once, with
7847 different instance names and different option settings each time. A second
7848 instance of the <command>smtp</command> transport, with different options, might be defined
7849 thus:
7850 </para>
7851 <literallayout class="monospaced">
7852 special_smtp:
7853   driver = smtp
7854   port = 1234
7855   command_timeout = 10s
7856 </literallayout>
7857 <para>
7858 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7859 these transport instances from routers, and these names would appear in log
7860 lines.
7861 </para>
7862 <para>
7863 Comment lines may be present in the middle of driver specifications. The full
7864 list of option settings for any particular driver instance, including all the
7865 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7866 option.
7867 </para>
7868 </section>
7869 </chapter>
7870
7871 <chapter id="CHAPdefconfil">
7872 <title>The default configuration file</title>
7873 <para>
7874 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7875 <primary>configuration file</primary>
7876 <secondary>default <quote>walk through</quote></secondary>
7877 </indexterm>
7878 <indexterm role="concept">
7879 <primary>default</primary>
7880 <secondary>configuration file <quote>walk through</quote></secondary>
7881 </indexterm>
7882 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7883 is sufficient for a host with simple mail requirements. As an introduction to
7884 the way Exim is configured, this chapter <quote>walks through</quote> the default
7885 configuration, giving brief explanations of the settings. Detailed descriptions
7886 of the options are given in subsequent chapters. The default configuration file
7887 itself contains extensive comments about ways you might want to modify the
7888 initial settings. However, note that there are many options that are not
7889 mentioned at all in the default configuration.
7890 </para>
7891 <section id="SECTdefconfmain">
7892 <title>Main configuration settings</title>
7893 <para>
7894 The main (global) configuration option settings must always come first in the
7895 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
7896 the line
7897 </para>
7898 <literallayout class="monospaced">
7899 # primary_hostname =
7900 </literallayout>
7901 <para>
7902 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7903 to know the official, fully qualified name of your host, and this is where you
7904 can specify it. However, in most cases you do not need to set this option. When
7905 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7906 </para>
7907 <para>
7908 The first three non-comment configuration lines are as follows:
7909 </para>
7910 <literallayout class="monospaced">
7911 domainlist local_domains = @
7912 domainlist relay_to_domains =
7913 hostlist   relay_from_hosts = 127.0.0.1
7914 </literallayout>
7915 <para>
7916 These are not, in fact, option settings. They are definitions of two named
7917 domain lists and one named host list. Exim allows you to give names to lists of
7918 domains, hosts, and email addresses, in order to make it easier to manage the
7919 configuration file (see section <xref linkend="SECTnamedlists"/>).
7920 </para>
7921 <para>
7922 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7923 later in the configuration to identify domains that are to be delivered
7924 on the local host.
7925 </para>
7926 <para>
7927 <indexterm role="concept">
7928 <primary>@ in a domain list</primary>
7929 </indexterm>
7930 There is just one item in this list, the string <quote>@</quote>. This is a special form
7931 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7932 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7933 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
7934 the same configuration file can be used on different hosts.
7935 </para>
7936 <para>
7937 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7938 list itself is empty. Later in the configuration we will come to the part that
7939 controls mail relaying through the local host; it allows relaying to any
7940 domains in this list. By default, therefore, no relaying on the basis of a mail
7941 domain is permitted.
7942 </para>
7943 <para>
7944 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7945 used later in the configuration to permit relaying from any host or IP address
7946 that matches the list. The default contains just the IP address of the IPv4
7947 loopback interface, which means that processes on the local host are able to
7948 submit mail for relaying by sending it over TCP/IP to that interface. No other
7949 hosts are permitted to submit messages for relaying.
7950 </para>
7951 <para>
7952 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
7953 we aren&#x2019;t actually setting up any controls. We are just defining some domains
7954 and hosts that will be used in the controls that are specified later.
7955 </para>
7956 <para>
7957 The next two configuration lines are genuine option settings:
7958 </para>
7959 <literallayout class="monospaced">
7960 acl_smtp_rcpt = acl_check_rcpt
7961 acl_smtp_data = acl_check_data
7962 </literallayout>
7963 <para>
7964 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7965 during an incoming SMTP session for every recipient of a message (every RCPT
7966 command), and after the contents of the message have been received,
7967 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7968 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7969 section of the configuration. The RCPT ACL controls which recipients are
7970 accepted for an incoming message &ndash; if a configuration does not provide an ACL
7971 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7972 contents of a message to be checked.
7973 </para>
7974 <para>
7975 Two commented-out option settings are next:
7976 </para>
7977 <literallayout class="monospaced">
7978 # av_scanner = clamd:/tmp/clamd
7979 # spamd_address = 127.0.0.1 783
7980 </literallayout>
7981 <para>
7982 These are example settings that can be used when Exim is compiled with the
7983 content-scanning extension. The first specifies the interface to the virus
7984 scanner, and the second specifies the interface to SpamAssassin. Further
7985 details are given in chapter <xref linkend="CHAPexiscan"/>.
7986 </para>
7987 <para>
7988 Three more commented-out option settings follow:
7989 </para>
7990 <literallayout class="monospaced">
7991 # tls_advertise_hosts = *
7992 # tls_certificate = /etc/ssl/exim.crt
7993 # tls_privatekey = /etc/ssl/exim.pem
7994 </literallayout>
7995 <para>
7996 These are example settings that can be used when Exim is compiled with
7997 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
7998 first one specifies the list of clients that are allowed to use TLS when
7999 connecting to this server; in this case the wildcard means all clients. The
8000 other options specify where Exim should find its TLS certificate and private
8001 key, which together prove the server&#x2019;s identity to any clients that connect.
8002 More details are given in chapter <xref linkend="CHAPTLS"/>.
8003 </para>
8004 <para>
8005 Another two commented-out option settings follow:
8006 </para>
8007 <literallayout class="monospaced">
8008 # daemon_smtp_ports = 25 : 465 : 587
8009 # tls_on_connect_ports = 465
8010 </literallayout>
8011 <para>
8012 <indexterm role="concept">
8013 <primary>port</primary>
8014 <secondary>465 and 587</secondary>
8015 </indexterm>
8016 <indexterm role="concept">
8017 <primary>port</primary>
8018 <secondary>for message submission</secondary>
8019 </indexterm>
8020 <indexterm role="concept">
8021 <primary>message</primary>
8022 <secondary>submission, ports for</secondary>
8023 </indexterm>
8024 <indexterm role="concept">
8025 <primary>ssmtp protocol</primary>
8026 </indexterm>
8027 <indexterm role="concept">
8028 <primary>smtps protocol</primary>
8029 </indexterm>
8030 <indexterm role="concept">
8031 <primary>SMTP</primary>
8032 <secondary>ssmtp protocol</secondary>
8033 </indexterm>
8034 <indexterm role="concept">
8035 <primary>SMTP</primary>
8036 <secondary>smtps protocol</secondary>
8037 </indexterm>
8038 These options provide better support for roaming users who wish to use this
8039 server for message submission. They are not much use unless you have turned on
8040 TLS (as described in the previous paragraph) and authentication (about which
8041 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8042 on end-user networks, so RFC 4409 specifies that message submission should use
8043 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8044 configured to use port 587 correctly, so these settings also enable the
8045 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8046 <xref linkend="SECTsupobssmt"/>).
8047 </para>
8048 <para>
8049 Two more commented-out options settings follow:
8050 </para>
8051 <literallayout class="monospaced">
8052 # qualify_domain =
8053 # qualify_recipient =
8054 </literallayout>
8055 <para>
8056 The first of these specifies a domain that Exim uses when it constructs a
8057 complete email address from a local login name. This is often needed when Exim
8058 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8059 the value of <option>primary_hostname</option> is used. If you set both of these options,
8060 you can have different qualification domains for sender and recipient
8061 addresses. If you set only the first one, its value is used in both cases.
8062 </para>
8063 <para>
8064 <indexterm role="concept">
8065 <primary>domain literal</primary>
8066 <secondary>recognizing format</secondary>
8067 </indexterm>
8068 The following line must be uncommented if you want Exim to recognize
8069 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8070 (an IP address within square brackets) instead of a named domain.
8071 </para>
8072 <literallayout class="monospaced">
8073 # allow_domain_literals
8074 </literallayout>
8075 <para>
8076 The RFCs still require this form, but many people think that in the modern
8077 Internet it makes little sense to permit mail to be sent to specific hosts by
8078 quoting their IP addresses. This ancient format has been used by people who
8079 try to abuse hosts by using them for unwanted relaying. However, some
8080 people believe there are circumstances (for example, messages addressed to
8081 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8082 </para>
8083 <para>
8084 The next configuration line is a kind of trigger guard:
8085 </para>
8086 <literallayout class="monospaced">
8087 never_users = root
8088 </literallayout>
8089 <para>
8090 It specifies that no delivery must ever be run as the root user. The normal
8091 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8092 setting is a guard against slips in the configuration.
8093 The list of users specified by <option>never_users</option> is not, however, the complete
8094 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8095 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8096 contents of <option>never_users</option> are added to this list. By default
8097 FIXED_NEVER_USERS also specifies root.
8098 </para>
8099 <para>
8100 When a remote host connects to Exim in order to send mail, the only information
8101 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8102 line,
8103 </para>
8104 <literallayout class="monospaced">
8105 host_lookup = *
8106 </literallayout>
8107 <para>
8108 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8109 in order to get a host name. This improves the quality of the logging
8110 information, but if you feel it is too expensive, you can remove it entirely,
8111 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8112 Note that it is not always possible to find a host name from an IP address,
8113 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8114 unreachable.
8115 </para>
8116 <para>
8117 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8118 1413 (hence their names):
8119 </para>
8120 <literallayout class="monospaced">
8121 rfc1413_hosts = *
8122 rfc1413_query_timeout = 5s
8123 </literallayout>
8124 <para>
8125 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8126 You can limit the hosts to which these calls are made, or change the timeout
8127 that is used. If you set the timeout to zero, all ident calls are disabled.
8128 Although they are cheap and can provide useful information for tracing problem
8129 messages, some hosts and firewalls have problems with ident calls. This can
8130 result in a timeout instead of an immediate refused connection, leading to
8131 delays on starting up an incoming SMTP session.
8132 </para>
8133 <para>
8134 When Exim receives messages over SMTP connections, it expects all addresses to
8135 be fully qualified with a domain, as required by the SMTP definition. However,
8136 if you are running a server to which simple clients submit messages, you may
8137 find that they send unqualified addresses. The two commented-out options:
8138 </para>
8139 <literallayout class="monospaced">
8140 # sender_unqualified_hosts =
8141 # recipient_unqualified_hosts =
8142 </literallayout>
8143 <para>
8144 show how you can specify hosts that are permitted to send unqualified sender
8145 and recipient addresses, respectively.
8146 </para>
8147 <para>
8148 The <option>percent_hack_domains</option> option is also commented out:
8149 </para>
8150 <literallayout class="monospaced">
8151 # percent_hack_domains =
8152 </literallayout>
8153 <para>
8154 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8155 This is an almost obsolete form of explicit email routing. If you do not know
8156 anything about it, you can safely ignore this topic.
8157 </para>
8158 <para>
8159 The last two settings in the main part of the default configuration are
8160 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8161 message is frozen, Exim no longer continues to try to deliver it. Freezing
8162 occurs when a bounce message encounters a permanent failure because the sender
8163 address of the original message that caused the bounce is invalid, so the
8164 bounce cannot be delivered. This is probably the most common case, but there
8165 are also other conditions that cause freezing, and frozen messages are not
8166 always bounce messages.
8167 </para>
8168 <literallayout class="monospaced">
8169 ignore_bounce_errors_after = 2d
8170 timeout_frozen_after = 7d
8171 </literallayout>
8172 <para>
8173 The first of these options specifies that failing bounce messages are to be
8174 discarded after 2 days on the queue. The second specifies that any frozen
8175 message (whether a bounce message or not) is to be timed out (and discarded)
8176 after a week. In this configuration, the first setting ensures that no failing
8177 bounce message ever lasts a week.
8178 </para>
8179 </section>
8180 <section id="SECID54">
8181 <title>ACL configuration</title>
8182 <para>
8183 <indexterm role="concept">
8184 <primary>default</primary>
8185 <secondary>ACLs</secondary>
8186 </indexterm>
8187 <indexterm role="concept">
8188 <primary>access control lists (ACLs)</primary>
8189 <secondary>default configuration</secondary>
8190 </indexterm>
8191 In the default configuration, the ACL section follows the main configuration.
8192 It starts with the line
8193 </para>
8194 <literallayout class="monospaced">
8195 begin acl
8196 </literallayout>
8197 <para>
8198 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8199 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8200 and <option>acl_smtp_data</option> above.
8201 </para>
8202 <para>
8203 <indexterm role="concept">
8204 <primary>RCPT</primary>
8205 <secondary>ACL for</secondary>
8206 </indexterm>
8207 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8208 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8209 are considered in order, until the recipient address is either accepted or
8210 rejected. The RCPT command is then accepted or rejected, according to the
8211 result of the ACL processing.
8212 </para>
8213 <literallayout class="monospaced">
8214 acl_check_rcpt:
8215 </literallayout>
8216 <para>
8217 This line, consisting of a name terminated by a colon, marks the start of the
8218 ACL, and names it.
8219 </para>
8220 <literallayout class="monospaced">
8221 accept  hosts = :
8222 </literallayout>
8223 <para>
8224 This ACL statement accepts the recipient if the sending host matches the list.
8225 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8226 names or IP addresses. The presence of the colon puts an empty item in the
8227 list; Exim matches this only if the incoming message did not come from a remote
8228 host, because in that case, the remote hostname is empty. The colon is
8229 important. Without it, the list itself is empty, and can never match anything.
8230 </para>
8231 <para>
8232 What this statement is doing is to accept unconditionally all recipients in
8233 messages that are submitted by SMTP from local processes using the standard
8234 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8235 manner.
8236 </para>
8237 <literallayout class="monospaced">
8238 deny    message       = Restricted characters in address
8239         domains       = +local_domains
8240         local_parts   = ^[.] : ^.*[@%!/|]
8241
8242 deny    message       = Restricted characters in address
8243         domains       = !+local_domains
8244         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8245 </literallayout>
8246 <para>
8247 These statements are concerned with local parts that contain any of the
8248 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8249 Although these characters are entirely legal in local parts (in the case of
8250 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8251 in Internet mail addresses.
8252 </para>
8253 <para>
8254 The first three have in the past been associated with explicitly routed
8255 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8256 option). Addresses containing these characters are regularly tried by spammers
8257 in an attempt to bypass relaying restrictions, and also by open relay testing
8258 programs. Unless you really need them it is safest to reject these characters
8259 at this early stage. This configuration is heavy-handed in rejecting these
8260 characters for all messages it accepts from remote hosts. This is a deliberate
8261 policy of being as safe as possible.
8262 </para>
8263 <para>
8264 The first rule above is stricter, and is applied to messages that are addressed
8265 to one of the local domains handled by this host. This is implemented by the
8266 first condition, which restricts it to domains that are 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 second condition on the first statement uses two regular expressions to
8273 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8274 or <quote>|</quote>. If you have local accounts that include these characters, you will
8275 have to modify this rule.
8276 </para>
8277 <para>
8278 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8279 allows them because they have been encountered in practice. (Consider the
8280 common convention of local parts constructed as
8281 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8282 the author of Exim, who has no second initial.) However, a local part starting
8283 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8284 file name (for example, for a mailing list). This is also true for local parts
8285 that contain slashes. A pipe symbol can also be troublesome if the local part
8286 is incorporated unthinkingly into a shell command line.
8287 </para>
8288 <para>
8289 The second rule above applies to all other domains, and is less strict. This
8290 allows your own users to send outgoing messages to sites that use slashes
8291 and vertical bars in their local parts. It blocks local parts that begin
8292 with a dot, slash, or vertical bar, but allows these characters within the
8293 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8294 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8295 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8296 </para>
8297 <literallayout class="monospaced">
8298 accept  local_parts   = postmaster
8299         domains       = +local_domains
8300 </literallayout>
8301 <para>
8302 This statement, which has two conditions, accepts an incoming address if the
8303 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8304 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8305 reference to a named list. In this configuration, there is just one domain in
8306 <emphasis>local_domains</emphasis>, but in general there may be many.
8307 </para>
8308 <para>
8309 The presence of this statement means that mail to postmaster is never blocked
8310 by any of the subsequent tests. This can be helpful while sorting out problems
8311 in cases where the subsequent tests are incorrectly denying access.
8312 </para>
8313 <literallayout class="monospaced">
8314 require verify        = sender
8315 </literallayout>
8316 <para>
8317 This statement requires the sender address to be verified before any subsequent
8318 ACL statement can be used. If verification fails, the incoming recipient
8319 address is refused. Verification consists of trying to route the address, to
8320 see if a bounce message could be delivered to it. In the case of remote
8321 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8322 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8323 discusses the details of address verification.
8324 </para>
8325 <literallayout class="monospaced">
8326 accept  hosts         = +relay_from_hosts
8327         control       = submission
8328 </literallayout>
8329 <para>
8330 This statement accepts the address if the message is coming from one of the
8331 hosts that are defined as being allowed to relay through this host. Recipient
8332 verification is omitted here, because in many cases the clients are dumb MUAs
8333 that do not cope well with SMTP error responses. For the same reason, the
8334 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8335 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8336 messages that are deficient in some way, for example, because they lack a
8337 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8338 probably add recipient verification here, and disable submission mode.
8339 </para>
8340 <literallayout class="monospaced">
8341 accept  authenticated = *
8342         control       = submission
8343 </literallayout>
8344 <para>
8345 This statement accepts the address if the client host has authenticated itself.
8346 Submission mode is again specified, on the grounds that such messages are most
8347 likely to come from MUAs. The default configuration does not define any
8348 authenticators, though it does include some nearly complete commented-out
8349 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8350 fact authenticate until you complete the authenticator definitions.
8351 </para>
8352 <literallayout class="monospaced">
8353 require message = relay not permitted
8354         domains = +local_domains : +relay_domains
8355 </literallayout>
8356 <para>
8357 This statement rejects the address if its domain is neither a local domain nor
8358 one of the domains for which this host is a relay.
8359 </para>
8360 <literallayout class="monospaced">
8361 require verify = recipient
8362 </literallayout>
8363 <para>
8364 This statement requires the recipient address to be verified; if verification
8365 fails, the address is rejected.
8366 </para>
8367 <literallayout class="monospaced">
8368 # deny    message     = rejected because $sender_host_address \
8369 #                       is in a black list at $dnslist_domain\n\
8370 #                       $dnslist_text
8371 #         dnslists    = black.list.example
8372 #
8373 # warn    dnslists    = black.list.example
8374 #         add_header  = X-Warning: $sender_host_address is in \
8375 #                       a black list at $dnslist_domain
8376 #         log_message = found in $dnslist_domain
8377 </literallayout>
8378 <para>
8379 These commented-out lines are examples of how you could configure Exim to check
8380 sending hosts against a DNS black list. The first statement rejects messages
8381 from blacklisted hosts, whereas the second just inserts a warning header
8382 line.
8383 </para>
8384 <literallayout class="monospaced">
8385 # require verify = csa
8386 </literallayout>
8387 <para>
8388 This commented-out line is an example of how you could turn on client SMTP
8389 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8390 records.
8391 </para>
8392 <literallayout class="monospaced">
8393 accept
8394 </literallayout>
8395 <para>
8396 The final statement in the first ACL unconditionally accepts any recipient
8397 address that has successfully passed all the previous tests.
8398 </para>
8399 <literallayout class="monospaced">
8400 acl_check_data:
8401 </literallayout>
8402 <para>
8403 This line marks the start of the second ACL, and names it. Most of the contents
8404 of this ACL are commented out:
8405 </para>
8406 <literallayout class="monospaced">
8407 # deny    malware   = *
8408 #         message   = This message contains a virus \
8409 #                     ($malware_name).
8410 </literallayout>
8411 <para>
8412 These lines are examples of how to arrange for messages to be scanned for
8413 viruses when Exim has been compiled with the content-scanning extension, and a
8414 suitable virus scanner is installed. If the message is found to contain a
8415 virus, it is rejected with the given custom error message.
8416 </para>
8417 <literallayout class="monospaced">
8418 # warn    spam      = nobody
8419 #         message   = X-Spam_score: $spam_score\n\
8420 #                     X-Spam_score_int: $spam_score_int\n\
8421 #                     X-Spam_bar: $spam_bar\n\
8422 #                     X-Spam_report: $spam_report
8423 </literallayout>
8424 <para>
8425 These lines are an example of how to arrange for messages to be scanned by
8426 SpamAssassin when Exim has been compiled with the content-scanning extension,
8427 and SpamAssassin has been installed. The SpamAssassin check is run with
8428 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8429 series of extra header line. In this case, the message is not rejected,
8430 whatever the spam score.
8431 </para>
8432 <literallayout class="monospaced">
8433 accept
8434 </literallayout>
8435 <para>
8436 This final line in the DATA ACL accepts the message unconditionally.
8437 </para>
8438 </section>
8439 <section id="SECID55">
8440 <title>Router configuration</title>
8441 <para>
8442 <indexterm role="concept">
8443 <primary>default</primary>
8444 <secondary>routers</secondary>
8445 </indexterm>
8446 <indexterm role="concept">
8447 <primary>routers</primary>
8448 <secondary>default</secondary>
8449 </indexterm>
8450 The router configuration comes next in the default configuration, introduced
8451 by the line
8452 </para>
8453 <literallayout class="monospaced">
8454 begin routers
8455 </literallayout>
8456 <para>
8457 Routers are the modules in Exim that make decisions about where to send
8458 messages. An address is passed to each router in turn, until it is either
8459 accepted, or failed. This means that the order in which you define the routers
8460 matters. Each router is fully described in its own chapter later in this
8461 manual. Here we give only brief overviews.
8462 </para>
8463 <literallayout class="monospaced">
8464 # domain_literal:
8465 #   driver = ipliteral
8466 #   domains = !+local_domains
8467 #   transport = remote_smtp
8468 </literallayout>
8469 <para>
8470 <indexterm role="concept">
8471 <primary>domain literal</primary>
8472 <secondary>default router</secondary>
8473 </indexterm>
8474 This router is commented out because the majority of sites do not want to
8475 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8476 you uncomment this router, you also need to uncomment the setting of
8477 <option>allow_domain_literals</option> in the main part of the configuration.
8478 </para>
8479 <literallayout class="monospaced">
8480 dnslookup:
8481   driver = dnslookup
8482   domains = ! +local_domains
8483   transport = remote_smtp
8484   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8485   no_more
8486 </literallayout>
8487 <para>
8488 The first uncommented router handles addresses that do not involve any local
8489 domains. This is specified by the line
8490 </para>
8491 <literallayout class="monospaced">
8492 domains = ! +local_domains
8493 </literallayout>
8494 <para>
8495 The <option>domains</option> option lists the domains to which this router applies, but the
8496 exclamation mark is a negation sign, so the router is used only for domains
8497 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8498 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8499 indicates that it is referring to a named list. Addresses in other domains are
8500 passed on to the following routers.
8501 </para>
8502 <para>
8503 The name of the router driver is <command>dnslookup</command>,
8504 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8505 the name of this router instance is the same as the name of the driver. The
8506 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8507 one of the driver modules that is in the Exim binary.
8508 </para>
8509 <para>
8510 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8511 DNS in order to obtain a list of hosts to which the address is routed. If the
8512 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8513 specified by the <option>transport</option> option. If the router does not find the domain
8514 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8515 the address fails and is bounced.
8516 </para>
8517 <para>
8518 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8519 be entirely ignored. This option is present because a number of cases have been
8520 encountered where MX records in the DNS point to host names
8521 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8522 Completely ignoring these IP addresses causes Exim to fail to route the
8523 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8524 continue to try to deliver the message periodically until the address timed
8525 out.
8526 </para>
8527 <literallayout class="monospaced">
8528 system_aliases:
8529   driver = redirect
8530   allow_fail
8531   allow_defer
8532   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8533 # user = exim
8534   file_transport = address_file
8535   pipe_transport = address_pipe
8536 </literallayout>
8537 <para>
8538 Control reaches this and subsequent routers only for addresses in the local
8539 domains. This router checks to see whether the local part is defined as an
8540 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8541 data that it looks up from that file. If no data is found for the local part,
8542 the value of the <option>data</option> option is empty, causing the address to be passed to
8543 the next router.
8544 </para>
8545 <para>
8546 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8547 often used. That is why it is referenced by from the default configuration
8548 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8549 <filename>Local/Makefile</filename> before building Exim.
8550 </para>
8551 <literallayout class="monospaced">
8552 userforward:
8553   driver = redirect
8554   check_local_user
8555 # local_part_suffix = +* : -*
8556 # local_part_suffix_optional
8557   file = $home/.forward
8558 # allow_filter
8559   no_verify
8560   no_expn
8561   check_ancestor
8562   file_transport = address_file
8563   pipe_transport = address_pipe
8564   reply_transport = address_reply
8565 </literallayout>
8566 <para>
8567 This is the most complicated router in the default configuration. It is another
8568 redirection router, but this time it is looking for forwarding data set up by
8569 individual users. The <option>check_local_user</option> setting specifies a check that the
8570 local part of the address is the login name of a local user. If it is not, the
8571 router is skipped. The two commented options that follow <option>check_local_user</option>,
8572 namely:
8573 </para>
8574 <literallayout class="monospaced">
8575 # local_part_suffix = +* : -*
8576 # local_part_suffix_optional
8577 </literallayout>
8578 <para>
8579 <indexterm role="variable">
8580 <primary><varname>$local_part_suffix</varname></primary>
8581 </indexterm>
8582 show how you can specify the recognition of local part suffixes. If the first
8583 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8584 by any sequence of characters, is removed from the local part and placed in the
8585 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8586 presence of a suffix in the local part is optional. When a suffix is present,
8587 the check for a local login uses the local part with the suffix removed.
8588 </para>
8589 <para>
8590 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8591 home directory is consulted. If it does not exist, or is empty, the router
8592 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8593 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8594 </para>
8595 <para>
8596 <indexterm role="concept">
8597 <primary>Sieve filter</primary>
8598 <secondary>enabling in default router</secondary>
8599 </indexterm>
8600 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8601 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8602 is commented out by default), the contents of the file are interpreted as a set
8603 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8604 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8605 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8606 </para>
8607 <para>
8608 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8609 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8610 There are two reasons for doing this:
8611 </para>
8612 <orderedlist numeration="arabic">
8613 <listitem>
8614 <para>
8615 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8616 checking an address for validity; it makes sense not to waste resources doing
8617 unnecessary work.
8618 </para>
8619 </listitem>
8620 <listitem>
8621 <para>
8622 More importantly, when Exim is verifying addresses or handling an EXPN
8623 command during an SMTP session, it is running as the Exim user, not as root.
8624 The group is the Exim group, and no additional groups are set up.
8625 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
8626 this time.
8627 </para>
8628 </listitem>
8629 </orderedlist>
8630 <para>
8631 The setting of <option>check_ancestor</option> prevents the router from generating a new
8632 address that is the same as any previous address that was redirected. (This
8633 works round a problem concerning a bad interaction between aliasing and
8634 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
8635 </para>
8636 <para>
8637 The final three option settings specify the transports that are to be used when
8638 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8639 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8640 </para>
8641 <literallayout class="monospaced">
8642 a.nother@elsewhere.example, /home/spqr/archive
8643 </literallayout>
8644 <para>
8645 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8646 transport.
8647 </para>
8648 <literallayout class="monospaced">
8649 localuser:
8650   driver = accept
8651   check_local_user
8652 # local_part_suffix = +* : -*
8653 # local_part_suffix_optional
8654   transport = local_delivery
8655 </literallayout>
8656 <para>
8657 The final router sets up delivery into local mailboxes, provided that the local
8658 part is the name of a local login, by accepting the address and assigning it to
8659 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8660 routers, so the address is bounced. The commented suffix settings fulfil the
8661 same purpose as they do for the <command>userforward</command> router.
8662 </para>
8663 </section>
8664 <section id="SECID56">
8665 <title>Transport configuration</title>
8666 <para>
8667 <indexterm role="concept">
8668 <primary>default</primary>
8669 <secondary>transports</secondary>
8670 </indexterm>
8671 <indexterm role="concept">
8672 <primary>transports</primary>
8673 <secondary>default</secondary>
8674 </indexterm>
8675 Transports define mechanisms for actually delivering messages. They operate
8676 only when referenced from routers, so the order in which they are defined does
8677 not matter. The transports section of the configuration starts with
8678 </para>
8679 <literallayout class="monospaced">
8680 begin transports
8681 </literallayout>
8682 <para>
8683 One remote transport and four local transports are defined.
8684 </para>
8685 <literallayout class="monospaced">
8686 remote_smtp:
8687   driver = smtp
8688 </literallayout>
8689 <para>
8690 This transport is used for delivering messages over SMTP connections. All its
8691 options are defaulted. The list of remote hosts comes from the router.
8692 </para>
8693 <literallayout class="monospaced">
8694 local_delivery:
8695   driver = appendfile
8696   file = /var/mail/$local_part
8697   delivery_date_add
8698   envelope_to_add
8699   return_path_add
8700 # group = mail
8701 # mode = 0660
8702 </literallayout>
8703 <para>
8704 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8705 traditional BSD mailbox format. By default it runs under the uid and gid of the
8706 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8707 directory. Some systems use the alternative approach of running mail deliveries
8708 under a particular group instead of using the sticky bit. The commented options
8709 show how this can be done.
8710 </para>
8711 <para>
8712 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8713 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8714 similarly-named options above.
8715 </para>
8716 <literallayout class="monospaced">
8717 address_pipe:
8718   driver = pipe
8719   return_output
8720 </literallayout>
8721 <para>
8722 This transport is used for handling deliveries to pipes that are generated by
8723 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
8724 option specifies that any output generated by the pipe is to be returned to the
8725 sender.
8726 </para>
8727 <literallayout class="monospaced">
8728 address_file:
8729   driver = appendfile
8730   delivery_date_add
8731   envelope_to_add
8732   return_path_add
8733 </literallayout>
8734 <para>
8735 This transport is used for handling deliveries to files that are generated by
8736 redirection. The name of the file is not specified in this instance of
8737 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8738 </para>
8739 <literallayout class="monospaced">
8740 address_reply:
8741   driver = autoreply
8742 </literallayout>
8743 <para>
8744 This transport is used for handling automatic replies generated by users&#x2019;
8745 filter files.
8746 </para>
8747 </section>
8748 <section id="SECID57">
8749 <title>Default retry rule</title>
8750 <para>
8751 <indexterm role="concept">
8752 <primary>retry</primary>
8753 <secondary>default rule</secondary>
8754 </indexterm>
8755 <indexterm role="concept">
8756 <primary>default</primary>
8757 <secondary>retry rule</secondary>
8758 </indexterm>
8759 The retry section of the configuration file contains rules which affect the way
8760 Exim retries deliveries that cannot be completed at the first attempt. It is
8761 introduced by the line
8762 </para>
8763 <literallayout class="monospaced">
8764 begin retry
8765 </literallayout>
8766 <para>
8767 In the default configuration, there is just one rule, which applies to all
8768 errors:
8769 </para>
8770 <literallayout class="monospaced">
8771 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
8772 </literallayout>
8773 <para>
8774 This causes any temporarily failing address to be retried every 15 minutes for
8775 2 hours, then at intervals starting at one hour and increasing by a factor of
8776 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8777 is not delivered after 4 days of temporary failure, it is bounced.
8778 </para>
8779 <para revisionflag="changed">
8780 If the retry section is removed from the configuration, or is empty (that is,
8781 if no retry rules are defined), Exim will not retry deliveries. This turns
8782 temporary errors into permanent errors.
8783 </para>
8784 </section>
8785 <section id="SECID58">
8786 <title>Rewriting configuration</title>
8787 <para>
8788 The rewriting section of the configuration, introduced by
8789 </para>
8790 <literallayout class="monospaced">
8791 begin rewrite
8792 </literallayout>
8793 <para>
8794 contains rules for rewriting addresses in messages as they arrive. There are no
8795 rewriting rules in the default configuration file.
8796 </para>
8797 </section>
8798 <section id="SECTdefconfauth">
8799 <title>Authenticators configuration</title>
8800 <para>
8801 <indexterm role="concept">
8802 <primary>AUTH</primary>
8803 <secondary>configuration</secondary>
8804 </indexterm>
8805 The authenticators section of the configuration, introduced by
8806 </para>
8807 <literallayout class="monospaced">
8808 begin authenticators
8809 </literallayout>
8810 <para>
8811 defines mechanisms for the use of the SMTP AUTH command. The default
8812 configuration file contains two commented-out example authenticators
8813 which support plaintext username/password authentication using the
8814 standard PLAIN mechanism and the traditional but non-standard LOGIN
8815 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8816 to support most MUA software.
8817 </para>
8818 <para>
8819 The example PLAIN authenticator looks like this:
8820 </para>
8821 <literallayout class="monospaced">
8822 #PLAIN:
8823 #  driver                  = plaintext
8824 #  server_set_id           = $auth2
8825 #  server_prompts          = :
8826 #  server_condition        = Authentication is not yet configured
8827 #  server_advertise_condition = ${if def:tls_cipher }
8828 </literallayout>
8829 <para>
8830 And the example LOGIN authenticator looks like this:
8831 </para>
8832 <literallayout class="monospaced">
8833 #LOGIN:
8834 #  driver                  = plaintext
8835 #  server_set_id           = $auth1
8836 #  server_prompts          = &lt;| Username: | Password:
8837 #  server_condition        = Authentication is not yet configured
8838 #  server_advertise_condition = ${if def:tls_cipher }
8839 </literallayout>
8840 <para>
8841 The <option>server_set_id</option> option makes Exim remember the authenticated username
8842 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8843 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8844 that it implements the details of the specific authentication mechanism,
8845 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8846 when Exim offers authentication to clients; in the examples, this is only
8847 when TLS or SSL has been started, so to enable the authenticators you also
8848 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8849 </para>
8850 <para>
8851 The <option>server_condition</option> setting defines how to verify that the username and
8852 password are correct. In the examples it just produces an error message.
8853 To make the authenticators work, you can use a string expansion
8854 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8855 </para>
8856 <para>
8857 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8858 </para>
8859 </section>
8860 </chapter>
8861
8862 <chapter id="CHAPregexp">
8863 <title>Regular expressions</title>
8864 <para>
8865 <indexterm role="concept">
8866 <primary>regular expressions</primary>
8867 <secondary>library</secondary>
8868 </indexterm>
8869 <indexterm role="concept">
8870 <primary>PCRE</primary>
8871 </indexterm>
8872 Exim supports the use of regular expressions in many of its options. It
8873 uses the PCRE regular expression library; this provides regular expression
8874 matching that is compatible with Perl 5. The syntax and semantics of
8875 regular expressions is discussed in many Perl reference books, and also in
8876 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8877 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8878 </para>
8879 <para>
8880 The documentation for the syntax and semantics of the regular expressions that
8881 are supported by PCRE is included in plain text in the file
8882 <filename>doc/pcrepattern.txt</filename> in the Exim distribution, and also in the HTML
8883 tarbundle of Exim documentation. It describes in detail the features of the
8884 regular expressions that PCRE supports, so no further description is included
8885 here. The PCRE functions are called from Exim using the default option settings
8886 (that is, with no PCRE options set), except that the PCRE_CASELESS option is
8887 set when the matching is required to be case-insensitive.
8888 </para>
8889 <para>
8890 In most cases, when a regular expression is required in an Exim configuration,
8891 it has to start with a circumflex, in order to distinguish it from plain text
8892 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8893 second item in the colon-separated list is a regular expression.
8894 </para>
8895 <literallayout class="monospaced">
8896 domains = a.b.c : ^\\d{3} : *.y.z : ...
8897 </literallayout>
8898 <para>
8899 The doubling of the backslash is required because of string expansion that
8900 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
8901 of this issue, and a way of avoiding the need for doubling backslashes. The
8902 regular expression that is eventually used in this example contains just one
8903 backslash. The circumflex is included in the regular expression, and has the
8904 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8905 matched.
8906 </para>
8907 <para>
8908 There are, however, two cases where a circumflex is not required for the
8909 recognition of a regular expression: these are the <option>match</option> condition in a
8910 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8911 these cases, the relevant string is always treated as a regular expression; if
8912 it does not start with a circumflex, the expression is not anchored, and can
8913 match anywhere in the subject string.
8914 </para>
8915 <para>
8916 In all cases, if you want a regular expression to match at the end of a string,
8917 you must code the $ metacharacter to indicate this. For example:
8918 </para>
8919 <literallayout class="monospaced">
8920 domains = ^\\d{3}\\.example
8921 </literallayout>
8922 <para>
8923 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8924 You need to use:
8925 </para>
8926 <literallayout class="monospaced">
8927 domains = ^\\d{3}\\.example\$
8928 </literallayout>
8929 <para>
8930 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8931 $ is needed because string expansion also interprets dollar characters.
8932 </para>
8933 <section id="SECID59">
8934 <title>Testing regular expressions</title>
8935 <para>
8936 <indexterm role="concept">
8937 <primary>testing</primary>
8938 <secondary>regular expressions</secondary>
8939 </indexterm>
8940 <indexterm role="concept">
8941 <primary>regular expressions</primary>
8942 <secondary>testing</secondary>
8943 </indexterm>
8944 <indexterm role="concept">
8945 <primary><emphasis>pcretest</emphasis></primary>
8946 </indexterm>
8947 A program called <emphasis>pcretest</emphasis> forms part of the PCRE distribution and is built
8948 with PCRE during the process of building Exim. It is primarily intended for
8949 testing PCRE itself, but it can also be used for experimenting with regular
8950 expressions. After building Exim, the binary can be found in the build
8951 directory (it is not installed anywhere automatically). There is documentation
8952 of various options in <filename>doc/pcretest.txt</filename>, but for simple testing, none are
8953 needed. This is the output of a sample run of <emphasis>pcretest</emphasis>:
8954 </para>
8955 <literallayout>
8956 <literal>  re&gt; </literal><emphasis role="bold"><literal>/^([@]+)@.+\.(ac|edu)\.(?!kr)[a-z]{2}$/</literal></emphasis>
8957 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.ac.uk</literal></emphasis>
8958 <literal> 0: x@y.ac.uk</literal>
8959 <literal> 1: x</literal>
8960 <literal> 2: ac</literal>
8961 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.ac.kr</literal></emphasis>
8962 <literal>No match</literal>
8963 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.edu.com</literal></emphasis>
8964 <literal>No match</literal>
8965 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.edu.co</literal></emphasis>
8966 <literal> 0: x@y.edu.co</literal>
8967 <literal> 1: x</literal>
8968 <literal> 2: edu</literal>
8969 </literallayout>
8970 <para>
8971 Input typed by the user is shown in bold face. After the <quote>re&gt;</quote> prompt, a
8972 regular expression enclosed in delimiters is expected. If this compiles without
8973 error, <quote>data&gt;</quote> prompts are given for strings against which the expression is
8974 matched. An empty data line causes a new regular expression to be read. If the
8975 match is successful, the captured substring values (that is, what would be in
8976 the variables <varname>$0</varname>, <varname>$1</varname>, <varname>$2</varname>, etc.) are shown. The above example tests for
8977 an email address whose domain ends with either <quote>ac</quote> or <quote>edu</quote> followed by a
8978 two-character top-level domain that is not <quote>kr</quote>. The local part is captured
8979 in <varname>$1</varname> and the <quote>ac</quote> or <quote>edu</quote> in <varname>$2</varname>.
8980 </para>
8981 </section>
8982 </chapter>
8983
8984 <chapter id="CHAPfdlookup">
8985 <title>File and database lookups</title>
8986 <para>
8987 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8988 <primary>file</primary>
8989 <secondary>lookups</secondary>
8990 </indexterm>
8991 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8992 <primary>database</primary>
8993 <secondary>lookups</secondary>
8994 </indexterm>
8995 <indexterm role="concept">
8996 <primary>lookup</primary>
8997 <secondary>description of</secondary>
8998 </indexterm>
8999 Exim can be configured to look up data in files or databases as it processes
9000 messages. Two different kinds of syntax are used:
9001 </para>
9002 <orderedlist numeration="arabic">
9003 <listitem>
9004 <para>
9005 A string that is to be expanded may contain explicit lookup requests. These
9006 cause parts of the string to be replaced by data that is obtained from the
9007 lookup. Lookups of this type are conditional expansion items. Different results
9008 can be defined for the cases of lookup success and failure. See chapter
9009 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9010 </para>
9011 </listitem>
9012 <listitem>
9013 <para>
9014 Lists of domains, hosts, and email addresses can contain lookup requests as a
9015 way of avoiding excessively long linear lists. In this case, the data that is
9016 returned by the lookup is often (but not always) discarded; whether the lookup
9017 succeeds or fails is what really counts. These kinds of list are described in
9018 chapter <xref linkend="CHAPdomhosaddlists"/>.
9019 </para>
9020 </listitem>
9021 </orderedlist>
9022 <para>
9023 String expansions, lists, and lookups interact with each other in such a way
9024 that there is no order in which to describe any one of them that does not
9025 involve references to the others. Each of these three chapters makes more sense
9026 if you have read the other two first. If you are reading this for the first
9027 time, be aware that some of it will make a lot more sense after you have read
9028 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9029 </para>
9030 <section id="SECID60">
9031 <title>Examples of different lookup syntax</title>
9032 <para>
9033 It is easy to confuse the two different kinds of lookup, especially as the
9034 lists that may contain the second kind are always expanded before being
9035 processed as lists. Therefore, they may also contain lookups of the first kind.
9036 Be careful to distinguish between the following two examples:
9037 </para>
9038 <literallayout class="monospaced">
9039 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9040 domains = lsearch;/some/file
9041 </literallayout>
9042 <para>
9043 The first uses a string expansion, the result of which must be a domain list.
9044 No strings have been specified for a successful or a failing lookup; the
9045 defaults in this case are the looked-up data and an empty string, respectively.
9046 The expansion takes place before the string is processed as a list, and the
9047 file that is searched could contain lines like this:
9048 </para>
9049 <literallayout class="monospaced">
9050 192.168.3.4: domain1:domain2:...
9051 192.168.1.9: domain3:domain4:...
9052 </literallayout>
9053 <para>
9054 When the lookup succeeds, the result of the expansion is a list of domains (and
9055 possibly other types of item that are allowed in domain lists).
9056 </para>
9057 <para>
9058 In the second example, the lookup is a single item in a domain list. It causes
9059 Exim to use a lookup to see if the domain that is being processed can be found
9060 in the file. The file could contains lines like this:
9061 </para>
9062 <literallayout class="monospaced">
9063 domain1:
9064 domain2:
9065 </literallayout>
9066 <para>
9067 Any data that follows the keys is not relevant when checking that the domain
9068 matches the list item.
9069 </para>
9070 <para>
9071 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9072 Consider a file containing lines like this:
9073 </para>
9074 <literallayout class="monospaced">
9075 192.168.5.6: lsearch;/another/file
9076 </literallayout>
9077 <para>
9078 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9079 first <option>domains</option> setting above generates the second setting, which therefore
9080 causes a second lookup to occur.
9081 </para>
9082 <para>
9083 The rest of this chapter describes the different lookup types that are
9084 available. Any of them can be used in any part of the configuration where a
9085 lookup is permitted.
9086 </para>
9087 </section>
9088 <section id="SECID61">
9089 <title>Lookup types</title>
9090 <para>
9091 <indexterm role="concept">
9092 <primary>lookup</primary>
9093 <secondary>types of</secondary>
9094 </indexterm>
9095 <indexterm role="concept">
9096 <primary>single-key lookup</primary>
9097 <secondary>definition of</secondary>
9098 </indexterm>
9099 Two different types of data lookup are implemented:
9100 </para>
9101 <itemizedlist>
9102 <listitem>
9103 <para>
9104 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9105 and a single key to search for. The key must be a non-empty string for the
9106 lookup to succeed. The lookup type determines how the file is searched.
9107 </para>
9108 </listitem>
9109 <listitem>
9110 <para>
9111 <indexterm role="concept">
9112 <primary>query-style lookup</primary>
9113 <secondary>definition of</secondary>
9114 </indexterm>
9115 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9116 key value is assumed by Exim for query-style lookups. You can use whichever
9117 Exim variables you need to construct the database query.
9118 </para>
9119 </listitem>
9120 </itemizedlist>
9121 <para>
9122 The code for each lookup type is in a separate source file that is included in
9123 the binary of Exim only if the corresponding compile-time option is set. The
9124 default settings in <filename>src/EDITME</filename> are:
9125 </para>
9126 <literallayout class="monospaced">
9127 LOOKUP_DBM=yes
9128 LOOKUP_LSEARCH=yes
9129 </literallayout>
9130 <para>
9131 which means that only linear searching and DBM lookups are included by default.
9132 For some types of lookup (e.g. SQL databases), you need to install appropriate
9133 libraries and header files before building Exim.
9134 </para>
9135 </section>
9136 <section id="SECTsinglekeylookups">
9137 <title>Single-key lookup types</title>
9138 <para>
9139 <indexterm role="concept">
9140 <primary>lookup</primary>
9141 <secondary>single-key types</secondary>
9142 </indexterm>
9143 <indexterm role="concept">
9144 <primary>single-key lookup</primary>
9145 <secondary>list of types</secondary>
9146 </indexterm>
9147 The following single-key lookup types are implemented:
9148 </para>
9149 <itemizedlist>
9150 <listitem>
9151 <para>
9152 <indexterm role="concept">
9153 <primary>cdb</primary>
9154 <secondary>description of</secondary>
9155 </indexterm>
9156 <indexterm role="concept">
9157 <primary>lookup</primary>
9158 <secondary>cdb</secondary>
9159 </indexterm>
9160 <indexterm role="concept">
9161 <primary>binary zero</primary>
9162 <secondary>in lookup key</secondary>
9163 </indexterm>
9164 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9165 string without a terminating binary zero. The cdb format is designed for
9166 indexed files that are read frequently and never updated, except by total
9167 re-creation. As such, it is particularly suitable for large files containing
9168 aliases or other indexed data referenced by an MTA. Information about cdb can
9169 be found in several places:
9170 </para>
9171 <literallayout>
9172 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9173 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9174 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9175 </literallayout>
9176 <para>
9177 A cdb distribution is not needed in order to build Exim with cdb support,
9178 because the code for reading cdb files is included directly in Exim itself.
9179 However, no means of building or testing cdb files is provided with Exim, so
9180 you need to obtain a cdb distribution in order to do this.
9181 </para>
9182 </listitem>
9183 <listitem>
9184 <para>
9185 <indexterm role="concept">
9186 <primary>DBM</primary>
9187 <secondary>lookup type</secondary>
9188 </indexterm>
9189 <indexterm role="concept">
9190 <primary>lookup</primary>
9191 <secondary>dbm</secondary>
9192 </indexterm>
9193 <indexterm role="concept">
9194 <primary>binary zero</primary>
9195 <secondary>in lookup key</secondary>
9196 </indexterm>
9197 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9198 DBM file by looking up the record with the given key. A terminating binary
9199 zero is included in the key that is passed to the DBM library. See section
9200 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9201 </para>
9202 <para>
9203 <indexterm role="concept">
9204 <primary>Berkeley DB library</primary>
9205 <secondary>file format</secondary>
9206 </indexterm>
9207 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9208 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9209 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9210 the DB_UNKNOWN option. This enables it to handle any of the types of database
9211 that the library supports, and can be useful for accessing DBM files created by
9212 other applications. (For earlier DB versions, DB_HASH is always used.)
9213 </para>
9214 </listitem>
9215 <listitem>
9216 <para>
9217 <indexterm role="concept">
9218 <primary>lookup</primary>
9219 <secondary>dbmnz</secondary>
9220 </indexterm>
9221 <indexterm role="concept">
9222 <primary>lookup</primary>
9223 <secondary>dbm &ndash; terminating zero</secondary>
9224 </indexterm>
9225 <indexterm role="concept">
9226 <primary>binary zero</primary>
9227 <secondary>in lookup key</secondary>
9228 </indexterm>
9229 <indexterm role="concept">
9230 <primary>Courier</primary>
9231 </indexterm>
9232 <indexterm role="concept">
9233 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9234 </indexterm>
9235 <indexterm role="concept">
9236 <primary>dmbnz lookup type</primary>
9237 </indexterm>
9238 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9239 is not included in the key that is passed to the DBM library. You may need this
9240 if you want to look up data in files that are created by or shared with some
9241 other application that does not use terminating zeros. For example, you need to
9242 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9243 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9244 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9245 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9246 </para>
9247 </listitem>
9248 <listitem>
9249 <para revisionflag="changed">
9250 <indexterm role="concept">
9251 <primary>lookup</primary>
9252 <secondary>dsearch</secondary>
9253 </indexterm>
9254 <indexterm role="concept">
9255 <primary>dsearch lookup type</primary>
9256 </indexterm>
9257 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9258 whose name is the key by calling the <function>lstat()</function> function. The key may not
9259 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9260 the lookup is the name of the entry, which may be a file, directory,
9261 symbolic link, or any other kind of directory entry. An example of how this
9262 lookup can be used to support virtual domains is given in section
9263 <xref linkend="SECTvirtualdomains"/>.
9264 </para>
9265 </listitem>
9266 <listitem>
9267 <para>
9268 <indexterm role="concept">
9269 <primary>lookup</primary>
9270 <secondary>iplsearch</secondary>
9271 </indexterm>
9272 <indexterm role="concept">
9273 <primary>iplsearch lookup type</primary>
9274 </indexterm>
9275 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9276 terminated by a colon or white space or the end of the line. The keys in the
9277 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9278 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9279 being interpreted as a key terminator. For example:
9280 </para>
9281 <literallayout class="monospaced">
9282 1.2.3.4:           data for 1.2.3.4
9283 192.168.0.0/16     data for 192.168.0.0/16
9284 "abcd::cdab":      data for abcd::cdab
9285 "abcd:abcd::/32"   data for abcd:abcd::/32
9286 </literallayout>
9287 <para>
9288 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9289 file is searched linearly, using the CIDR masks where present, until a matching
9290 key is found. The first key that matches is used; there is no attempt to find a
9291 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9292 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9293 </para>
9294 <para>
9295 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9296 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9297 lookup types support only literal keys.
9298 </para>
9299 <para>
9300 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9301 the implicit key is the host&#x2019;s IP address rather than its name (see section
9302 <xref linkend="SECThoslispatsikey"/>).
9303 </para>
9304 </listitem>
9305 <listitem>
9306 <para>
9307 <indexterm role="concept">
9308 <primary>linear search</primary>
9309 </indexterm>
9310 <indexterm role="concept">
9311 <primary>lookup</primary>
9312 <secondary>lsearch</secondary>
9313 </indexterm>
9314 <indexterm role="concept">
9315 <primary>lsearch lookup type</primary>
9316 </indexterm>
9317 <indexterm role="concept">
9318 <primary>case sensitivity</primary>
9319 <secondary>in lsearch lookup</secondary>
9320 </indexterm>
9321 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9322 line beginning with the search key, terminated by a colon or white space or the
9323 end of the line. The search is case-insensitive; that is, upper and lower case
9324 letters are treated as the same. The first occurrence of the key that is found
9325 in the file is used.
9326 </para>
9327 <para>
9328 White space between the key and the colon is permitted. The remainder of the
9329 line, with leading and trailing white space removed, is the data. This can be
9330 continued onto subsequent lines by starting them with any amount of white
9331 space, but only a single space character is included in the data at such a
9332 junction. If the data begins with a colon, the key must be terminated by a
9333 colon, for example:
9334 </para>
9335 <literallayout class="monospaced">
9336 baduser:  :fail:
9337 </literallayout>
9338 <para>
9339 Empty lines and lines beginning with # are ignored, even if they occur in the
9340 middle of an item. This is the traditional textual format of alias files. Note
9341 that the keys in an <command>lsearch</command> file are literal strings. There is no
9342 wildcarding of any kind.
9343 </para>
9344 <para>
9345 <indexterm role="concept">
9346 <primary>lookup</primary>
9347 <secondary>lsearch &ndash; colons in keys</secondary>
9348 </indexterm>
9349 <indexterm role="concept">
9350 <primary>white space</primary>
9351 <secondary>in lsearch key</secondary>
9352 </indexterm>
9353 In most <command>lsearch</command> files, keys are not required to contain colons or #
9354 characters, or white space. However, if you need this feature, it is available.
9355 If a key begins with a doublequote character, it is terminated only by a
9356 matching quote (or end of line), and the normal escaping rules apply to its
9357 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9358 quoted keys (exactly as for unquoted keys). There is no special handling of
9359 quotes for the data part of an <command>lsearch</command> line.
9360 </para>
9361 </listitem>
9362 <listitem>
9363 <para>
9364 <indexterm role="concept">
9365 <primary>NIS lookup type</primary>
9366 </indexterm>
9367 <indexterm role="concept">
9368 <primary>lookup</primary>
9369 <secondary>NIS</secondary>
9370 </indexterm>
9371 <indexterm role="concept">
9372 <primary>binary zero</primary>
9373 <secondary>in lookup key</secondary>
9374 </indexterm>
9375 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9376 the given key, without a terminating binary zero. There is a variant called
9377 <command>nis0</command> which does include the terminating binary zero in the key. This is
9378 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9379 aliases; the full map names must be used.
9380 </para>
9381 </listitem>
9382 <listitem>
9383 <para>
9384 <indexterm role="concept">
9385 <primary>wildlsearch lookup type</primary>
9386 </indexterm>
9387 <indexterm role="concept">
9388 <primary>lookup</primary>
9389 <secondary>wildlsearch</secondary>
9390 </indexterm>
9391 <indexterm role="concept">
9392 <primary>nwildlsearch lookup type</primary>
9393 </indexterm>
9394 <indexterm role="concept">
9395 <primary>lookup</primary>
9396 <secondary>nwildlsearch</secondary>
9397 </indexterm>
9398 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9399 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9400 the file may be wildcarded. The difference between these two lookup types is
9401 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9402 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9403 </para>
9404 <para>
9405 <indexterm role="concept">
9406 <primary>case sensitivity</primary>
9407 <secondary>in (n)wildlsearch lookup</secondary>
9408 </indexterm>
9409 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9410 file that are regular expressions can be made case-sensitive by the use of
9411 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9412 </para>
9413 <orderedlist numeration="arabic">
9414 <listitem>
9415 <para>
9416 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9417 </para>
9418 <literallayout class="monospaced">
9419     *.a.b.c       data for anything.a.b.c
9420     *fish         data for anythingfish
9421 </literallayout>
9422 </listitem>
9423 <listitem>
9424 <para>
9425 The string may begin with a circumflex to indicate a regular expression. For
9426 example, for <command>wildlsearch</command>:
9427 </para>
9428 <literallayout class="monospaced">
9429     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9430 </literallayout>
9431 <para>
9432 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9433 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9434 string-expanded, the equivalent entry is:
9435 </para>
9436 <literallayout class="monospaced">
9437     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9438 </literallayout>
9439 <para>
9440 The case-insensitive flag is set at the start of compiling the regular
9441 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9442 For example, to make the entire pattern case-sensitive:
9443 </para>
9444 <literallayout class="monospaced">
9445     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9446 </literallayout>
9447 <para>
9448 If the regular expression contains white space or colon characters, you must
9449 either quote it (see <command>lsearch</command> above), or represent these characters in other
9450 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9451 colon. This may be easier than quoting, because if you quote, you have to
9452 escape all the backslashes inside the quotes.
9453 </para>
9454 <para>
9455 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9456 match for later use, because the results of all lookups are cached. If a lookup
9457 is repeated, the result is taken from the cache, and no actual pattern matching
9458 takes place. The values of all the numeric variables are unset after a
9459 <command>(n)wildlsearch</command> match.
9460 </para>
9461 </listitem>
9462 <listitem>
9463 <para>
9464 Although I cannot see it being of much use, the general matching function that
9465 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9466 lookup name terminated by a semicolon, and followed by lookup data. For
9467 example:
9468 </para>
9469 <literallayout class="monospaced">
9470     cdb;/some/file  data for keys that match the file
9471 </literallayout>
9472 <para>
9473 The data that is obtained from the nested lookup is discarded.
9474 </para>
9475 </listitem>
9476 </orderedlist>
9477 <para>
9478 Keys that do not match any of these patterns are interpreted literally. The
9479 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9480 be followed by optional colons.
9481 </para>
9482 <para>
9483 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9484 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9485 lookup types support only literal keys.
9486 </para>
9487 </listitem>
9488 </itemizedlist>
9489 </section>
9490 <section id="SECID62">
9491 <title>Query-style lookup types</title>
9492 <para>
9493 <indexterm role="concept">
9494 <primary>lookup</primary>
9495 <secondary>query-style types</secondary>
9496 </indexterm>
9497 <indexterm role="concept">
9498 <primary>query-style lookup</primary>
9499 <secondary>list of types</secondary>
9500 </indexterm>
9501 The supported query-style lookup types are listed below. Further details about
9502 many of them are given in later sections.
9503 </para>
9504 <itemizedlist>
9505 <listitem>
9506 <para>
9507 <indexterm role="concept">
9508 <primary>DNS</primary>
9509 <secondary>as a lookup type</secondary>
9510 </indexterm>
9511 <indexterm role="concept">
9512 <primary>lookup</primary>
9513 <secondary>DNS</secondary>
9514 </indexterm>
9515 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9516 are given in the supplied query. The resulting data is the contents of the
9517 records. See section <xref linkend="SECTdnsdb"/>.
9518 </para>
9519 </listitem>
9520 <listitem>
9521 <para>
9522 <indexterm role="concept">
9523 <primary>InterBase lookup type</primary>
9524 </indexterm>
9525 <indexterm role="concept">
9526 <primary>lookup</primary>
9527 <secondary>InterBase</secondary>
9528 </indexterm>
9529 <command>ibase</command>: This does a lookup in an InterBase database.
9530 </para>
9531 </listitem>
9532 <listitem>
9533 <para>
9534 <indexterm role="concept">
9535 <primary>LDAP</primary>
9536 <secondary>lookup type</secondary>
9537 </indexterm>
9538 <indexterm role="concept">
9539 <primary>lookup</primary>
9540 <secondary>LDAP</secondary>
9541 </indexterm>
9542 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9543 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9544 that permits values from multiple entries to be returned. A third variant
9545 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9546 any attribute values. See section <xref linkend="SECTldap"/>.
9547 </para>
9548 </listitem>
9549 <listitem>
9550 <para>
9551 <indexterm role="concept">
9552 <primary>MySQL</primary>
9553 <secondary>lookup type</secondary>
9554 </indexterm>
9555 <indexterm role="concept">
9556 <primary>lookup</primary>
9557 <secondary>MySQL</secondary>
9558 </indexterm>
9559 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9560 MySQL database. See section <xref linkend="SECTsql"/>.
9561 </para>
9562 </listitem>
9563 <listitem>
9564 <para>
9565 <indexterm role="concept">
9566 <primary>NIS+ lookup type</primary>
9567 </indexterm>
9568 <indexterm role="concept">
9569 <primary>lookup</primary>
9570 <secondary>NIS+</secondary>
9571 </indexterm>
9572 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9573 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9574 </para>
9575 </listitem>
9576 <listitem>
9577 <para>
9578 <indexterm role="concept">
9579 <primary>Oracle</primary>
9580 <secondary>lookup type</secondary>
9581 </indexterm>
9582 <indexterm role="concept">
9583 <primary>lookup</primary>
9584 <secondary>Oracle</secondary>
9585 </indexterm>
9586 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9587 Oracle database. See section <xref linkend="SECTsql"/>.
9588 </para>
9589 </listitem>
9590 <listitem>
9591 <para>
9592 <indexterm role="concept">
9593 <primary>lookup</primary>
9594 <secondary>passwd</secondary>
9595 </indexterm>
9596 <indexterm role="concept">
9597 <primary>passwd lookup type</primary>
9598 </indexterm>
9599 <indexterm role="concept">
9600 <primary><filename>/etc/passwd</filename></primary>
9601 </indexterm>
9602 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9603 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9604 success, the result string is the same as you would get from an <command>lsearch</command>
9605 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9606 password value. For example:
9607 </para>
9608 <literallayout class="monospaced">
9609 *:42:42:King Rat:/home/kr:/bin/bash
9610 </literallayout>
9611 </listitem>
9612 <listitem>
9613 <para>
9614 <indexterm role="concept">
9615 <primary>PostgreSQL lookup type</primary>
9616 </indexterm>
9617 <indexterm role="concept">
9618 <primary>lookup</primary>
9619 <secondary>PostgreSQL</secondary>
9620 </indexterm>
9621 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9622 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9623 </para>
9624 </listitem>
9625 <listitem>
9626 <para>
9627 <indexterm role="concept">
9628 <primary>sqlite lookup type</primary>
9629 </indexterm>
9630 <indexterm role="concept">
9631 <primary>lookup</primary>
9632 <secondary>sqlite</secondary>
9633 </indexterm>
9634 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9635 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9636 </para>
9637 </listitem>
9638 <listitem>
9639 <para>
9640 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9641 not likely to be useful in normal operation.
9642 </para>
9643 </listitem>
9644 <listitem>
9645 <para>
9646 <indexterm role="concept">
9647 <primary>whoson lookup type</primary>
9648 </indexterm>
9649 <indexterm role="concept">
9650 <primary>lookup</primary>
9651 <secondary>whoson</secondary>
9652 </indexterm>
9653 <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
9654 allows a server to check whether a particular (dynamically allocated) IP
9655 address is currently allocated to a known (trusted) user and, optionally, to
9656 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9657 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9658 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9659 <quote>POP before SMTP</quote> checking using ACL statements such as
9660 </para>
9661 <literallayout class="monospaced">
9662 require condition = \
9663   ${lookup whoson {$sender_host_address}{yes}{no}}
9664 </literallayout>
9665 <para>
9666 The query consists of a single IP address. The value returned is the name of
9667 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9668 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9669 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9670 </para>
9671 </listitem>
9672 </itemizedlist>
9673 </section>
9674 <section id="SECID63">
9675 <title>Temporary errors in lookups</title>
9676 <para>
9677 <indexterm role="concept">
9678 <primary>lookup</primary>
9679 <secondary>temporary error in</secondary>
9680 </indexterm>
9681 Lookup functions can return temporary error codes if the lookup cannot be
9682 completed. For example, an SQL or LDAP database might be unavailable. For this
9683 reason, it is not advisable to use a lookup that might do this for critical
9684 options such as a list of local domains.
9685 </para>
9686 <para>
9687 When a lookup cannot be completed in a router or transport, delivery
9688 of the message (to the relevant address) is deferred, as for any other
9689 temporary error. In other circumstances Exim may assume the lookup has failed,
9690 or may give up altogether.
9691 </para>
9692 </section>
9693 <section id="SECTdefaultvaluelookups">
9694 <title>Default values in single-key lookups</title>
9695 <para>
9696 <indexterm role="concept">
9697 <primary>wildcard lookups</primary>
9698 </indexterm>
9699 <indexterm role="concept">
9700 <primary>lookup</primary>
9701 <secondary>default values</secondary>
9702 </indexterm>
9703 <indexterm role="concept">
9704 <primary>lookup</primary>
9705 <secondary>wildcard</secondary>
9706 </indexterm>
9707 <indexterm role="concept">
9708 <primary>lookup</primary>
9709 <secondary>* added to type</secondary>
9710 </indexterm>
9711 <indexterm role="concept">
9712 <primary>default</primary>
9713 <secondary>in single-key lookups</secondary>
9714 </indexterm>
9715 In this context, a <quote>default value</quote> is a value specified by the administrator
9716 that is to be used if a lookup fails.
9717 </para>
9718 <para>
9719 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9720 lookups, the facilities of the query language must be used. An attempt to
9721 specify a default for a query-style lookup provokes an error.
9722 </para>
9723 <para>
9724 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9725 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9726 provide a default value. See also the section on partial matching below.
9727 </para>
9728 <para>
9729 <indexterm role="concept">
9730 <primary>*@ with single-key lookup</primary>
9731 </indexterm>
9732 <indexterm role="concept">
9733 <primary>lookup</primary>
9734 <secondary>*@ added to type</secondary>
9735 </indexterm>
9736 <indexterm role="concept">
9737 <primary>alias file</primary>
9738 <secondary>per-domain default</secondary>
9739 </indexterm>
9740 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9741 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9742 character, a second lookup is done with everything before the last @ replaced
9743 by *. This makes it possible to provide per-domain defaults in alias files
9744 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
9745 take place because there is no @ in the key), <quote>*</quote> is looked up.
9746 For example, a <command>redirect</command> router might contain:
9747 </para>
9748 <literallayout class="monospaced">
9749 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9750 </literallayout>
9751 <para>
9752 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9753 looks up these keys, in this order:
9754 </para>
9755 <literallayout class="monospaced">
9756 jane@eyre.example
9757 *@eyre.example
9758 *
9759 </literallayout>
9760 <para>
9761 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9762 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9763 complete scan is done for each key, and only if it is not found at all does
9764 Exim move on to try the next key.
9765 </para>
9766 </section>
9767 <section id="SECTpartiallookup">
9768 <title>Partial matching in single-key lookups</title>
9769 <para>
9770 <indexterm role="concept">
9771 <primary>partial matching</primary>
9772 </indexterm>
9773 <indexterm role="concept">
9774 <primary>wildcard lookups</primary>
9775 </indexterm>
9776 <indexterm role="concept">
9777 <primary>lookup</primary>
9778 <secondary>partial matching</secondary>
9779 </indexterm>
9780 <indexterm role="concept">
9781 <primary>lookup</primary>
9782 <secondary>wildcard</secondary>
9783 </indexterm>
9784 <indexterm role="concept">
9785 <primary>asterisk</primary>
9786 <secondary>in search type</secondary>
9787 </indexterm>
9788 The normal operation of a single-key lookup is to search the file for an exact
9789 match with the given key. However, in a number of situations where domains are
9790 being looked up, it is useful to be able to do partial matching. In this case,
9791 information in the file that has a key starting with <quote>*.</quote> is matched by any
9792 domain that ends with the components that follow the full stop. For example, if
9793 a key in a DBM file is
9794 </para>
9795 <literallayout class="monospaced">
9796 *.dates.fict.example
9797 </literallayout>
9798 <para>
9799 then when partial matching is enabled this is matched by (amongst others)
9800 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9801 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9802 file.
9803 </para>
9804 <para>
9805 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9806 also not available for any lookup items in address lists (see section
9807 <xref linkend="SECTaddresslist"/>).
9808 </para>
9809 <para>
9810 Partial matching is implemented by doing a series of separate lookups using
9811 keys constructed by modifying the original subject key. This means that it can
9812 be used with any of the single-key lookup types, provided that
9813 partial matching keys
9814 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9815 Keys in the file that do not begin with the prefix are matched only by
9816 unmodified subject keys when partial matching is in use.
9817 </para>
9818 <para>
9819 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9820 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9821 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9822 is added at the start of the subject key, and it is looked up again. If that
9823 fails, further lookups are tried with dot-separated components removed from the
9824 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9825 remains.
9826 </para>
9827 <para>
9828 A minimum number of two non-* components are required. This can be adjusted
9829 by including a number before the hyphen in the search type. For example,
9830 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9831 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9832 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9833 up when the minimum number of non-* components is two:
9834 </para>
9835 <literallayout class="monospaced">
9836 2250.dates.fict.example
9837 *.2250.dates.fict.example
9838 *.dates.fict.example
9839 *.fict.example
9840 </literallayout>
9841 <para>
9842 As soon as one key in the sequence is successfully looked up, the lookup
9843 finishes.
9844 </para>
9845 <para>
9846 <indexterm role="concept">
9847 <primary>lookup</primary>
9848 <secondary>partial matching &ndash; changing prefix</secondary>
9849 </indexterm>
9850 <indexterm role="concept">
9851 <primary>prefix</primary>
9852 <secondary>for partial matching</secondary>
9853 </indexterm>
9854 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9855 changed. The motivation for this feature is to allow Exim to operate with file
9856 formats that are used by other MTAs. A different prefix can be supplied in
9857 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9858 </para>
9859 <literallayout class="monospaced">
9860 domains = partial(.)lsearch;/some/file
9861 </literallayout>
9862 <para>
9863 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9864 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9865 components is unchanged). The prefix may consist of any punctuation characters
9866 other than a closing parenthesis. It may be empty, for example:
9867 </para>
9868 <literallayout class="monospaced">
9869 domains = partial1()cdb;/some/file
9870 </literallayout>
9871 <para>
9872 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9873 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9874 </para>
9875 <para>
9876 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9877 just one non-wild component has failed, and the original key is shortened right
9878 down to the null string) depends on the prefix:
9879 </para>
9880 <itemizedlist>
9881 <listitem>
9882 <para>
9883 If the prefix has zero length, the whole lookup fails.
9884 </para>
9885 </listitem>
9886 <listitem>
9887 <para>
9888 If the prefix has length 1, a lookup for just the prefix is done. For
9889 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9890 </para>
9891 </listitem>
9892 <listitem>
9893 <para>
9894 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9895 remainder is looked up. With the default prefix, therefore, the final lookup is
9896 for <quote>*</quote> on its own.
9897 </para>
9898 </listitem>
9899 <listitem>
9900 <para>
9901 Otherwise, the whole prefix is looked up.
9902 </para>
9903 </listitem>
9904 </itemizedlist>
9905 <para>
9906 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9907 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9908 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9909 specified, adding <quote>*</quote> to the search type has no effect with the default
9910 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9911 lookups. However, there might be a use for lookup types such as
9912 <quote>partial0(.)lsearch*</quote>.
9913 </para>
9914 <para>
9915 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9916 in domain lists and the like. Partial matching works only in terms of
9917 dot-separated components; a key such as <literal>*fict.example</literal>
9918 in a database file is useless, because the asterisk in a partial matching
9919 subject key is always followed by a dot.
9920 </para>
9921 </section>
9922 <section id="SECID64">
9923 <title>Lookup caching</title>
9924 <para>
9925 <indexterm role="concept">
9926 <primary>lookup</primary>
9927 <secondary>caching</secondary>
9928 </indexterm>
9929 <indexterm role="concept">
9930 <primary>caching</primary>
9931 <secondary>lookup data</secondary>
9932 </indexterm>
9933 Exim caches all lookup results in order to avoid needless repetition of
9934 lookups. However, because (apart from the daemon) Exim operates as a collection
9935 of independent, short-lived processes, this caching applies only within a
9936 single Exim process. There is no inter-process lookup caching facility.
9937 </para>
9938 <para>
9939 For single-key lookups, Exim keeps the relevant files open in case there is
9940 another lookup that needs them. In some types of configuration this can lead to
9941 many files being kept open for messages with many recipients. To avoid hitting
9942 the operating system limit on the number of simultaneously open files, Exim
9943 closes the least recently used file when it needs to open more files than its
9944 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9945 </para>
9946 <para>
9947 The single-key lookup files are closed and the lookup caches are flushed at
9948 strategic points during delivery &ndash; for example, after all routing is
9949 complete.
9950 </para>
9951 </section>
9952 <section id="SECID65">
9953 <title>Quoting lookup data</title>
9954 <para>
9955 <indexterm role="concept">
9956 <primary>lookup</primary>
9957 <secondary>quoting</secondary>
9958 </indexterm>
9959 <indexterm role="concept">
9960 <primary>quoting</primary>
9961 <secondary>in lookups</secondary>
9962 </indexterm>
9963 When data from an incoming message is included in a query-style lookup, there
9964 is the possibility of special characters in the data messing up the syntax of
9965 the query. For example, a NIS+ query that contains
9966 </para>
9967 <literallayout class="monospaced">
9968 [name=$local_part]
9969 </literallayout>
9970 <para>
9971 will be broken if the local part happens to contain a closing square bracket.
9972 For NIS+, data can be enclosed in double quotes like this:
9973 </para>
9974 <literallayout class="monospaced">
9975 [name="$local_part"]
9976 </literallayout>
9977 <para>
9978 but this still leaves the problem of a double quote in the data. The rule for
9979 NIS+ is that double quotes must be doubled. Other lookup types have different
9980 rules, and to cope with the differing requirements, an expansion operator
9981 of the following form is provided:
9982 </para>
9983 <literallayout class="monospaced">
9984 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
9985 </literallayout>
9986 <para>
9987 For example, the safest way to write the NIS+ query is
9988 </para>
9989 <literallayout class="monospaced">
9990 [name="${quote_nisplus:$local_part}"]
9991 </literallayout>
9992 <para>
9993 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9994 operator can be used for all lookup types, but has no effect for single-key
9995 lookups, since no quoting is ever needed in their key strings.
9996 </para>
9997 </section>
9998 <section id="SECTdnsdb">
9999 <title>More about dnsdb</title>
10000 <para>
10001 <indexterm role="concept">
10002 <primary>dnsdb lookup</primary>
10003 </indexterm>
10004 <indexterm role="concept">
10005 <primary>lookup</primary>
10006 <secondary>dnsdb</secondary>
10007 </indexterm>
10008 <indexterm role="concept">
10009 <primary>DNS</primary>
10010 <secondary>as a lookup type</secondary>
10011 </indexterm>
10012 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10013 of a record type and a domain name, separated by an equals sign. For example,
10014 an expansion string could contain:
10015 </para>
10016 <literallayout class="monospaced">
10017 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10018 </literallayout>
10019 <para>
10020 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10021 is used on its own as the result. If the lookup does not succeed, the
10022 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10023 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10024 </para>
10025 <para>
10026 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
10027 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10028 configured). If no type is given, TXT is assumed. When the type is PTR,
10029 the data can be an IP address, written as normal; inversion and the addition of
10030 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10031 </para>
10032 <literallayout class="monospaced">
10033 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10034 </literallayout>
10035 <para>
10036 If the data for a PTR record is not a syntactically valid IP address, it is not
10037 altered and nothing is added.
10038 </para>
10039 <para>
10040 <indexterm role="concept">
10041 <primary>MX record</primary>
10042 <secondary>in <command>dnsdb</command> lookup</secondary>
10043 </indexterm>
10044 <indexterm role="concept">
10045 <primary>SRV record</primary>
10046 <secondary>in <command>dnsdb</command> lookup</secondary>
10047 </indexterm>
10048 For an MX lookup, both the preference value and the host name are returned for
10049 each record, separated by a space. For an SRV lookup, the priority, weight,
10050 port, and host name are returned for each record, separated by spaces.
10051 </para>
10052 <para>
10053 For any record type, if multiple records are found (or, for A6 lookups, if a
10054 single record leads to multiple addresses), the data is returned as a
10055 concatenation, with newline as the default separator. The order, of course,
10056 depends on the DNS resolver. You can specify a different separator character
10057 between multiple records by putting a right angle-bracket followed immediately
10058 by the new separator at the start of the query. For example:
10059 </para>
10060 <literallayout class="monospaced">
10061 ${lookup dnsdb{&gt;: a=host1.example}}
10062 </literallayout>
10063 <para>
10064 It is permitted to specify a space as the separator character. Further
10065 white space is ignored.
10066 </para>
10067 </section>
10068 <section id="SECID66">
10069 <title>Pseudo dnsdb record types</title>
10070 <para>
10071 <indexterm role="concept">
10072 <primary>MX record</primary>
10073 <secondary>in <command>dnsdb</command> lookup</secondary>
10074 </indexterm>
10075 By default, both the preference value and the host name are returned for
10076 each MX record, separated by a space. If you want only host names, you can use
10077 the pseudo-type MXH:
10078 </para>
10079 <literallayout class="monospaced">
10080 ${lookup dnsdb{mxh=a.b.example}}
10081 </literallayout>
10082 <para>
10083 In this case, the preference values are omitted, and just the host names are
10084 returned.
10085 </para>
10086 <para>
10087 <indexterm role="concept">
10088 <primary>name server for enclosing domain</primary>
10089 </indexterm>
10090 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10091 records on the given domain, but if none are found, it removes the first
10092 component of the domain name, and tries again. This process continues until NS
10093 records are found or there are no more components left (or there is a DNS
10094 error). In other words, it may return the name servers for a top-level domain,
10095 but it never returns the root name servers. If there are no NS records for the
10096 top-level domain, the lookup fails. Consider these examples:
10097 </para>
10098 <literallayout class="monospaced">
10099 ${lookup dnsdb{zns=xxx.quercite.com}}
10100 ${lookup dnsdb{zns=xxx.edu}}
10101 </literallayout>
10102 <para>
10103 Assuming that in each case there are no NS records for the full domain name,
10104 the first returns the name servers for <option>quercite.com</option>, and the second returns
10105 the name servers for <option>edu</option>.
10106 </para>
10107 <para>
10108 You should be careful about how you use this lookup because, unless the
10109 top-level domain does not exist, the lookup always returns some host names. The
10110 sort of use to which this might be put is for seeing if the name servers for a
10111 given domain are on a blacklist. You can probably assume that the name servers
10112 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10113 such a list.
10114 </para>
10115 <para>
10116 <indexterm role="concept">
10117 <primary>CSA</primary>
10118 <secondary>in <command>dnsdb</command> lookup</secondary>
10119 </indexterm>
10120 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10121 records according to the CSA rules, which are described in section
10122 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10123 not sufficient because of the extra parent domain search behaviour of CSA. The
10124 result of a successful lookup such as:
10125 </para>
10126 <literallayout class="monospaced">
10127 ${lookup dnsdb {csa=$sender_helo_name}}
10128 </literallayout>
10129 <para>
10130 has two space-separated fields: an authorization code and a target host name.
10131 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10132 authorization required but absent, or <quote>?</quote> for unknown.
10133 </para>
10134 </section>
10135 <section id="SECID67">
10136 <title>Multiple dnsdb lookups</title>
10137 <para>
10138 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10139 However, you can specify a list of domains or IP addresses in a single
10140 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10141 the default separator, but with the ability to change this. For example:
10142 </para>
10143 <literallayout class="monospaced">
10144 ${lookup dnsdb{one.domain.com:two.domain.com}}
10145 ${lookup dnsdb{a=one.host.com:two.host.com}}
10146 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10147 </literallayout>
10148 <para>
10149 In order to retain backwards compatibility, there is one special case: if
10150 the lookup type is PTR and no change of separator is specified, Exim looks
10151 to see if the rest of the string is precisely one IPv6 address. In this
10152 case, it does not treat it as a list.
10153 </para>
10154 <para>
10155 The data from each lookup is concatenated, with newline separators by default,
10156 in the same way that multiple DNS records for a single item are handled. A
10157 different separator can be specified, as described above.
10158 </para>
10159 <para>
10160 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10161 temporary DNS error for any of them, the behaviour is controlled by
10162 an optional keyword followed by a comma that may appear before the record
10163 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10164 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10165 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10166 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10167 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10168 error causes the whole lookup to defer only if none of the other lookups
10169 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10170 </para>
10171 <literallayout class="monospaced">
10172 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10173 ${lookup dnsdb{a=one.host.com:two.host.com}}
10174 </literallayout>
10175 <para>
10176 Thus, in the default case, as long as at least one of the DNS lookups
10177 yields some data, the lookup succeeds.
10178 </para>
10179 </section>
10180 <section id="SECTldap">
10181 <title>More about LDAP</title>
10182 <para>
10183 <indexterm role="concept">
10184 <primary>LDAP</primary>
10185 <secondary>lookup, more about</secondary>
10186 </indexterm>
10187 <indexterm role="concept">
10188 <primary>lookup</primary>
10189 <secondary>LDAP</secondary>
10190 </indexterm>
10191 <indexterm role="concept">
10192 <primary>Solaris</primary>
10193 <secondary>LDAP</secondary>
10194 </indexterm>
10195 The original LDAP implementation came from the University of Michigan; this has
10196 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10197 implementation comes from Netscape, and Solaris 7 and subsequent releases
10198 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10199 the lookup function level, their error handling is different. For this reason
10200 it is necessary to set a compile-time variable when building Exim with LDAP, to
10201 indicate which LDAP library is in use. One of the following should appear in
10202 your <filename>Local/Makefile</filename>:
10203 </para>
10204 <literallayout class="monospaced">
10205 LDAP_LIB_TYPE=UMICHIGAN
10206 LDAP_LIB_TYPE=OPENLDAP1
10207 LDAP_LIB_TYPE=OPENLDAP2
10208 LDAP_LIB_TYPE=NETSCAPE
10209 LDAP_LIB_TYPE=SOLARIS
10210 </literallayout>
10211 <para>
10212 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10213 same interface as the University of Michigan version.
10214 </para>
10215 <para>
10216 There are three LDAP lookup types in Exim. These behave slightly differently in
10217 the way they handle the results of a query:
10218 </para>
10219 <itemizedlist>
10220 <listitem>
10221 <para>
10222 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10223 gives an error.
10224 </para>
10225 </listitem>
10226 <listitem>
10227 <para>
10228 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10229 Distinguished Name that is returned rather than any attribute values.
10230 </para>
10231 </listitem>
10232 <listitem>
10233 <para>
10234 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10235 from all of them are returned.
10236 </para>
10237 </listitem>
10238 </itemizedlist>
10239 <para>
10240 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10241 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10242 the data returned by a successful lookup is described in the next section.
10243 First we explain how LDAP queries are coded.
10244 </para>
10245 </section>
10246 <section id="SECTforldaque">
10247 <title>Format of LDAP queries</title>
10248 <para>
10249 <indexterm role="concept">
10250 <primary>LDAP</primary>
10251 <secondary>query format</secondary>
10252 </indexterm>
10253 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10254 the configuration of a <command>redirect</command> router one might have this setting:
10255 </para>
10256 <literallayout class="monospaced">
10257 data = ${lookup ldap \
10258   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10259   c=UK?mailbox?base?}}
10260 </literallayout>
10261 <para>
10262 <indexterm role="concept">
10263 <primary>LDAP</primary>
10264 <secondary>with TLS</secondary>
10265 </indexterm>
10266 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10267 secure (encrypted) LDAP connections. The second of these ensures that an
10268 encrypted TLS connection is used.
10269 </para>
10270 </section>
10271 <section id="SECID68">
10272 <title>LDAP quoting</title>
10273 <para>
10274 <indexterm role="concept">
10275 <primary>LDAP</primary>
10276 <secondary>quoting</secondary>
10277 </indexterm>
10278 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10279 and the second because the LDAP query is represented as a URL. Furthermore,
10280 within an LDAP query, two different kinds of quoting are required. For this
10281 reason, there are two different LDAP-specific quoting operators.
10282 </para>
10283 <para>
10284 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10285 filter specifications. Conceptually, it first does the following conversions on
10286 the string:
10287 </para>
10288 <literallayout class="monospaced">
10289 *   =&gt;   \2A
10290 (   =&gt;   \28
10291 )   =&gt;   \29
10292 \   =&gt;   \5C
10293 </literallayout>
10294 <para>
10295 in accordance with RFC 2254. The resulting string is then quoted according
10296 to the rules for URLs, that is, all non-alphanumeric characters except
10297 </para>
10298 <literallayout class="monospaced">
10299 ! $ ' - . _ ( ) * +
10300 </literallayout>
10301 <para>
10302 are converted to their hex values, preceded by a percent sign. For example:
10303 </para>
10304 <literallayout class="monospaced">
10305 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10306 </literallayout>
10307 <para>
10308 yields
10309 </para>
10310 <literallayout class="monospaced">
10311 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10312 </literallayout>
10313 <para>
10314 Removing the URL quoting, this is (with a leading and a trailing space):
10315 </para>
10316 <literallayout class="monospaced">
10317 a\28bc\29\2A, a&lt;yz&gt;;
10318 </literallayout>
10319 <para>
10320 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10321 base DN specifications in queries. Conceptually, it first converts the string
10322 by inserting a backslash in front of any of the following characters:
10323 </para>
10324 <literallayout class="monospaced">
10325 , + " \ &lt; &gt; ;
10326 </literallayout>
10327 <para>
10328 It also inserts a backslash before any leading spaces or # characters, and
10329 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10330 is then quoted according to the rules for URLs. For example:
10331 </para>
10332 <literallayout class="monospaced">
10333 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10334 </literallayout>
10335 <para>
10336 yields
10337 </para>
10338 <literallayout class="monospaced">
10339 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10340 </literallayout>
10341 <para>
10342 Removing the URL quoting, this is (with a trailing space):
10343 </para>
10344 <literallayout class="monospaced">
10345 \ a(bc)*\, a\&lt;yz\&gt;\;\
10346 </literallayout>
10347 <para>
10348 There are some further comments about quoting in the section on LDAP
10349 authentication below.
10350 </para>
10351 </section>
10352 <section id="SECID69">
10353 <title>LDAP connections</title>
10354 <para>
10355 <indexterm role="concept">
10356 <primary>LDAP</primary>
10357 <secondary>connections</secondary>
10358 </indexterm>
10359 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10360 is in use, via a Unix domain socket. The example given above does not specify
10361 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10362 by starting it with
10363 </para>
10364 <literallayout class="monospaced">
10365 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10366 </literallayout>
10367 <para>
10368 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10369 used. When no server is specified in a query, a list of default servers is
10370 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10371 colon-separated list of servers which are tried in turn until one successfully
10372 handles a query, or there is a serious error. Successful handling either
10373 returns the requested data, or indicates that it does not exist. Serious errors
10374 are syntactical, or multiple values when only a single value is expected.
10375 Errors which cause the next server to be tried are connection failures, bind
10376 failures, and timeouts.
10377 </para>
10378 <para>
10379 For each server name in the list, a port number can be given. The standard way
10380 of specifying a host and port is to use a colon separator (RFC 1738). Because
10381 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10382 doubled. For example
10383 </para>
10384 <literallayout class="monospaced">
10385 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10386 </literallayout>
10387 <para>
10388 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10389 to the LDAP library with no server name, and the library&#x2019;s default (normally
10390 the local host) is used.
10391 </para>
10392 <para>
10393 If you are using the OpenLDAP library, you can connect to an LDAP server using
10394 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10395 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10396 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10397 not available.
10398 </para>
10399 <para>
10400 For this type of connection, instead of a host name for the server, a pathname
10401 for the socket is required, and the port number is not relevant. The pathname
10402 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10403 the query. In the former case, you can have settings such as
10404 </para>
10405 <literallayout class="monospaced">
10406 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10407 </literallayout>
10408 <para>
10409 When the pathname is given in the query, you have to escape the slashes as
10410 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10411 </para>
10412 <literallayout class="monospaced">
10413 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10414 </literallayout>
10415 <para>
10416 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10417 a pathname, it uses the Unix domain socket code, even if the query actually
10418 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10419 socket connection. This behaviour means that you can use a setting of
10420 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10421 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10422 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10423 backup host.
10424 </para>
10425 <para>
10426 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10427 specified, an error is diagnosed. However, if there are more items in
10428 <option>ldap_default_servers</option>, they are tried. In other words:
10429 </para>
10430 <itemizedlist>
10431 <listitem>
10432 <para>
10433 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10434 interface.
10435 </para>
10436 </listitem>
10437 <listitem>
10438 <para>
10439 Using <literal>ldapi</literal> with a host name causes an error.
10440 </para>
10441 </listitem>
10442 </itemizedlist>
10443 <para>
10444 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10445 <option>ldap_default_servers</option>, does whatever the library does by default.
10446 </para>
10447 </section>
10448 <section id="SECID70">
10449 <title>LDAP authentication and control information</title>
10450 <para>
10451 <indexterm role="concept">
10452 <primary>LDAP</primary>
10453 <secondary>authentication</secondary>
10454 </indexterm>
10455 The LDAP URL syntax provides no way of passing authentication and other control
10456 information to the server. To make this possible, the URL in an LDAP query may
10457 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10458 spaces. If a value contains spaces it must be enclosed in double quotes, and
10459 when double quotes are used, backslash is interpreted in the usual way inside
10460 them. The following names are recognized:
10461 </para>
10462 <literallayout>
10463 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10464 <literal>NETTIME    </literal>  set a timeout for a network operation
10465 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10466 <literal>PASS       </literal>  set the password, likewise
10467 <literal>REFERRALS  </literal>  set the referrals parameter
10468 <literal>SIZE       </literal>  set the limit for the number of entries returned
10469 <literal>TIME       </literal>  set the maximum waiting time for a query
10470 </literallayout>
10471 <para>
10472 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10473 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10474 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10475 library from trying to follow referrals issued by the LDAP server.
10476 </para>
10477 <para>
10478 The name CONNECT is an obsolete name for NETTIME, retained for
10479 backwards compatibility. This timeout (specified as a number of seconds) is
10480 enforced from the client end for operations that can be carried out over a
10481 network. Specifically, it applies to network connections and calls to the
10482 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10483 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10484 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10485 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10486 Netscape SDK; for OpenLDAP no action is taken.
10487 </para>
10488 <para>
10489 The TIME parameter (also a number of seconds) is passed to the server to
10490 set a server-side limit on the time taken to complete a search.
10491 </para>
10492 <para>
10493 Here is an example of an LDAP query in an Exim lookup that uses some of these
10494 values. This is a single line, folded to fit on the page:
10495 </para>
10496 <literallayout class="monospaced">
10497 ${lookup ldap
10498   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10499   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10500   {$value}fail}
10501 </literallayout>
10502 <para>
10503 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10504 any of the auxiliary data. Exim configuration settings that include lookups
10505 which contain password information should be preceded by <quote>hide</quote> to prevent
10506 non-admin users from using the <option>-bP</option> option to see their values.
10507 </para>
10508 <para>
10509 The auxiliary data items may be given in any order. The default is no
10510 connection timeout (the system timeout is used), no user or password, no limit
10511 on the number of entries returned, and no time limit on queries.
10512 </para>
10513 <para>
10514 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10515 removes any URL quoting that it may contain before passing it LDAP. Apparently
10516 some libraries do this for themselves, but some do not. Removing the URL
10517 quoting has two advantages:
10518 </para>
10519 <itemizedlist>
10520 <listitem>
10521 <para>
10522 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10523 DNs as with DNs inside actual queries.
10524 </para>
10525 </listitem>
10526 <listitem>
10527 <para>
10528 It permits spaces inside USER= DNs.
10529 </para>
10530 </listitem>
10531 </itemizedlist>
10532 <para>
10533 For example, a setting such as
10534 </para>
10535 <literallayout class="monospaced">
10536 USER=cn=${quote_ldap_dn:$1}
10537 </literallayout>
10538 <para>
10539 should work even if <varname>$1</varname> contains spaces.
10540 </para>
10541 <para>
10542 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10543 expansion operator, rather than the LDAP quote operators. The only reason this
10544 field needs quoting is to ensure that it conforms to the Exim syntax, which
10545 does not allow unquoted spaces. For example:
10546 </para>
10547 <literallayout class="monospaced">
10548 PASS=${quote:$3}
10549 </literallayout>
10550 <para>
10551 The LDAP authentication mechanism can be used to check passwords as part of
10552 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10553 <xref linkend="CHAPexpand"/>.
10554 </para>
10555 </section>
10556 <section id="SECID71">
10557 <title>Format of data returned by LDAP</title>
10558 <para>
10559 <indexterm role="concept">
10560 <primary>LDAP</primary>
10561 <secondary>returned data formats</secondary>
10562 </indexterm>
10563 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10564 as a sequence of values, for example
10565 </para>
10566 <literallayout class="monospaced">
10567 cn=manager, o=University of Cambridge, c=UK
10568 </literallayout>
10569 <para>
10570 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10571 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10572 the result between the data from different entries. It is possible for multiple
10573 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10574 you know that whatever values are returned all came from a single entry in the
10575 directory.
10576 </para>
10577 <para>
10578 In the common case where you specify a single attribute in your LDAP query, the
10579 result is not quoted, and does not contain the attribute name. If the attribute
10580 has multiple values, they are separated by commas.
10581 </para>
10582 <para>
10583 If you specify multiple attributes, the result contains space-separated, quoted
10584 strings, each preceded by the attribute name and an equals sign. Within the
10585 quotes, the quote character, backslash, and newline are escaped with
10586 backslashes, and commas are used to separate multiple values for the attribute.
10587 Apart from the escaping, the string within quotes takes the same form as the
10588 output when a single attribute is requested. Specifying no attributes is the
10589 same as specifying all of an entry&#x2019;s attributes.
10590 </para>
10591 <para>
10592 Here are some examples of the output format. The first line of each pair is an
10593 LDAP query, and the second is the data that is returned. The attribute called
10594 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10595 </para>
10596 <literallayout class="monospaced">
10597 ldap:///o=base?attr1?sub?(uid=fred)
10598 value1.1, value1.2
10599
10600 ldap:///o=base?attr2?sub?(uid=fred)
10601 value two
10602
10603 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10604 attr1="value1.1, value1.2" attr2="value two"
10605
10606 ldap:///o=base??sub?(uid=fred)
10607 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10608 </literallayout>
10609 <para>
10610 The <option>extract</option> operator in string expansions can be used to pick out
10611 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10612 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
10613 results of LDAP lookups.
10614 </para>
10615 </section>
10616 <section id="SECTnisplus">
10617 <title>More about NIS+</title>
10618 <para>
10619 <indexterm role="concept">
10620 <primary>NIS+ lookup type</primary>
10621 </indexterm>
10622 <indexterm role="concept">
10623 <primary>lookup</primary>
10624 <secondary>NIS+</secondary>
10625 </indexterm>
10626 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10627 and field name. If this is given, the result of a successful query is the
10628 contents of the named field; otherwise the result consists of a concatenation
10629 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10630 values containing spaces are quoted. For example, the query
10631 </para>
10632 <literallayout class="monospaced">
10633 [name=mg1456],passwd.org_dir
10634 </literallayout>
10635 <para>
10636 might return the string
10637 </para>
10638 <literallayout class="monospaced">
10639 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10640 home=/home/mg1456 shell=/bin/bash shadow=""
10641 </literallayout>
10642 <para>
10643 (split over two lines here to fit on the page), whereas
10644 </para>
10645 <literallayout class="monospaced">
10646 [name=mg1456],passwd.org_dir:gcos
10647 </literallayout>
10648 <para>
10649 would just return
10650 </para>
10651 <literallayout class="monospaced">
10652 Martin Guerre
10653 </literallayout>
10654 <para>
10655 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10656 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10657 operator is to double any quote characters within the text.
10658 </para>
10659 </section>
10660 <section id="SECTsql">
10661 <title>SQL lookups</title>
10662 <para>
10663 <indexterm role="concept">
10664 <primary>SQL lookup types</primary>
10665 </indexterm>
10666 <indexterm role="concept">
10667 <primary>MySQL</primary>
10668 <secondary>lookup type</secondary>
10669 </indexterm>
10670 <indexterm role="concept">
10671 <primary>PostgreSQL lookup type</primary>
10672 </indexterm>
10673 <indexterm role="concept">
10674 <primary>lookup</primary>
10675 <secondary>MySQL</secondary>
10676 </indexterm>
10677 <indexterm role="concept">
10678 <primary>lookup</primary>
10679 <secondary>PostgreSQL</secondary>
10680 </indexterm>
10681 <indexterm role="concept">
10682 <primary>Oracle</primary>
10683 <secondary>lookup type</secondary>
10684 </indexterm>
10685 <indexterm role="concept">
10686 <primary>lookup</primary>
10687 <secondary>Oracle</secondary>
10688 </indexterm>
10689 <indexterm role="concept">
10690 <primary>InterBase lookup type</primary>
10691 </indexterm>
10692 <indexterm role="concept">
10693 <primary>lookup</primary>
10694 <secondary>InterBase</secondary>
10695 </indexterm>
10696 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10697 databases. Queries for these databases contain SQL statements, so an example
10698 might be
10699 </para>
10700 <literallayout class="monospaced">
10701 ${lookup mysql{select mailbox from users where id='userx'}\
10702   {$value}fail}
10703 </literallayout>
10704 <para>
10705 If the result of the query contains more than one field, the data for each
10706 field in the row is returned, preceded by its name, so the result of
10707 </para>
10708 <literallayout class="monospaced">
10709 ${lookup pgsql{select home,name from users where id='userx'}\
10710   {$value}}
10711 </literallayout>
10712 <para>
10713 might be
10714 </para>
10715 <literallayout class="monospaced">
10716 home=/home/userx name="Mister X"
10717 </literallayout>
10718 <para>
10719 Empty values and values containing spaces are double quoted, with embedded
10720 quotes escaped by a backslash. If the result of the query contains just one
10721 field, the value is passed back verbatim, without a field name, for example:
10722 </para>
10723 <literallayout class="monospaced">
10724 Mister X
10725 </literallayout>
10726 <para>
10727 If the result of the query yields more than one row, it is all concatenated,
10728 with a newline between the data for each row.
10729 </para>
10730 </section>
10731 <section id="SECID72">
10732 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10733 <para>
10734 <indexterm role="concept">
10735 <primary>MySQL</primary>
10736 <secondary>lookup type</secondary>
10737 </indexterm>
10738 <indexterm role="concept">
10739 <primary>PostgreSQL lookup type</primary>
10740 </indexterm>
10741 <indexterm role="concept">
10742 <primary>lookup</primary>
10743 <secondary>MySQL</secondary>
10744 </indexterm>
10745 <indexterm role="concept">
10746 <primary>lookup</primary>
10747 <secondary>PostgreSQL</secondary>
10748 </indexterm>
10749 <indexterm role="concept">
10750 <primary>Oracle</primary>
10751 <secondary>lookup type</secondary>
10752 </indexterm>
10753 <indexterm role="concept">
10754 <primary>lookup</primary>
10755 <secondary>Oracle</secondary>
10756 </indexterm>
10757 <indexterm role="concept">
10758 <primary>InterBase lookup type</primary>
10759 </indexterm>
10760 <indexterm role="concept">
10761 <primary>lookup</primary>
10762 <secondary>InterBase</secondary>
10763 </indexterm>
10764 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10765 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10766 option (as appropriate) must be set to a colon-separated list of server
10767 information.
10768 <phrase revisionflag="changed">(For MySQL and PostgreSQL only, the global option need not be set if all
10769 queries contain their own server information &ndash; see section
10770 <xref linkend="SECTspeserque"/>.)</phrase> Each item in the list is a slash-separated list of four
10771 items: host name, database name, user name, and password. In the case of
10772 Oracle, the host name field is used for the <quote>service name</quote>, and the database
10773 name field is not used and should be empty. For example:
10774 </para>
10775 <literallayout class="monospaced">
10776 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10777 </literallayout>
10778 <para>
10779 Because password data is sensitive, you should always precede the setting with
10780 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10781 option. Here is an example where two MySQL servers are listed:
10782 </para>
10783 <literallayout class="monospaced">
10784 hide mysql_servers = localhost/users/root/secret:\
10785                      otherhost/users/root/othersecret
10786 </literallayout>
10787 <para revisionflag="changed">
10788 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
10789 because this is a colon-separated list, the colon has to be doubled. For each
10790 query, these parameter groups are tried in order until a connection is made and
10791 a query is successfully processed. The result of a query may be that no data is
10792 found, but that is still a successful query. In other words, the list of
10793 servers provides a backup facility, not a list of different places to look.
10794 </para>
10795 <para>
10796 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10797 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10798 respectively, and the characters single-quote, double-quote, and backslash
10799 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10800 addition, escapes the percent and underscore characters. This cannot be done
10801 for MySQL because these escapes are not recognized in contexts where these
10802 characters are not special.
10803 </para>
10804 </section>
10805 <section id="SECTspeserque" revisionflag="changed">
10806 <title>Specifying the server in the query</title>
10807 <para revisionflag="changed">
10808 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
10809 it is possible to specify a list of servers with an individual query. This is
10810 done by starting the query with
10811 </para>
10812 <literallayout revisionflag="changed">
10813 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
10814 </literallayout>
10815 <para revisionflag="changed">
10816 Each item in the list may take one of two forms:
10817 </para>
10818 <orderedlist numeration="arabic" revisionflag="changed">
10819 <listitem>
10820 <para revisionflag="changed">
10821 If it contains no slashes it is assumed to be just a host name. The appropriate
10822 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
10823 of the same name, and the remaining parameters (database, user, password) are
10824 taken from there.
10825 </para>
10826 </listitem>
10827 <listitem>
10828 <para revisionflag="changed">
10829 If it contains any slashes, it is taken as a complete parameter set.
10830 </para>
10831 </listitem>
10832 </orderedlist>
10833 <para revisionflag="changed">
10834 The list of servers is used in exactly the same way as the global list.
10835 Once a connection to a server has happened and a query has been
10836 successfully executed, processing of the lookup ceases.
10837 </para>
10838 <para revisionflag="changed">
10839 This feature is intended for use in master/slave situations where updates
10840 are occurring and you want to update the master rather than a slave. If the
10841 master is in the list as a backup for reading, you might have a global setting
10842 like this:
10843 </para>
10844 <literallayout class="monospaced" revisionflag="changed">
10845 mysql_servers = slave1/db/name/pw:\
10846                 slave2/db/name/pw:\
10847                 master/db/name/pw
10848 </literallayout>
10849 <para revisionflag="changed">
10850 In an updating lookup, you could then write:
10851 </para>
10852 <literallayout class="monospaced" revisionflag="changed">
10853 ${lookup mysql{servers=master; UPDATE ...}
10854 </literallayout>
10855 <para revisionflag="changed">
10856 That query would then be sent only to the master server. If, on the other hand,
10857 the master is not to be used for reading, and so is not present in the global
10858 option, you can still update it by a query of this form:
10859 </para>
10860 <literallayout class="monospaced" revisionflag="changed">
10861 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...}
10862 </literallayout>
10863 </section>
10864 <section id="SECID73">
10865 <title>Special MySQL features</title>
10866 <para>
10867 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10868 causes a connection to the server on the local host by means of a Unix domain
10869 socket. An alternate socket can be specified in parentheses. The full syntax of
10870 each item in <option>mysql_servers</option> is:
10871 </para>
10872 <literallayout>
10873 &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;
10874 </literallayout>
10875 <para>
10876 Any of the three sub-parts of the first field can be omitted. For normal use on
10877 the local host it can be left blank or set to just <quote>localhost</quote>.
10878 </para>
10879 <para>
10880 No database need be supplied &ndash; but if it is absent here, it must be given in
10881 the queries.
10882 </para>
10883 <para>
10884 If a MySQL query is issued that does not request any data (an insert, update,
10885 or delete command), the result of the lookup is the number of rows affected.
10886 </para>
10887 <para>
10888 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10889 anything (for example, setting a field to the value it already has), the result
10890 is zero because no rows are affected.
10891 </para>
10892 </section>
10893 <section id="SECID74">
10894 <title>Special PostgreSQL features</title>
10895 <para>
10896 PostgreSQL lookups can also use Unix domain socket connections to the database.
10897 This is usually faster and costs less CPU time than a TCP/IP connection.
10898 However it can be used only if the mail server runs on the same machine as the
10899 database server. A configuration line for PostgreSQL via Unix domain sockets
10900 looks like this:
10901 </para>
10902 <literallayout class="monospaced">
10903 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10904 </literallayout>
10905 <para>
10906 In other words, instead of supplying a host name, a path to the socket is
10907 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
10908 visually confused with the delimiters for the other server parameters.
10909 </para>
10910 <para>
10911 If a PostgreSQL query is issued that does not request any data (an insert,
10912 update, or delete command), the result of the lookup is the number of rows
10913 affected.
10914 </para>
10915 </section>
10916 <section id="SECTsqlite">
10917 <title>More about SQLite</title>
10918 <para>
10919 <indexterm role="concept">
10920 <primary>lookup</primary>
10921 <secondary>SQLite</secondary>
10922 </indexterm>
10923 <indexterm role="concept">
10924 <primary>sqlite lookup type</primary>
10925 </indexterm>
10926 SQLite is different to the other SQL lookups because a file name is required in
10927 addition to the SQL query. An SQLite database is a single file, and there is no
10928 daemon as in the other SQL databases. The interface to Exim requires the name
10929 of the file, as an absolute path, to be given at the start of the query. It is
10930 separated from the query by white space. This means that the path name cannot
10931 contain white space. Here is a lookup expansion example:
10932 </para>
10933 <literallayout class="monospaced">
10934 ${lookup sqlite {/some/thing/sqlitedb \
10935   select name from aliases where id='userx';}}
10936 </literallayout>
10937 <para>
10938 In a list, the syntax is similar. For example:
10939 </para>
10940 <literallayout class="monospaced">
10941 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10942    select * from relays where ip='$sender_host_address';
10943 </literallayout>
10944 <para>
10945 The only character affected by the <option>quote_sqlite</option> operator is a single
10946 quote, which it doubles.
10947 </para>
10948 <para>
10949 The SQLite library handles multiple simultaneous accesses to the database
10950 internally. Multiple readers are permitted, but only one process can
10951 update at once. Attempts to access the database while it is being updated
10952 are rejected after a timeout period, during which the SQLite library
10953 waits for the lock to be released. In Exim, the default timeout is set
10954 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10955 option.
10956 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10957 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10958 </para>
10959 </section>
10960 </chapter>
10961
10962 <chapter id="CHAPdomhosaddlists">
10963 <title>Domain, host, address, and local part lists</title>
10964 <titleabbrev>Domain, host, and address lists</titleabbrev>
10965 <para>
10966 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10967 <primary>lists of domains; hosts; etc.</primary>
10968 </indexterm>
10969 A number of Exim configuration options contain lists of domains, hosts,
10970 email addresses, or local parts. For example, the <option>hold_domains</option> option
10971 contains a list of domains whose delivery is currently suspended. These lists
10972 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10973 arguments to expansion conditions such as <option>match_domain</option>.
10974 </para>
10975 <para>
10976 Each item in one of these lists is a pattern to be matched against a domain,
10977 host, email address, or local part, respectively. In the sections below, the
10978 different types of pattern for each case are described, but first we cover some
10979 general facilities that apply to all four kinds of list.
10980 </para>
10981 <section id="SECID75">
10982 <title>Expansion of lists</title>
10983 <para>
10984 <indexterm role="concept">
10985 <primary>expansion</primary>
10986 <secondary>of lists</secondary>
10987 </indexterm>
10988 Each list is expanded as a single string before it is used. The result of
10989 expansion must be a list, possibly containing empty items, which is split up
10990 into separate items for matching. By default, colon is the separator character,
10991 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10992 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10993 discusses the way to specify empty list items.
10994 </para>
10995 <para>
10996 If the string expansion is forced to fail, Exim behaves as if the item it is
10997 testing (domain, host, address, or local part) is not in the list. Other
10998 expansion failures cause temporary errors.
10999 </para>
11000 <para>
11001 If an item in a list is a regular expression, backslashes, dollars and possibly
11002 other special characters in the expression must be protected against
11003 misinterpretation by the string expander. The easiest way to do this is to use
11004 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11005 expression should not be expanded. For example, in an ACL you might have:
11006 </para>
11007 <literallayout class="monospaced">
11008 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11009                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11010 </literallayout>
11011 <para>
11012 The first item is a regular expression that is protected from expansion by
11013 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11014 senders based on the receiving domain.
11015 </para>
11016 </section>
11017 <section id="SECID76">
11018 <title>Negated items in lists</title>
11019 <para>
11020 <indexterm role="concept">
11021 <primary>list</primary>
11022 <secondary>negation</secondary>
11023 </indexterm>
11024 <indexterm role="concept">
11025 <primary>negation</primary>
11026 <secondary>in lists</secondary>
11027 </indexterm>
11028 Items in a list may be positive or negative. Negative items are indicated by a
11029 leading exclamation mark, which may be followed by optional white space. A list
11030 defines a set of items (domains, etc). When Exim processes one of these lists,
11031 it is trying to find out whether a domain, host, address, or local part
11032 (respectively) is in the set that is defined by the list. It works like this:
11033 </para>
11034 <para>
11035 The list is scanned from left to right. If a positive item is matched, the
11036 subject that is being checked is in the set; if a negative item is matched, the
11037 subject is not in the set. If the end of the list is reached without the
11038 subject having matched any of the patterns, it is in the set if the last item
11039 was a negative one, but not if it was a positive one. For example, the list in
11040 </para>
11041 <literallayout class="monospaced">
11042 domainlist relay_domains = !a.b.c : *.b.c
11043 </literallayout>
11044 <para>
11045 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11046 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11047 list is positive. However, if the setting were
11048 </para>
11049 <literallayout class="monospaced">
11050 domainlist relay_domains = !a.b.c
11051 </literallayout>
11052 <para>
11053 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11054 list is negative. In other words, a list that ends with a negative item behaves
11055 as if it had an extra item <literal>:*</literal> on the end.
11056 </para>
11057 <para>
11058 Another way of thinking about positive and negative items in lists is to read
11059 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11060 item.
11061 </para>
11062 </section>
11063 <section id="SECTfilnamlis">
11064 <title>File names in lists</title>
11065 <para>
11066 <indexterm role="concept">
11067 <primary>list</primary>
11068 <secondary>file name in</secondary>
11069 </indexterm>
11070 If an item in a domain, host, address, or local part list is an absolute file
11071 name (beginning with a slash character), each line of the file is read and
11072 processed as if it were an independent item in the list, except that further
11073 file names are not allowed,
11074 and no expansion of the data from the file takes place.
11075 Empty lines in the file are ignored, and the file may also contain comment
11076 lines:
11077 </para>
11078 <itemizedlist>
11079 <listitem>
11080 <para>
11081 For domain and host lists, if a # character appears anywhere in a line of the
11082 file, it and all following characters are ignored.
11083 </para>
11084 </listitem>
11085 <listitem>
11086 <para>
11087 Because local parts may legitimately contain # characters, a comment in an
11088 address list or local part list file is recognized only if # is preceded by
11089 white space or the start of the line. For example:
11090 </para>
11091 <literallayout class="monospaced">
11092 not#comment@x.y.z   # but this is a comment
11093 </literallayout>
11094 </listitem>
11095 </itemizedlist>
11096 <para>
11097 Putting a file name in a list has the same effect as inserting each line of the
11098 file as an item in the list (blank lines and comments excepted). However, there
11099 is one important difference: the file is read each time the list is processed,
11100 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11101 </para>
11102 <para>
11103 If a file name is preceded by an exclamation mark, the sense of any match
11104 within the file is inverted. For example, if
11105 </para>
11106 <literallayout class="monospaced">
11107 hold_domains = !/etc/nohold-domains
11108 </literallayout>
11109 <para>
11110 and the file contains the lines
11111 </para>
11112 <literallayout class="monospaced">
11113 !a.b.c
11114 *.b.c
11115 </literallayout>
11116 <para>
11117 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11118 any domain matching <literal>*.b.c</literal> is not.
11119 </para>
11120 </section>
11121 <section id="SECID77">
11122 <title>An lsearch file is not an out-of-line list</title>
11123 <para>
11124 As will be described in the sections that follow, lookups can be used in lists
11125 to provide indexed methods of checking list membership. There has been some
11126 confusion about the way <command>lsearch</command> lookups work in lists. Because
11127 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11128 sometimes thought that it is allowed to contain wild cards and other kinds of
11129 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11130 always fixed strings, just as for any other single-key lookup type.
11131 </para>
11132 <para>
11133 If you want to use a file to contain wild-card patterns that form part of a
11134 list, just give the file name on its own, without a search type, as described
11135 in the previous section. You could also use the <command>wildlsearch</command> or
11136 <command>nwildlsearch</command>, but there is no advantage in doing this.
11137 </para>
11138 </section>
11139 <section id="SECTnamedlists">
11140 <title>Named lists</title>
11141 <para>
11142 <indexterm role="concept">
11143 <primary>named lists</primary>
11144 </indexterm>
11145 <indexterm role="concept">
11146 <primary>list</primary>
11147 <secondary>named</secondary>
11148 </indexterm>
11149 A list of domains, hosts, email addresses, or local parts can be given a name
11150 which is then used to refer to the list elsewhere in the configuration. This is
11151 particularly convenient if the same list is required in several different
11152 places. It also allows lists to be given meaningful names, which can improve
11153 the readability of the configuration. For example, it is conventional to define
11154 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11155 locally on a host, using a configuration line such as
11156 </para>
11157 <literallayout class="monospaced">
11158 domainlist local_domains = localhost:my.dom.example
11159 </literallayout>
11160 <para>
11161 Named lists are referenced by giving their name preceded by a plus sign, so,
11162 for example, a router that is intended to handle local domains would be
11163 configured with the line
11164 </para>
11165 <literallayout class="monospaced">
11166 domains = +local_domains
11167 </literallayout>
11168 <para>
11169 The first router in a configuration is often one that handles all domains
11170 except the local ones, using a configuration with a negated item like this:
11171 </para>
11172 <literallayout class="monospaced">
11173 dnslookup:
11174   driver = dnslookup
11175   domains = ! +local_domains
11176   transport = remote_smtp
11177   no_more
11178 </literallayout>
11179 <para>
11180 The four kinds of named list are created by configuration lines starting with
11181 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11182 respectively. Then there follows the name that you are defining, followed by an
11183 equals sign and the list itself. For example:
11184 </para>
11185 <literallayout class="monospaced">
11186 hostlist    relay_hosts = 192.168.23.0/24 : my.friend.example
11187 addresslist bad_senders = cdb;/etc/badsenders
11188 </literallayout>
11189 <para>
11190 A named list may refer to other named lists:
11191 </para>
11192 <literallayout class="monospaced">
11193 domainlist  dom1 = first.example : second.example
11194 domainlist  dom2 = +dom1 : third.example
11195 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11196 </literallayout>
11197 <para>
11198 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11199 effect may not be what you intended, because the negation does not propagate
11200 out to the higher level. For example, consider:
11201 </para>
11202 <literallayout class="monospaced">
11203 domainlist  dom1 = !a.b
11204 domainlist  dom2 = +dom1 : *.b
11205 </literallayout>
11206 <para>
11207 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11208 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11209 means it matches the second list as well. The effect is not the same as
11210 </para>
11211 <literallayout class="monospaced">
11212 domainlist  dom2 = !a.b : *.b
11213 </literallayout>
11214 <para>
11215 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11216 referenced lists if you can.
11217 </para>
11218 <para>
11219 Named lists may have a performance advantage. When Exim is routing an
11220 address or checking an incoming message, it caches the result of tests on named
11221 lists. So, if you have a setting such as
11222 </para>
11223 <literallayout class="monospaced">
11224 domains = +local_domains
11225 </literallayout>
11226 <para>
11227 on several of your routers
11228 or in several ACL statements,
11229 the actual test is done only for the first one. However, the caching works only
11230 if there are no expansions within the list itself or any sublists that it
11231 references. In other words, caching happens only for lists that are known to be
11232 the same each time they are referenced.
11233 </para>
11234 <para>
11235 By default, there may be up to 16 named lists of each type. This limit can be
11236 extended by changing a compile-time variable. The use of domain and host lists
11237 is recommended for concepts such as local domains, relay domains, and relay
11238 hosts. The default configuration is set up like this.
11239 </para>
11240 </section>
11241 <section id="SECID78">
11242 <title>Named lists compared with macros</title>
11243 <para>
11244 <indexterm role="concept">
11245 <primary>list</primary>
11246 <secondary>named compared with macro</secondary>
11247 </indexterm>
11248 <indexterm role="concept">
11249 <primary>macro</primary>
11250 <secondary>compared with named list</secondary>
11251 </indexterm>
11252 At first sight, named lists might seem to be no different from macros in the
11253 configuration file. However, macros are just textual substitutions. If you
11254 write
11255 </para>
11256 <literallayout class="monospaced">
11257 ALIST = host1 : host2
11258 auth_advertise_hosts = !ALIST
11259 </literallayout>
11260 <para>
11261 it probably won&#x2019;t do what you want, because that is exactly the same as
11262 </para>
11263 <literallayout class="monospaced">
11264 auth_advertise_hosts = !host1 : host2
11265 </literallayout>
11266 <para>
11267 Notice that the second host name is not negated. However, if you use a host
11268 list, and write
11269 </para>
11270 <literallayout class="monospaced">
11271 hostlist alist = host1 : host2
11272 auth_advertise_hosts = ! +alist
11273 </literallayout>
11274 <para>
11275 the negation applies to the whole list, and so that is equivalent to
11276 </para>
11277 <literallayout class="monospaced">
11278 auth_advertise_hosts = !host1 : !host2
11279 </literallayout>
11280 </section>
11281 <section id="SECID79">
11282 <title>Named list caching</title>
11283 <para>
11284 <indexterm role="concept">
11285 <primary>list</primary>
11286 <secondary>caching of named</secondary>
11287 </indexterm>
11288 <indexterm role="concept">
11289 <primary>caching</primary>
11290 <secondary>named lists</secondary>
11291 </indexterm>
11292 While processing a message, Exim caches the result of checking a named list if
11293 it is sure that the list is the same each time. In practice, this means that
11294 the cache operates only if the list contains no $ characters, which guarantees
11295 that it will not change when it is expanded. Sometimes, however, you may have
11296 an expanded list that you know will be the same each time within a given
11297 message. For example:
11298 </para>
11299 <literallayout class="monospaced">
11300 domainlist special_domains = \
11301            ${lookup{$sender_host_address}cdb{/some/file}}
11302 </literallayout>
11303 <para>
11304 This provides a list of domains that depends only on the sending host&#x2019;s IP
11305 address. If this domain list is referenced a number of times (for example,
11306 in several ACL lines, or in several routers) the result of the check is not
11307 cached by default, because Exim does not know that it is going to be the
11308 same list each time.
11309 </para>
11310 <para>
11311 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11312 cache the result anyway. For example:
11313 </para>
11314 <literallayout class="monospaced">
11315 domainlist_cache special_domains = ${lookup{...
11316 </literallayout>
11317 <para>
11318 If you do this, you should be absolutely sure that caching is going to do
11319 the right thing in all cases. When in doubt, leave it out.
11320 </para>
11321 </section>
11322 <section id="SECTdomainlist">
11323 <title>Domain lists</title>
11324 <para>
11325 <indexterm role="concept">
11326 <primary>domain list</primary>
11327 <secondary>patterns for</secondary>
11328 </indexterm>
11329 <indexterm role="concept">
11330 <primary>list</primary>
11331 <secondary>domain list</secondary>
11332 </indexterm>
11333 Domain lists contain patterns that are to be matched against a mail domain.
11334 The following types of item may appear in domain lists:
11335 </para>
11336 <itemizedlist>
11337 <listitem>
11338 <para>
11339 <indexterm role="concept">
11340 <primary>primary host name</primary>
11341 </indexterm>
11342 <indexterm role="concept">
11343 <primary>host name</primary>
11344 <secondary>matched in domain list</secondary>
11345 </indexterm>
11346 <indexterm role="option">
11347 <primary><option>primary_hostname</option></primary>
11348 </indexterm>
11349 <indexterm role="concept">
11350 <primary>domain list</primary>
11351 <secondary>matching primary host name</secondary>
11352 </indexterm>
11353 <indexterm role="concept">
11354 <primary>@ in a domain list</primary>
11355 </indexterm>
11356 If a pattern consists of a single @ character, it matches the local host name,
11357 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11358 possible to use the same configuration file on several different hosts that
11359 differ only in their names.
11360 </para>
11361 </listitem>
11362 <listitem>
11363 <para revisionflag="changed">
11364 <indexterm role="concept">
11365 <primary>@[] in a domain list</primary>
11366 </indexterm>
11367 <indexterm role="concept">
11368 <primary>domain list</primary>
11369 <secondary>matching local IP interfaces</secondary>
11370 </indexterm>
11371 <indexterm role="concept">
11372 <primary>domain literal</primary>
11373 </indexterm>
11374 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11375 in square brackets (as in an email address that contains a domain literal), but
11376 only if that IP address is recognized as local for email routing purposes. The
11377 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11378 control which of a host&#x2019;s several IP addresses are treated as local.
11379 In today&#x2019;s Internet, the use of domain literals is controversial.
11380 </para>
11381 </listitem>
11382 <listitem>
11383 <para>
11384 <indexterm role="concept">
11385 <primary>@mx_any</primary>
11386 </indexterm>
11387 <indexterm role="concept">
11388 <primary>@mx_primary</primary>
11389 </indexterm>
11390 <indexterm role="concept">
11391 <primary>@mx_secondary</primary>
11392 </indexterm>
11393 <indexterm role="concept">
11394 <primary>domain list</primary>
11395 <secondary>matching MX pointers to local host</secondary>
11396 </indexterm>
11397 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11398 has an MX record pointing to the local host or to any host that is listed in
11399 <indexterm role="option">
11400 <primary><option>hosts_treat_as_local</option></primary>
11401 </indexterm>
11402 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11403 are similar, except that the first matches only when a primary MX target is the
11404 local host, and the second only when no primary MX target is the local host,
11405 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11406 preference value &ndash; there may of course be more than one of them.
11407 </para>
11408 <para>
11409 The MX lookup that takes place when matching a pattern of this type is
11410 performed with the resolver options for widening names turned off. Thus, for
11411 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11412 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11413 options of the <command>dnslookup</command> router for a discussion of domain widening.
11414 </para>
11415 <para>
11416 Sometimes you may want to ignore certain IP addresses when using one of these
11417 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11418 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11419 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11420 on a router). For example:
11421 </para>
11422 <literallayout class="monospaced">
11423 domains = @mx_any/ignore=127.0.0.1
11424 </literallayout>
11425 <para>
11426 This example matches any domain that has an MX record pointing to one of
11427 the local host&#x2019;s IP addresses other than 127.0.0.1.
11428 </para>
11429 <para>
11430 The list of IP addresses is in fact processed by the same code that processes
11431 host lists, so it may contain CIDR-coded network specifications and it may also
11432 contain negative items.
11433 </para>
11434 <para>
11435 Because the list of IP addresses is a sublist within a domain list, you have to
11436 be careful about delimiters if there is more than one address. Like any other
11437 list, the default delimiter can be changed. Thus, you might have:
11438 </para>
11439 <literallayout class="monospaced">
11440 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11441           an.other.domain : ...
11442 </literallayout>
11443 <para>
11444 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11445 involved, it is easiest to change the delimiter for the main list as well:
11446 </para>
11447 <literallayout class="monospaced">
11448 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11449           an.other.domain ? ...
11450 </literallayout>
11451 </listitem>
11452 <listitem>
11453 <para>
11454 <indexterm role="concept">
11455 <primary>asterisk</primary>
11456 <secondary>in domain list</secondary>
11457 </indexterm>
11458 <indexterm role="concept">
11459 <primary>domain list</primary>
11460 <secondary>asterisk in</secondary>
11461 </indexterm>
11462 <indexterm role="concept">
11463 <primary>domain list</primary>
11464 <secondary>matching <quote>ends with</quote></secondary>
11465 </indexterm>
11466 If a pattern starts with an asterisk, the remaining characters of the pattern
11467 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11468 domain lists differs from its use in partial matching lookups. In a domain
11469 list, the character following the asterisk need not be a dot, whereas partial
11470 matching works only in terms of dot-separated components. For example, a domain
11471 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11472 <emphasis>cipher.key.ex</emphasis>.
11473 </para>
11474 </listitem>
11475 <listitem>
11476 <para revisionflag="changed">
11477 <indexterm role="concept">
11478 <primary>regular expressions</primary>
11479 <secondary>in domain list</secondary>
11480 </indexterm>
11481 <indexterm role="concept">
11482 <primary>domain list</primary>
11483 <secondary>matching regular expression</secondary>
11484 </indexterm>
11485 If a pattern starts with a circumflex character, it is treated as a regular
11486 expression, and matched against the domain using a regular expression matching
11487 function. The circumflex is treated as part of the regular expression.
11488 Email domains are case-independent, so this regular expression match is by
11489 default case-independent, but you can make it case-dependent by starting it
11490 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11491 are given in chapter <xref linkend="CHAPregexp"/>.
11492 </para>
11493 <para>
11494 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11495 must escape any backslash and dollar characters in the regular expression, or
11496 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11497 it is not to be expanded (unless you really do want to build a regular
11498 expression by expansion, of course).
11499 </para>
11500 </listitem>
11501 <listitem>
11502 <para>
11503 <indexterm role="concept">
11504 <primary>lookup</primary>
11505 <secondary>in domain list</secondary>
11506 </indexterm>
11507 <indexterm role="concept">
11508 <primary>domain list</primary>
11509 <secondary>matching by lookup</secondary>
11510 </indexterm>
11511 If a pattern starts with the name of a single-key lookup type followed by a
11512 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11513 must be a file name in a suitable format for the lookup type. For example, for
11514 <quote>cdb;</quote> it must be an absolute path:
11515 </para>
11516 <literallayout class="monospaced">
11517 domains = cdb;/etc/mail/local_domains.cdb
11518 </literallayout>
11519 <para>
11520 The appropriate type of lookup is done on the file using the domain name as the
11521 key. In most cases, the data that is looked up is not used; Exim is interested
11522 only in whether or not the key is present in the file. However, when a lookup
11523 is used for the <option>domains</option> option on a router
11524 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11525 <varname>$domain_data</varname> variable and can be referred to in other router options or
11526 other statements in the same ACL.
11527 </para>
11528 </listitem>
11529 <listitem>
11530 <para>
11531 Any of the single-key lookup type names may be preceded by
11532 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11533 </para>
11534 <literallayout class="monospaced">
11535 domains = partial-dbm;/partial/domains
11536 </literallayout>
11537 <para>
11538 This causes partial matching logic to be invoked; a description of how this
11539 works is given in section <xref linkend="SECTpartiallookup"/>.
11540 </para>
11541 </listitem>
11542 <listitem>
11543 <para>
11544 <indexterm role="concept">
11545 <primary>asterisk</primary>
11546 <secondary>in lookup type</secondary>
11547 </indexterm>
11548 Any of the single-key lookup types may be followed by an asterisk. This causes
11549 a default lookup for a key consisting of a single asterisk to be done if the
11550 original lookup fails. This is not a useful feature when using a domain list to
11551 select particular domains (because any domain would match), but it might have
11552 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11553 expansion variable.
11554 </para>
11555 </listitem>
11556 <listitem>
11557 <para>
11558 If the pattern starts with the name of a query-style lookup type followed by a
11559 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11560 pattern must be an appropriate query for the lookup type, as described in
11561 chapter <xref linkend="CHAPfdlookup"/>. For example:
11562 </para>
11563 <literallayout class="monospaced">
11564 hold_domains = mysql;select domain from holdlist \
11565   where domain = '$domain';
11566 </literallayout>
11567 <para>
11568 In most cases, the data that is looked up is not used (so for an SQL query, for
11569 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11570 whether or not the query succeeds. However, when a lookup is used for the
11571 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11572 variable and can be referred to in other options.
11573 </para>
11574 </listitem>
11575 <listitem>
11576 <para>
11577 <indexterm role="concept">
11578 <primary>domain list</primary>
11579 <secondary>matching literal domain name</secondary>
11580 </indexterm>
11581 If none of the above cases apply, a caseless textual comparison is made
11582 between the pattern and the domain.
11583 </para>
11584 </listitem>
11585 </itemizedlist>
11586 <para>
11587 Here is an example that uses several different kinds of pattern:
11588 </para>
11589 <literallayout class="monospaced">
11590 domainlist funny_domains = \
11591   @ : \
11592   lib.unseen.edu : \
11593   *.foundation.fict.example : \
11594   \N^[1-2]\d{3}\.fict\.example$\N : \
11595   partial-dbm;/opt/data/penguin/book : \
11596   nis;domains.byname : \
11597   nisplus;[name=$domain,status=local],domains.org_dir
11598 </literallayout>
11599 <para>
11600 There are obvious processing trade-offs among the various matching modes. Using
11601 an asterisk is faster than a regular expression, and listing a few names
11602 explicitly probably is too. The use of a file or database lookup is expensive,
11603 but may be the only option if hundreds of names are required. Because the
11604 patterns are tested in order, it makes sense to put the most commonly matched
11605 patterns earlier.
11606 </para>
11607 </section>
11608 <section id="SECThostlist">
11609 <title>Host lists</title>
11610 <para>
11611 <indexterm role="concept">
11612 <primary>host list</primary>
11613 <secondary>patterns in</secondary>
11614 </indexterm>
11615 <indexterm role="concept">
11616 <primary>list</primary>
11617 <secondary>host list</secondary>
11618 </indexterm>
11619 Host lists are used to control what remote hosts are allowed to do. For
11620 example, some hosts may be allowed to use the local host as a relay, and some
11621 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11622 two different ways, by name or by IP address. In a host list, some types of
11623 pattern are matched to a host name, and some are matched to an IP address.
11624 You need to be particularly careful with this when single-key lookups are
11625 involved, to ensure that the right value is being used as the key.
11626 </para>
11627 </section>
11628 <section id="SECID80">
11629 <title>Special host list patterns</title>
11630 <para>
11631 <indexterm role="concept">
11632 <primary>empty item in hosts list</primary>
11633 </indexterm>
11634 <indexterm role="concept">
11635 <primary>host list</primary>
11636 <secondary>empty string in</secondary>
11637 </indexterm>
11638 If a host list item is the empty string, it matches only when no remote host is
11639 involved. This is the case when a message is being received from a local
11640 process using SMTP on the standard input, that is, when a TCP/IP connection is
11641 not used.
11642 </para>
11643 <para>
11644 <indexterm role="concept">
11645 <primary>asterisk</primary>
11646 <secondary>in host list</secondary>
11647 </indexterm>
11648 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11649 the IP address nor the name is actually inspected.
11650 </para>
11651 </section>
11652 <section id="SECThoslispatip">
11653 <title>Host list patterns that match by IP address</title>
11654 <para>
11655 <indexterm role="concept">
11656 <primary>host list</primary>
11657 <secondary>matching IP addresses</secondary>
11658 </indexterm>
11659 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11660 the incoming address actually appears in the IPv6 host as
11661 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
11662 list, it is converted into a traditional IPv4 address first. (Not all operating
11663 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11664 concerns.)
11665 </para>
11666 <para>
11667 The following types of pattern in a host list check the remote host by
11668 inspecting its IP address:
11669 </para>
11670 <itemizedlist>
11671 <listitem>
11672 <para>
11673 If the pattern is a plain domain name (not a regular expression, not starting
11674 with *, not a lookup of any kind), Exim calls the operating system function
11675 to find the associated IP address(es). Exim uses the newer
11676 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11677 This typically causes a forward DNS lookup of the name. The result is compared
11678 with the IP address of the subject host.
11679 </para>
11680 <para>
11681 If there is a temporary problem (such as a DNS timeout) with the host name
11682 lookup, a temporary error occurs. For example, if the list is being used in an
11683 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11684 temporary SMTP error code. If no IP address can be found for the host name,
11685 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11686 </para>
11687 </listitem>
11688 <listitem>
11689 <para>
11690 <indexterm role="concept">
11691 <primary>@ in a host list</primary>
11692 </indexterm>
11693 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11694 domain name, as just described.
11695 </para>
11696 </listitem>
11697 <listitem>
11698 <para>
11699 If the pattern is an IP address, it is matched against the IP address of the
11700 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11701 IPv6 addresses can be given in colon-separated format, but the colons have to
11702 be doubled so as not to be taken as item separators when the default list
11703 separator is used. IPv6 addresses are recognized even when Exim is compiled
11704 without IPv6 support. This means that if they appear in a host list on an
11705 IPv4-only host, Exim will not treat them as host names. They are just addresses
11706 that can never match a client host.
11707 </para>
11708 </listitem>
11709 <listitem>
11710 <para>
11711 <indexterm role="concept">
11712 <primary>@[] in a host list</primary>
11713 </indexterm>
11714 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11715 the local host. For example, if the local host is an IPv4 host with one
11716 interface address 10.45.23.56, these two ACL statements have the same effect:
11717 </para>
11718 <literallayout class="monospaced">
11719 accept hosts = 127.0.0.1 : 10.45.23.56
11720 accept hosts = @[]
11721 </literallayout>
11722 </listitem>
11723 <listitem>
11724 <para>
11725 <indexterm role="concept">
11726 <primary>CIDR notation</primary>
11727 </indexterm>
11728 If the pattern is an IP address followed by a slash and a mask length (for
11729 example 10.11.42.0/24), it is matched against the IP address of the subject
11730 host under the given mask. This allows, an entire network of hosts to be
11731 included (or excluded) by a single item. The mask uses CIDR notation; it
11732 specifies the number of address bits that must match, starting from the most
11733 significant end of the address.
11734 </para>
11735 <para>
11736 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11737 of a range of addresses. It is the number of bits in the network portion of the
11738 address. The above example specifies a 24-bit netmask, so it matches all 256
11739 addresses in the 10.11.42.0 network. An item such as
11740 </para>
11741 <literallayout class="monospaced">
11742 192.168.23.236/31
11743 </literallayout>
11744 <para>
11745 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11746 32 for an IPv4 address is the same as no mask at all; just a single address
11747 matches.
11748 </para>
11749 <para>
11750 Here is another example which shows an IPv4 and an IPv6 network:
11751 </para>
11752 <literallayout class="monospaced">
11753 recipient_unqualified_hosts = 192.168.0.0/16: \
11754                               3ffe::ffff::836f::::/48
11755 </literallayout>
11756 <para>
11757 The doubling of list separator characters applies only when these items
11758 appear inline in a host list. It is not required when indirecting via a file.
11759 For example:
11760 </para>
11761 <literallayout class="monospaced">
11762 recipient_unqualified_hosts = /opt/exim/unqualnets
11763 </literallayout>
11764 <para>
11765 could make use of a file containing
11766 </para>
11767 <literallayout class="monospaced">
11768 172.16.0.0/12
11769 3ffe:ffff:836f::/48
11770 </literallayout>
11771 <para>
11772 to have exactly the same effect as the previous example. When listing IPv6
11773 addresses inline, it is usually more convenient to use the facility for
11774 changing separator characters. This list contains the same two networks:
11775 </para>
11776 <literallayout class="monospaced">
11777 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
11778                                  3ffe:ffff:836f::/48
11779 </literallayout>
11780 <para>
11781 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
11782 list.
11783 </para>
11784 </listitem>
11785 </itemizedlist>
11786 </section>
11787 <section id="SECThoslispatsikey">
11788 <title>Host list patterns for single-key lookups by host address</title>
11789 <para>
11790 <indexterm role="concept">
11791 <primary>host list</primary>
11792 <secondary>lookup of IP address</secondary>
11793 </indexterm>
11794 When a host is to be identified by a single-key lookup of its complete IP
11795 address, the pattern takes this form:
11796 </para>
11797 <literallayout>
11798 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
11799 </literallayout>
11800 <para>
11801 For example:
11802 </para>
11803 <literallayout class="monospaced">
11804 hosts_lookup = net-cdb;/hosts-by-ip.db
11805 </literallayout>
11806 <para>
11807 The text form of the IP address of the subject host is used as the lookup key.
11808 IPv6 addresses are converted to an unabbreviated form, using lower case
11809 letters, with dots as separators because colon is the key terminator in
11810 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11811 quoting the keys, but this is a facility that was added later.] The data
11812 returned by the lookup is not used.
11813 </para>
11814 <para>
11815 <indexterm role="concept">
11816 <primary>IP address</primary>
11817 <secondary>masking</secondary>
11818 </indexterm>
11819 <indexterm role="concept">
11820 <primary>host list</primary>
11821 <secondary>masked IP address</secondary>
11822 </indexterm>
11823 Single-key lookups can also be performed using masked IP addresses, using
11824 patterns of this form:
11825 </para>
11826 <literallayout>
11827 <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>
11828 </literallayout>
11829 <para>
11830 For example:
11831 </para>
11832 <literallayout class="monospaced">
11833 net24-dbm;/networks.db
11834 </literallayout>
11835 <para>
11836 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
11837 length. A textual string is constructed from the masked value, followed by the
11838 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
11839 is 192.168.34.6, the key that is looked up for the above example is
11840 <quote>192.168.34.0/24</quote>.
11841 </para>
11842 <para revisionflag="changed">
11843 When an IPv6 address is converted to a string, dots are normally used instead
11844 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
11845 terminate <command>lsearch</command> keys). This was implemented some time before the ability
11846 to quote keys was made available in <command>lsearch</command> files. However, the more
11847 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
11848 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
11849 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
11850 converted using colons and not dots. In all cases, full, unabbreviated IPv6
11851 addresses are always used.
11852 </para>
11853 <para revisionflag="changed">
11854 Ideally, it would be nice to tidy up this anomalous situation by changing to
11855 colons in all cases, given that quoting is now available for <command>lsearch</command>.
11856 However, this would be an incompatible change that might break some existing
11857 configurations.
11858 </para>
11859 <para>
11860 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11861 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
11862 the former case the key strings include the mask value, whereas in the latter
11863 case the IP address is used on its own.
11864 </para>
11865 </section>
11866 <section id="SECThoslispatnam">
11867 <title>Host list patterns that match by host name</title>
11868 <para>
11869 <indexterm role="concept">
11870 <primary>host</primary>
11871 <secondary>lookup failures</secondary>
11872 </indexterm>
11873 <indexterm role="concept">
11874 <primary>unknown host name</primary>
11875 </indexterm>
11876 <indexterm role="concept">
11877 <primary>host list</primary>
11878 <secondary>matching host name</secondary>
11879 </indexterm>
11880 There are several types of pattern that require Exim to know the name of the
11881 remote host. These are either wildcard patterns or lookups by name. (If a
11882 complete hostname is given without any wildcarding, it is used to find an IP
11883 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11884 above.)
11885 </para>
11886 <para>
11887 If the remote host name is not already known when Exim encounters one of these
11888 patterns, it has to be found from the IP address.
11889 Although many sites on the Internet are conscientious about maintaining reverse
11890 DNS data for their hosts, there are also many that do not do this.
11891 Consequently, a name cannot always be found, and this may lead to unwanted
11892 effects. Take care when configuring host lists with wildcarded name patterns.
11893 Consider what will happen if a name cannot be found.
11894 </para>
11895 <para>
11896 Because of the problems of determining host names from IP addresses, matching
11897 against host names is not as common as matching against IP addresses.
11898 </para>
11899 <para>
11900 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11901 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11902 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11903 are done can be changed by setting the <option>host_lookup_order</option> option. For
11904 security, once Exim has found one or more names, it looks up the IP addresses
11905 for these names and compares them with the IP address that it started with.
11906 Only those names whose IP addresses match are accepted. Any other names are
11907 discarded. If no names are left, Exim behaves as if the host name cannot be
11908 found. In the most common case there is only one name and one IP address.
11909 </para>
11910 <para>
11911 There are some options that control what happens if a host name cannot be
11912 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11913 </para>
11914 <para>
11915 <indexterm role="concept">
11916 <primary>host</primary>
11917 <secondary>alias for</secondary>
11918 </indexterm>
11919 <indexterm role="concept">
11920 <primary>alias for host</primary>
11921 </indexterm>
11922 As a result of aliasing, hosts may have more than one name. When processing any
11923 of the following types of pattern, all the host&#x2019;s names are checked:
11924 </para>
11925 <itemizedlist>
11926 <listitem>
11927 <para>
11928 <indexterm role="concept">
11929 <primary>asterisk</primary>
11930 <secondary>in host list</secondary>
11931 </indexterm>
11932 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11933 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11934 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11935 requirement. Other kinds of wildcarding require the use of a regular
11936 expression.
11937 </para>
11938 </listitem>
11939 <listitem>
11940 <para revisionflag="changed">
11941 <indexterm role="concept">
11942 <primary>regular expressions</primary>
11943 <secondary>in host list</secondary>
11944 </indexterm>
11945 <indexterm role="concept">
11946 <primary>host list</primary>
11947 <secondary>regular expression in</secondary>
11948 </indexterm>
11949 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11950 matched against the host name. Host names are case-independent, so this regular
11951 expression match is by default case-independent, but you can make it
11952 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
11953 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
11954 example,
11955 </para>
11956 <literallayout class="monospaced">
11957 ^(a|b)\.c\.d$
11958 </literallayout>
11959 <para>
11960 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11961 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11962 that backslash and dollar characters are not misinterpreted as part of the
11963 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11964 part of the string as non-expandable. For example:
11965 </para>
11966 <literallayout class="monospaced">
11967 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11968 </literallayout>
11969 <para>
11970 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11971 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11972 example. Without it, a match at the start of the host name is all that is
11973 required.
11974 </para>
11975 </listitem>
11976 </itemizedlist>
11977 </section>
11978 <section id="SECTbehipnot">
11979 <title>Behaviour when an IP address or name cannot be found</title>
11980 <para>
11981 <indexterm role="concept">
11982 <primary>host</primary>
11983 <secondary>lookup failures, permanent</secondary>
11984 </indexterm>
11985 While processing a host list, Exim may need to look up an IP address from a
11986 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11987 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11988 behaviour when it fails to find the information it is seeking is the same.
11989 </para>
11990 <para revisionflag="changed">
11991 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11992 apply to temporary DNS errors, whose handling is described in the next section.
11993 </para>
11994 <para>
11995 <indexterm role="concept">
11996 <primary><literal>+include_unknown</literal></primary>
11997 </indexterm>
11998 <indexterm role="concept">
11999 <primary><literal>+ignore_unknown</literal></primary>
12000 </indexterm>
12001 By default, Exim behaves as if the host does not match the list. This may not
12002 always be what you want to happen. To change Exim&#x2019;s behaviour, the special
12003 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
12004 top level &ndash; they are not recognized in an indirected file).
12005 </para>
12006 <itemizedlist>
12007 <listitem>
12008 <para>
12009 If any item that follows <literal>+include_unknown</literal> requires information that
12010 cannot found, Exim behaves as if the host does match the list. For example,
12011 </para>
12012 <literallayout class="monospaced">
12013 host_reject_connection = +include_unknown:*.enemy.ex
12014 </literallayout>
12015 <para>
12016 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12017 any hosts whose name it cannot find.
12018 </para>
12019 </listitem>
12020 <listitem>
12021 <para>
12022 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12023 be found, Exim ignores that item and proceeds to the rest of the list. For
12024 example:
12025 </para>
12026 <literallayout class="monospaced">
12027 accept hosts = +ignore_unknown : friend.example : \
12028                192.168.4.5
12029 </literallayout>
12030 <para>
12031 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12032 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12033 name can be found for 192.168.4.5, it is rejected.
12034 </para>
12035 </listitem>
12036 </itemizedlist>
12037 <para>
12038 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12039 list. The effect of each one lasts until the next, or until the end of the
12040 list.
12041 </para>
12042 </section>
12043 <section id="SECTtemdnserr" revisionflag="changed">
12044 <title>Temporary DNS errors when looking up host information</title>
12045 <para revisionflag="changed">
12046 <indexterm role="concept">
12047 <primary>host</primary>
12048 <secondary>lookup failures, temporary</secondary>
12049 </indexterm>
12050 <indexterm role="concept">
12051 <primary><literal>+include_defer</literal></primary>
12052 </indexterm>
12053 <indexterm role="concept">
12054 <primary><literal>+ignore_defer</literal></primary>
12055 </indexterm>
12056 A temporary DNS lookup failure normally causes a defer action (except when
12057 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12058 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12059 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12060 section. These options should be used with care, probably only in non-critical
12061 host lists such as whitelists.
12062 </para>
12063 </section>
12064 <section id="SECThoslispatnamsk">
12065 <title>Host list patterns for single-key lookups by host name</title>
12066 <para>
12067 <indexterm role="concept">
12068 <primary>unknown host name</primary>
12069 </indexterm>
12070 <indexterm role="concept">
12071 <primary>host list</primary>
12072 <secondary>matching host name</secondary>
12073 </indexterm>
12074 If a pattern is of the form
12075 </para>
12076 <literallayout>
12077 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12078 </literallayout>
12079 <para>
12080 for example
12081 </para>
12082 <literallayout class="monospaced">
12083 dbm;/host/accept/list
12084 </literallayout>
12085 <para>
12086 a single-key lookup is performed, using the host name as its key. If the
12087 lookup succeeds, the host matches the item. The actual data that is looked up
12088 is not used.
12089 </para>
12090 <para>
12091 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12092 keys in the file, not IP addresses. If you want to do lookups based on IP
12093 addresses, you must precede the search type with <quote>net-</quote> (see section
12094 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12095 two items in the same list, one doing an address lookup and one doing a name
12096 lookup, both using the same file.
12097 </para>
12098 </section>
12099 <section id="SECID81">
12100 <title>Host list patterns for query-style lookups</title>
12101 <para>
12102 If a pattern is of the form
12103 </para>
12104 <literallayout>
12105 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12106 </literallayout>
12107 <para>
12108 the query is obeyed, and if it succeeds, the host matches the item. The actual
12109 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12110 <varname>$sender_host_name</varname> can be used in the query. For example:
12111 </para>
12112 <literallayout class="monospaced">
12113 hosts_lookup = pgsql;\
12114   select ip from hostlist where ip='$sender_host_address'
12115 </literallayout>
12116 <para>
12117 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12118 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12119 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12120 operator.
12121 </para>
12122 <para>
12123 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12124 looks up the host name if has not already done so. (See section
12125 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12126 </para>
12127 <para>
12128 Historical note: prior to release 4.30, Exim would always attempt to find a
12129 host name before running the query, unless the search type was preceded by
12130 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12131 still recognized for query-style lookups, but its presence or absence has no
12132 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12133 See section <xref linkend="SECThoslispatsikey"/>.)
12134 </para>
12135 </section>
12136 <section id="SECTmixwilhos">
12137 <title>Mixing wildcarded host names and addresses in host lists</title>
12138 <para>
12139 <indexterm role="concept">
12140 <primary>host list</primary>
12141 <secondary>mixing names and addresses in</secondary>
12142 </indexterm>
12143 If you have name lookups or wildcarded host names and IP addresses in the same
12144 host list, you should normally put the IP addresses first. For example, in an
12145 ACL you could have:
12146 </para>
12147 <literallayout class="monospaced">
12148 accept hosts = 10.9.8.7 : *.friend.example
12149 </literallayout>
12150 <para>
12151 The reason for this lies in the left-to-right way that Exim processes lists.
12152 It can test IP addresses without doing any DNS lookups, but when it reaches an
12153 item that requires a host name, it fails if it cannot find a host name to
12154 compare with the pattern. If the above list is given in the opposite order, the
12155 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12156 IP address is 10.9.8.7.
12157 </para>
12158 <para>
12159 If you really do want to do the name check first, and still recognize the IP
12160 address, you can rewrite the ACL like this:
12161 </para>
12162 <literallayout class="monospaced">
12163 accept hosts = *.friend.example
12164 accept hosts = 10.9.8.7
12165 </literallayout>
12166 <para>
12167 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12168 <xref linkend="CHAPACL"/> for details of ACLs.
12169 </para>
12170 </section>
12171 <section id="SECTaddresslist">
12172 <title>Address lists</title>
12173 <para>
12174 <indexterm role="concept">
12175 <primary>list</primary>
12176 <secondary>address list</secondary>
12177 </indexterm>
12178 <indexterm role="concept">
12179 <primary>address list</primary>
12180 <secondary>empty item</secondary>
12181 </indexterm>
12182 <indexterm role="concept">
12183 <primary>address list</primary>
12184 <secondary>patterns</secondary>
12185 </indexterm>
12186 Address lists contain patterns that are matched against mail addresses. There
12187 is one special case to be considered: the sender address of a bounce message is
12188 always empty. You can test for this by providing an empty item in an address
12189 list. For example, you can set up a router to process bounce messages by
12190 using this option setting:
12191 </para>
12192 <literallayout class="monospaced">
12193 senders = :
12194 </literallayout>
12195 <para>
12196 The presence of the colon creates an empty item. If you do not provide any
12197 data, the list is empty and matches nothing. The empty sender can also be
12198 detected by a regular expression that matches an empty string,
12199 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12200 </para>
12201 <para>
12202 Non-empty items in an address list can be straightforward email addresses. For
12203 example:
12204 </para>
12205 <literallayout class="monospaced">
12206 senders = jbc@askone.example : hs@anacreon.example
12207 </literallayout>
12208 <para>
12209 A certain amount of wildcarding is permitted. If a pattern contains an @
12210 character, but is not a regular expression and does not begin with a
12211 semicolon-terminated lookup type (described below), the local part of the
12212 subject address is compared with the local part of the pattern, which may start
12213 with an asterisk. If the local parts match, the domain is checked in exactly
12214 the same way as for a pattern in a domain list. For example, the domain can be
12215 wildcarded, refer to a named list, or be a lookup:
12216 </para>
12217 <literallayout class="monospaced">
12218 deny senders = *@*.spamming.site:\
12219                *@+hostile_domains:\
12220                bozo@partial-lsearch;/list/of/dodgy/sites:\
12221                *@dbm;/bad/domains.db
12222 </literallayout>
12223 <para>
12224 <indexterm role="concept">
12225 <primary>local part</primary>
12226 <secondary>starting with !</secondary>
12227 </indexterm>
12228 <indexterm role="concept">
12229 <primary>address list</primary>
12230 <secondary>local part starting with !</secondary>
12231 </indexterm>
12232 If a local part that begins with an exclamation mark is required, it has to be
12233 specified using a regular expression, because otherwise the exclamation mark is
12234 treated as a sign of negation, as is standard in lists.
12235 </para>
12236 <para>
12237 If a non-empty pattern that is not a regular expression or a lookup does not
12238 contain an @ character, it is matched against the domain part of the subject
12239 address. The only two formats that are recognized this way are a literal
12240 domain, or a domain pattern that starts with *. In both these cases, the effect
12241 is the same as if <literal>*@</literal> preceded the pattern. For example:
12242 </para>
12243 <literallayout class="monospaced">
12244 deny senders = enemy.domain : *.enemy.domain
12245 </literallayout>
12246 <para>
12247 The following kinds of more complicated address list pattern can match any
12248 address, including the empty address that is characteristic of bounce message
12249 senders:
12250 </para>
12251 <itemizedlist>
12252 <listitem>
12253 <para>
12254 <indexterm role="concept">
12255 <primary>regular expressions</primary>
12256 <secondary>in address list</secondary>
12257 </indexterm>
12258 <indexterm role="concept">
12259 <primary>address list</primary>
12260 <secondary>regular expression in</secondary>
12261 </indexterm>
12262 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12263 done against the complete address, with the pattern as the regular expression.
12264 You must take care that backslash and dollar characters are not misinterpreted
12265 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12266 to mark that part of the string as non-expandable. For example:
12267 </para>
12268 <literallayout class="monospaced">
12269 deny senders = \N^.*this.*@example\.com$\N : \
12270                \N^\d{8}.+@spamhaus.example$\N : ...
12271 </literallayout>
12272 <para>
12273 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12274 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12275 </para>
12276 </listitem>
12277 <listitem>
12278 <para>
12279 <indexterm role="concept">
12280 <primary>address list</primary>
12281 <secondary>lookup for complete address</secondary>
12282 </indexterm>
12283 Complete addresses can be looked up by using a pattern that starts with a
12284 lookup type terminated by a semicolon, followed by the data for the lookup. For
12285 example:
12286 </para>
12287 <literallayout class="monospaced">
12288 deny senders = cdb;/etc/blocked.senders : \
12289   mysql;select address from blocked where \
12290   address='${quote_mysql:$sender_address}'
12291 </literallayout>
12292 <para>
12293 Both query-style and single-key lookup types can be used. For a single-key
12294 lookup type, Exim uses the complete address as the key. However, empty keys are
12295 not supported for single-key lookups, so a match against the empty address
12296 always fails. This restriction does not apply to query-style lookups.
12297 </para>
12298 <para>
12299 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12300 cannot be used, and is ignored if specified, with an entry being written to the
12301 panic log.
12302 <indexterm role="concept">
12303 <primary>*@ with single-key lookup</primary>
12304 </indexterm>
12305 However, you can configure lookup defaults, as described in section
12306 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12307 default. For example, with this lookup:
12308 </para>
12309 <literallayout class="monospaced">
12310 accept senders = lsearch*@;/some/file
12311 </literallayout>
12312 <para>
12313 the file could contains lines like this:
12314 </para>
12315 <literallayout class="monospaced">
12316 user1@domain1.example
12317 *@domain2.example
12318 </literallayout>
12319 <para>
12320 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12321 that are tried is:
12322 </para>
12323 <literallayout class="monospaced">
12324 nimrod@jaeger.example
12325 *@jaeger.example
12326 *
12327 </literallayout>
12328 <para>
12329 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12330 would mean that every address matches, thus rendering the test useless.
12331 </para>
12332 <para>
12333 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12334 </para>
12335 <literallayout class="monospaced">
12336 deny recipients = dbm*@;/some/file
12337 deny recipients = *@dbm;/some/file
12338 </literallayout>
12339 <para>
12340 The first does a whole address lookup, with defaulting, as just described,
12341 because it starts with a lookup type. The second matches the local part and
12342 domain independently, as described in a bullet point below.
12343 </para>
12344 </listitem>
12345 </itemizedlist>
12346 <para>
12347 The following kinds of address list pattern can match only non-empty addresses.
12348 If the subject address is empty, a match against any of these pattern types
12349 always fails.
12350 </para>
12351 <itemizedlist>
12352 <listitem>
12353 <para>
12354 <indexterm role="concept">
12355 <primary>@@ with single-key lookup</primary>
12356 </indexterm>
12357 <indexterm role="concept">
12358 <primary>address list</primary>
12359 <secondary>@@ lookup type</secondary>
12360 </indexterm>
12361 <indexterm role="concept">
12362 <primary>address list</primary>
12363 <secondary>split local part and domain</secondary>
12364 </indexterm>
12365 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12366 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12367 split into a local part and a domain. The domain is looked up in the file. If
12368 it is not found, there is no match. If it is found, the data that is looked up
12369 from the file is treated as a colon-separated list of local part patterns, each
12370 of which is matched against the subject local part in turn.
12371 </para>
12372 <para>
12373 <indexterm role="concept">
12374 <primary>asterisk</primary>
12375 <secondary>in address list</secondary>
12376 </indexterm>
12377 The lookup may be a partial one, and/or one involving a search for a default
12378 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12379 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12380 even be further lookups. They may also be independently negated. For example,
12381 with
12382 </para>
12383 <literallayout class="monospaced">
12384 deny senders = @@dbm;/etc/reject-by-domain
12385 </literallayout>
12386 <para>
12387 the data from which the DBM file is built could contain lines like
12388 </para>
12389 <literallayout class="monospaced">
12390 baddomain.com:  !postmaster : *
12391 </literallayout>
12392 <para>
12393 to reject all senders except <option>postmaster</option> from that domain.
12394 </para>
12395 <para>
12396 <indexterm role="concept">
12397 <primary>local part</primary>
12398 <secondary>starting with !</secondary>
12399 </indexterm>
12400 If a local part that actually begins with an exclamation mark is required, it
12401 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12402 may be split over several lines by indenting the second and subsequent lines,
12403 but the separating colon must still be included at line breaks. White space
12404 surrounding the colons is ignored. For example:
12405 </para>
12406 <literallayout class="monospaced">
12407 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12408 spammer3 : spammer4
12409 </literallayout>
12410 <para>
12411 As in all colon-separated lists in Exim, a colon can be included in an item by
12412 doubling.
12413 </para>
12414 <para>
12415 If the last item in the list starts with a right angle-bracket, the remainder
12416 of the item is taken as a new key to look up in order to obtain a continuation
12417 list of local parts. The new key can be any sequence of characters. Thus one
12418 might have entries like
12419 </para>
12420 <literallayout class="monospaced">
12421 aol.com: spammer1 : spammer 2 : &gt;*
12422 xyz.com: spammer3 : &gt;*
12423 *:       ^\d{8}$
12424 </literallayout>
12425 <para>
12426 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12427 local parts for all domains, in addition to the specific local parts listed for
12428 each domain. Of course, using this feature costs another lookup each time a
12429 chain is followed, but the effort needed to maintain the data is reduced.
12430 </para>
12431 <para>
12432 <indexterm role="concept">
12433 <primary>loop</primary>
12434 <secondary>in lookups</secondary>
12435 </indexterm>
12436 It is possible to construct loops using this facility, and in order to catch
12437 them, the chains may be no more than fifty items long.
12438 </para>
12439 </listitem>
12440 <listitem>
12441 <para>
12442 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12443 lookup, but in this case, the chaining facility is not available. The lookup
12444 can only return a single list of local parts.
12445 </para>
12446 </listitem>
12447 </itemizedlist>
12448 <para>
12449 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12450 in these two examples:
12451 </para>
12452 <literallayout class="monospaced">
12453 senders = +my_list
12454 senders = *@+my_list
12455 </literallayout>
12456 <para>
12457 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12458 example it is a named domain list.
12459 </para>
12460 </section>
12461 <section id="SECTcasletadd">
12462 <title>Case of letters in address lists</title>
12463 <para>
12464 <indexterm role="concept">
12465 <primary>case of local parts</primary>
12466 </indexterm>
12467 <indexterm role="concept">
12468 <primary>address list</primary>
12469 <secondary>case forcing</secondary>
12470 </indexterm>
12471 <indexterm role="concept">
12472 <primary>case forcing in address lists</primary>
12473 </indexterm>
12474 Domains in email addresses are always handled caselessly, but for local parts
12475 case may be significant on some systems (see <option>caseful_local_part</option> for how
12476 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12477 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12478 blocking lists should be done in a case-independent manner. Since most address
12479 lists in Exim are used for this kind of control, Exim attempts to do this by
12480 default.
12481 </para>
12482 <para>
12483 The domain portion of an address is always lowercased before matching it to an
12484 address list. The local part is lowercased by default, and any string
12485 comparisons that take place are done caselessly. This means that the data in
12486 the address list itself, in files included as plain file names, and in any file
12487 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12488 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12489 works caselessly) must be in lower case, because these lookups are not
12490 case-independent.
12491 </para>
12492 <para>
12493 <indexterm role="concept">
12494 <primary><literal>+caseful</literal></primary>
12495 </indexterm>
12496 To allow for the possibility of caseful address list matching, if an item in
12497 an address list is the string <quote>+caseful</quote>, the original case of the local
12498 part is restored for any comparisons that follow, and string comparisons are no
12499 longer case-independent. This does not affect the domain, which remains in
12500 lower case. However, although independent matches on the domain alone are still
12501 performed caselessly, regular expressions that match against an entire address
12502 become case-sensitive after <quote>+caseful</quote> has been seen.
12503 </para>
12504 </section>
12505 <section id="SECTlocparlis">
12506 <title>Local part lists</title>
12507 <para>
12508 <indexterm role="concept">
12509 <primary>list</primary>
12510 <secondary>local part list</secondary>
12511 </indexterm>
12512 <indexterm role="concept">
12513 <primary>local part</primary>
12514 <secondary>list</secondary>
12515 </indexterm>
12516 Case-sensitivity in local part lists is handled in the same way as for address
12517 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12518 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12519 set false, the subject is lowercased and the matching is initially
12520 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12521 matching in the local part list, but not elsewhere in the router. If
12522 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12523 option is case-sensitive from the start.
12524 </para>
12525 <para>
12526 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12527 comments are handled in the same way as address lists &ndash; they are recognized
12528 only if the # is preceded by white space or the start of the line.
12529 Otherwise, local part lists are matched in the same way as domain lists, except
12530 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12531 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12532 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12533 types.
12534 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12535 </para>
12536 </section>
12537 </chapter>
12538
12539 <chapter id="CHAPexpand">
12540 <title>String expansions</title>
12541 <para>
12542 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12543 <primary>expansion</primary>
12544 <secondary>of strings</secondary>
12545 </indexterm>
12546 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12547 them are expanded every time they are used; others are expanded only once.
12548 </para>
12549 <para>
12550 When a string is being expanded it is copied verbatim from left to right except
12551 when a dollar or backslash character is encountered. A dollar specifies the
12552 start of a portion of the string that is interpreted and replaced as described
12553 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12554 escape character, as described in the following section.
12555 </para>
12556 <section id="SECTlittext">
12557 <title>Literal text in expanded strings</title>
12558 <para>
12559 <indexterm role="concept">
12560 <primary>expansion</primary>
12561 <secondary>including literal text</secondary>
12562 </indexterm>
12563 An uninterpreted dollar can be included in an expanded string by putting a
12564 backslash in front of it. A backslash can be used to prevent any special
12565 character being treated specially in an expansion, including backslash itself.
12566 If the string appears in quotes in the configuration file, two backslashes are
12567 required because the quotes themselves cause interpretation of backslashes when
12568 the string is read in (see section <xref linkend="SECTstrings"/>).
12569 </para>
12570 <para>
12571 <indexterm role="concept">
12572 <primary>expansion</primary>
12573 <secondary>non-expandable substrings</secondary>
12574 </indexterm>
12575 A portion of the string can specified as non-expandable by placing it between
12576 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12577 expressions, which often contain backslashes and dollar signs. For example:
12578 </para>
12579 <literallayout class="monospaced">
12580 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12581 </literallayout>
12582 <para>
12583 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12584 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12585 string.
12586 </para>
12587 </section>
12588 <section id="SECID82">
12589 <title>Character escape sequences in expanded strings</title>
12590 <para>
12591 <indexterm role="concept">
12592 <primary>expansion</primary>
12593 <secondary>escape sequences</secondary>
12594 </indexterm>
12595 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12596 expanded string is recognized as an escape sequence for the character newline,
12597 carriage return, or tab, respectively. A backslash followed by up to three
12598 octal digits is recognized as an octal encoding for a single character, and a
12599 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12600 encoding.
12601 </para>
12602 <para>
12603 These escape sequences are also recognized in quoted strings when they are read
12604 in. Their interpretation in expansions as well is useful for unquoted strings,
12605 and for other cases such as looked-up strings that are then expanded.
12606 </para>
12607 </section>
12608 <section id="SECID83">
12609 <title>Testing string expansions</title>
12610 <para>
12611 <indexterm role="concept">
12612 <primary>expansion</primary>
12613 <secondary>testing</secondary>
12614 </indexterm>
12615 <indexterm role="concept">
12616 <primary>testing</primary>
12617 <secondary>string expansion</secondary>
12618 </indexterm>
12619 <indexterm role="option">
12620 <primary><option>-be</option></primary>
12621 </indexterm>
12622 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12623 takes the command arguments, or lines from the standard input if there are no
12624 arguments, runs them through the string expansion code, and writes the results
12625 to the standard output. Variables based on configuration values are set up, but
12626 since no message is being processed, variables such as <varname>$local_part</varname> have no
12627 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12628 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12629 and <option>nhash</option>.
12630 </para>
12631 <para>
12632 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12633 instead runs under the uid and gid it was called with, to prevent users from
12634 using <option>-be</option> for reading files to which they do not have access.
12635 </para>
12636 <para>
12637 <indexterm role="option">
12638 <primary><option>-bem</option></primary>
12639 </indexterm>
12640 If you want to test expansions that include variables whose values are taken
12641 from a message, there are two other options that can be used. The <option>-bem</option>
12642 option is like <option>-be</option> except that it is followed by a file name. The file is
12643 read as a message before doing the test expansions. For example:
12644 </para>
12645 <literallayout class="monospaced">
12646 exim -bem /tmp/test.message '$h_subject:'
12647 </literallayout>
12648 <para>
12649 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12650 Exim message identifier. For example:
12651 </para>
12652 <literallayout class="monospaced">
12653 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12654 </literallayout>
12655 <para>
12656 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
12657 is therefore restricted to admin users.
12658 </para>
12659 </section>
12660 <section id="SECTforexpfai">
12661 <title>Forced expansion failure</title>
12662 <para>
12663 <indexterm role="concept">
12664 <primary>expansion</primary>
12665 <secondary>forced failure</secondary>
12666 </indexterm>
12667 A number of expansions that are described in the following section have
12668 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12669 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12670 used depends on some condition that is evaluated as part of the expansion. If,
12671 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12672 the entire string expansion fails in a way that can be detected by the code
12673 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12674 its consequences depend on the circumstances. In some cases it is no different
12675 from any other expansion failure, but in others a different action may be
12676 taken. Such variations are mentioned in the documentation of the option that is
12677 being expanded.
12678 </para>
12679 </section>
12680 <section id="SECTexpansionitems">
12681 <title>Expansion items</title>
12682 <para>
12683 The following items are recognized in expanded strings. White space may be used
12684 between sub-items that are keywords or substrings enclosed in braces inside an
12685 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12686 white space is significant.
12687 </para>
12688 <variablelist>
12689 <varlistentry>
12690 <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>
12691 <listitem>
12692 <para>
12693 <indexterm role="concept">
12694 <primary>expansion</primary>
12695 <secondary>variables</secondary>
12696 </indexterm>
12697 Substitute the contents of the named variable, for example:
12698 </para>
12699 <literallayout class="monospaced">
12700 $local_part
12701 ${domain}
12702 </literallayout>
12703 <para>
12704 The second form can be used to separate the name from subsequent alphanumeric
12705 characters. This form (using braces) is available only for variables; it does
12706 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12707 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12708 given, the expansion fails.
12709 </para>
12710 </listitem></varlistentry>
12711 <varlistentry>
12712 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12713 <listitem>
12714 <para>
12715 <indexterm role="concept">
12716 <primary>expansion</primary>
12717 <secondary>operators</secondary>
12718 </indexterm>
12719 The string is first itself expanded, and then the operation specified by
12720 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
12721 </para>
12722 <literallayout class="monospaced">
12723 ${lc:$local_part}
12724 </literallayout>
12725 <para>
12726 The string starts with the first character after the colon, which may be
12727 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12728 below. The operator notation is used for simple expansion items that have just
12729 one argument, because it reduces the number of braces and therefore makes the
12730 string easier to understand.
12731 </para>
12732 </listitem></varlistentry>
12733 <varlistentry>
12734 <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>
12735 <listitem>
12736 <para>
12737 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
12738 expansion item below.
12739 </para>
12740 </listitem></varlistentry>
12741 <varlistentry>
12742 <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>
12743 <listitem>
12744 <para>
12745 <indexterm role="concept">
12746 <primary><option>dlfunc</option></primary>
12747 </indexterm>
12748 This expansion dynamically loads and then calls a locally-written C function.
12749 This functionality is available only if Exim is compiled with
12750 </para>
12751 <literallayout class="monospaced">
12752 EXPAND_DLFUNC=yes
12753 </literallayout>
12754 <para>
12755 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12756 object so that it doesn&#x2019;t reload the same object file in the same Exim process
12757 (but of course Exim does start new processes frequently).
12758 </para>
12759 <para>
12760 There may be from zero to eight arguments to the function. When compiling
12761 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12762 included. The Exim variables and functions that are defined by that API
12763 are also available for dynamically loaded functions. The function itself
12764 must have the following type:
12765 </para>
12766 <literallayout class="monospaced">
12767 int dlfunction(uschar **yield, int argc, uschar *argv[])
12768 </literallayout>
12769 <para>
12770 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12771 function should return one of the following values:
12772 </para>
12773 <para>
12774 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12775 into the expanded string that is being built.
12776 </para>
12777 <para>
12778 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12779 from <emphasis>yield</emphasis>, if it is set.
12780 </para>
12781 <para>
12782 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12783 taken from <emphasis>yield</emphasis> if it is set.
12784 </para>
12785 <para>
12786 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12787 </para>
12788 <para>
12789 When compiling a function that is to be used in this way with gcc,
12790 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12791 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12792 </para>
12793 </listitem></varlistentry>
12794 <varlistentry>
12795 <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>
12796 <listitem>
12797 <para>
12798 <indexterm role="concept">
12799 <primary>expansion</primary>
12800 <secondary>extracting substrings by key</secondary>
12801 </indexterm>
12802 <indexterm role="concept">
12803 <primary><option>extract</option></primary>
12804 <secondary>substrings by key</secondary>
12805 </indexterm>
12806 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
12807 white space is removed from the key (but not from any of the strings). The key
12808 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
12809 form:
12810 </para>
12811 <literallayout>
12812 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
12813 </literallayout>
12814 <para>
12815 <indexterm role="variable">
12816 <primary><varname>$value</varname></primary>
12817 </indexterm>
12818 where the equals signs and spaces (but not both) are optional. If any of the
12819 values contain white space, they must be enclosed in double quotes, and any
12820 values that are enclosed in double quotes are subject to escape processing as
12821 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
12822 for the value that corresponds to the key. The search is case-insensitive. If
12823 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
12824 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
12825 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12826 is restored to any previous value it might have had.
12827 </para>
12828 <para>
12829 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
12830 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
12831 extracted is used. Thus, for example, these two expansions are identical, and
12832 yield <quote>2001</quote>:
12833 </para>
12834 <literallayout class="monospaced">
12835 ${extract{gid}{uid=1984 gid=2001}}
12836 ${extract{gid}{uid=1984 gid=2001}{$value}}
12837 </literallayout>
12838 <para>
12839 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
12840 appear, for example:
12841 </para>
12842 <literallayout class="monospaced">
12843 ${extract{Z}{A=... B=...}{$value} fail }
12844 </literallayout>
12845 <para>
12846 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12847 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
12848 </para>
12849 </listitem></varlistentry>
12850 <varlistentry>
12851 <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>
12852 <listitem>
12853 <para>
12854 <indexterm role="concept">
12855 <primary>expansion</primary>
12856 <secondary>extracting substrings by number</secondary>
12857 </indexterm>
12858 <indexterm role="concept">
12859 <primary><option>extract</option></primary>
12860 <secondary>substrings by number</secondary>
12861 </indexterm>
12862 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
12863 apart from leading and trailing white space, which is ignored.
12864 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12865 behaves in the same way, except that, instead of extracting a named field, it
12866 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
12867 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
12868 &lt;<emphasis>string3</emphasis>&gt; as before.
12869 </para>
12870 <para>
12871 The fields in the string are separated by any one of the characters in the
12872 separator string. These may include space or tab characters.
12873 The first field is numbered one. If the number is negative, the fields are
12874 counted from the end of the string, with the rightmost one numbered -1. If the
12875 number given is zero, the entire string is returned. If the modulus of the
12876 number is greater than the number of fields in the string, the result is the
12877 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
12878 provided. For example:
12879 </para>
12880 <literallayout class="monospaced">
12881 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12882 </literallayout>
12883 <para>
12884 yields <quote>42</quote>, and
12885 </para>
12886 <literallayout class="monospaced">
12887 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12888 </literallayout>
12889 <para>
12890 yields <quote>99</quote>. Two successive separators mean that the field between them is
12891 empty (for example, the fifth field above).
12892 </para>
12893 </listitem></varlistentry>
12894 <varlistentry>
12895 <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>
12896 <listitem>
12897 <para>
12898 <indexterm role="concept">
12899 <primary>list</primary>
12900 <secondary>selecting by condition</secondary>
12901 </indexterm>
12902 <indexterm role="concept">
12903 <primary>expansion</primary>
12904 <secondary>selecting from list by condition</secondary>
12905 </indexterm>
12906 <indexterm role="variable">
12907 <primary><varname>$item</varname></primary>
12908 </indexterm>
12909 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
12910 default, but the separator can be changed in the usual way. For each item
12911 in this list, its value is place in <varname>$item</varname>, and then the condition is
12912 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
12913 item in a new list; if the condition is false, the item is discarded. The
12914 separator used for the output list is the same as the one used for the
12915 input, but a separator setting is not included in the output. For example:
12916 </para>
12917 <literallayout class="monospaced">
12918 ${filter{a:b:c}{!eq{$item}{b}}
12919 </literallayout>
12920 <para>
12921 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
12922 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
12923 </para>
12924 </listitem></varlistentry>
12925 <varlistentry>
12926 <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>
12927 <listitem>
12928 <para>
12929 <indexterm role="concept">
12930 <primary>hash function</primary>
12931 <secondary>textual</secondary>
12932 </indexterm>
12933 <indexterm role="concept">
12934 <primary>expansion</primary>
12935 <secondary>textual hash</secondary>
12936 </indexterm>
12937 This is a textual hashing function, and was the first to be implemented in
12938 early versions of Exim. In current releases, there are other hashing functions
12939 (numeric, MD5, and SHA-1), which are described below.
12940 </para>
12941 <para>
12942 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
12943 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
12944 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
12945 use the simpler operator notation that avoids some of the braces:
12946 </para>
12947 <literallayout class="monospaced">
12948 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
12949 </literallayout>
12950 <para>
12951 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
12952 or equal to the length of the string, the expansion item returns the string.
12953 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
12954 function to the string. The new string consists of characters taken from the
12955 first &lt;<emphasis>m</emphasis>&gt; characters of the string
12956 </para>
12957 <literallayout class="monospaced">
12958 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12959 </literallayout>
12960 <para>
12961 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
12962 letters appear. For example:
12963 </para>
12964 <literallayout>
12965 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
12966 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
12967 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
12968 </literallayout>
12969 </listitem></varlistentry>
12970 <varlistentry>
12971 <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>
12972 <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>
12973 <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>
12974 <listitem>
12975 <para>
12976 <indexterm role="concept">
12977 <primary>expansion</primary>
12978 <secondary>header insertion</secondary>
12979 </indexterm>
12980 <indexterm role="variable">
12981 <primary><varname>$header_</varname></primary>
12982 </indexterm>
12983 <indexterm role="variable">
12984 <primary><varname>$bheader_</varname></primary>
12985 </indexterm>
12986 <indexterm role="variable">
12987 <primary><varname>$rheader_</varname></primary>
12988 </indexterm>
12989 <indexterm role="concept">
12990 <primary>header lines</primary>
12991 <secondary>in expansion strings</secondary>
12992 </indexterm>
12993 <indexterm role="concept">
12994 <primary>header lines</primary>
12995 <secondary>character sets</secondary>
12996 </indexterm>
12997 <indexterm role="concept">
12998 <primary>header lines</primary>
12999 <secondary>decoding</secondary>
13000 </indexterm>
13001 Substitute the contents of the named message header line, for example
13002 </para>
13003 <literallayout class="monospaced">
13004 $header_reply-to:
13005 </literallayout>
13006 <para>
13007 The newline that terminates a header line is not included in the expansion, but
13008 internal newlines (caused by splitting the header line over several physical
13009 lines) may be present.
13010 </para>
13011 <para>
13012 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13013 the data in the header line is interpreted.
13014 </para>
13015 <itemizedlist>
13016 <listitem>
13017 <para>
13018 <indexterm role="concept">
13019 <primary>white space</primary>
13020 <secondary>in header lines</secondary>
13021 </indexterm>
13022 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13023 processing at all, and without the removal of leading and trailing white space.
13024 </para>
13025 </listitem>
13026 <listitem>
13027 <para>
13028 <indexterm role="concept">
13029 <primary>base64 encoding</primary>
13030 <secondary>in header lines</secondary>
13031 </indexterm>
13032 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13033 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13034 character set translation. If decoding of what looks superficially like a MIME
13035 <quote>word</quote> fails, the raw string is returned. If decoding
13036 <indexterm role="concept">
13037 <primary>binary zero</primary>
13038 <secondary>in header line</secondary>
13039 </indexterm>
13040 produces a binary zero character, it is replaced by a question mark &ndash; this is
13041 what Exim does for binary zeros that are actually received in header lines.
13042 </para>
13043 </listitem>
13044 <listitem>
13045 <para>
13046 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13047 standard character set. This is an attempt to produce the same string as would
13048 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13049 returned. Translation is attempted only on operating systems that support the
13050 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13051 a system Makefile or in <filename>Local/Makefile</filename>.
13052 </para>
13053 </listitem>
13054 </itemizedlist>
13055 <para>
13056 In a filter file, the target character set for <option>header</option> can be specified by a
13057 command of the following form:
13058 </para>
13059 <literallayout class="monospaced">
13060 headers charset "UTF-8"
13061 </literallayout>
13062 <para>
13063 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13064 subsequently obeyed filter commands. In the absence of this command, the target
13065 character set in a filter is taken from the setting of the <option>headers_charset</option>
13066 option in the runtime configuration. The value of this option defaults to the
13067 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13068 ISO-8859-1.
13069 </para>
13070 <para>
13071 Header names follow the syntax of RFC 2822, which states that they may contain
13072 any printing characters except space and colon. Consequently, curly brackets
13073 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13074 if they were variables. Attempting to do so causes a syntax error.
13075 </para>
13076 <para>
13077 Only header lines that are common to all copies of a message are visible to
13078 this mechanism. These are the original header lines that are received with the
13079 message, and any that are added by an ACL statement or by a system
13080 filter. Header lines that are added to a particular copy of a message by a
13081 router or transport are not accessible.
13082 </para>
13083 <para>
13084 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13085 before the DATA ACL, because the header structure is not set up until the
13086 message is received. Header lines that are added in a RCPT ACL (for example)
13087 are saved until the message&#x2019;s incoming header lines are available, at which
13088 point they are added. When a DATA ACL is running, however, header lines added
13089 by earlier ACLs are visible.
13090 </para>
13091 <para>
13092 Upper case and lower case letters are synonymous in header names. If the
13093 following character is white space, the terminating colon may be omitted, but
13094 this is not recommended, because you may then forget it when it is needed. When
13095 white space terminates the header name, it is included in the expanded string.
13096 If the message does not contain the given header, the expansion item is
13097 replaced by an empty string. (See the <option>def</option> condition in section
13098 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13099 </para>
13100 <para>
13101 If there is more than one header with the same name, they are all concatenated
13102 to form the substitution string, up to a maximum length of 64K. Unless
13103 <option>rheader</option> is being used, leading and trailing white space is removed from
13104 each header before concatenation, and a completely empty header is ignored. A
13105 newline character is then inserted between non-empty headers, but there is no
13106 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13107 those headers that contain lists of addresses, a comma is also inserted at the
13108 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13109 </para>
13110 </listitem></varlistentry>
13111 <varlistentry>
13112 <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>
13113 <listitem>
13114 <para>
13115 <indexterm role="concept">
13116 <primary>expansion</primary>
13117 <secondary>hmac hashing</secondary>
13118 </indexterm>
13119 <indexterm role="concept">
13120 <primary><option>hmac</option></primary>
13121 </indexterm>
13122 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13123 shared secret and some text into a message authentication code, as specified in
13124 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13125 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13126 cryptographic hash, allowing for authentication that is not possible with MD5
13127 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13128 present. For example:
13129 </para>
13130 <literallayout class="monospaced">
13131 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13132 </literallayout>
13133 <para>
13134 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13135 produces:
13136 </para>
13137 <literallayout class="monospaced">
13138 dd97e3ba5d1a61b5006108f8c8252953
13139 </literallayout>
13140 <para>
13141 As an example of how this might be used, you might put in the main part of
13142 an Exim configuration:
13143 </para>
13144 <literallayout class="monospaced">
13145 SPAMSCAN_SECRET=cohgheeLei2thahw
13146 </literallayout>
13147 <para>
13148 In a router or a transport you could then have:
13149 </para>
13150 <literallayout class="monospaced">
13151 headers_add = \
13152   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13153   ${hmac{md5}{SPAMSCAN_SECRET}\
13154   {${primary_hostname},${message_exim_id},$h_message-id:}}
13155 </literallayout>
13156 <para>
13157 Then given a message, you can check where it was scanned by looking at the
13158 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13159 this header line is authentic by recomputing the authentication code from the
13160 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13161 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13162 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13163 </para>
13164 </listitem></varlistentry>
13165 <varlistentry>
13166 <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>
13167 <listitem>
13168 <para>
13169 <indexterm role="concept">
13170 <primary>expansion</primary>
13171 <secondary>conditional</secondary>
13172 </indexterm>
13173 <indexterm role="concept">
13174 <primary><option>if</option>, expansion item</primary>
13175 </indexterm>
13176 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13177 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13178 in section <xref linkend="SECTexpcond"/> below. For example:
13179 </para>
13180 <literallayout class="monospaced">
13181 ${if eq {$local_part}{postmaster} {yes}{no} }
13182 </literallayout>
13183 <para>
13184 The second string need not be present; if it is not and the condition is not
13185 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13186 be present instead of the second string (without any curly brackets). In this
13187 case, the expansion is forced to fail if the condition is not true (see section
13188 <xref linkend="SECTforexpfai"/>).
13189 </para>
13190 <para>
13191 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13192 is true, and the empty string if the condition is false. This makes it less
13193 cumbersome to write custom ACL and router conditions. For example, instead of
13194 </para>
13195 <literallayout class="monospaced">
13196 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13197 </literallayout>
13198 <para>
13199 you can use
13200 </para>
13201 <literallayout class="monospaced">
13202 condition = ${if &gt;{$acl_m4}{3}}
13203 </literallayout>
13204 </listitem></varlistentry>
13205 <varlistentry>
13206 <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>
13207 <listitem>
13208 <para>
13209 <indexterm role="concept">
13210 <primary>expansion</primary>
13211 <secondary>string truncation</secondary>
13212 </indexterm>
13213 <indexterm role="concept">
13214 <primary><option>length</option> expansion item</primary>
13215 </indexterm>
13216 The <option>length</option> item is used to extract the initial portion of a string. Both
13217 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13218 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13219 change when expanded, you can use the simpler operator notation that avoids
13220 some of the braces:
13221 </para>
13222 <literallayout class="monospaced">
13223 ${length_&lt;n&gt;:&lt;string&gt;}
13224 </literallayout>
13225 <para>
13226 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13227 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13228 <option>strlen</option>, which gives the length of a string.
13229 </para>
13230 </listitem></varlistentry>
13231 <varlistentry>
13232 <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>
13233 <listitem>
13234 <para>
13235 This is the first of one of two different types of lookup item, which are both
13236 described in the next item.
13237 </para>
13238 </listitem></varlistentry>
13239 <varlistentry>
13240 <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>
13241 <listitem>
13242 <para>
13243 <indexterm role="concept">
13244 <primary>expansion</primary>
13245 <secondary>lookup in</secondary>
13246 </indexterm>
13247 <indexterm role="concept">
13248 <primary>file</primary>
13249 <secondary>lookups</secondary>
13250 </indexterm>
13251 <indexterm role="concept">
13252 <primary>lookup</primary>
13253 <secondary>in expanded string</secondary>
13254 </indexterm>
13255 The two forms of lookup item specify data lookups in files and databases, as
13256 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13257 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13258 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13259 </para>
13260 <para>
13261 If there is any white space in a lookup item which is part of a filter command,
13262 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13263 other place where white space is significant, the lookup item must be enclosed
13264 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13265 out by the system administrator.
13266 </para>
13267 <para>
13268 <indexterm role="variable">
13269 <primary><varname>$value</varname></primary>
13270 </indexterm>
13271 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13272 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13273 lookup. Afterwards it reverts to the value it had previously (at the outer
13274 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13275 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13276 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13277 lookup, thus providing a mechanism for looking up a default value when the
13278 original lookup fails.
13279 </para>
13280 <para>
13281 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13282 data for the outer lookup while the parameters of the second lookup are
13283 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13284 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13285 appear, and in this case, if the lookup fails, the entire expansion is forced
13286 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13287 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13288 successful lookup, and nothing in the case of failure.
13289 </para>
13290 <para>
13291 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13292 search type in order to do partial matching, and * or *@ may follow a search
13293 type to request default lookups if the key does not match (see sections
13294 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13295 </para>
13296 <para>
13297 <indexterm role="concept">
13298 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13299 <secondary>in lookup expansion</secondary>
13300 </indexterm>
13301 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13302 and non-wild parts of the key during the expansion of the replacement text.
13303 They return to their previous values at the end of the lookup item.
13304 </para>
13305 <para>
13306 This example looks up the postmaster alias in the conventional alias file:
13307 </para>
13308 <literallayout class="monospaced">
13309 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13310 </literallayout>
13311 <para>
13312 This example uses NIS+ to look up the full name of the user corresponding to
13313 the local part of an address, forcing the expansion to fail if it is not found:
13314 </para>
13315 <literallayout class="monospaced">
13316 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13317   {$value}fail}
13318 </literallayout>
13319 </listitem></varlistentry>
13320 <varlistentry>
13321 <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>
13322 <listitem>
13323 <para>
13324 <indexterm role="concept">
13325 <primary>expansion</primary>
13326 <secondary>list creation</secondary>
13327 </indexterm>
13328 <indexterm role="variable">
13329 <primary><varname>$item</varname></primary>
13330 </indexterm>
13331 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13332 default, but the separator can be changed in the usual way. For each item
13333 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
13334 expanded and added to the output as an item in a new list. The separator used
13335 for the output list is the same as the one used for the input, but a separator
13336 setting is not included in the output. For example:
13337 </para>
13338 <literallayout class="monospaced">
13339 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
13340 </literallayout>
13341 <para>
13342 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13343 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13344 and <emphasis role="bold">reduce</emphasis> expansion items.
13345 </para>
13346 </listitem></varlistentry>
13347 <varlistentry>
13348 <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>
13349 <listitem>
13350 <para>
13351 <indexterm role="concept">
13352 <primary>expansion</primary>
13353 <secondary>numeric hash</secondary>
13354 </indexterm>
13355 <indexterm role="concept">
13356 <primary>hash function</primary>
13357 <secondary>numeric</secondary>
13358 </indexterm>
13359 The three strings are expanded; the first two must yield numbers. Call them
13360 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13361 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13362 can use the simpler operator notation that avoids some of the braces:
13363 </para>
13364 <literallayout class="monospaced">
13365 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13366 </literallayout>
13367 <para>
13368 The second number is optional (in both notations). If there is only one number,
13369 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13370 processed by a div/mod hash function that returns two numbers, separated by a
13371 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13372 example,
13373 </para>
13374 <literallayout class="monospaced">
13375 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13376 </literallayout>
13377 <para>
13378 returns the string <quote>6/33</quote>.
13379 </para>
13380 </listitem></varlistentry>
13381 <varlistentry>
13382 <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>
13383 <listitem>
13384 <para>
13385 <indexterm role="concept">
13386 <primary>Perl</primary>
13387 <secondary>use in expanded string</secondary>
13388 </indexterm>
13389 <indexterm role="concept">
13390 <primary>expansion</primary>
13391 <secondary>calling Perl from</secondary>
13392 </indexterm>
13393 This item is available only if Exim has been built to include an embedded Perl
13394 interpreter. The subroutine name and the arguments are first separately
13395 expanded, and then the Perl subroutine is called with those arguments. No
13396 additional arguments need be given; the maximum number permitted, including the
13397 name of the subroutine, is nine.
13398 </para>
13399 <para>
13400 The return value of the subroutine is inserted into the expanded string, unless
13401 the return value is <option>undef</option>. In that case, the expansion fails in the same
13402 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13403 Whatever you return is evaluated in a scalar context. For example, if you
13404 return the name of a Perl vector, the return value is the size of the vector,
13405 not its contents.
13406 </para>
13407 <para>
13408 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13409 with the error message that was passed to <option>die</option>. More details of the embedded
13410 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13411 </para>
13412 <para>
13413 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13414 out the use of this expansion item in filter files.
13415 </para>
13416 </listitem></varlistentry>
13417 <varlistentry>
13418 <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>
13419 <listitem>
13420 <para>
13421 <indexterm role="concept">
13422 <primary><option>prvs</option> expansion item</primary>
13423 </indexterm>
13424 The first argument is a complete email address and the second is secret
13425 keystring. The third argument, specifying a key number, is optional. If absent,
13426 it defaults to 0. The result of the expansion is a prvs-signed email address,
13427 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13428 as part of a bounce address tag validation (BATV) scheme. For more discussion
13429 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13430 </para>
13431 </listitem></varlistentry>
13432 <varlistentry>
13433 <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>
13434 <listitem>
13435 <para>
13436 <indexterm role="concept">
13437 <primary><option>prvscheck</option> expansion item</primary>
13438 </indexterm>
13439 This expansion item is the complement of the <option>prvs</option> item. It is used for
13440 checking prvs-signed addresses. If the expansion of the first argument does not
13441 yield a syntactically valid prvs-signed address, the whole item expands to the
13442 empty string. When the first argument does expand to a syntactically valid
13443 prvs-signed address, the second argument is expanded, with the prvs-decoded
13444 version of the address and the key number extracted from the address in the
13445 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13446 </para>
13447 <para>
13448 These two variables can be used in the expansion of the second argument to
13449 retrieve the secret. The validity of the prvs-signed address is then checked
13450 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13451 which is empty for failure or <quote>1</quote> for success.
13452 </para>
13453 <para>
13454 The third argument is optional; if it is missing, it defaults to an empty
13455 string. This argument is now expanded. If the result is an empty string, the
13456 result of the expansion is the decoded version of the address. This is the case
13457 whether or not the signature was valid. Otherwise, the result of the expansion
13458 is the expansion of the third argument.
13459 </para>
13460 <para>
13461 All three variables can be used in the expansion of the third argument.
13462 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13463 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13464 </para>
13465 </listitem></varlistentry>
13466 <varlistentry>
13467 <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>
13468 <listitem>
13469 <para>
13470 <indexterm role="concept">
13471 <primary>expansion</primary>
13472 <secondary>inserting an entire file</secondary>
13473 </indexterm>
13474 <indexterm role="concept">
13475 <primary>file</primary>
13476 <secondary>inserting into expansion</secondary>
13477 </indexterm>
13478 <indexterm role="concept">
13479 <primary><option>readfile</option> expansion item</primary>
13480 </indexterm>
13481 The file name and end-of-line string are first expanded separately. The file is
13482 then read, and its contents replace the entire item. All newline characters in
13483 the file are replaced by the end-of-line string if it is present. Otherwise,
13484 newlines are left in the string.
13485 String expansion is not applied to the contents of the file. If you want this,
13486 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13487 the string expansion fails.
13488 </para>
13489 <para>
13490 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13491 locks out the use of this expansion item in filter files.
13492 </para>
13493 </listitem></varlistentry>
13494 <varlistentry>
13495 <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>
13496 <listitem>
13497 <para>
13498 <indexterm role="concept">
13499 <primary>expansion</primary>
13500 <secondary>inserting from a socket</secondary>
13501 </indexterm>
13502 <indexterm role="concept">
13503 <primary>socket, use of in expansion</primary>
13504 </indexterm>
13505 <indexterm role="concept">
13506 <primary><option>readsocket</option> expansion item</primary>
13507 </indexterm>
13508 This item inserts data from a Unix domain or Internet socket into the expanded
13509 string. The minimal way of using it uses just two arguments, as in these
13510 examples:
13511 </para>
13512 <literallayout class="monospaced">
13513 ${readsocket{/socket/name}{request string}}
13514 ${readsocket{inet:some.host:1234}{request string}}
13515 </literallayout>
13516 <para>
13517 For a Unix domain socket, the first substring must be the path to the socket.
13518 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13519 a host name or IP address, followed by a colon and a port, which can be a
13520 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13521 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13522 example:
13523 </para>
13524 <literallayout class="monospaced">
13525 ${readsocket{inet:[::1]:1234}{request string}}
13526 </literallayout>
13527 <para>
13528 Only a single host name may be given, but if looking it up yields more than
13529 one IP address, they are each tried in turn until a connection is made. For
13530 both kinds of socket, Exim makes a connection, writes the request string
13531 (unless it is an empty string) and reads from the socket until an end-of-file
13532 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13533 extend what can be done. Firstly, you can vary the timeout. For example:
13534 </para>
13535 <literallayout class="monospaced">
13536 ${readsocket{/socket/name}{request string}{3s}}
13537 </literallayout>
13538 <para>
13539 A fourth argument allows you to change any newlines that are in the data
13540 that is read, in the same way as for <option>readfile</option> (see above). This example
13541 turns them into spaces:
13542 </para>
13543 <literallayout class="monospaced">
13544 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13545 </literallayout>
13546 <para>
13547 As with all expansions, the substrings are expanded before the processing
13548 happens. Errors in these sub-expansions cause the expansion to fail. In
13549 addition, the following errors can occur:
13550 </para>
13551 <itemizedlist>
13552 <listitem>
13553 <para>
13554 Failure to create a socket file descriptor;
13555 </para>
13556 </listitem>
13557 <listitem>
13558 <para>
13559 Failure to connect the socket;
13560 </para>
13561 </listitem>
13562 <listitem>
13563 <para>
13564 Failure to write the request string;
13565 </para>
13566 </listitem>
13567 <listitem>
13568 <para>
13569 Timeout on reading from the socket.
13570 </para>
13571 </listitem>
13572 </itemizedlist>
13573 <para>
13574 By default, any of these errors causes the expansion to fail. However, if
13575 you supply a fifth substring, it is expanded and used when any of the above
13576 errors occurs. For example:
13577 </para>
13578 <literallayout class="monospaced">
13579 ${readsocket{/socket/name}{request string}{3s}{\n}\
13580   {socket failure}}
13581 </literallayout>
13582 <para>
13583 You can test for the existence of a Unix domain socket by wrapping this
13584 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13585 and the actual opening of the socket, so it is safer to use the fifth argument
13586 if you want to be absolutely sure of avoiding an expansion error for a
13587 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13588 </para>
13589 <para>
13590 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13591 locks out the use of this expansion item in filter files.
13592 </para>
13593 </listitem></varlistentry>
13594 <varlistentry>
13595 <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>
13596 <listitem>
13597 <para>
13598 <indexterm role="concept">
13599 <primary>expansion</primary>
13600 <secondary>reducing a list to a scalar</secondary>
13601 </indexterm>
13602 <indexterm role="concept">
13603 <primary>list</primary>
13604 <secondary>reducing to a scalar</secondary>
13605 </indexterm>
13606 <indexterm role="variable">
13607 <primary><varname>$value</varname></primary>
13608 </indexterm>
13609 <indexterm role="variable">
13610 <primary><varname>$item</varname></primary>
13611 </indexterm>
13612 This operation reduces a list to a single, scalar string. After expansion,
13613 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
13614 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
13615 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
13616 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
13617 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13618 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13619 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13620 number of ways. For example, to add up a list of numbers:
13621 </para>
13622 <literallayout class="monospaced">
13623 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
13624 </literallayout>
13625 <para>
13626 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13627 can be found:
13628 </para>
13629 <literallayout class="monospaced">
13630 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
13631 </literallayout>
13632 <para>
13633 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13634 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13635 expansion items.
13636 </para>
13637 </listitem></varlistentry>
13638 <varlistentry>
13639 <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>
13640 <listitem>
13641 <para>
13642 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13643 expansion item above.
13644 </para>
13645 </listitem></varlistentry>
13646 <varlistentry>
13647 <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>
13648 <listitem>
13649 <para>
13650 <indexterm role="concept">
13651 <primary>expansion</primary>
13652 <secondary>running a command</secondary>
13653 </indexterm>
13654 <indexterm role="concept">
13655 <primary><option>run</option> expansion item</primary>
13656 </indexterm>
13657 The command and its arguments are first expanded separately, and then the
13658 command is run in a separate process, but under the same uid and gid. As in
13659 other command executions from Exim, a shell is not used by default. If you want
13660 a shell, you must explicitly code it.
13661 </para>
13662 <para>
13663 The standard input for the command exists, but is empty. The standard output
13664 and standard error are set to the same file descriptor.
13665 <indexterm role="concept">
13666 <primary>return code</primary>
13667 <secondary>from <option>run</option> expansion</secondary>
13668 </indexterm>
13669 <indexterm role="variable">
13670 <primary><varname>$value</varname></primary>
13671 </indexterm>
13672 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
13673 and replaces the entire item; during this expansion, the standard output/error
13674 from the command is in the variable <varname>$value</varname>. If the command fails,
13675 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
13676 expansion, the standard output/error from the command is in the variable
13677 <varname>$value</varname>.
13678 </para>
13679 <para>
13680 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
13681 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13682 command does not succeed. If both strings are omitted, the result is contents
13683 of the standard output/error on success, and nothing on failure.
13684 </para>
13685 <para>
13686 <indexterm role="variable">
13687 <primary><varname>$runrc</varname></primary>
13688 </indexterm>
13689 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13690 remains set afterwards, so in a filter file you can do things like this:
13691 </para>
13692 <literallayout class="monospaced">
13693 if "${run{x y z}{}}$runrc" is 1 then ...
13694   elif $runrc is 2 then ...
13695   ...
13696 endif
13697 </literallayout>
13698 <para>
13699 If execution of the command fails (for example, the command does not exist),
13700 the return code is 127 &ndash; the same code that shells use for non-existent
13701 commands.
13702 </para>
13703 <para>
13704 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13705 option values are expanded, except for those preconditions whose order of
13706 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13707 by the expansion of one option, and use it in another.
13708 </para>
13709 <para>
13710 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13711 out the use of this expansion item in filter files.
13712 </para>
13713 </listitem></varlistentry>
13714 <varlistentry>
13715 <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>
13716 <listitem>
13717 <para>
13718 <indexterm role="concept">
13719 <primary>expansion</primary>
13720 <secondary>string substitution</secondary>
13721 </indexterm>
13722 <indexterm role="concept">
13723 <primary><option>sg</option> expansion item</primary>
13724 </indexterm>
13725 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
13726 option; hence its name. However, unlike the Perl equivalent, Exim does not
13727 modify the subject string; instead it returns the modified string for insertion
13728 into the overall expansion. The item takes three arguments: the subject string,
13729 a regular expression, and a substitution string. For example:
13730 </para>
13731 <literallayout class="monospaced">
13732 ${sg{abcdefabcdef}{abc}{xyz}}
13733 </literallayout>
13734 <para>
13735 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13736 if any $ or \ characters are required in the regular expression or in the
13737 substitution string, they have to be escaped. For example:
13738 </para>
13739 <literallayout class="monospaced">
13740 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13741 </literallayout>
13742 <para>
13743 yields <quote>defabc</quote>, and
13744 </para>
13745 <literallayout class="monospaced">
13746 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13747 </literallayout>
13748 <para>
13749 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13750 the regular expression from string expansion.
13751 </para>
13752 </listitem></varlistentry>
13753 <varlistentry>
13754 <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>
13755 <listitem>
13756 <para>
13757 <indexterm role="concept">
13758 <primary><option>substr</option> expansion item</primary>
13759 </indexterm>
13760 <indexterm role="concept">
13761 <primary>substring extraction</primary>
13762 </indexterm>
13763 <indexterm role="concept">
13764 <primary>expansion</primary>
13765 <secondary>substring extraction</secondary>
13766 </indexterm>
13767 The three strings are expanded; the first two must yield numbers. Call them
13768 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13769 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13770 can use the simpler operator notation that avoids some of the braces:
13771 </para>
13772 <literallayout class="monospaced">
13773 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13774 </literallayout>
13775 <para>
13776 The second number is optional (in both notations).
13777 If it is absent in the simpler format, the preceding underscore must also be
13778 omitted.
13779 </para>
13780 <para>
13781 The <option>substr</option> item can be used to extract more general substrings than
13782 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
13783 length required. For example
13784 </para>
13785 <literallayout class="monospaced">
13786 ${substr{3}{2}{$local_part}}
13787 </literallayout>
13788 <para>
13789 If the starting offset is greater than the string length the result is the
13790 null string; if the length plus starting offset is greater than the string
13791 length, the result is the right-hand part of the string, starting from the
13792 given offset. The first character in the string has offset zero.
13793 </para>
13794 <para>
13795 The <option>substr</option> expansion item can take negative offset values to count
13796 from the right-hand end of its operand. The last character is offset -1, the
13797 second-last is offset -2, and so on. Thus, for example,
13798 </para>
13799 <literallayout class="monospaced">
13800 ${substr{-5}{2}{1234567}}
13801 </literallayout>
13802 <para>
13803 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13804 length of the string, the substring starts at the beginning of the string, and
13805 the length is reduced by the amount of overshoot. Thus, for example,
13806 </para>
13807 <literallayout class="monospaced">
13808 ${substr{-5}{2}{12}}
13809 </literallayout>
13810 <para>
13811 yields an empty string, but
13812 </para>
13813 <literallayout class="monospaced">
13814 ${substr{-3}{2}{12}}
13815 </literallayout>
13816 <para>
13817 yields <quote>1</quote>.
13818 </para>
13819 <para>
13820 When the second number is omitted from <option>substr</option>, the remainder of the string
13821 is taken if the offset is positive. If it is negative, all characters in the
13822 string preceding the offset point are taken. For example, an offset of -1 and
13823 no length, as in these semantically identical examples:
13824 </para>
13825 <literallayout class="monospaced">
13826 ${substr_-1:abcde}
13827 ${substr{-1}{abcde}}
13828 </literallayout>
13829 <para>
13830 yields all but the last character of the string, that is, <quote>abcd</quote>.
13831 </para>
13832 </listitem></varlistentry>
13833 <varlistentry>
13834 <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>
13835 <listitem>
13836 <para>
13837 <indexterm role="concept">
13838 <primary>expansion</primary>
13839 <secondary>character translation</secondary>
13840 </indexterm>
13841 <indexterm role="concept">
13842 <primary><option>tr</option> expansion item</primary>
13843 </indexterm>
13844 This item does single-character translation on its subject string. The second
13845 argument is a list of characters to be translated in the subject string. Each
13846 matching character is replaced by the corresponding character from the
13847 replacement list. For example
13848 </para>
13849 <literallayout class="monospaced">
13850 ${tr{abcdea}{ac}{13}}
13851 </literallayout>
13852 <para>
13853 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13854 last occurrence is used. If the third string is shorter than the second, its
13855 last character is replicated. However, if it is empty, no translation takes
13856 place.
13857 </para>
13858 </listitem></varlistentry>
13859 </variablelist>
13860 </section>
13861 <section id="SECTexpop">
13862 <title>Expansion operators</title>
13863 <para>
13864 <indexterm role="concept">
13865 <primary>expansion</primary>
13866 <secondary>operators</secondary>
13867 </indexterm>
13868 For expansion items that perform transformations on a single argument string,
13869 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13870 The substring is first expanded before the operation is applied to it. The
13871 following operations can be performed:
13872 </para>
13873 <variablelist>
13874 <varlistentry>
13875 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13876 <listitem>
13877 <para>
13878 <indexterm role="concept">
13879 <primary>expansion</primary>
13880 <secondary>RFC 2822 address handling</secondary>
13881 </indexterm>
13882 <indexterm role="concept">
13883 <primary><option>address</option> expansion item</primary>
13884 </indexterm>
13885 The string is interpreted as an RFC 2822 address, as it might appear in a
13886 header line, and the effective address is extracted from it. If the string does
13887 not parse successfully, the result is empty.
13888 </para>
13889 </listitem></varlistentry>
13890 <varlistentry>
13891 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13892 <listitem>
13893 <para>
13894 <indexterm role="concept">
13895 <primary>expansion</primary>
13896 <secondary>RFC 2822 address handling</secondary>
13897 </indexterm>
13898 <indexterm role="concept">
13899 <primary><option>addresses</option> expansion item</primary>
13900 </indexterm>
13901 The string (after expansion) is interpreted as a list of addresses in RFC
13902 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
13903 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
13904 result of the expansion is a colon-separated list, with appropriate
13905 doubling of colons should any happen to be present in the email addresses.
13906 Syntactically invalid RFC2822 address items are omitted from the output.
13907 </para>
13908 <para>
13909 It is possible to specify a character other than colon for the output
13910 separator by starting the string with &gt; followed by the new separator
13911 character. For example:
13912 </para>
13913 <literallayout class="monospaced">
13914 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
13915 </literallayout>
13916 <para>
13917 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
13918 expansion item, which extracts the working address from a single RFC2822
13919 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
13920 processing lists.
13921 </para>
13922 </listitem></varlistentry>
13923 <varlistentry>
13924 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13925 <listitem>
13926 <para>
13927 <indexterm role="concept">
13928 <primary><option>base62</option> expansion item</primary>
13929 </indexterm>
13930 <indexterm role="concept">
13931 <primary>expansion</primary>
13932 <secondary>conversion to base 62</secondary>
13933 </indexterm>
13934 The string must consist entirely of decimal digits. The number is converted to
13935 base 62 and output as a string of six characters, including leading zeros. In
13936 the few operating environments where Exim uses base 36 instead of base 62 for
13937 its message identifiers (because those systems do not have case-sensitive file
13938 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13939 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13940 </para>
13941 </listitem></varlistentry>
13942 <varlistentry>
13943 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13944 <listitem>
13945 <para>
13946 <indexterm role="concept">
13947 <primary><option>base62d</option> expansion item</primary>
13948 </indexterm>
13949 <indexterm role="concept">
13950 <primary>expansion</primary>
13951 <secondary>conversion to base 62</secondary>
13952 </indexterm>
13953 The string must consist entirely of base-62 digits, or, in operating
13954 environments where Exim uses base 36 instead of base 62 for its message
13955 identifiers, base-36 digits. The number is converted to decimal and output as a
13956 string.
13957 </para>
13958 </listitem></varlistentry>
13959 <varlistentry>
13960 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13961 <listitem>
13962 <para>
13963 <indexterm role="concept">
13964 <primary>domain</primary>
13965 <secondary>extraction</secondary>
13966 </indexterm>
13967 <indexterm role="concept">
13968 <primary>expansion</primary>
13969 <secondary>domain extraction</secondary>
13970 </indexterm>
13971 The string is interpreted as an RFC 2822 address and the domain is extracted
13972 from it. If the string does not parse successfully, the result is empty.
13973 </para>
13974 </listitem></varlistentry>
13975 <varlistentry>
13976 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13977 <listitem>
13978 <para>
13979 <indexterm role="concept">
13980 <primary>expansion</primary>
13981 <secondary>escaping non-printing characters</secondary>
13982 </indexterm>
13983 <indexterm role="concept">
13984 <primary><option>escape</option> expansion item</primary>
13985 </indexterm>
13986 If the string contains any non-printing characters, they are converted to
13987 escape sequences starting with a backslash. Whether characters with the most
13988 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13989 is controlled by the <option>print_topbitchars</option> option.
13990 </para>
13991 </listitem></varlistentry>
13992 <varlistentry>
13993 <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>
13994 <listitem>
13995 <para>
13996 <indexterm role="concept">
13997 <primary>expansion</primary>
13998 <secondary>expression evaluation</secondary>
13999 </indexterm>
14000 <indexterm role="concept">
14001 <primary>expansion</primary>
14002 <secondary>arithmetic expression</secondary>
14003 </indexterm>
14004 <indexterm role="concept">
14005 <primary><option>eval</option> expansion item</primary>
14006 </indexterm>
14007 These items supports simple arithmetic and bitwise logical operations in
14008 expansion strings. The string (after expansion) must be a conventional
14009 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14010 logical operators, and parentheses. All operations are carried out using
14011 integer arithmetic. The operator priorities are as follows (the same as in the
14012 C programming language):
14013 </para>
14014 <informaltable frame="none">
14015 <tgroup cols="2" colsep="0" rowsep="0">
14016 <colspec colwidth="70pt" align="left"/>
14017 <colspec colwidth="300pt" align="left"/>
14018 <tbody>
14019 <row>
14020 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14021 <entry>not (~), negate (-)</entry>
14022 </row>
14023 <row>
14024 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14025 <entry>multiply (*), divide (/), remainder (%)</entry>
14026 </row>
14027 <row>
14028 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14029 <entry>plus (+), minus (-)</entry>
14030 </row>
14031 <row>
14032 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14033 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14034 </row>
14035 <row>
14036 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14037 <entry>and (&amp;)</entry>
14038 </row>
14039 <row>
14040 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14041 <entry>xor (^)</entry>
14042 </row>
14043 <row>
14044 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14045 <entry>or (|)</entry>
14046 </row>
14047 </tbody>
14048 </tgroup>
14049 </informaltable>
14050 <para>
14051 Binary operators with the same priority are evaluated from left to right. White
14052 space is permitted before or after operators.
14053 </para>
14054 <para>
14055 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14056 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14057 decimal, even if they start with a leading zero; hexadecimal numbers are not
14058 permitted. This can be useful when processing numbers extracted from dates or
14059 times, which often do have leading zeros.
14060 </para>
14061 <para>
14062 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
14063 respectively. Negative numbers are supported. The result of the computation is
14064 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
14065 </para>
14066 <literallayout>
14067 <literal>${eval:1+1}            </literal>  yields 2
14068 <literal>${eval:1+2*3}          </literal>  yields 7
14069 <literal>${eval:(1+2)*3}        </literal>  yields 9
14070 <literal>${eval:2+42%5}         </literal>  yields 4
14071 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14072 <literal>${eval:0xc|5}          </literal>  yields 13
14073 <literal>${eval:0xc^5}          </literal>  yields 9
14074 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14075 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14076 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14077 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14078 </literallayout>
14079 <para>
14080 As a more realistic example, in an ACL you might have
14081 </para>
14082 <literallayout class="monospaced">
14083 deny   message = Too many bad recipients
14084        condition =                    \
14085          ${if and {                   \
14086            {&gt;{$rcpt_count}{10}}       \
14087            {                          \
14088            &lt;                          \
14089              {$recipients_count}      \
14090              {${eval:$rcpt_count/2}}  \
14091            }                          \
14092          }{yes}{no}}
14093 </literallayout>
14094 <para>
14095 The condition is true if there have been more than 10 RCPT commands and
14096 fewer than half of them have resulted in a valid recipient.
14097 </para>
14098 </listitem></varlistentry>
14099 <varlistentry>
14100 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14101 <listitem>
14102 <para>
14103 <indexterm role="concept">
14104 <primary>expansion</primary>
14105 <secondary>re-expansion of substring</secondary>
14106 </indexterm>
14107 The <option>expand</option> operator causes a string to be expanded for a second time. For
14108 example,
14109 </para>
14110 <literallayout class="monospaced">
14111 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14112 </literallayout>
14113 <para>
14114 first looks up a string in a file while expanding the operand for <option>expand</option>,
14115 and then re-expands what it has found.
14116 </para>
14117 </listitem></varlistentry>
14118 <varlistentry>
14119 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14120 <listitem>
14121 <para>
14122 <indexterm role="concept">
14123 <primary>Unicode</primary>
14124 </indexterm>
14125 <indexterm role="concept">
14126 <primary>UTF-8</primary>
14127 <secondary>conversion from</secondary>
14128 </indexterm>
14129 <indexterm role="concept">
14130 <primary>expansion</primary>
14131 <secondary>UTF-8 conversion</secondary>
14132 </indexterm>
14133 <indexterm role="concept">
14134 <primary><option>from_utf8</option> expansion item</primary>
14135 </indexterm>
14136 The world is slowly moving towards Unicode, although there are no standards for
14137 email yet. However, other applications (including some databases) are starting
14138 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14139 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14140 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14141 the result is an undefined sequence of bytes.
14142 </para>
14143 <para>
14144 Unicode code points with values less than 256 are compatible with ASCII and
14145 ISO-8859-1 (also known as Latin-1).
14146 For example, character 169 is the copyright symbol in both cases, though the
14147 way it is encoded is different. In UTF-8, more than one byte is needed for
14148 characters with code values greater than 127, whereas ISO-8859-1 is a
14149 single-byte encoding (but thereby limited to 256 characters). This makes
14150 translation from UTF-8 to ISO-8859-1 straightforward.
14151 </para>
14152 </listitem></varlistentry>
14153 <varlistentry>
14154 <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>
14155 <listitem>
14156 <para>
14157 <indexterm role="concept">
14158 <primary>hash function</primary>
14159 <secondary>textual</secondary>
14160 </indexterm>
14161 <indexterm role="concept">
14162 <primary>expansion</primary>
14163 <secondary>textual hash</secondary>
14164 </indexterm>
14165 The <option>hash</option> operator is a simpler interface to the hashing function that can
14166 be used when the two parameters are fixed numbers (as opposed to strings that
14167 change when expanded). The effect is the same as
14168 </para>
14169 <literallayout class="monospaced">
14170 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14171 </literallayout>
14172 <para>
14173 See the description of the general <option>hash</option> item above for details. The
14174 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14175 </para>
14176 </listitem></varlistentry>
14177 <varlistentry>
14178 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14179 <listitem>
14180 <para>
14181 <indexterm role="concept">
14182 <primary>base64 encoding</primary>
14183 <secondary>conversion from hex</secondary>
14184 </indexterm>
14185 <indexterm role="concept">
14186 <primary>expansion</primary>
14187 <secondary>hex to base64</secondary>
14188 </indexterm>
14189 <indexterm role="concept">
14190 <primary><option>hex2b64</option> expansion item</primary>
14191 </indexterm>
14192 This operator converts a hex string into one that is base64 encoded. This can
14193 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14194 </para>
14195 </listitem></varlistentry>
14196 <varlistentry>
14197 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14198 <listitem>
14199 <para>
14200 <indexterm role="concept">
14201 <primary>case forcing in strings</primary>
14202 </indexterm>
14203 <indexterm role="concept">
14204 <primary>string</primary>
14205 <secondary>case forcing</secondary>
14206 </indexterm>
14207 <indexterm role="concept">
14208 <primary>lower casing</primary>
14209 </indexterm>
14210 <indexterm role="concept">
14211 <primary>expansion</primary>
14212 <secondary>case forcing</secondary>
14213 </indexterm>
14214 <indexterm role="concept">
14215 <primary><option>lc</option> expansion item</primary>
14216 </indexterm>
14217 This forces the letters in the string into lower-case, for example:
14218 </para>
14219 <literallayout class="monospaced">
14220 ${lc:$local_part}
14221 </literallayout>
14222 </listitem></varlistentry>
14223 <varlistentry>
14224 <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>
14225 <listitem>
14226 <para>
14227 <indexterm role="concept">
14228 <primary>expansion</primary>
14229 <secondary>string truncation</secondary>
14230 </indexterm>
14231 <indexterm role="concept">
14232 <primary><option>length</option> expansion item</primary>
14233 </indexterm>
14234 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14235 can be used when the parameter is a fixed number (as opposed to a string that
14236 changes when expanded). The effect is the same as
14237 </para>
14238 <literallayout class="monospaced">
14239 ${length{&lt;number&gt;}{&lt;string&gt;}}
14240 </literallayout>
14241 <para>
14242 See the description of the general <option>length</option> item above for details. Note that
14243 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14244 when <option>length</option> is used as an operator.
14245 </para>
14246 </listitem></varlistentry>
14247 <varlistentry>
14248 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14249 <listitem>
14250 <para>
14251 <indexterm role="concept">
14252 <primary>expansion</primary>
14253 <secondary>local part extraction</secondary>
14254 </indexterm>
14255 <indexterm role="concept">
14256 <primary><option>local_part</option> expansion item</primary>
14257 </indexterm>
14258 The string is interpreted as an RFC 2822 address and the local part is
14259 extracted from it. If the string does not parse successfully, the result is
14260 empty.
14261 </para>
14262 </listitem></varlistentry>
14263 <varlistentry>
14264 <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>
14265 <listitem>
14266 <para>
14267 <indexterm role="concept">
14268 <primary>masked IP address</primary>
14269 </indexterm>
14270 <indexterm role="concept">
14271 <primary>IP address</primary>
14272 <secondary>masking</secondary>
14273 </indexterm>
14274 <indexterm role="concept">
14275 <primary>CIDR notation</primary>
14276 </indexterm>
14277 <indexterm role="concept">
14278 <primary>expansion</primary>
14279 <secondary>IP address masking</secondary>
14280 </indexterm>
14281 <indexterm role="concept">
14282 <primary><option>mask</option> expansion item</primary>
14283 </indexterm>
14284 If the form of the string to be operated on is not an IP address followed by a
14285 slash and an integer (that is, a network address in CIDR notation), the
14286 expansion fails. Otherwise, this operator converts the IP address to binary,
14287 masks off the least significant bits according to the bit count, and converts
14288 the result back to text, with mask appended. For example,
14289 </para>
14290 <literallayout class="monospaced">
14291 ${mask:10.111.131.206/28}
14292 </literallayout>
14293 <para>
14294 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14295 be mostly used for looking up masked addresses in files, the result for an IPv6
14296 address uses dots to separate components instead of colons, because colon
14297 terminates a key string in lsearch files. So, for example,
14298 </para>
14299 <literallayout class="monospaced">
14300 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14301 </literallayout>
14302 <para>
14303 returns the string
14304 </para>
14305 <literallayout class="monospaced">
14306 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14307 </literallayout>
14308 <para>
14309 Letters in IPv6 addresses are always output in lower case.
14310 </para>
14311 </listitem></varlistentry>
14312 <varlistentry>
14313 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14314 <listitem>
14315 <para>
14316 <indexterm role="concept">
14317 <primary>MD5 hash</primary>
14318 </indexterm>
14319 <indexterm role="concept">
14320 <primary>expansion</primary>
14321 <secondary>MD5 hash</secondary>
14322 </indexterm>
14323 <indexterm role="concept">
14324 <primary><option>md5</option> expansion item</primary>
14325 </indexterm>
14326 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14327 as a 32-digit hexadecimal number, in which any letters are in lower case.
14328 </para>
14329 </listitem></varlistentry>
14330 <varlistentry>
14331 <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>
14332 <listitem>
14333 <para>
14334 <indexterm role="concept">
14335 <primary>expansion</primary>
14336 <secondary>numeric hash</secondary>
14337 </indexterm>
14338 <indexterm role="concept">
14339 <primary>hash function</primary>
14340 <secondary>numeric</secondary>
14341 </indexterm>
14342 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14343 that can be used when the two parameters are fixed numbers (as opposed to
14344 strings that change when expanded). The effect is the same as
14345 </para>
14346 <literallayout class="monospaced">
14347 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14348 </literallayout>
14349 <para>
14350 See the description of the general <option>nhash</option> item above for details.
14351 </para>
14352 </listitem></varlistentry>
14353 <varlistentry>
14354 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14355 <listitem>
14356 <para>
14357 <indexterm role="concept">
14358 <primary>quoting</primary>
14359 <secondary>in string expansions</secondary>
14360 </indexterm>
14361 <indexterm role="concept">
14362 <primary>expansion</primary>
14363 <secondary>quoting</secondary>
14364 </indexterm>
14365 <indexterm role="concept">
14366 <primary><option>quote</option> expansion item</primary>
14367 </indexterm>
14368 The <option>quote</option> operator puts its argument into double quotes if it
14369 is an empty string or
14370 contains anything other than letters, digits, underscores, dots, and hyphens.
14371 Any occurrences of double quotes and backslashes are escaped with a backslash.
14372 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14373 respectively For example,
14374 </para>
14375 <literallayout class="monospaced">
14376 ${quote:ab"*"cd}
14377 </literallayout>
14378 <para>
14379 becomes
14380 </para>
14381 <literallayout class="monospaced">
14382 "ab\"*\"cd"
14383 </literallayout>
14384 <para>
14385 The place where this is useful is when the argument is a substitution from a
14386 variable or a message header.
14387 </para>
14388 </listitem></varlistentry>
14389 <varlistentry>
14390 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14391 <listitem>
14392 <para>
14393 <indexterm role="concept">
14394 <primary><option>quote_local_part</option> expansion item</primary>
14395 </indexterm>
14396 This operator is like <option>quote</option>, except that it quotes the string only if
14397 required to do so by the rules of RFC 2822 for quoting local parts. For
14398 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14399 If you are creating a new email address from the contents of <varname>$local_part</varname>
14400 (or any other unknown data), you should always use this operator.
14401 </para>
14402 </listitem></varlistentry>
14403 <varlistentry>
14404 <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>
14405 <listitem>
14406 <para>
14407 <indexterm role="concept">
14408 <primary>quoting</primary>
14409 <secondary>lookup-specific</secondary>
14410 </indexterm>
14411 This operator applies lookup-specific quoting rules to the string. Each
14412 query-style lookup type has its own quoting rules which are described with
14413 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14414 </para>
14415 <literallayout class="monospaced">
14416 ${quote_ldap:two * two}
14417 </literallayout>
14418 <para>
14419 returns
14420 </para>
14421 <literallayout class="monospaced">
14422 two%20%5C2A%20two
14423 </literallayout>
14424 <para>
14425 For single-key lookup types, no quoting is ever necessary and this operator
14426 yields an unchanged string.
14427 </para>
14428 </listitem></varlistentry>
14429 <varlistentry>
14430 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14431 <listitem>
14432 <para>
14433 <indexterm role="concept">
14434 <primary>expansion</primary>
14435 <secondary>RFC 2047</secondary>
14436 </indexterm>
14437 <indexterm role="concept">
14438 <primary>RFC 2047</primary>
14439 <secondary>expansion operator</secondary>
14440 </indexterm>
14441 <indexterm role="concept">
14442 <primary><option>rfc2047</option> expansion item</primary>
14443 </indexterm>
14444 This operator encodes text according to the rules of RFC 2047. This is an
14445 encoding that is used in header lines to encode non-ASCII characters. It is
14446 assumed that the input string is in the encoding specified by the
14447 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14448 contains only characters in the range 33&ndash;126, and no instances of the
14449 characters
14450 </para>
14451 <literallayout class="monospaced">
14452 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
14453 </literallayout>
14454 <para>
14455 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14456 string, using as many <quote>encoded words</quote> as necessary to encode all the
14457 characters.
14458 </para>
14459 </listitem></varlistentry>
14460 <varlistentry>
14461 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14462 <listitem>
14463 <para>
14464 <indexterm role="concept">
14465 <primary>expansion</primary>
14466 <secondary>RFC 2047</secondary>
14467 </indexterm>
14468 <indexterm role="concept">
14469 <primary>RFC 2047</primary>
14470 <secondary>decoding</secondary>
14471 </indexterm>
14472 <indexterm role="concept">
14473 <primary><option>rfc2047d</option> expansion item</primary>
14474 </indexterm>
14475 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14476 bytes are replaced by question marks. Characters are converted into the
14477 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14478 not recognized unless <option>check_rfc2047_length</option> is set false.
14479 </para>
14480 <para revisionflag="changed">
14481 <emphasis role="bold">Note</emphasis>: If you use <option>$header</option>_<emphasis>xxx</emphasis><emphasis role="bold">:</emphasis> (or <option>$h</option>_<emphasis>xxx</emphasis><emphasis role="bold">:</emphasis>) to
14482 access a header line, RFC 2047 decoding is done automatically. You do not need
14483 to use this operator as well.
14484 </para>
14485 </listitem></varlistentry>
14486 <varlistentry>
14487 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14488 <listitem>
14489 <para>
14490 <indexterm role="concept">
14491 <primary>quoting</primary>
14492 <secondary>in regular expressions</secondary>
14493 </indexterm>
14494 <indexterm role="concept">
14495 <primary>regular expressions</primary>
14496 <secondary>quoting</secondary>
14497 </indexterm>
14498 <indexterm role="concept">
14499 <primary><option>rxquote</option> expansion item</primary>
14500 </indexterm>
14501 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14502 characters in its argument. This is useful when substituting the values of
14503 variables or headers inside regular expressions.
14504 </para>
14505 </listitem></varlistentry>
14506 <varlistentry>
14507 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14508 <listitem>
14509 <para>
14510 <indexterm role="concept">
14511 <primary>SHA-1 hash</primary>
14512 </indexterm>
14513 <indexterm role="concept">
14514 <primary>expansion</primary>
14515 <secondary>SHA-1 hashing</secondary>
14516 </indexterm>
14517 <indexterm role="concept">
14518 <primary><option>sha2</option> expansion item</primary>
14519 </indexterm>
14520 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14521 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14522 </para>
14523 </listitem></varlistentry>
14524 <varlistentry>
14525 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14526 <listitem>
14527 <para>
14528 <indexterm role="concept">
14529 <primary>expansion</primary>
14530 <secondary>statting a file</secondary>
14531 </indexterm>
14532 <indexterm role="concept">
14533 <primary>file</primary>
14534 <secondary>extracting characteristics</secondary>
14535 </indexterm>
14536 <indexterm role="concept">
14537 <primary><option>stat</option> expansion item</primary>
14538 </indexterm>
14539 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14540 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14541 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14542 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
14543 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14544 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14545 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14546 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14547 can extract individual fields using the <option>extract</option> expansion item.
14548 </para>
14549 <para>
14550 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
14551 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14552 systems for files larger than 2GB.
14553 </para>
14554 </listitem></varlistentry>
14555 <varlistentry>
14556 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14557 <listitem>
14558 <para>
14559 <indexterm role="concept">
14560 <primary>expansion</primary>
14561 <secondary>base64 encoding</secondary>
14562 </indexterm>
14563 <indexterm role="concept">
14564 <primary>base64 encoding</primary>
14565 <secondary>in string expansion</secondary>
14566 </indexterm>
14567 <indexterm role="concept">
14568 <primary><option>str2b64</option> expansion item</primary>
14569 </indexterm>
14570 This operator converts a string into one that is base64 encoded.
14571 </para>
14572 </listitem></varlistentry>
14573 <varlistentry>
14574 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14575 <listitem>
14576 <para>
14577 <indexterm role="concept">
14578 <primary>expansion</primary>
14579 <secondary>string length</secondary>
14580 </indexterm>
14581 <indexterm role="concept">
14582 <primary>string</primary>
14583 <secondary>length in expansion</secondary>
14584 </indexterm>
14585 <indexterm role="concept">
14586 <primary><option>strlen</option> expansion item</primary>
14587 </indexterm>
14588 The item is replace by the length of the expanded string, expressed as a
14589 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14590 </para>
14591 </listitem></varlistentry>
14592 <varlistentry>
14593 <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>
14594 <listitem>
14595 <para>
14596 <indexterm role="concept">
14597 <primary><option>substr</option> expansion item</primary>
14598 </indexterm>
14599 <indexterm role="concept">
14600 <primary>substring extraction</primary>
14601 </indexterm>
14602 <indexterm role="concept">
14603 <primary>expansion</primary>
14604 <secondary>substring expansion</secondary>
14605 </indexterm>
14606 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14607 can be used when the two parameters are fixed numbers (as opposed to strings
14608 that change when expanded). The effect is the same as
14609 </para>
14610 <literallayout class="monospaced">
14611 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
14612 </literallayout>
14613 <para>
14614 See the description of the general <option>substr</option> item above for details. The
14615 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14616 </para>
14617 </listitem></varlistentry>
14618 <varlistentry>
14619 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14620 <listitem>
14621 <para>
14622 <indexterm role="concept">
14623 <primary><option>time_eval</option> expansion item</primary>
14624 </indexterm>
14625 <indexterm role="concept">
14626 <primary>time interval</primary>
14627 <secondary>decoding</secondary>
14628 </indexterm>
14629 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14630 seconds.
14631 </para>
14632 </listitem></varlistentry>
14633 <varlistentry>
14634 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14635 <listitem>
14636 <para>
14637 <indexterm role="concept">
14638 <primary><option>time_interval</option> expansion item</primary>
14639 </indexterm>
14640 <indexterm role="concept">
14641 <primary>time interval</primary>
14642 <secondary>formatting</secondary>
14643 </indexterm>
14644 The argument (after sub-expansion) must be a sequence of decimal digits that
14645 represents an interval of time as a number of seconds. It is converted into a
14646 number of larger units and output in Exim&#x2019;s normal time format, for example,
14647 <literal>1w3d4h2m6s</literal>.
14648 </para>
14649 </listitem></varlistentry>
14650 <varlistentry>
14651 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14652 <listitem>
14653 <para>
14654 <indexterm role="concept">
14655 <primary>case forcing in strings</primary>
14656 </indexterm>
14657 <indexterm role="concept">
14658 <primary>string</primary>
14659 <secondary>case forcing</secondary>
14660 </indexterm>
14661 <indexterm role="concept">
14662 <primary>upper casing</primary>
14663 </indexterm>
14664 <indexterm role="concept">
14665 <primary>expansion</primary>
14666 <secondary>case forcing</secondary>
14667 </indexterm>
14668 <indexterm role="concept">
14669 <primary><option>uc</option> expansion item</primary>
14670 </indexterm>
14671 This forces the letters in the string into upper-case.
14672 </para>
14673 </listitem></varlistentry>
14674 </variablelist>
14675 </section>
14676 <section id="SECTexpcond">
14677 <title>Expansion conditions</title>
14678 <para>
14679 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14680 <primary>expansion</primary>
14681 <secondary>conditions</secondary>
14682 </indexterm>
14683 The following conditions are available for testing by the <option>${if</option> construct
14684 while expanding strings:
14685 </para>
14686 <variablelist>
14687 <varlistentry>
14688 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
14689 <listitem>
14690 <para>
14691 <indexterm role="concept">
14692 <primary>expansion</primary>
14693 <secondary>negating a condition</secondary>
14694 </indexterm>
14695 <indexterm role="concept">
14696 <primary>negation</primary>
14697 <secondary>in expansion condition</secondary>
14698 </indexterm>
14699 Preceding any condition with an exclamation mark negates the result of the
14700 condition.
14701 </para>
14702 </listitem></varlistentry>
14703 <varlistentry>
14704 <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>
14705 <listitem>
14706 <para>
14707 <indexterm role="concept">
14708 <primary>numeric comparison</primary>
14709 </indexterm>
14710 <indexterm role="concept">
14711 <primary>expansion</primary>
14712 <secondary>numeric comparison</secondary>
14713 </indexterm>
14714 There are a number of symbolic operators for doing numeric comparisons. They
14715 are:
14716 </para>
14717 <literallayout>
14718 <literal>=   </literal>   equal
14719 <literal>==  </literal>   equal
14720 <literal>&gt;   </literal>   greater
14721 <literal>&gt;=  </literal>   greater or equal
14722 <literal>&lt;   </literal>   less
14723 <literal>&lt;=  </literal>   less or equal
14724 </literallayout>
14725 <para>
14726 For example:
14727 </para>
14728 <literallayout class="monospaced">
14729 ${if &gt;{$message_size}{10M} ...
14730 </literallayout>
14731 <para>
14732 Note that the general negation operator provides for inequality testing. The
14733 two strings must take the form of optionally signed decimal integers,
14734 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14735 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14736 As a special case, the numerical value of an empty string is taken as
14737 zero.
14738 </para>
14739 </listitem></varlistentry>
14740 <varlistentry>
14741 <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>
14742 <listitem>
14743 <para>
14744 <indexterm role="concept">
14745 <primary>expansion</primary>
14746 <secondary>encrypted comparison</secondary>
14747 </indexterm>
14748 <indexterm role="concept">
14749 <primary>encrypted strings, comparing</primary>
14750 </indexterm>
14751 <indexterm role="concept">
14752 <primary><option>crypteq</option> expansion condition</primary>
14753 </indexterm>
14754 This condition is included in the Exim binary if it is built to support any
14755 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14756 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14757 included in the binary.
14758 </para>
14759 <para>
14760 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14761 compared against the second, which is already encrypted. The second string may
14762 be in the LDAP form for storing encrypted strings, which starts with the
14763 encryption type in curly brackets, followed by the data. If the second string
14764 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14765 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14766 Typically this will be a field from a password file. An example of an encrypted
14767 string in LDAP form is:
14768 </para>
14769 <literallayout class="monospaced">
14770 {md5}CY9rzUYh03PK3k6DJie09g==
14771 </literallayout>
14772 <para>
14773 If such a string appears directly in an expansion, the curly brackets have to
14774 be quoted, because they are part of the expansion syntax. For example:
14775 </para>
14776 <literallayout class="monospaced">
14777 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14778 </literallayout>
14779 <para>
14780 The following encryption types (whose names are matched case-independently) are
14781 supported:
14782 </para>
14783 <itemizedlist>
14784 <listitem>
14785 <para>
14786 <indexterm role="concept">
14787 <primary>MD5 hash</primary>
14788 </indexterm>
14789 <indexterm role="concept">
14790 <primary>base64 encoding</primary>
14791 <secondary>in encrypted password</secondary>
14792 </indexterm>
14793 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14794 printable characters to compare with the remainder of the second string. If the
14795 length of the comparison string is 24, Exim assumes that it is base64 encoded
14796 (as in the above example). If the length is 32, Exim assumes that it is a
14797 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14798 comparison fails.
14799 </para>
14800 </listitem>
14801 <listitem>
14802 <para>
14803 <indexterm role="concept">
14804 <primary>SHA-1 hash</primary>
14805 </indexterm>
14806 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14807 printable characters to compare with the remainder of the second string. If the
14808 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14809 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14810 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14811 </para>
14812 </listitem>
14813 <listitem>
14814 <para>
14815 <indexterm role="concept">
14816 <primary><function>crypt()</function></primary>
14817 </indexterm>
14818 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14819 only the first eight characters of the password. However, in modern operating
14820 systems this is no longer true, and in many cases the entire password is used,
14821 whatever its length.
14822 </para>
14823 </listitem>
14824 <listitem>
14825 <para>
14826 <indexterm role="concept">
14827 <primary><function>crypt16()</function></primary>
14828 </indexterm>
14829 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
14830 use up to 16 characters of the password in some operating systems. Again, in
14831 modern operating systems, more characters may be used.
14832 </para>
14833 </listitem>
14834 </itemizedlist>
14835 <para>
14836 Exim has its own version of <function>crypt16()</function>, which is just a double call to
14837 <function>crypt()</function>. For operating systems that have their own version, setting
14838 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14839 operating system version instead of its own. This option is set by default in
14840 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14841 support <function>crypt16()</function>.
14842 </para>
14843 <para>
14844 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
14845 it was not using the same algorithm as some operating systems&#x2019; versions. It
14846 turns out that as well as <function>crypt16()</function> there is a function called
14847 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
14848 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
14849 </para>
14850 <para>
14851 However, since there is now a move away from the traditional <function>crypt()</function>
14852 functions towards using SHA1 and other algorithms, tidying up this area of
14853 Exim is seen as very low priority.
14854 </para>
14855 <para>
14856 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
14857 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
14858 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
14859 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
14860 function by specifying it explicitly in curly brackets.
14861 </para>
14862 </listitem></varlistentry>
14863 <varlistentry>
14864 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
14865 <listitem>
14866 <para>
14867 <indexterm role="concept">
14868 <primary>expansion</primary>
14869 <secondary>checking for empty variable</secondary>
14870 </indexterm>
14871 <indexterm role="concept">
14872 <primary><option>def</option> expansion condition</primary>
14873 </indexterm>
14874 The <option>def</option> condition must be followed by the name of one of the expansion
14875 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14876 variable does not contain the empty string. For example:
14877 </para>
14878 <literallayout class="monospaced">
14879 ${if def:sender_ident {from $sender_ident}}
14880 </literallayout>
14881 <para>
14882 Note that the variable name is given without a leading <option>$</option> character. If the
14883 variable does not exist, the expansion fails.
14884 </para>
14885 </listitem></varlistentry>
14886 <varlistentry>
14887 <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>
14888 <listitem>
14889 <para>
14890 <indexterm role="concept">
14891 <primary>expansion</primary>
14892 <secondary>checking header line existence</secondary>
14893 </indexterm>
14894 This condition is true if a message is being processed and the named header
14895 exists in the message. For example,
14896 </para>
14897 <literallayout class="monospaced">
14898 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14899 </literallayout>
14900 <para>
14901 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14902 the header name must be terminated by a colon if white space does not follow.
14903 </para>
14904 </listitem></varlistentry>
14905 <varlistentry>
14906 <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>
14907 <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>
14908 <listitem>
14909 <para>
14910 <indexterm role="concept">
14911 <primary>string</primary>
14912 <secondary>comparison</secondary>
14913 </indexterm>
14914 <indexterm role="concept">
14915 <primary>expansion</primary>
14916 <secondary>string comparison</secondary>
14917 </indexterm>
14918 <indexterm role="concept">
14919 <primary><option>eq</option> expansion condition</primary>
14920 </indexterm>
14921 <indexterm role="concept">
14922 <primary><option>eqi</option> expansion condition</primary>
14923 </indexterm>
14924 The two substrings are first expanded. The condition is true if the two
14925 resulting strings are identical. For <option>eq</option> the comparison includes the case of
14926 letters, whereas for <option>eqi</option> the comparison is case-independent.
14927 </para>
14928 </listitem></varlistentry>
14929 <varlistentry>
14930 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14931 <listitem>
14932 <para>
14933 <indexterm role="concept">
14934 <primary>expansion</primary>
14935 <secondary>file existence test</secondary>
14936 </indexterm>
14937 <indexterm role="concept">
14938 <primary>file</primary>
14939 <secondary>existence test</secondary>
14940 </indexterm>
14941 <indexterm role="concept">
14942 <primary><option>exists</option>, expansion condition</primary>
14943 </indexterm>
14944 The substring is first expanded and then interpreted as an absolute path. The
14945 condition is true if the named file (or directory) exists. The existence test
14946 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14947 users&#x2019; filter files may be locked out by the system administrator.
14948 </para>
14949 </listitem></varlistentry>
14950 <varlistentry>
14951 <term><emphasis role="bold">first_delivery</emphasis></term>
14952 <listitem>
14953 <para>
14954 <indexterm role="concept">
14955 <primary>delivery</primary>
14956 <secondary>first</secondary>
14957 </indexterm>
14958 <indexterm role="concept">
14959 <primary>first delivery</primary>
14960 </indexterm>
14961 <indexterm role="concept">
14962 <primary>expansion</primary>
14963 <secondary>first delivery test</secondary>
14964 </indexterm>
14965 <indexterm role="concept">
14966 <primary><option>first_delivery</option> expansion condition</primary>
14967 </indexterm>
14968 This condition, which has no data, is true during a message&#x2019;s first delivery
14969 attempt. It is false during any subsequent delivery attempts.
14970 </para>
14971 </listitem></varlistentry>
14972 <varlistentry>
14973 <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>
14974 <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>
14975 <listitem>
14976 <para>
14977 <indexterm role="concept">
14978 <primary>list</primary>
14979 <secondary>iterative conditions</secondary>
14980 </indexterm>
14981 <indexterm role="concept">
14982 <primary>expansion</primary>
14983 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
14984 </indexterm>
14985 <indexterm role="concept">
14986 <primary>expansion</primary>
14987 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
14988 </indexterm>
14989 <indexterm role="variable">
14990 <primary><varname>$item</varname></primary>
14991 </indexterm>
14992 These conditions iterate over a list. The first argument is expanded to form
14993 the list. By default, the list separator is a colon, but it can be changed by
14994 the normal method. The second argument is interpreted as a condition that is to
14995 be applied to each item in the list in turn. During the interpretation of the
14996 condition, the current list item is placed in a variable called <varname>$item</varname>.
14997 </para>
14998 <itemizedlist>
14999 <listitem>
15000 <para>
15001 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15002 the result of the whole condition is true. If the condition is false for all
15003 items in the list, the overall condition is false.
15004 </para>
15005 </listitem>
15006 <listitem>
15007 <para>
15008 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15009 and the result of the whole condition is false. If the condition is true for
15010 all items in the list, the overall condition is true.
15011 </para>
15012 </listitem>
15013 </itemizedlist>
15014 <para>
15015 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15016 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15017 that the condition must be false for at least one item. In this example, the
15018 list separator is changed to a comma:
15019 </para>
15020 <literallayout class="monospaced">
15021 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
15022 </literallayout>
15023 <para>
15024 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15025 being processed, to enable these expansion items to be nested.
15026 </para>
15027 </listitem></varlistentry>
15028 <varlistentry>
15029 <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>
15030 <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>
15031 <listitem>
15032 <para>
15033 <indexterm role="concept">
15034 <primary>string</primary>
15035 <secondary>comparison</secondary>
15036 </indexterm>
15037 <indexterm role="concept">
15038 <primary>expansion</primary>
15039 <secondary>string comparison</secondary>
15040 </indexterm>
15041 <indexterm role="concept">
15042 <primary><option>ge</option> expansion condition</primary>
15043 </indexterm>
15044 <indexterm role="concept">
15045 <primary><option>gei</option> expansion condition</primary>
15046 </indexterm>
15047 The two substrings are first expanded. The condition is true if the first
15048 string is lexically greater than or equal to the second string. For <option>ge</option> the
15049 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15050 case-independent.
15051 </para>
15052 </listitem></varlistentry>
15053 <varlistentry>
15054 <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>
15055 <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>
15056 <listitem>
15057 <para>
15058 <indexterm role="concept">
15059 <primary>string</primary>
15060 <secondary>comparison</secondary>
15061 </indexterm>
15062 <indexterm role="concept">
15063 <primary>expansion</primary>
15064 <secondary>string comparison</secondary>
15065 </indexterm>
15066 <indexterm role="concept">
15067 <primary><option>gt</option> expansion condition</primary>
15068 </indexterm>
15069 <indexterm role="concept">
15070 <primary><option>gti</option> expansion condition</primary>
15071 </indexterm>
15072 The two substrings are first expanded. The condition is true if the first
15073 string is lexically greater than the second string. For <option>gt</option> the comparison
15074 includes the case of letters, whereas for <option>gti</option> the comparison is
15075 case-independent.
15076 </para>
15077 </listitem></varlistentry>
15078 <varlistentry>
15079 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15080 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15081 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15082 <listitem>
15083 <para>
15084 <indexterm role="concept">
15085 <primary>IP address</primary>
15086 <secondary>testing string format</secondary>
15087 </indexterm>
15088 <indexterm role="concept">
15089 <primary>string</primary>
15090 <secondary>testing for IP address</secondary>
15091 </indexterm>
15092 <indexterm role="concept">
15093 <primary><option>isip</option> expansion condition</primary>
15094 </indexterm>
15095 <indexterm role="concept">
15096 <primary><option>isip4</option> expansion condition</primary>
15097 </indexterm>
15098 <indexterm role="concept">
15099 <primary><option>isip6</option> expansion condition</primary>
15100 </indexterm>
15101 The substring is first expanded, and then tested to see if it has the form of
15102 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15103 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15104 </para>
15105 <para revisionflag="changed">
15106 For an IPv4 address, the test is for four dot-separated components, each of
15107 which consists of from one to three digits. For an IPv6 address, up to eight
15108 colon-separated components are permitted, each containing from one to four
15109 hexadecimal digits. There may be fewer than eight components if an empty
15110 component (adjacent colons) is present. Only one empty component is permitted.
15111 </para>
15112 <para revisionflag="changed">
15113 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15114 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15115 check. The main use of these tests is to distinguish between IP addresses and
15116 host names, or between IPv4 and IPv6 addresses. For example, you could use
15117 </para>
15118 <literallayout class="monospaced" revisionflag="changed">
15119 ${if isip4{$sender_host_address}...
15120 </literallayout>
15121 <para revisionflag="changed">
15122 to test which IP version an incoming SMTP connection is using.
15123 </para>
15124 </listitem></varlistentry>
15125 <varlistentry>
15126 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15127 <listitem>
15128 <para>
15129 <indexterm role="concept">
15130 <primary>LDAP</primary>
15131 <secondary>use for authentication</secondary>
15132 </indexterm>
15133 <indexterm role="concept">
15134 <primary>expansion</primary>
15135 <secondary>LDAP authentication test</secondary>
15136 </indexterm>
15137 <indexterm role="concept">
15138 <primary><option>ldapauth</option> expansion condition</primary>
15139 </indexterm>
15140 This condition supports user authentication using LDAP. See section
15141 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15142 queries. For this use, the query must contain a user name and password. The
15143 query itself is not used, and can be empty. The condition is true if the
15144 password is not empty, and the user name and password are accepted by the LDAP
15145 server. An empty password is rejected without calling LDAP because LDAP binds
15146 with an empty password are considered anonymous regardless of the username, and
15147 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15148 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15149 this can be used.
15150 </para>
15151 </listitem></varlistentry>
15152 <varlistentry>
15153 <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>
15154 <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>
15155 <listitem>
15156 <para>
15157 <indexterm role="concept">
15158 <primary>string</primary>
15159 <secondary>comparison</secondary>
15160 </indexterm>
15161 <indexterm role="concept">
15162 <primary>expansion</primary>
15163 <secondary>string comparison</secondary>
15164 </indexterm>
15165 <indexterm role="concept">
15166 <primary><option>le</option> expansion condition</primary>
15167 </indexterm>
15168 <indexterm role="concept">
15169 <primary><option>lei</option> expansion condition</primary>
15170 </indexterm>
15171 The two substrings are first expanded. The condition is true if the first
15172 string is lexically less than or equal to the second string. For <option>le</option> the
15173 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15174 case-independent.
15175 </para>
15176 </listitem></varlistentry>
15177 <varlistentry>
15178 <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>
15179 <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>
15180 <listitem>
15181 <para>
15182 <indexterm role="concept">
15183 <primary>string</primary>
15184 <secondary>comparison</secondary>
15185 </indexterm>
15186 <indexterm role="concept">
15187 <primary>expansion</primary>
15188 <secondary>string comparison</secondary>
15189 </indexterm>
15190 <indexterm role="concept">
15191 <primary><option>lt</option> expansion condition</primary>
15192 </indexterm>
15193 <indexterm role="concept">
15194 <primary><option>lti</option> expansion condition</primary>
15195 </indexterm>
15196 The two substrings are first expanded. The condition is true if the first
15197 string is lexically less than the second string. For <option>lt</option> the comparison
15198 includes the case of letters, whereas for <option>lti</option> the comparison is
15199 case-independent.
15200 </para>
15201 </listitem></varlistentry>
15202 <varlistentry>
15203 <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>
15204 <listitem>
15205 <para>
15206 <indexterm role="concept">
15207 <primary>expansion</primary>
15208 <secondary>regular expression comparison</secondary>
15209 </indexterm>
15210 <indexterm role="concept">
15211 <primary>regular expressions</primary>
15212 <secondary>match in expanded string</secondary>
15213 </indexterm>
15214 <indexterm role="concept">
15215 <primary><option>match</option> expansion condition</primary>
15216 </indexterm>
15217 The two substrings are first expanded. The second is then treated as a regular
15218 expression and applied to the first. Because of the pre-expansion, if the
15219 regular expression contains dollar, or backslash characters, they must be
15220 escaped. Care must also be taken if the regular expression contains braces
15221 (curly brackets). A closing brace must be escaped so that it is not taken as a
15222 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
15223 <literal>\N</literal> feature to disable expansion of the regular expression.
15224 For example,
15225 </para>
15226 <literallayout class="monospaced">
15227 ${if match {$local_part}{\N^\d{3}\N} ...
15228 </literallayout>
15229 <para>
15230 If the whole expansion string is in double quotes, further escaping of
15231 backslashes is also required.
15232 </para>
15233 <para>
15234 The condition is true if the regular expression match succeeds.
15235 The regular expression is not required to begin with a circumflex
15236 metacharacter, but if there is no circumflex, the expression is not anchored,
15237 and it may match anywhere in the subject, not just at the start. If you want
15238 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15239 metacharacter at an appropriate point.
15240 </para>
15241 <para>
15242 <indexterm role="concept">
15243 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15244 <secondary>in <option>if</option> expansion</secondary>
15245 </indexterm>
15246 At the start of an <option>if</option> expansion the values of the numeric variable
15247 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15248 succeeds causes them to be reset to the substrings of that condition and they
15249 will have these values during the expansion of the success string. At the end
15250 of the <option>if</option> expansion, the previous values are restored. After testing a
15251 combination of conditions using <option>or</option>, the subsequent values of the numeric
15252 variables are those of the condition that succeeded.
15253 </para>
15254 </listitem></varlistentry>
15255 <varlistentry>
15256 <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>
15257 <listitem>
15258 <para>
15259 <indexterm role="concept">
15260 <primary><option>match_address</option> expansion condition</primary>
15261 </indexterm>
15262 See <emphasis role="bold">match_local_part</emphasis>.
15263 </para>
15264 </listitem></varlistentry>
15265 <varlistentry>
15266 <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>
15267 <listitem>
15268 <para>
15269 <indexterm role="concept">
15270 <primary><option>match_domain</option> expansion condition</primary>
15271 </indexterm>
15272 See <emphasis role="bold">match_local_part</emphasis>.
15273 </para>
15274 </listitem></varlistentry>
15275 <varlistentry>
15276 <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>
15277 <listitem>
15278 <para>
15279 <indexterm role="concept">
15280 <primary><option>match_ip</option> expansion condition</primary>
15281 </indexterm>
15282 This condition matches an IP address to a list of IP address patterns. It must
15283 be followed by two argument strings. The first (after expansion) must be an IP
15284 address or an empty string. The second (after expansion) is a restricted host
15285 list that can match only an IP address, not a host name. For example:
15286 </para>
15287 <literallayout class="monospaced">
15288 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15289 </literallayout>
15290 <para>
15291 The specific types of host list item that are permitted in the list are:
15292 </para>
15293 <itemizedlist>
15294 <listitem>
15295 <para>
15296 An IP address, optionally with a CIDR mask.
15297 </para>
15298 </listitem>
15299 <listitem>
15300 <para>
15301 A single asterisk, which matches any IP address.
15302 </para>
15303 </listitem>
15304 <listitem>
15305 <para>
15306 An empty item, which matches only if the IP address is empty. This could be
15307 useful for testing for a locally submitted message or one from specific hosts
15308 in a single test such as
15309 </para>
15310 <literallayout class="monospaced">
15311   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15312 </literallayout>
15313 <para>
15314 where the first item in the list is the empty string.
15315 </para>
15316 </listitem>
15317 <listitem>
15318 <para>
15319 The item @[] matches any of the local host&#x2019;s interface addresses.
15320 </para>
15321 </listitem>
15322 <listitem>
15323 <para>
15324 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15325 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15326 address into a host name. The most common type of linear search for
15327 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15328 masks. For example:
15329 </para>
15330 <literallayout class="monospaced">
15331   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15332 </literallayout>
15333 <para>
15334 It is of course possible to use other kinds of lookup, and in such a case, you
15335 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15336 address mask, for example:
15337 </para>
15338 <literallayout class="monospaced">
15339   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15340 </literallayout>
15341 <para>
15342 However, unless you are combining a <option>match_ip</option> condition with others, it is
15343 just as easy to use the fact that a lookup is itself a condition, and write:
15344 </para>
15345 <literallayout class="monospaced">
15346   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15347 </literallayout>
15348 </listitem>
15349 </itemizedlist>
15350 <para>
15351 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15352 </para>
15353 </listitem></varlistentry>
15354 <varlistentry>
15355 <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>
15356 <listitem>
15357 <para>
15358 <indexterm role="concept">
15359 <primary>domain list</primary>
15360 <secondary>in expansion condition</secondary>
15361 </indexterm>
15362 <indexterm role="concept">
15363 <primary>address list</primary>
15364 <secondary>in expansion condition</secondary>
15365 </indexterm>
15366 <indexterm role="concept">
15367 <primary>local part</primary>
15368 <secondary>list, in expansion condition</secondary>
15369 </indexterm>
15370 <indexterm role="concept">
15371 <primary><option>match_local_part</option> expansion condition</primary>
15372 </indexterm>
15373 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15374 possible to test domain, address, and local part lists within expansions. Each
15375 condition requires two arguments: an item and a list to match. A trivial
15376 example is:
15377 </para>
15378 <literallayout class="monospaced">
15379 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15380 </literallayout>
15381 <para>
15382 In each case, the second argument may contain any of the allowable items for a
15383 list of the appropriate type. Also, because the second argument (after
15384 expansion) is a standard form of list, it is possible to refer to a named list.
15385 Thus, you can use conditions like this:
15386 </para>
15387 <literallayout class="monospaced">
15388 ${if match_domain{$domain}{+local_domains}{...
15389 </literallayout>
15390 <para>
15391 <indexterm role="concept">
15392 <primary><literal>+caseful</literal></primary>
15393 </indexterm>
15394 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15395 item can be used, as in all address lists, to cause subsequent items to
15396 have their local parts matched casefully. Domains are always matched
15397 caselessly.
15398 </para>
15399 <para>
15400 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15401 hosts have two identities: a name and an IP address, and it is not clear
15402 how to specify cleanly how such a test would work. However, IP addresses can be
15403 matched using <option>match_ip</option>.
15404 </para>
15405 </listitem></varlistentry>
15406 <varlistentry>
15407 <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>
15408 <listitem>
15409 <para>
15410 <indexterm role="concept">
15411 <primary>PAM authentication</primary>
15412 </indexterm>
15413 <indexterm role="concept">
15414 <primary>AUTH</primary>
15415 <secondary>with PAM</secondary>
15416 </indexterm>
15417 <indexterm role="concept">
15418 <primary>Solaris</primary>
15419 <secondary>PAM support</secondary>
15420 </indexterm>
15421 <indexterm role="concept">
15422 <primary>expansion</primary>
15423 <secondary>PAM authentication test</secondary>
15424 </indexterm>
15425 <indexterm role="concept">
15426 <primary><option>pam</option> expansion condition</primary>
15427 </indexterm>
15428 <emphasis>Pluggable Authentication Modules</emphasis>
15429 (<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
15430 available in the latest releases of Solaris and in some GNU/Linux
15431 distributions. The Exim support, which is intended for use in conjunction with
15432 the SMTP AUTH command, is available only if Exim is compiled with
15433 </para>
15434 <literallayout class="monospaced">
15435 SUPPORT_PAM=yes
15436 </literallayout>
15437 <para>
15438 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15439 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15440 </para>
15441 <para>
15442 The argument string is first expanded, and the result must be a
15443 colon-separated list of strings. Leading and trailing white space is ignored.
15444 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15445 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
15446 The remaining items in the data string are passed over in response to requests
15447 from the authentication function. In the simple case there will only be one
15448 request, for a password, so the data consists of just two strings.
15449 </para>
15450 <para>
15451 There can be problems if any of the strings are permitted to contain colon
15452 characters. In the usual way, these have to be doubled to avoid being taken as
15453 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15454 item can be used to double any existing colons. For example, the configuration
15455 of a LOGIN authenticator might contain this setting:
15456 </para>
15457 <literallayout class="monospaced">
15458 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15459 </literallayout>
15460 <para>
15461 For a PLAIN authenticator you could use:
15462 </para>
15463 <literallayout class="monospaced">
15464 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15465 </literallayout>
15466 <para>
15467 In some operating systems, PAM authentication can be done only from a process
15468 running as root. Since Exim is running as the Exim user when receiving
15469 messages, this means that PAM cannot be used directly in those systems.
15470 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15471 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>.
15472 The patched module allows one special uid/gid combination, in addition to root,
15473 to authenticate. If you build the patched module to allow the Exim user and
15474 group, PAM can then be used from an Exim authenticator.
15475 </para>
15476 </listitem></varlistentry>
15477 <varlistentry>
15478 <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>
15479 <listitem>
15480 <para>
15481 <indexterm role="concept">
15482 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15483 </indexterm>
15484 <indexterm role="concept">
15485 <primary>Cyrus</primary>
15486 </indexterm>
15487 <indexterm role="concept">
15488 <primary>expansion</primary>
15489 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15490 </indexterm>
15491 <indexterm role="concept">
15492 <primary><option>pwcheck</option> expansion condition</primary>
15493 </indexterm>
15494 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15495 This is one way of making it possible for passwords to be checked by a process
15496 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15497 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15498 </para>
15499 <para>
15500 The pwcheck support is not included in Exim by default. You need to specify
15501 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15502 building Exim. For example:
15503 </para>
15504 <literallayout class="monospaced">
15505 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15506 </literallayout>
15507 <para>
15508 You do not need to install the full Cyrus software suite in order to use
15509 the pwcheck daemon. You can compile and install just the daemon alone
15510 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15511 access to the <filename>/var/pwcheck</filename> directory.
15512 </para>
15513 <para>
15514 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15515 password, separated by a colon. For example, in a LOGIN authenticator
15516 configuration, you might have this:
15517 </para>
15518 <literallayout class="monospaced">
15519 server_condition = ${if pwcheck{$auth1:$auth2}}
15520 </literallayout>
15521 </listitem></varlistentry>
15522 <varlistentry>
15523 <term><emphasis role="bold">queue_running</emphasis></term>
15524 <listitem>
15525 <para>
15526 <indexterm role="concept">
15527 <primary>queue runner</primary>
15528 <secondary>detecting when delivering from</secondary>
15529 </indexterm>
15530 <indexterm role="concept">
15531 <primary>expansion</primary>
15532 <secondary>queue runner test</secondary>
15533 </indexterm>
15534 <indexterm role="concept">
15535 <primary><option>queue_running</option> expansion condition</primary>
15536 </indexterm>
15537 This condition, which has no data, is true during delivery attempts that are
15538 initiated by queue runner processes, and false otherwise.
15539 </para>
15540 </listitem></varlistentry>
15541 <varlistentry>
15542 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15543 <listitem>
15544 <para>
15545 <indexterm role="concept">
15546 <primary>Radius</primary>
15547 </indexterm>
15548 <indexterm role="concept">
15549 <primary>expansion</primary>
15550 <secondary>Radius authentication</secondary>
15551 </indexterm>
15552 <indexterm role="concept">
15553 <primary><option>radius</option> expansion condition</primary>
15554 </indexterm>
15555 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15556 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15557 the Radius client configuration file in order to build Exim with Radius
15558 support.
15559 </para>
15560 <para>
15561 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15562 library, using the original API. If you are using release 0.4.0 or later of
15563 this library, you need to set
15564 </para>
15565 <literallayout class="monospaced">
15566 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15567 </literallayout>
15568 <para>
15569 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15570 <option>libradius</option> library that comes with FreeBSD. To do this, set
15571 </para>
15572 <literallayout class="monospaced">
15573 RADIUS_LIB_TYPE=RADLIB
15574 </literallayout>
15575 <para>
15576 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15577 You may also have to supply a suitable setting in EXTRALIBS so that the
15578 Radius library can be found when Exim is linked.
15579 </para>
15580 <para>
15581 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15582 Radius client library, which calls the Radius server. The condition is true if
15583 the authentication is successful. For example:
15584 </para>
15585 <literallayout class="monospaced">
15586 server_condition = ${if radius{&lt;arguments&gt;}}
15587 </literallayout>
15588 </listitem></varlistentry>
15589 <varlistentry>
15590 <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>
15591 <listitem>
15592 <para>
15593 <indexterm role="concept">
15594 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15595 </indexterm>
15596 <indexterm role="concept">
15597 <primary>Cyrus</primary>
15598 </indexterm>
15599 <indexterm role="concept">
15600 <primary>expansion</primary>
15601 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15602 </indexterm>
15603 <indexterm role="concept">
15604 <primary><option>saslauthd</option> expansion condition</primary>
15605 </indexterm>
15606 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15607 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15608 Using this daemon is one way of making it possible for passwords to be checked
15609 by a process that is not running as root.
15610 </para>
15611 <para>
15612 The saslauthd support is not included in Exim by default. You need to specify
15613 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15614 building Exim. For example:
15615 </para>
15616 <literallayout class="monospaced">
15617 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15618 </literallayout>
15619 <para>
15620 You do not need to install the full Cyrus software suite in order to use
15621 the saslauthd daemon. You can compile and install just the daemon alone
15622 from the Cyrus SASL library.
15623 </para>
15624 <para>
15625 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15626 two are mandatory. For example:
15627 </para>
15628 <literallayout class="monospaced">
15629 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15630 </literallayout>
15631 <para>
15632 The service and the realm are optional (which is why the arguments are enclosed
15633 in their own set of braces). For details of the meaning of the service and
15634 realm, and how to run the daemon, consult the Cyrus documentation.
15635 </para>
15636 </listitem></varlistentry>
15637 </variablelist>
15638 </section>
15639 <section id="SECID84">
15640 <title>Combining expansion conditions</title>
15641 <para>
15642 <indexterm role="concept">
15643 <primary>expansion</primary>
15644 <secondary>combining conditions</secondary>
15645 </indexterm>
15646 Several conditions can be tested at once by combining them using the <option>and</option>
15647 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15648 conditions on their own, and precede their lists of sub-conditions. Each
15649 sub-condition must be enclosed in braces within the overall braces that contain
15650 the list. No repetition of <option>if</option> is used.
15651 </para>
15652 <variablelist>
15653 <varlistentry>
15654 <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>
15655 <listitem>
15656 <para>
15657 <indexterm role="concept">
15658 <primary><quote>or</quote> expansion condition</primary>
15659 </indexterm>
15660 <indexterm role="concept">
15661 <primary>expansion</primary>
15662 <secondary><quote>or</quote> of conditions</secondary>
15663 </indexterm>
15664 The sub-conditions are evaluated from left to right. The condition is true if
15665 any one of the sub-conditions is true.
15666 For example,
15667 </para>
15668 <literallayout class="monospaced">
15669 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15670 </literallayout>
15671 <para>
15672 When a true sub-condition is found, the following ones are parsed but not
15673 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15674 numeric variables afterwards are taken from the first one that succeeds.
15675 </para>
15676 </listitem></varlistentry>
15677 <varlistentry>
15678 <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>
15679 <listitem>
15680 <para>
15681 <indexterm role="concept">
15682 <primary><quote>and</quote> expansion condition</primary>
15683 </indexterm>
15684 <indexterm role="concept">
15685 <primary>expansion</primary>
15686 <secondary><quote>and</quote> of conditions</secondary>
15687 </indexterm>
15688 The sub-conditions are evaluated from left to right. The condition is true if
15689 all of the sub-conditions are true. If there are several <quote>match</quote>
15690 sub-conditions, the values of the numeric variables afterwards are taken from
15691 the last one. When a false sub-condition is found, the following ones are
15692 parsed but not evaluated.
15693 </para>
15694 </listitem></varlistentry>
15695 </variablelist>
15696 <para>
15697 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15698 </para>
15699 </section>
15700 <section id="SECTexpvar">
15701 <title>Expansion variables</title>
15702 <para>
15703 <indexterm role="concept">
15704 <primary>expansion</primary>
15705 <secondary>variables, list of</secondary>
15706 </indexterm>
15707 This section contains an alphabetical list of all the expansion variables. Some
15708 of them are available only when Exim is compiled with specific options such as
15709 support for TLS or the content scanning extension.
15710 </para>
15711 <variablelist>
15712 <varlistentry>
15713 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15714 <listitem>
15715 <para>
15716 <indexterm role="concept">
15717 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15718 </indexterm>
15719 When a <option>match</option> expansion condition succeeds, these variables contain the
15720 captured substrings identified by the regular expression during subsequent
15721 processing of the success string of the containing <option>if</option> expansion item.
15722 However, they do not retain their values afterwards; in fact, their previous
15723 values are restored at the end of processing an <option>if</option> item. The numerical
15724 variables may also be set externally by some other matching process which
15725 precedes the expansion of the string. For example, the commands available in
15726 Exim filter files include an <option>if</option> command with its own regular expression
15727 matching condition.
15728 </para>
15729 </listitem></varlistentry>
15730 <varlistentry>
15731 <term><varname>$acl_c...</varname></term>
15732 <listitem>
15733 <para>
15734 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15735 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15736 long, but the sixth character must be either a digit or an underscore. For
15737 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15738 variables persist throughout the lifetime of an SMTP connection. They can be
15739 used to pass information between ACLs and between different invocations of the
15740 same ACL. When a message is received, the values of these variables are saved
15741 with the message, and can be accessed by filters, routers, and transports
15742 during subsequent delivery.
15743 </para>
15744 </listitem></varlistentry>
15745 <varlistentry>
15746 <term><varname>$acl_m...</varname></term>
15747 <listitem>
15748 <para>
15749 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15750 are reset after a message has been received. Thus, if several messages are
15751 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15752 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15753 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15754 message is received, the values of these variables are saved with the message,
15755 and can be accessed by filters, routers, and transports during subsequent
15756 delivery.
15757 </para>
15758 </listitem></varlistentry>
15759 <varlistentry>
15760 <term><varname>$acl_verify_message</varname></term>
15761 <listitem>
15762 <para>
15763 <indexterm role="variable">
15764 <primary><varname>$acl_verify_message</varname></primary>
15765 </indexterm>
15766 After an address verification has failed, this variable contains the failure
15767 message. It retains its value for use in subsequent modifiers. The message can
15768 be preserved by coding like this:
15769 </para>
15770 <literallayout class="monospaced">
15771 warn !verify = sender
15772      set acl_m0 = $acl_verify_message
15773 </literallayout>
15774 <para>
15775 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15776 <option>log_message</option> modifiers, to include information about the verification
15777 failure.
15778 </para>
15779 </listitem></varlistentry>
15780 <varlistentry>
15781 <term><varname>$address_data</varname></term>
15782 <listitem>
15783 <para>
15784 <indexterm role="variable">
15785 <primary><varname>$address_data</varname></primary>
15786 </indexterm>
15787 This variable is set by means of the <option>address_data</option> option in routers. The
15788 value then remains with the address while it is processed by subsequent routers
15789 and eventually a transport. If the transport is handling multiple addresses,
15790 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15791 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15792 user filter files.
15793 </para>
15794 <para>
15795 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15796 a recipient address, the final value is still in the variable for subsequent
15797 conditions and modifiers of the ACL statement. If routing the address caused it
15798 to be redirected to just one address, the child address is also routed as part
15799 of the verification, and in this case the final value of <varname>$address_data</varname> is
15800 from the child&#x2019;s routing.
15801 </para>
15802 <para>
15803 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15804 sender address, the final value is also preserved, but this time in
15805 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15806 address.
15807 </para>
15808 <para>
15809 In both cases (recipient and sender verification), the value does not persist
15810 after the end of the current ACL statement. If you want to preserve
15811 these values for longer, you can save them in ACL variables.
15812 </para>
15813 </listitem></varlistentry>
15814 <varlistentry>
15815 <term><varname>$address_file</varname></term>
15816 <listitem>
15817 <para>
15818 <indexterm role="variable">
15819 <primary><varname>$address_file</varname></primary>
15820 </indexterm>
15821 When, as a result of aliasing, forwarding, or filtering, a message is directed
15822 to a specific file, this variable holds the name of the file when the transport
15823 is running. At other times, the variable is empty. For example, using the
15824 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15825 </para>
15826 <literallayout class="monospaced">
15827 /home/r2d2/savemail
15828 </literallayout>
15829 <para>
15830 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15831 contains the text string <literal>/home/r2d2/savemail</literal>.
15832 <indexterm role="concept">
15833 <primary>Sieve filter</primary>
15834 <secondary>value of <varname>$address_file</varname></secondary>
15835 </indexterm>
15836 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15837 then up to the transport configuration to generate an appropriate absolute path
15838 to the relevant file.
15839 </para>
15840 </listitem></varlistentry>
15841 <varlistentry>
15842 <term><varname>$address_pipe</varname></term>
15843 <listitem>
15844 <para>
15845 <indexterm role="variable">
15846 <primary><varname>$address_pipe</varname></primary>
15847 </indexterm>
15848 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15849 this variable holds the pipe command when the transport is running.
15850 </para>
15851 </listitem></varlistentry>
15852 <varlistentry>
15853 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
15854 <listitem>
15855 <para>
15856 <indexterm role="variable">
15857 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15858 </indexterm>
15859 These variables are used in SMTP authenticators (see chapters
15860 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15861 </para>
15862 </listitem></varlistentry>
15863 <varlistentry>
15864 <term><varname>$authenticated_id</varname></term>
15865 <listitem>
15866 <para>
15867 <indexterm role="concept">
15868 <primary>authentication</primary>
15869 <secondary>id</secondary>
15870 </indexterm>
15871 <indexterm role="variable">
15872 <primary><varname>$authenticated_id</varname></primary>
15873 </indexterm>
15874 When a server successfully authenticates a client it may be configured to
15875 preserve some of the authentication information in the variable
15876 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15877 user/password authenticator configuration might preserve the user name for use
15878 in the routers. Note that this is not the same information that is saved in
15879 <varname>$sender_host_authenticated</varname>.
15880 When a message is submitted locally (that is, not over a TCP connection)
15881 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15882 process. However, a trusted user can override this by means of the <option>-oMai</option>
15883 command line option.
15884 </para>
15885 </listitem></varlistentry>
15886 <varlistentry>
15887 <term><varname>$authenticated_sender</varname></term>
15888 <listitem>
15889 <para>
15890 <indexterm role="concept">
15891 <primary>sender</primary>
15892 <secondary>authenticated</secondary>
15893 </indexterm>
15894 <indexterm role="concept">
15895 <primary>authentication</primary>
15896 <secondary>sender</secondary>
15897 </indexterm>
15898 <indexterm role="concept">
15899 <primary>AUTH</primary>
15900 <secondary>on MAIL command</secondary>
15901 </indexterm>
15902 <indexterm role="variable">
15903 <primary><varname>$authenticated_sender</varname></primary>
15904 </indexterm>
15905 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15906 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15907 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15908 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
15909 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15910 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15911 </para>
15912 <para>
15913 <indexterm role="variable">
15914 <primary><varname>$qualify_domain</varname></primary>
15915 </indexterm>
15916 When a message is submitted locally (that is, not over a TCP connection), the
15917 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15918 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15919 can override this by means of the <option>-oMas</option> command line option.
15920 </para>
15921 </listitem></varlistentry>
15922 <varlistentry>
15923 <term><varname>$authentication_failed</varname></term>
15924 <listitem>
15925 <para>
15926 <indexterm role="concept">
15927 <primary>authentication</primary>
15928 <secondary>failure</secondary>
15929 </indexterm>
15930 <indexterm role="variable">
15931 <primary><varname>$authentication_failed</varname></primary>
15932 </indexterm>
15933 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15934 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15935 possible to distinguish between <quote>did not try to authenticate</quote>
15936 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15937 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15938 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15939 negative response to an AUTH command, including (for example) an attempt to use
15940 an undefined mechanism.
15941 </para>
15942 </listitem></varlistentry>
15943 <varlistentry>
15944 <term><varname>$body_linecount</varname></term>
15945 <listitem>
15946 <para>
15947 <indexterm role="concept">
15948 <primary>message body</primary>
15949 <secondary>line count</secondary>
15950 </indexterm>
15951 <indexterm role="concept">
15952 <primary>body of message</primary>
15953 <secondary>line count</secondary>
15954 </indexterm>
15955 <indexterm role="variable">
15956 <primary><varname>$body_linecount</varname></primary>
15957 </indexterm>
15958 When a message is being received or delivered, this variable contains the
15959 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
15960 </para>
15961 </listitem></varlistentry>
15962 <varlistentry>
15963 <term><varname>$body_zerocount</varname></term>
15964 <listitem>
15965 <para>
15966 <indexterm role="concept">
15967 <primary>message body</primary>
15968 <secondary>binary zero count</secondary>
15969 </indexterm>
15970 <indexterm role="concept">
15971 <primary>body of message</primary>
15972 <secondary>binary zero count</secondary>
15973 </indexterm>
15974 <indexterm role="concept">
15975 <primary>binary zero</primary>
15976 <secondary>in message body</secondary>
15977 </indexterm>
15978 <indexterm role="variable">
15979 <primary><varname>$body_zerocount</varname></primary>
15980 </indexterm>
15981 When a message is being received or delivered, this variable contains the
15982 number of binary zero bytes in the message&#x2019;s body.
15983 </para>
15984 </listitem></varlistentry>
15985 <varlistentry>
15986 <term><varname>$bounce_recipient</varname></term>
15987 <listitem>
15988 <para>
15989 <indexterm role="variable">
15990 <primary><varname>$bounce_recipient</varname></primary>
15991 </indexterm>
15992 This is set to the recipient address of a bounce message while Exim is creating
15993 it. It is useful if a customized bounce message text file is in use (see
15994 chapter <xref linkend="CHAPemsgcust"/>).
15995 </para>
15996 </listitem></varlistentry>
15997 <varlistentry>
15998 <term><varname>$bounce_return_size_limit</varname></term>
15999 <listitem>
16000 <para>
16001 <indexterm role="variable">
16002 <primary><varname>$bounce_return_size_limit</varname></primary>
16003 </indexterm>
16004 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16005 up to a multiple of 1000. It is useful when a customized error message text
16006 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16007 </para>
16008 </listitem></varlistentry>
16009 <varlistentry>
16010 <term><varname>$caller_gid</varname></term>
16011 <listitem>
16012 <para>
16013 <indexterm role="concept">
16014 <primary>gid (group id)</primary>
16015 <secondary>caller</secondary>
16016 </indexterm>
16017 <indexterm role="variable">
16018 <primary><varname>$caller_gid</varname></primary>
16019 </indexterm>
16020 The real group id under which the process that called Exim was running. This is
16021 not the same as the group id of the originator of a message (see
16022 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16023 incarnation normally contains the Exim gid.
16024 </para>
16025 </listitem></varlistentry>
16026 <varlistentry>
16027 <term><varname>$caller_uid</varname></term>
16028 <listitem>
16029 <para>
16030 <indexterm role="concept">
16031 <primary>uid (user id)</primary>
16032 <secondary>caller</secondary>
16033 </indexterm>
16034 <indexterm role="variable">
16035 <primary><varname>$caller_uid</varname></primary>
16036 </indexterm>
16037 The real user id under which the process that called Exim was running. This is
16038 not the same as the user id of the originator of a message (see
16039 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16040 incarnation normally contains the Exim uid.
16041 </para>
16042 </listitem></varlistentry>
16043 <varlistentry>
16044 <term><varname>$compile_date</varname></term>
16045 <listitem>
16046 <para>
16047 <indexterm role="variable">
16048 <primary><varname>$compile_date</varname></primary>
16049 </indexterm>
16050 The date on which the Exim binary was compiled.
16051 </para>
16052 </listitem></varlistentry>
16053 <varlistentry>
16054 <term><varname>$compile_number</varname></term>
16055 <listitem>
16056 <para>
16057 <indexterm role="variable">
16058 <primary><varname>$compile_number</varname></primary>
16059 </indexterm>
16060 The building process for Exim keeps a count of the number
16061 of times it has been compiled. This serves to distinguish different
16062 compilations of the same version of the program.
16063 </para>
16064 </listitem></varlistentry>
16065 <varlistentry>
16066 <term><varname>$demime_errorlevel</varname></term>
16067 <listitem>
16068 <para>
16069 <indexterm role="variable">
16070 <primary><varname>$demime_errorlevel</varname></primary>
16071 </indexterm>
16072 This variable is available when Exim is compiled with
16073 the content-scanning extension and the obsolete <option>demime</option> condition. For
16074 details, see section <xref linkend="SECTdemimecond"/>.
16075 </para>
16076 </listitem></varlistentry>
16077 <varlistentry>
16078 <term><varname>$demime_reason</varname></term>
16079 <listitem>
16080 <para>
16081 <indexterm role="variable">
16082 <primary><varname>$demime_reason</varname></primary>
16083 </indexterm>
16084 This variable is available when Exim is compiled with the
16085 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16086 see section <xref linkend="SECTdemimecond"/>.
16087 </para>
16088 </listitem></varlistentry>
16089 <varlistentry revisionflag="changed">
16090 <term><varname>$dnslist_domain</varname></term>
16091 <term><varname>$dnslist_matched</varname></term>
16092 <term><varname>$dnslist_text</varname></term>
16093 <term><varname>$dnslist_value</varname></term>
16094 <listitem>
16095 <para revisionflag="changed">
16096 <indexterm role="variable">
16097 <primary><varname>$dnslist_domain</varname></primary>
16098 </indexterm>
16099 <indexterm role="variable">
16100 <primary><varname>$dnslist_matched</varname></primary>
16101 </indexterm>
16102 <indexterm role="variable">
16103 <primary><varname>$dnslist_text</varname></primary>
16104 </indexterm>
16105 <indexterm role="variable">
16106 <primary><varname>$dnslist_value</varname></primary>
16107 </indexterm>
16108 <indexterm role="concept">
16109 <primary>black list (DNS)</primary>
16110 </indexterm>
16111 When a DNS (black) list lookup succeeds, these variables are set to contain
16112 the following data from the lookup: the list&#x2019;s domain name, the key that was
16113 looked up, the contents of any associated TXT record, and the value from the
16114 main A record. See section <xref linkend="SECID204"/> for more details.
16115 </para>
16116 </listitem></varlistentry>
16117 <varlistentry>
16118 <term><varname>$domain</varname></term>
16119 <listitem>
16120 <para>
16121 <indexterm role="variable">
16122 <primary><varname>$domain</varname></primary>
16123 </indexterm>
16124 When an address is being routed, or delivered on its own, this variable
16125 contains the domain. Uppercase letters in the domain are converted into lower
16126 case for <varname>$domain</varname>.
16127 </para>
16128 <para>
16129 Global address rewriting happens when a message is received, so the value of
16130 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16131 is set during user filtering, but not during system filtering, because a
16132 message may have many recipients and the system filter is called just once.
16133 </para>
16134 <para>
16135 When more than one address is being delivered at once (for example, several
16136 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16137 have the same domain. Transports can be restricted to handling only one domain
16138 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
16139 the default for local transports. For further details of the environment in
16140 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16141 </para>
16142 <para>
16143 <indexterm role="option">
16144 <primary><option>delay_warning_condition</option></primary>
16145 </indexterm>
16146 At the end of a delivery, if all deferred addresses have the same domain, it is
16147 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16148 </para>
16149 <para>
16150 The <varname>$domain</varname> variable is also used in some other circumstances:
16151 </para>
16152 <itemizedlist>
16153 <listitem>
16154 <para>
16155 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16156 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16157 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16158 normally set during the running of the MAIL ACL. However, if the sender address
16159 is verified with a callout during the MAIL ACL, the sender domain is placed in
16160 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16161 the <command>smtp</command> transport.
16162 </para>
16163 </listitem>
16164 <listitem>
16165 <para>
16166 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16167 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16168 it can be used in the expansion of the replacement address, for example, to
16169 rewrite domains by file lookup.
16170 </para>
16171 </listitem>
16172 <listitem>
16173 <para>
16174 With one important exception, whenever a domain list is being scanned,
16175 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16176 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16177 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16178 that, in a RCPT ACL, the sender domain list can be dependent on the
16179 recipient domain (which is what is in <varname>$domain</varname> at this time).
16180 </para>
16181 </listitem>
16182 <listitem>
16183 <para>
16184 <indexterm role="concept">
16185 <primary>ETRN</primary>
16186 <secondary>value of <varname>$domain</varname></secondary>
16187 </indexterm>
16188 <indexterm role="option">
16189 <primary><option>smtp_etrn_command</option></primary>
16190 </indexterm>
16191 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16192 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16193 </para>
16194 </listitem>
16195 </itemizedlist>
16196 </listitem></varlistentry>
16197 <varlistentry>
16198 <term><varname>$domain_data</varname></term>
16199 <listitem>
16200 <para>
16201 <indexterm role="variable">
16202 <primary><varname>$domain_data</varname></primary>
16203 </indexterm>
16204 When the <option>domains</option> option on a router matches a domain by
16205 means of a lookup, the data read by the lookup is available during the running
16206 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16207 address to a transport, the value is available in that transport. If the
16208 transport is handling multiple addresses, the value from the first address is
16209 used.
16210 </para>
16211 <para>
16212 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16213 domain by means of a lookup. The data read by the lookup is available during
16214 the rest of the ACL statement. In all other situations, this variable expands
16215 to nothing.
16216 </para>
16217 </listitem></varlistentry>
16218 <varlistentry>
16219 <term><varname>$exim_gid</varname></term>
16220 <listitem>
16221 <para>
16222 <indexterm role="variable">
16223 <primary><varname>$exim_gid</varname></primary>
16224 </indexterm>
16225 This variable contains the numerical value of the Exim group id.
16226 </para>
16227 </listitem></varlistentry>
16228 <varlistentry>
16229 <term><varname>$exim_path</varname></term>
16230 <listitem>
16231 <para>
16232 <indexterm role="variable">
16233 <primary><varname>$exim_path</varname></primary>
16234 </indexterm>
16235 This variable contains the path to the Exim binary.
16236 </para>
16237 </listitem></varlistentry>
16238 <varlistentry>
16239 <term><varname>$exim_uid</varname></term>
16240 <listitem>
16241 <para>
16242 <indexterm role="variable">
16243 <primary><varname>$exim_uid</varname></primary>
16244 </indexterm>
16245 This variable contains the numerical value of the Exim user id.
16246 </para>
16247 </listitem></varlistentry>
16248 <varlistentry>
16249 <term><varname>$found_extension</varname></term>
16250 <listitem>
16251 <para>
16252 <indexterm role="variable">
16253 <primary><varname>$found_extension</varname></primary>
16254 </indexterm>
16255 This variable is available when Exim is compiled with the
16256 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16257 see section <xref linkend="SECTdemimecond"/>.
16258 </para>
16259 </listitem></varlistentry>
16260 <varlistentry>
16261 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
16262 <listitem>
16263 <para>
16264 This is not strictly an expansion variable. It is expansion syntax for
16265 inserting the message header line with the given name. Note that the name must
16266 be terminated by colon or white space, because it may contain a wide variety of
16267 characters. Note also that braces must <emphasis>not</emphasis> be used.
16268 </para>
16269 </listitem></varlistentry>
16270 <varlistentry>
16271 <term><varname>$home</varname></term>
16272 <listitem>
16273 <para>
16274 <indexterm role="variable">
16275 <primary><varname>$home</varname></primary>
16276 </indexterm>
16277 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
16278 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16279 means it is set during the running of users&#x2019; filter files. A router may also
16280 explicitly set a home directory for use by a transport; this can be overridden
16281 by a setting on the transport itself.
16282 </para>
16283 <para>
16284 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16285 of the environment variable HOME.
16286 </para>
16287 </listitem></varlistentry>
16288 <varlistentry>
16289 <term><varname>$host</varname></term>
16290 <listitem>
16291 <para>
16292 <indexterm role="variable">
16293 <primary><varname>$host</varname></primary>
16294 </indexterm>
16295 If a router assigns an address to a transport (any transport), and passes a
16296 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16297 to run is the name of the first host on the list. Note that this applies both
16298 to local and remote transports.
16299 </para>
16300 <para>
16301 <indexterm role="concept">
16302 <primary>transport</primary>
16303 <secondary>filter</secondary>
16304 </indexterm>
16305 <indexterm role="concept">
16306 <primary>filter</primary>
16307 <secondary>transport filter</secondary>
16308 </indexterm>
16309 For the <command>smtp</command> transport, if there is more than one host, the value of
16310 <varname>$host</varname> changes as the transport works its way through the list. In
16311 particular, when the <command>smtp</command> transport is expanding its options for encryption
16312 using TLS, or for specifying a transport filter (see chapter
16313 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16314 is connected.
16315 </para>
16316 <para>
16317 When used in the client part of an authenticator configuration (see chapter
16318 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16319 client is connected.
16320 </para>
16321 </listitem></varlistentry>
16322 <varlistentry>
16323 <term><varname>$host_address</varname></term>
16324 <listitem>
16325 <para>
16326 <indexterm role="variable">
16327 <primary><varname>$host_address</varname></primary>
16328 </indexterm>
16329 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
16330 for a remote connection. It is also set to the IP address that is being checked
16331 when the <option>ignore_target_hosts</option> option is being processed.
16332 </para>
16333 </listitem></varlistentry>
16334 <varlistentry>
16335 <term><varname>$host_data</varname></term>
16336 <listitem>
16337 <para>
16338 <indexterm role="variable">
16339 <primary><varname>$host_data</varname></primary>
16340 </indexterm>
16341 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16342 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16343 allows you, for example, to do things like this:
16344 </para>
16345 <literallayout class="monospaced">
16346 deny  hosts = net-lsearch;/some/file
16347 message = $host_data
16348 </literallayout>
16349 </listitem></varlistentry>
16350 <varlistentry>
16351 <term><varname>$host_lookup_deferred</varname></term>
16352 <listitem>
16353 <para>
16354 <indexterm role="concept">
16355 <primary>host name</primary>
16356 <secondary>lookup, failure of</secondary>
16357 </indexterm>
16358 <indexterm role="variable">
16359 <primary><varname>$host_lookup_deferred</varname></primary>
16360 </indexterm>
16361 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16362 message comes from a remote host and there is an attempt to look up the host&#x2019;s
16363 name from its IP address, and the attempt is not successful, one of these
16364 variables is set to <quote>1</quote>.
16365 </para>
16366 <itemizedlist>
16367 <listitem>
16368 <para>
16369 If the lookup receives a definite negative response (for example, a DNS lookup
16370 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16371 </para>
16372 </listitem>
16373 <listitem>
16374 <para>
16375 If there is any kind of problem during the lookup, such that Exim cannot
16376 tell whether or not the host name is defined (for example, a timeout for a DNS
16377 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16378 </para>
16379 </listitem>
16380 </itemizedlist>
16381 <para>
16382 Looking up a host&#x2019;s name from its IP address consists of more than just a
16383 single reverse lookup. Exim checks that a forward lookup of at least one of the
16384 names it receives from a reverse lookup yields the original IP address. If this
16385 is not the case, Exim does not accept the looked up name(s), and
16386 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16387 IP address (for example, the existence of a PTR record in the DNS) is not
16388 sufficient on its own for the success of a host name lookup. If the reverse
16389 lookup succeeds, but there is a lookup problem such as a timeout when checking
16390 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16391 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16392 </para>
16393 </listitem></varlistentry>
16394 <varlistentry>
16395 <term><varname>$host_lookup_failed</varname></term>
16396 <listitem>
16397 <para>
16398 <indexterm role="variable">
16399 <primary><varname>$host_lookup_failed</varname></primary>
16400 </indexterm>
16401 See <varname>$host_lookup_deferred</varname>.
16402 </para>
16403 </listitem></varlistentry>
16404 <varlistentry>
16405 <term><varname>$inode</varname></term>
16406 <listitem>
16407 <para>
16408 <indexterm role="variable">
16409 <primary><varname>$inode</varname></primary>
16410 </indexterm>
16411 The only time this variable is set is while expanding the <option>directory_file</option>
16412 option in the <command>appendfile</command> transport. The variable contains the inode number
16413 of the temporary file which is about to be renamed. It can be used to construct
16414 a unique name for the file.
16415 </para>
16416 </listitem></varlistentry>
16417 <varlistentry>
16418 <term><varname>$interface_address</varname></term>
16419 <listitem>
16420 <para>
16421 <indexterm role="variable">
16422 <primary><varname>$interface_address</varname></primary>
16423 </indexterm>
16424 This is an obsolete name for <varname>$received_ip_address</varname>.
16425 </para>
16426 </listitem></varlistentry>
16427 <varlistentry>
16428 <term><varname>$interface_port</varname></term>
16429 <listitem>
16430 <para>
16431 <indexterm role="variable">
16432 <primary><varname>$interface_port</varname></primary>
16433 </indexterm>
16434 This is an obsolete name for <varname>$received_port</varname>.
16435 </para>
16436 </listitem></varlistentry>
16437 <varlistentry>
16438 <term><varname>$item</varname></term>
16439 <listitem>
16440 <para>
16441 <indexterm role="variable">
16442 <primary><varname>$item</varname></primary>
16443 </indexterm>
16444 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16445 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">man</emphasis>, and
16446 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16447 empty.
16448 </para>
16449 </listitem></varlistentry>
16450 <varlistentry>
16451 <term><varname>$ldap_dn</varname></term>
16452 <listitem>
16453 <para>
16454 <indexterm role="variable">
16455 <primary><varname>$ldap_dn</varname></primary>
16456 </indexterm>
16457 This variable, which is available only when Exim is compiled with LDAP support,
16458 contains the DN from the last entry in the most recently successful LDAP
16459 lookup.
16460 </para>
16461 </listitem></varlistentry>
16462 <varlistentry>
16463 <term><varname>$load_average</varname></term>
16464 <listitem>
16465 <para>
16466 <indexterm role="variable">
16467 <primary><varname>$load_average</varname></primary>
16468 </indexterm>
16469 This variable contains the system load average, multiplied by 1000 so that it
16470 is an integer. For example, if the load average is 0.21, the value of the
16471 variable is 210. The value is recomputed every time the variable is referenced.
16472 </para>
16473 </listitem></varlistentry>
16474 <varlistentry>
16475 <term><varname>$local_part</varname></term>
16476 <listitem>
16477 <para>
16478 <indexterm role="variable">
16479 <primary><varname>$local_part</varname></primary>
16480 </indexterm>
16481 When an address is being routed, or delivered on its own, this
16482 variable contains the local part. When a number of addresses are being
16483 delivered together (for example, multiple RCPT commands in an SMTP
16484 session), <varname>$local_part</varname> is not set.
16485 </para>
16486 <para>
16487 Global address rewriting happens when a message is received, so the value of
16488 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16489 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16490 because a message may have many recipients and the system filter is called just
16491 once.
16492 </para>
16493 <para>
16494 <indexterm role="variable">
16495 <primary><varname>$local_part_prefix</varname></primary>
16496 </indexterm>
16497 <indexterm role="variable">
16498 <primary><varname>$local_part_suffix</varname></primary>
16499 </indexterm>
16500 If a local part prefix or suffix has been recognized, it is not included in the
16501 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16502 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16503 <varname>$local_part_suffix</varname>, respectively.
16504 </para>
16505 <para>
16506 When a message is being delivered to a file, pipe, or autoreply transport as a
16507 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16508 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16509 <varname>$address_pipe</varname>).
16510 </para>
16511 <para>
16512 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16513 local part of the recipient address.
16514 </para>
16515 <para>
16516 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16517 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16518 it can be used in the expansion of the replacement address, for example.
16519 </para>
16520 <para>
16521 In all cases, all quoting is removed from the local part. For example, for both
16522 the addresses
16523 </para>
16524 <literallayout class="monospaced">
16525 "abc:xyz"@test.example
16526 abc\:xyz@test.example
16527 </literallayout>
16528 <para>
16529 the value of <varname>$local_part</varname> is
16530 </para>
16531 <literallayout class="monospaced">
16532 abc:xyz
16533 </literallayout>
16534 <para>
16535 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16536 inside a quoting operator. For example, in a <command>redirect</command> router you could
16537 have:
16538 </para>
16539 <literallayout class="monospaced">
16540 data = ${quote_local_part:$local_part}@new.domain.example
16541 </literallayout>
16542 <para>
16543 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16544 to process local parts in a case-dependent manner in a router, you can set the
16545 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16546 </para>
16547 </listitem></varlistentry>
16548 <varlistentry>
16549 <term><varname>$local_part_data</varname></term>
16550 <listitem>
16551 <para>
16552 <indexterm role="variable">
16553 <primary><varname>$local_part_data</varname></primary>
16554 </indexterm>
16555 When the <option>local_parts</option> option on a router matches a local part by means of a
16556 lookup, the data read by the lookup is available during the running of the
16557 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16558 to a transport, the value is available in that transport. If the transport is
16559 handling multiple addresses, the value from the first address is used.
16560 </para>
16561 <para>
16562 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16563 matches a local part by means of a lookup. The data read by the lookup is
16564 available during the rest of the ACL statement. In all other situations, this
16565 variable expands to nothing.
16566 </para>
16567 </listitem></varlistentry>
16568 <varlistentry>
16569 <term><varname>$local_part_prefix</varname></term>
16570 <listitem>
16571 <para>
16572 <indexterm role="variable">
16573 <primary><varname>$local_part_prefix</varname></primary>
16574 </indexterm>
16575 When an address is being routed or delivered, and a
16576 specific prefix for the local part was recognized, it is available in this
16577 variable, having been removed from <varname>$local_part</varname>.
16578 </para>
16579 </listitem></varlistentry>
16580 <varlistentry>
16581 <term><varname>$local_part_suffix</varname></term>
16582 <listitem>
16583 <para>
16584 <indexterm role="variable">
16585 <primary><varname>$local_part_suffix</varname></primary>
16586 </indexterm>
16587 When an address is being routed or delivered, and a
16588 specific suffix for the local part was recognized, it is available in this
16589 variable, having been removed from <varname>$local_part</varname>.
16590 </para>
16591 </listitem></varlistentry>
16592 <varlistentry>
16593 <term><varname>$local_scan_data</varname></term>
16594 <listitem>
16595 <para>
16596 <indexterm role="variable">
16597 <primary><varname>$local_scan_data</varname></primary>
16598 </indexterm>
16599 This variable contains the text returned by the <function>local_scan()</function> function when
16600 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16601 </para>
16602 </listitem></varlistentry>
16603 <varlistentry>
16604 <term><varname>$local_user_gid</varname></term>
16605 <listitem>
16606 <para>
16607 <indexterm role="variable">
16608 <primary><varname>$local_user_gid</varname></primary>
16609 </indexterm>
16610 See <varname>$local_user_uid</varname>.
16611 </para>
16612 </listitem></varlistentry>
16613 <varlistentry>
16614 <term><varname>$local_user_uid</varname></term>
16615 <listitem>
16616 <para>
16617 <indexterm role="variable">
16618 <primary><varname>$local_user_uid</varname></primary>
16619 </indexterm>
16620 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16621 <option>check_local_user</option> router precondition succeeds. This means that their values
16622 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16623 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16624 router-specific expansions. At all other times, the values in these variables
16625 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16626 </para>
16627 </listitem></varlistentry>
16628 <varlistentry>
16629 <term><varname>$localhost_number</varname></term>
16630 <listitem>
16631 <para>
16632 <indexterm role="variable">
16633 <primary><varname>$localhost_number</varname></primary>
16634 </indexterm>
16635 This contains the expanded value of the
16636 <option>localhost_number</option> option. The expansion happens after the main options have
16637 been read.
16638 </para>
16639 </listitem></varlistentry>
16640 <varlistentry>
16641 <term><varname>$log_inodes</varname></term>
16642 <listitem>
16643 <para>
16644 <indexterm role="variable">
16645 <primary><varname>$log_inodes</varname></primary>
16646 </indexterm>
16647 The number of free inodes in the disk partition where Exim&#x2019;s
16648 log files are being written. The value is recalculated whenever the variable is
16649 referenced. If the relevant file system does not have the concept of inodes,
16650 the value of is -1. See also the <option>check_log_inodes</option> option.
16651 </para>
16652 </listitem></varlistentry>
16653 <varlistentry>
16654 <term><varname>$log_space</varname></term>
16655 <listitem>
16656 <para>
16657 <indexterm role="variable">
16658 <primary><varname>$log_space</varname></primary>
16659 </indexterm>
16660 The amount of free space (as a number of kilobytes) in the disk
16661 partition where Exim&#x2019;s log files are being written. The value is recalculated
16662 whenever the variable is referenced. If the operating system does not have the
16663 ability to find the amount of free space (only true for experimental systems),
16664 the space value is -1. See also the <option>check_log_space</option> option.
16665 </para>
16666 </listitem></varlistentry>
16667 <varlistentry>
16668 <term><varname>$mailstore_basename</varname></term>
16669 <listitem>
16670 <para>
16671 <indexterm role="variable">
16672 <primary><varname>$mailstore_basename</varname></primary>
16673 </indexterm>
16674 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16675 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16676 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16677 contains the basename of the files that are being written, that is, the name
16678 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16679 variable is empty.
16680 </para>
16681 </listitem></varlistentry>
16682 <varlistentry>
16683 <term><varname>$malware_name</varname></term>
16684 <listitem>
16685 <para>
16686 <indexterm role="variable">
16687 <primary><varname>$malware_name</varname></primary>
16688 </indexterm>
16689 This variable is available when Exim is compiled with the
16690 content-scanning extension. It is set to the name of the virus that was found
16691 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16692 </para>
16693 </listitem></varlistentry>
16694 <varlistentry revisionflag="changed">
16695 <term><varname>$max_received_linelength</varname></term>
16696 <listitem>
16697 <para revisionflag="changed">
16698 <indexterm role="variable">
16699 <primary><varname>$max_received_linelength</varname></primary>
16700 </indexterm>
16701 <indexterm role="concept">
16702 <primary>maximum</primary>
16703 <secondary>line length</secondary>
16704 </indexterm>
16705 <indexterm role="concept">
16706 <primary>line length</primary>
16707 <secondary>maximum</secondary>
16708 </indexterm>
16709 This variable contains the number of bytes in the longest line that was
16710 received as part of the message, not counting the line termination
16711 character(s).
16712 </para>
16713 </listitem></varlistentry>
16714 <varlistentry>
16715 <term><varname>$message_age</varname></term>
16716 <listitem>
16717 <para>
16718 <indexterm role="concept">
16719 <primary>message</primary>
16720 <secondary>age of</secondary>
16721 </indexterm>
16722 <indexterm role="variable">
16723 <primary><varname>$message_age</varname></primary>
16724 </indexterm>
16725 This variable is set at the start of a delivery attempt to contain the number
16726 of seconds since the message was received. It does not change during a single
16727 delivery attempt.
16728 </para>
16729 </listitem></varlistentry>
16730 <varlistentry>
16731 <term><varname>$message_body</varname></term>
16732 <listitem>
16733 <para>
16734 <indexterm role="concept">
16735 <primary>body of message</primary>
16736 <secondary>expansion variable</secondary>
16737 </indexterm>
16738 <indexterm role="concept">
16739 <primary>message body</primary>
16740 <secondary>in expansion</secondary>
16741 </indexterm>
16742 <indexterm role="concept">
16743 <primary>binary zero</primary>
16744 <secondary>in message body</secondary>
16745 </indexterm>
16746 <indexterm role="variable">
16747 <primary><varname>$message_body</varname></primary>
16748 </indexterm>
16749 <indexterm role="option">
16750 <primary><option>message_body_visible</option></primary>
16751 </indexterm>
16752 This variable contains the initial portion of a message&#x2019;s body while it is
16753 being delivered, and is intended mainly for use in filter files. The maximum
16754 number of characters of the body that are put into the variable is set by the
16755 <option>message_body_visible</option> configuration option; the default is 500.
16756 </para>
16757 <para revisionflag="changed">
16758 <indexterm role="option">
16759 <primary><option>message_body_newlines</option></primary>
16760 </indexterm>
16761 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
16762 easier to search for phrases that might be split over a line break. However,
16763 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
16764 zeros are always converted into spaces.
16765 </para>
16766 </listitem></varlistentry>
16767 <varlistentry>
16768 <term><varname>$message_body_end</varname></term>
16769 <listitem>
16770 <para>
16771 <indexterm role="concept">
16772 <primary>body of message</primary>
16773 <secondary>expansion variable</secondary>
16774 </indexterm>
16775 <indexterm role="concept">
16776 <primary>message body</primary>
16777 <secondary>in expansion</secondary>
16778 </indexterm>
16779 <indexterm role="variable">
16780 <primary><varname>$message_body_end</varname></primary>
16781 </indexterm>
16782 This variable contains the final portion of a message&#x2019;s
16783 body while it is being delivered. The format and maximum size are as for
16784 <varname>$message_body</varname>.
16785 </para>
16786 </listitem></varlistentry>
16787 <varlistentry>
16788 <term><varname>$message_body_size</varname></term>
16789 <listitem>
16790 <para>
16791 <indexterm role="concept">
16792 <primary>body of message</primary>
16793 <secondary>size</secondary>
16794 </indexterm>
16795 <indexterm role="concept">
16796 <primary>message body</primary>
16797 <secondary>size</secondary>
16798 </indexterm>
16799 <indexterm role="variable">
16800 <primary><varname>$message_body_size</varname></primary>
16801 </indexterm>
16802 When a message is being delivered, this variable contains the size of the body
16803 in bytes. The count starts from the character after the blank line that
16804 separates the body from the header. Newlines are included in the count. See
16805 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16806 </para>
16807 </listitem></varlistentry>
16808 <varlistentry>
16809 <term><varname>$message_exim_id</varname></term>
16810 <listitem>
16811 <para>
16812 <indexterm role="variable">
16813 <primary><varname>$message_exim_id</varname></primary>
16814 </indexterm>
16815 When a message is being received or delivered, this variable contains the
16816 unique message id that is generated and used by Exim to identify the message.
16817 An id is not created for a message until after its header has been successfully
16818 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16819 line; it is the local id that Exim assigns to the message, for example:
16820 <literal>1BXTIK-0001yO-VA</literal>.
16821 </para>
16822 </listitem></varlistentry>
16823 <varlistentry>
16824 <term><varname>$message_headers</varname></term>
16825 <listitem>
16826 <para>
16827 <indexterm role="variable">
16828 <primary><varname>$message_headers</varname></primary>
16829 </indexterm>
16830 This variable contains a concatenation of all the header lines when a message
16831 is being processed, except for lines added by routers or transports. The header
16832 lines are separated by newline characters. Their contents are decoded in the
16833 same way as a header line that is inserted by <option>bheader</option>.
16834 </para>
16835 </listitem></varlistentry>
16836 <varlistentry>
16837 <term><varname>$message_headers_raw</varname></term>
16838 <listitem>
16839 <para>
16840 <indexterm role="variable">
16841 <primary><varname>$message_headers_raw</varname></primary>
16842 </indexterm>
16843 This variable is like <varname>$message_headers</varname> except that no processing of the
16844 contents of header lines is done.
16845 </para>
16846 </listitem></varlistentry>
16847 <varlistentry>
16848 <term><varname>$message_id</varname></term>
16849 <listitem>
16850 <para>
16851 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16852 </para>
16853 </listitem></varlistentry>
16854 <varlistentry>
16855 <term><varname>$message_linecount</varname></term>
16856 <listitem>
16857 <para>
16858 <indexterm role="variable">
16859 <primary><varname>$message_linecount</varname></primary>
16860 </indexterm>
16861 This variable contains the total number of lines in the header and body of the
16862 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16863 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16864 number of lines received. Before delivery happens (that is, before filters,
16865 routers, and transports run) the count is increased to include the
16866 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16867 lines that are added by ACLs. The blank line that separates the message header
16868 from the body is not counted. Here is an example of the use of this variable in
16869 a DATA ACL:
16870 </para>
16871 <literallayout class="monospaced">
16872 deny message   = Too many lines in message header
16873      condition = \
16874       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
16875 </literallayout>
16876 <para>
16877 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16878 message has not yet been received.
16879 </para>
16880 </listitem></varlistentry>
16881 <varlistentry>
16882 <term><varname>$message_size</varname></term>
16883 <listitem>
16884 <para>
16885 <indexterm role="concept">
16886 <primary>size</primary>
16887 <secondary>of message</secondary>
16888 </indexterm>
16889 <indexterm role="concept">
16890 <primary>message</primary>
16891 <secondary>size</secondary>
16892 </indexterm>
16893 <indexterm role="variable">
16894 <primary><varname>$message_size</varname></primary>
16895 </indexterm>
16896 When a message is being processed, this variable contains its size in bytes. In
16897 most cases, the size includes those headers that were received with the
16898 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16899 deliveries as they are written. However, there is one special case: during the
16900 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16901 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16902 precise size of the file that has been written. See also
16903 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16904 </para>
16905 <para>
16906 <indexterm role="concept">
16907 <primary>RCPT</primary>
16908 <secondary>value of <varname>$message_size</varname></secondary>
16909 </indexterm>
16910 While running an ACL at the time of an SMTP RCPT command, <varname>$message_size</varname>
16911 contains the size supplied on the MAIL command, or -1 if no size was given. The
16912 value may not, of course, be truthful.
16913 </para>
16914 </listitem></varlistentry>
16915 <varlistentry>
16916 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16917 <listitem>
16918 <para>
16919 A number of variables whose names start with <varname>$mime</varname> are
16920 available when Exim is compiled with the content-scanning extension. For
16921 details, see section <xref linkend="SECTscanmimepart"/>.
16922 </para>
16923 </listitem></varlistentry>
16924 <varlistentry>
16925 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
16926 <listitem>
16927 <para>
16928 These variables are counters that can be incremented by means
16929 of the <option>add</option> command in filter files.
16930 </para>
16931 </listitem></varlistentry>
16932 <varlistentry>
16933 <term><varname>$original_domain</varname></term>
16934 <listitem>
16935 <para>
16936 <indexterm role="variable">
16937 <primary><varname>$domain</varname></primary>
16938 </indexterm>
16939 <indexterm role="variable">
16940 <primary><varname>$original_domain</varname></primary>
16941 </indexterm>
16942 When a top-level address is being processed for delivery, this contains the
16943 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16944 generated by an alias, forward, or filter file) is being processed, this
16945 variable contains the domain of the original address (lower cased). This
16946 differs from <varname>$parent_domain</varname> only when there is more than one level of
16947 aliasing or forwarding. When more than one address is being delivered in a
16948 single transport run, <varname>$original_domain</varname> is not set.
16949 </para>
16950 <para>
16951 If a new address is created by means of a <option>deliver</option> command in a system
16952 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16953 part <emphasis>system-filter</emphasis> and the default qualify domain.
16954 </para>
16955 </listitem></varlistentry>
16956 <varlistentry>
16957 <term><varname>$original_local_part</varname></term>
16958 <listitem>
16959 <para>
16960 <indexterm role="variable">
16961 <primary><varname>$local_part</varname></primary>
16962 </indexterm>
16963 <indexterm role="variable">
16964 <primary><varname>$original_local_part</varname></primary>
16965 </indexterm>
16966 When a top-level address is being processed for delivery, this contains the
16967 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16968 local part, because <varname>$original_local_part</varname> always contains the full local
16969 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16970 filter file) is being processed, this variable contains the full local part of
16971 the original address.
16972 </para>
16973 <para>
16974 If the router that did the redirection processed the local part
16975 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16976 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16977 one level of aliasing or forwarding. When more than one address is being
16978 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
16979 </para>
16980 <para>
16981 If a new address is created by means of a <option>deliver</option> command in a system
16982 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16983 part <emphasis>system-filter</emphasis> and the default qualify domain.
16984 </para>
16985 </listitem></varlistentry>
16986 <varlistentry>
16987 <term><varname>$originator_gid</varname></term>
16988 <listitem>
16989 <para>
16990 <indexterm role="concept">
16991 <primary>gid (group id)</primary>
16992 <secondary>of originating user</secondary>
16993 </indexterm>
16994 <indexterm role="concept">
16995 <primary>sender</primary>
16996 <secondary>gid</secondary>
16997 </indexterm>
16998 <indexterm role="variable">
16999 <primary><varname>$caller_gid</varname></primary>
17000 </indexterm>
17001 <indexterm role="variable">
17002 <primary><varname>$originator_gid</varname></primary>
17003 </indexterm>
17004 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17005 message was received. For messages received via the command line, this is the
17006 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17007 normally the gid of the Exim user.
17008 </para>
17009 </listitem></varlistentry>
17010 <varlistentry>
17011 <term><varname>$originator_uid</varname></term>
17012 <listitem>
17013 <para>
17014 <indexterm role="concept">
17015 <primary>uid (user id)</primary>
17016 <secondary>of originating user</secondary>
17017 </indexterm>
17018 <indexterm role="concept">
17019 <primary>sender</primary>
17020 <secondary>uid</secondary>
17021 </indexterm>
17022 <indexterm role="variable">
17023 <primary><varname>$caller_uid</varname></primary>
17024 </indexterm>
17025 <indexterm role="variable">
17026 <primary><varname>$originaltor_uid</varname></primary>
17027 </indexterm>
17028 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17029 messages received via the command line, this is the uid of the sending user.
17030 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17031 user.
17032 </para>
17033 </listitem></varlistentry>
17034 <varlistentry>
17035 <term><varname>$parent_domain</varname></term>
17036 <listitem>
17037 <para>
17038 <indexterm role="variable">
17039 <primary><varname>$parent_domain</varname></primary>
17040 </indexterm>
17041 This variable is similar to <varname>$original_domain</varname> (see
17042 above), except that it refers to the immediately preceding parent address.
17043 </para>
17044 </listitem></varlistentry>
17045 <varlistentry>
17046 <term><varname>$parent_local_part</varname></term>
17047 <listitem>
17048 <para>
17049 <indexterm role="variable">
17050 <primary><varname>$parent_local_part</varname></primary>
17051 </indexterm>
17052 This variable is similar to <varname>$original_local_part</varname>
17053 (see above), except that it refers to the immediately preceding parent address.
17054 </para>
17055 </listitem></varlistentry>
17056 <varlistentry>
17057 <term><varname>$pid</varname></term>
17058 <listitem>
17059 <para>
17060 <indexterm role="concept">
17061 <primary>pid (process id)</primary>
17062 <secondary>of current process</secondary>
17063 </indexterm>
17064 <indexterm role="variable">
17065 <primary><varname>$pid</varname></primary>
17066 </indexterm>
17067 This variable contains the current process id.
17068 </para>
17069 </listitem></varlistentry>
17070 <varlistentry>
17071 <term><varname>$pipe_addresses</varname></term>
17072 <listitem>
17073 <para>
17074 <indexterm role="concept">
17075 <primary>filter</primary>
17076 <secondary>transport filter</secondary>
17077 </indexterm>
17078 <indexterm role="concept">
17079 <primary>transport</primary>
17080 <secondary>filter</secondary>
17081 </indexterm>
17082 <indexterm role="variable">
17083 <primary><varname>$pipe_addresses</varname></primary>
17084 </indexterm>
17085 This is not an expansion variable, but is mentioned here because the string
17086 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17087 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17088 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17089 It cannot be used in general expansion strings, and provokes an <quote>unknown
17090 variable</quote> error if encountered.
17091 </para>
17092 </listitem></varlistentry>
17093 <varlistentry>
17094 <term><varname>$primary_hostname</varname></term>
17095 <listitem>
17096 <para>
17097 <indexterm role="variable">
17098 <primary><varname>$primary_hostname</varname></primary>
17099 </indexterm>
17100 This variable contains the value set by <option>primary_hostname</option> in the
17101 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17102 a single-component name, Exim calls <function>gethostbyname()</function> (or
17103 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17104 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17105 </para>
17106 </listitem></varlistentry>
17107 <varlistentry>
17108 <term><varname>$prvscheck_address</varname></term>
17109 <listitem>
17110 <para>
17111 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17112 which is described in sections <xref linkend="SECTexpansionitems"/> and
17113 <xref linkend="SECTverifyPRVS"/>.
17114 </para>
17115 </listitem></varlistentry>
17116 <varlistentry>
17117 <term><varname>$prvscheck_keynum</varname></term>
17118 <listitem>
17119 <para>
17120 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17121 which is described in sections <xref linkend="SECTexpansionitems"/> and
17122 <xref linkend="SECTverifyPRVS"/>.
17123 </para>
17124 </listitem></varlistentry>
17125 <varlistentry>
17126 <term><varname>$prvscheck_result</varname></term>
17127 <listitem>
17128 <para>
17129 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17130 which is described in sections <xref linkend="SECTexpansionitems"/> and
17131 <xref linkend="SECTverifyPRVS"/>.
17132 </para>
17133 </listitem></varlistentry>
17134 <varlistentry>
17135 <term><varname>$qualify_domain</varname></term>
17136 <listitem>
17137 <para>
17138 <indexterm role="variable">
17139 <primary><varname>$qualify_domain</varname></primary>
17140 </indexterm>
17141 The value set for the <option>qualify_domain</option> option in the configuration file.
17142 </para>
17143 </listitem></varlistentry>
17144 <varlistentry>
17145 <term><varname>$qualify_recipient</varname></term>
17146 <listitem>
17147 <para>
17148 <indexterm role="variable">
17149 <primary><varname>$qualify_recipient</varname></primary>
17150 </indexterm>
17151 The value set for the <option>qualify_recipient</option> option in the configuration file,
17152 or if not set, the value of <varname>$qualify_domain</varname>.
17153 </para>
17154 </listitem></varlistentry>
17155 <varlistentry>
17156 <term><varname>$rcpt_count</varname></term>
17157 <listitem>
17158 <para>
17159 <indexterm role="variable">
17160 <primary><varname>$rcpt_count</varname></primary>
17161 </indexterm>
17162 When a message is being received by SMTP, this variable contains the number of
17163 RCPT commands received for the current message. If this variable is used in a
17164 RCPT ACL, its value includes the current command.
17165 </para>
17166 </listitem></varlistentry>
17167 <varlistentry>
17168 <term><varname>$rcpt_defer_count</varname></term>
17169 <listitem>
17170 <para>
17171 <indexterm role="variable">
17172 <primary><varname>$rcpt_defer_count</varname></primary>
17173 </indexterm>
17174 <indexterm role="concept">
17175 <primary>4<emphasis>xx</emphasis> responses</primary>
17176 <secondary>count of</secondary>
17177 </indexterm>
17178 When a message is being received by SMTP, this variable contains the number of
17179 RCPT commands in the current message that have previously been rejected with a
17180 temporary (4<emphasis>xx</emphasis>) response.
17181 </para>
17182 </listitem></varlistentry>
17183 <varlistentry>
17184 <term><varname>$rcpt_fail_count</varname></term>
17185 <listitem>
17186 <para>
17187 <indexterm role="variable">
17188 <primary><varname>$rcpt_fail_count</varname></primary>
17189 </indexterm>
17190 When a message is being received by SMTP, this variable contains the number of
17191 RCPT commands in the current message that have previously been rejected with a
17192 permanent (5<emphasis>xx</emphasis>) response.
17193 </para>
17194 </listitem></varlistentry>
17195 <varlistentry>
17196 <term><varname>$received_count</varname></term>
17197 <listitem>
17198 <para>
17199 <indexterm role="variable">
17200 <primary><varname>$received_count</varname></primary>
17201 </indexterm>
17202 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17203 including the one added by Exim (so its value is always greater than zero). It
17204 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17205 delivering.
17206 </para>
17207 </listitem></varlistentry>
17208 <varlistentry>
17209 <term><varname>$received_for</varname></term>
17210 <listitem>
17211 <para>
17212 <indexterm role="variable">
17213 <primary><varname>$received_for</varname></primary>
17214 </indexterm>
17215 If there is only a single recipient address in an incoming message, this
17216 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17217 built. The value is copied after recipient rewriting has happened, but before
17218 the <function>local_scan()</function> function is run.
17219 </para>
17220 </listitem></varlistentry>
17221 <varlistentry>
17222 <term><varname>$received_ip_address</varname></term>
17223 <listitem>
17224 <para>
17225 <indexterm role="variable">
17226 <primary><varname>$received_ip_address</varname></primary>
17227 </indexterm>
17228 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17229 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17230 is set to the local port number. (The remote IP address and port are in
17231 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17232 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17233 option.
17234 </para>
17235 <para>
17236 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17237 could be used, for example, to make the file name for a TLS certificate depend
17238 on which interface and/or port is being used for the incoming connection. The
17239 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17240 messages that are received, thus making these variables available at delivery
17241 time.
17242 </para>
17243 <para>
17244 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17245 the values are unknown (unless they are explicitly set by options of the
17246 <command>smtp</command> transport).
17247 </para>
17248 </listitem></varlistentry>
17249 <varlistentry>
17250 <term><varname>$received_port</varname></term>
17251 <listitem>
17252 <para>
17253 <indexterm role="variable">
17254 <primary><varname>$received_port</varname></primary>
17255 </indexterm>
17256 See <varname>$received_ip_address</varname>.
17257 </para>
17258 </listitem></varlistentry>
17259 <varlistentry>
17260 <term><varname>$received_protocol</varname></term>
17261 <listitem>
17262 <para>
17263 <indexterm role="variable">
17264 <primary><varname>$received_protocol</varname></primary>
17265 </indexterm>
17266 When a message is being processed, this variable contains the name of the
17267 protocol by which it was received. Most of the names used by Exim are defined
17268 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17269 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17270 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17271 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17272 connection and the client was successfully authenticated.
17273 </para>
17274 <para>
17275 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17276 automatically set up on connection without the use of STARTTLS (see
17277 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17278 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17279 where the client initially uses EHLO, sets up an encrypted connection using
17280 STARTTLS, and then uses HELO afterwards.
17281 </para>
17282 <para>
17283 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17284 messages that are injected locally by trusted callers. This is commonly used to
17285 identify messages that are being re-injected after some kind of scanning.
17286 </para>
17287 </listitem></varlistentry>
17288 <varlistentry>
17289 <term><varname>$received_time</varname></term>
17290 <listitem>
17291 <para>
17292 <indexterm role="variable">
17293 <primary><varname>$received_time</varname></primary>
17294 </indexterm>
17295 This variable contains the date and time when the current message was received,
17296 as a number of seconds since the start of the Unix epoch.
17297 </para>
17298 </listitem></varlistentry>
17299 <varlistentry>
17300 <term><varname>$recipient_data</varname></term>
17301 <listitem>
17302 <para>
17303 <indexterm role="variable">
17304 <primary><varname>$recipient_data</varname></primary>
17305 </indexterm>
17306 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17307 condition. It contains the data from the lookup, and the value remains set
17308 until the next <option>recipients</option> test. Thus, you can do things like this:
17309 </para>
17310 <literallayout>
17311 <literal>require recipients  = cdb*@;/some/file</literal>
17312 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17313 </literallayout>
17314 <para>
17315 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17316 method in the address list, using the semicolon syntax as in the example above.
17317 The variable is not set for a lookup that is used as part of the string
17318 expansion that all such lists undergo before being interpreted.
17319 </para>
17320 </listitem></varlistentry>
17321 <varlistentry>
17322 <term><varname>$recipient_verify_failure</varname></term>
17323 <listitem>
17324 <para>
17325 <indexterm role="variable">
17326 <primary><varname>$recipient_verify_failure</varname></primary>
17327 </indexterm>
17328 In an ACL, when a recipient verification fails, this variable contains
17329 information about the failure. It is set to one of the following words:
17330 </para>
17331 <itemizedlist>
17332 <listitem>
17333 <para>
17334 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17335 was neither local nor came from an exempted host.
17336 </para>
17337 </listitem>
17338 <listitem>
17339 <para>
17340 <quote>route</quote>: Routing failed.
17341 </para>
17342 </listitem>
17343 <listitem>
17344 <para>
17345 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17346 or before the MAIL command (that is, on initial connection, HELO, or
17347 MAIL).
17348 </para>
17349 </listitem>
17350 <listitem>
17351 <para>
17352 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17353 </para>
17354 </listitem>
17355 <listitem>
17356 <para>
17357 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17358 </para>
17359 </listitem>
17360 </itemizedlist>
17361 <para>
17362 The main use of this variable is expected to be to distinguish between
17363 rejections of MAIL and rejections of RCPT.
17364 </para>
17365 </listitem></varlistentry>
17366 <varlistentry>
17367 <term><varname>$recipients</varname></term>
17368 <listitem>
17369 <para>
17370 <indexterm role="variable">
17371 <primary><varname>$recipients</varname></primary>
17372 </indexterm>
17373 This variable contains a list of envelope recipients for a message. A comma and
17374 a space separate the addresses in the replacement text. However, the variable
17375 is not generally available, to prevent exposure of Bcc recipients in
17376 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
17377 cases:
17378 </para>
17379 <orderedlist numeration="arabic">
17380 <listitem>
17381 <para>
17382 In a system filter file.
17383 </para>
17384 </listitem>
17385 <listitem>
17386 <para>
17387 In the ACLs associated with the DATA command and with non-SMTP messages, that
17388 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17389 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17390 <option>acl_not_smtp_mime</option>.
17391 </para>
17392 </listitem>
17393 <listitem>
17394 <para>
17395 From within a <function>local_scan()</function> function.
17396 </para>
17397 </listitem>
17398 </orderedlist>
17399 </listitem></varlistentry>
17400 <varlistentry>
17401 <term><varname>$recipients_count</varname></term>
17402 <listitem>
17403 <para>
17404 <indexterm role="variable">
17405 <primary><varname>$recipients_count</varname></primary>
17406 </indexterm>
17407 When a message is being processed, this variable contains the number of
17408 envelope recipients that came with the message. Duplicates are not excluded
17409 from the count. While a message is being received over SMTP, the number
17410 increases for each accepted recipient. It can be referenced in an ACL.
17411 </para>
17412 </listitem></varlistentry>
17413 <varlistentry>
17414 <term><varname>$regex_match_string</varname></term>
17415 <listitem>
17416 <para>
17417 <indexterm role="variable">
17418 <primary><varname>$regex_match_string</varname></primary>
17419 </indexterm>
17420 This variable is set to contain the matching regular expression after a
17421 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17422 </para>
17423 </listitem></varlistentry>
17424 <varlistentry>
17425 <term><varname>$reply_address</varname></term>
17426 <listitem>
17427 <para>
17428 <indexterm role="variable">
17429 <primary><varname>$reply_address</varname></primary>
17430 </indexterm>
17431 When a message is being processed, this variable contains the contents of the
17432 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17433 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17434 white space, the value is not processed in any way. In particular, no RFC 2047
17435 decoding or character code translation takes place.
17436 </para>
17437 </listitem></varlistentry>
17438 <varlistentry>
17439 <term><varname>$return_path</varname></term>
17440 <listitem>
17441 <para>
17442 <indexterm role="variable">
17443 <primary><varname>$return_path</varname></primary>
17444 </indexterm>
17445 When a message is being delivered, this variable contains the return path &ndash;
17446 the sender field that will be sent as part of the envelope. It is not enclosed
17447 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
17448 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17449 mailing list has been expanded by a router which specifies a different address
17450 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17451 address, whereas <varname>$sender_address</varname> always contains the original sender address
17452 that was received with the message. In other words, <varname>$sender_address</varname> contains
17453 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17454 envelope sender.
17455 </para>
17456 </listitem></varlistentry>
17457 <varlistentry>
17458 <term><varname>$return_size_limit</varname></term>
17459 <listitem>
17460 <para>
17461 <indexterm role="variable">
17462 <primary><varname>$return_size_limit</varname></primary>
17463 </indexterm>
17464 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17465 </para>
17466 </listitem></varlistentry>
17467 <varlistentry>
17468 <term><varname>$runrc</varname></term>
17469 <listitem>
17470 <para>
17471 <indexterm role="concept">
17472 <primary>return code</primary>
17473 <secondary>from <option>run</option> expansion</secondary>
17474 </indexterm>
17475 <indexterm role="variable">
17476 <primary><varname>$runrc</varname></primary>
17477 </indexterm>
17478 This variable contains the return code from a command that is run by the
17479 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17480 assume the order in which option values are expanded, except for those
17481 preconditions whose order of testing is documented. Therefore, you cannot
17482 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17483 another.
17484 </para>
17485 </listitem></varlistentry>
17486 <varlistentry>
17487 <term><varname>$self_hostname</varname></term>
17488 <listitem>
17489 <para>
17490 <indexterm role="option">
17491 <primary><option>self</option></primary>
17492 <secondary>value of host name</secondary>
17493 </indexterm>
17494 <indexterm role="variable">
17495 <primary><varname>$self_hostname</varname></primary>
17496 </indexterm>
17497 When an address is routed to a supposedly remote host that turns out to be the
17498 local host, what happens is controlled by the <option>self</option> generic router option.
17499 One of its values causes the address to be passed to another router. When this
17500 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17501 original router encountered. In other circumstances its contents are null.
17502 </para>
17503 </listitem></varlistentry>
17504 <varlistentry>
17505 <term><varname>$sender_address</varname></term>
17506 <listitem>
17507 <para>
17508 <indexterm role="variable">
17509 <primary><varname>$sender_address</varname></primary>
17510 </indexterm>
17511 When a message is being processed, this variable contains the sender&#x2019;s address
17512 that was received in the message&#x2019;s envelope. The case of letters in the address
17513 is retained, in both the local part and the domain. For bounce messages, the
17514 value of this variable is the empty string. See also <varname>$return_path</varname>.
17515 </para>
17516 </listitem></varlistentry>
17517 <varlistentry>
17518 <term><varname>$sender_address_data</varname></term>
17519 <listitem>
17520 <para>
17521 <indexterm role="variable">
17522 <primary><varname>$address_data</varname></primary>
17523 </indexterm>
17524 <indexterm role="variable">
17525 <primary><varname>$sender_address_data</varname></primary>
17526 </indexterm>
17527 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17528 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17529 distinguish it from data from a recipient address. The value does not persist
17530 after the end of the current ACL statement. If you want to preserve it for
17531 longer, you can save it in an ACL variable.
17532 </para>
17533 </listitem></varlistentry>
17534 <varlistentry>
17535 <term><varname>$sender_address_domain</varname></term>
17536 <listitem>
17537 <para>
17538 <indexterm role="variable">
17539 <primary><varname>$sender_address_domain</varname></primary>
17540 </indexterm>
17541 The domain portion of <varname>$sender_address</varname>.
17542 </para>
17543 </listitem></varlistentry>
17544 <varlistentry>
17545 <term><varname>$sender_address_local_part</varname></term>
17546 <listitem>
17547 <para>
17548 <indexterm role="variable">
17549 <primary><varname>$sender_address_local_part</varname></primary>
17550 </indexterm>
17551 The local part portion of <varname>$sender_address</varname>.
17552 </para>
17553 </listitem></varlistentry>
17554 <varlistentry>
17555 <term><varname>$sender_data</varname></term>
17556 <listitem>
17557 <para>
17558 <indexterm role="variable">
17559 <primary><varname>$sender_data</varname></primary>
17560 </indexterm>
17561 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17562 in a router <option>senders</option> option. It contains the data from the lookup, and the
17563 value remains set until the next <option>senders</option> test. Thus, you can do things like
17564 this:
17565 </para>
17566 <literallayout>
17567 <literal>require senders      = cdb*@;/some/file</literal>
17568 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17569 </literallayout>
17570 <para>
17571 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17572 method in the address list, using the semicolon syntax as in the example above.
17573 The variable is not set for a lookup that is used as part of the string
17574 expansion that all such lists undergo before being interpreted.
17575 </para>
17576 </listitem></varlistentry>
17577 <varlistentry>
17578 <term><varname>$sender_fullhost</varname></term>
17579 <listitem>
17580 <para>
17581 <indexterm role="variable">
17582 <primary><varname>$sender_fullhost</varname></primary>
17583 </indexterm>
17584 When a message is received from a remote host, this variable contains the host
17585 name and IP address in a single string. It ends with the IP address in square
17586 brackets, followed by a colon and a port number if the logging of ports is
17587 enabled. The format of the rest of the string depends on whether the host
17588 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17589 looking up its IP address. (Looking up the IP address can be forced by the
17590 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17591 start of the string is a verified host name; if this is not present,
17592 verification either failed or was not requested. A host name in parentheses is
17593 the argument of a HELO or EHLO command. This is omitted if it is identical to
17594 the verified host name or to the host&#x2019;s IP address in square brackets.
17595 </para>
17596 </listitem></varlistentry>
17597 <varlistentry>
17598 <term><varname>$sender_helo_name</varname></term>
17599 <listitem>
17600 <para>
17601 <indexterm role="variable">
17602 <primary><varname>$sender_helo_name</varname></primary>
17603 </indexterm>
17604 When a message is received from a remote host that has issued a HELO or EHLO
17605 command, the argument of that command is placed in this variable. It is also
17606 set if HELO or EHLO is used when a message is received using SMTP locally via
17607 the <option>-bs</option> or <option>-bS</option> options.
17608 </para>
17609 </listitem></varlistentry>
17610 <varlistentry>
17611 <term><varname>$sender_host_address</varname></term>
17612 <listitem>
17613 <para>
17614 <indexterm role="variable">
17615 <primary><varname>$sender_host_address</varname></primary>
17616 </indexterm>
17617 When a message is received from a remote host, this variable contains that
17618 host&#x2019;s IP address. For locally submitted messages, it is empty.
17619 </para>
17620 </listitem></varlistentry>
17621 <varlistentry>
17622 <term><varname>$sender_host_authenticated</varname></term>
17623 <listitem>
17624 <para>
17625 <indexterm role="variable">
17626 <primary><varname>$sender_host_authenticated</varname></primary>
17627 </indexterm>
17628 This variable contains the name (not the public name) of the authenticator
17629 driver that successfully authenticated the client from which the message was
17630 received. It is empty if there was no successful authentication. See also
17631 <varname>$authenticated_id</varname>.
17632 </para>
17633 </listitem></varlistentry>
17634 <varlistentry>
17635 <term><varname>$sender_host_name</varname></term>
17636 <listitem>
17637 <para>
17638 <indexterm role="variable">
17639 <primary><varname>$sender_host_name</varname></primary>
17640 </indexterm>
17641 When a message is received from a remote host, this variable contains the
17642 host&#x2019;s name as obtained by looking up its IP address. For messages received by
17643 other means, this variable is empty.
17644 </para>
17645 <para>
17646 <indexterm role="variable">
17647 <primary><varname>$host_lookup_failed</varname></primary>
17648 </indexterm>
17649 If the host name has not previously been looked up, a reference to
17650 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17651 A looked up name is accepted only if it leads back to the original IP address
17652 via a forward lookup. If either the reverse or the forward lookup fails to find
17653 any data, or if the forward lookup does not yield the original IP address,
17654 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17655 </para>
17656 <para>
17657 <indexterm role="variable">
17658 <primary><varname>$host_lookup_deferred</varname></primary>
17659 </indexterm>
17660 However, if either of the lookups cannot be completed (for example, there is a
17661 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17662 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17663 </para>
17664 <para>
17665 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17666 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17667 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17668 is set to <quote>1</quote>.
17669 </para>
17670 <para>
17671 Exim does not automatically look up every calling host&#x2019;s name. If you want
17672 maximum efficiency, you should arrange your configuration so that it avoids
17673 these lookups altogether. The lookup happens only if one or more of the
17674 following are true:
17675 </para>
17676 <itemizedlist>
17677 <listitem>
17678 <para>
17679 A string containing <varname>$sender_host_name</varname> is expanded.
17680 </para>
17681 </listitem>
17682 <listitem>
17683 <para>
17684 The calling host matches the list in <option>host_lookup</option>. In the default
17685 configuration, this option is set to *, so it must be changed if lookups are
17686 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17687 </para>
17688 </listitem>
17689 <listitem>
17690 <para>
17691 Exim needs the host name in order to test an item in a host list. The items
17692 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17693 <xref linkend="SECThoslispatnamsk"/>.
17694 </para>
17695 </listitem>
17696 <listitem>
17697 <para>
17698 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17699 In this case, the host name is required to compare with the name quoted in any
17700 EHLO or HELO commands that the client issues.
17701 </para>
17702 </listitem>
17703 <listitem>
17704 <para>
17705 The remote host issues a EHLO or HELO command that quotes one of the
17706 domains in <option>helo_lookup_domains</option>. The default value of this option is
17707 </para>
17708 <literallayout class="monospaced">
17709   helo_lookup_domains = @ : @[]
17710 </literallayout>
17711 <para>
17712 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
17713 IP address in an EHLO or HELO command.
17714 </para>
17715 </listitem>
17716 </itemizedlist>
17717 </listitem></varlistentry>
17718 <varlistentry>
17719 <term><varname>$sender_host_port</varname></term>
17720 <listitem>
17721 <para>
17722 <indexterm role="variable">
17723 <primary><varname>$sender_host_port</varname></primary>
17724 </indexterm>
17725 When a message is received from a remote host, this variable contains the port
17726 number that was used on the remote host.
17727 </para>
17728 </listitem></varlistentry>
17729 <varlistentry>
17730 <term><varname>$sender_ident</varname></term>
17731 <listitem>
17732 <para>
17733 <indexterm role="variable">
17734 <primary><varname>$sender_ident</varname></primary>
17735 </indexterm>
17736 When a message is received from a remote host, this variable contains the
17737 identification received in response to an RFC 1413 request. When a message has
17738 been received locally, this variable contains the login name of the user that
17739 called Exim.
17740 </para>
17741 </listitem></varlistentry>
17742 <varlistentry>
17743 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17744 <listitem>
17745 <para>
17746 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17747 <option>ratelimit</option> ACL condition. Details are given in section
17748 <xref linkend="SECTratelimiting"/>.
17749 </para>
17750 </listitem></varlistentry>
17751 <varlistentry>
17752 <term><varname>$sender_rcvhost</varname></term>
17753 <listitem>
17754 <para>
17755 <indexterm role="concept">
17756 <primary>DNS</primary>
17757 <secondary>reverse lookup</secondary>
17758 </indexterm>
17759 <indexterm role="concept">
17760 <primary>reverse DNS lookup</primary>
17761 </indexterm>
17762 <indexterm role="variable">
17763 <primary><varname>$sender_rcvhost</varname></primary>
17764 </indexterm>
17765 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17766 either the verified host name (as obtained from a reverse DNS lookup) or, if
17767 there is no verified host name, the IP address in square brackets. After that
17768 there may be text in parentheses. When the first item is a verified host name,
17769 the first thing in the parentheses is the IP address in square brackets,
17770 followed by a colon and a port number if port logging is enabled. When the
17771 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17772 the parentheses.
17773 </para>
17774 <para>
17775 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17776 was used and its argument was not identical to the real host name or IP
17777 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17778 all three items are present in the parentheses, a newline and tab are inserted
17779 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17780 </para>
17781 </listitem></varlistentry>
17782 <varlistentry>
17783 <term><varname>$sender_verify_failure</varname></term>
17784 <listitem>
17785 <para>
17786 <indexterm role="variable">
17787 <primary><varname>$sender_verify_failure</varname></primary>
17788 </indexterm>
17789 In an ACL, when a sender verification fails, this variable contains information
17790 about the failure. The details are the same as for
17791 <varname>$recipient_verify_failure</varname>.
17792 </para>
17793 </listitem></varlistentry>
17794 <varlistentry>
17795 <term><varname>$sending_ip_address</varname></term>
17796 <listitem>
17797 <para>
17798 <indexterm role="variable">
17799 <primary><varname>$sending_ip_address</varname></primary>
17800 </indexterm>
17801 This variable is set whenever an outgoing SMTP connection to another host has
17802 been set up. It contains the IP address of the local interface that is being
17803 used. This is useful if a host that has more than one IP address wants to take
17804 on different personalities depending on which one is being used. For incoming
17805 connections, see <varname>$received_ip_address</varname>.
17806 </para>
17807 </listitem></varlistentry>
17808 <varlistentry>
17809 <term><varname>$sending_port</varname></term>
17810 <listitem>
17811 <para>
17812 <indexterm role="variable">
17813 <primary><varname>$sending_port</varname></primary>
17814 </indexterm>
17815 This variable is set whenever an outgoing SMTP connection to another host has
17816 been set up. It contains the local port that is being used. For incoming
17817 connections, see <varname>$received_port</varname>.
17818 </para>
17819 </listitem></varlistentry>
17820 <varlistentry>
17821 <term><varname>$smtp_active_hostname</varname></term>
17822 <listitem>
17823 <para>
17824 <indexterm role="variable">
17825 <primary><varname>$smtp_active_hostname</varname></primary>
17826 </indexterm>
17827 During an incoming SMTP session, this variable contains the value of the active
17828 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
17829 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17830 value can be consulted during routing and delivery.
17831 </para>
17832 </listitem></varlistentry>
17833 <varlistentry>
17834 <term><varname>$smtp_command</varname></term>
17835 <listitem>
17836 <para>
17837 <indexterm role="variable">
17838 <primary><varname>$smtp_command</varname></primary>
17839 </indexterm>
17840 During the processing of an incoming SMTP command, this variable contains the
17841 entire command. This makes it possible to distinguish between HELO and EHLO in
17842 the HELO ACL, and also to distinguish between commands such as these:
17843 </para>
17844 <literallayout class="monospaced">
17845 MAIL FROM:&lt;&gt;
17846 MAIL FROM: &lt;&gt;
17847 </literallayout>
17848 <para>
17849 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17850 command, the address in <varname>$smtp_command</varname> is the original address before any
17851 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17852 the address after SMTP-time rewriting.
17853 </para>
17854 </listitem></varlistentry>
17855 <varlistentry>
17856 <term><varname>$smtp_command_argument</varname></term>
17857 <listitem>
17858 <para>
17859 <indexterm role="concept">
17860 <primary>SMTP</primary>
17861 <secondary>command, argument for</secondary>
17862 </indexterm>
17863 <indexterm role="variable">
17864 <primary><varname>$smtp_command_argument</varname></primary>
17865 </indexterm>
17866 While an ACL is running to check an SMTP command, this variable contains the
17867 argument, that is, the text that follows the command name, with leading white
17868 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17869 somewhat redundant, but is retained for backwards compatibility.
17870 </para>
17871 </listitem></varlistentry>
17872 <varlistentry>
17873 <term><varname>$smtp_count_at_connection_start</varname></term>
17874 <listitem>
17875 <para>
17876 <indexterm role="variable">
17877 <primary><varname>$smtp_count_at_connection_start</varname></primary>
17878 </indexterm>
17879 This variable is set greater than zero only in processes spawned by the Exim
17880 daemon for handling incoming SMTP connections. The name is deliberately long,
17881 in order to emphasize what the contents are. When the daemon accepts a new
17882 connection, it increments this variable. A copy of the variable is passed to
17883 the child process that handles the connection, but its value is fixed, and
17884 never changes. It is only an approximation of how many incoming connections
17885 there actually are, because many other connections may come and go while a
17886 single connection is being processed. When a child process terminates, the
17887 daemon decrements its copy of the variable.
17888 </para>
17889 </listitem></varlistentry>
17890 <varlistentry>
17891 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
17892 <listitem>
17893 <para>
17894 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
17895 that were current at the end of the system filter file. This allows a system
17896 filter file to set values that can be tested in users&#x2019; filter files. For
17897 example, a system filter could set a value indicating how likely it is that a
17898 message is junk mail.
17899 </para>
17900 </listitem></varlistentry>
17901 <varlistentry>
17902 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17903 <listitem>
17904 <para>
17905 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17906 is compiled with the content-scanning extension. For details, see section
17907 <xref linkend="SECTscanspamass"/>.
17908 </para>
17909 </listitem></varlistentry>
17910 <varlistentry>
17911 <term><varname>$spool_directory</varname></term>
17912 <listitem>
17913 <para>
17914 <indexterm role="variable">
17915 <primary><varname>$spool_directory</varname></primary>
17916 </indexterm>
17917 The name of Exim&#x2019;s spool directory.
17918 </para>
17919 </listitem></varlistentry>
17920 <varlistentry>
17921 <term><varname>$spool_inodes</varname></term>
17922 <listitem>
17923 <para>
17924 <indexterm role="variable">
17925 <primary><varname>$spool_inodes</varname></primary>
17926 </indexterm>
17927 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
17928 being written. The value is recalculated whenever the variable is referenced.
17929 If the relevant file system does not have the concept of inodes, the value of
17930 is -1. See also the <option>check_spool_inodes</option> option.
17931 </para>
17932 </listitem></varlistentry>
17933 <varlistentry>
17934 <term><varname>$spool_space</varname></term>
17935 <listitem>
17936 <para>
17937 <indexterm role="variable">
17938 <primary><varname>$spool_space</varname></primary>
17939 </indexterm>
17940 The amount of free space (as a number of kilobytes) in the disk partition where
17941 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
17942 variable is referenced. If the operating system does not have the ability to
17943 find the amount of free space (only true for experimental systems), the space
17944 value is -1. For example, to check in an ACL that there is at least 50
17945 megabytes free on the spool, you could write:
17946 </para>
17947 <literallayout class="monospaced">
17948 condition = ${if &gt; {$spool_space}{50000}}
17949 </literallayout>
17950 <para>
17951 See also the <option>check_spool_space</option> option.
17952 </para>
17953 </listitem></varlistentry>
17954 <varlistentry>
17955 <term><varname>$thisaddress</varname></term>
17956 <listitem>
17957 <para>
17958 <indexterm role="variable">
17959 <primary><varname>$thisaddress</varname></primary>
17960 </indexterm>
17961 This variable is set only during the processing of the <option>foranyaddress</option>
17962 command in a filter file. Its use is explained in the description of that
17963 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
17964 interfaces to mail filtering</emphasis>.
17965 </para>
17966 </listitem></varlistentry>
17967 <varlistentry>
17968 <term><varname>$tls_certificate_verified</varname></term>
17969 <listitem>
17970 <para>
17971 <indexterm role="variable">
17972 <primary><varname>$tls_certificate_verified</varname></primary>
17973 </indexterm>
17974 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17975 message was received, and <quote>0</quote> otherwise.
17976 </para>
17977 </listitem></varlistentry>
17978 <varlistentry>
17979 <term><varname>$tls_cipher</varname></term>
17980 <listitem>
17981 <para revisionflag="changed">
17982 <indexterm role="variable">
17983 <primary><varname>$tls_cipher</varname></primary>
17984 </indexterm>
17985 When a message is received from a remote host over an encrypted SMTP
17986 connection, this variable is set to the cipher suite that was negotiated, for
17987 example DES-CBC3-SHA. In other circumstances, in particular, for message
17988 received over unencrypted connections, the variable is empty. Testing
17989 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
17990 non-encrypted connections during ACL processing.
17991 </para>
17992 <para revisionflag="changed">
17993 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
17994 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
17995 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
17996 and then set to the outgoing cipher suite if one is negotiated. See chapter
17997 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
17998 details of the <command>smtp</command> transport.
17999 </para>
18000 </listitem></varlistentry>
18001 <varlistentry>
18002 <term><varname>$tls_peerdn</varname></term>
18003 <listitem>
18004 <para>
18005 <indexterm role="variable">
18006 <primary><varname>$tls_peerdn</varname></primary>
18007 </indexterm>
18008 When a message is received from a remote host over an encrypted SMTP
18009 connection, and Exim is configured to request a certificate from the client,
18010 the value of the Distinguished Name of the certificate is made available in the
18011 <varname>$tls_peerdn</varname> during subsequent processing. <phrase revisionflag="changed">Like <varname>$tls_cipher</varname>, the
18012 value is retained during message delivery, except during outbound SMTP
18013 deliveries.</phrase>
18014 </para>
18015 </listitem></varlistentry>
18016 <varlistentry>
18017 <term><varname>$tod_bsdinbox</varname></term>
18018 <listitem>
18019 <para>
18020 <indexterm role="variable">
18021 <primary><varname>$tod_bsdinbox</varname></primary>
18022 </indexterm>
18023 The time of day and the date, in the format required for BSD-style mailbox
18024 files, for example: Thu Oct 17 17:14:09 1995.
18025 </para>
18026 </listitem></varlistentry>
18027 <varlistentry>
18028 <term><varname>$tod_epoch</varname></term>
18029 <listitem>
18030 <para>
18031 <indexterm role="variable">
18032 <primary><varname>$tod_epoch</varname></primary>
18033 </indexterm>
18034 The time and date as a number of seconds since the start of the Unix epoch.
18035 </para>
18036 </listitem></varlistentry>
18037 <varlistentry>
18038 <term><varname>$tod_full</varname></term>
18039 <listitem>
18040 <para>
18041 <indexterm role="variable">
18042 <primary><varname>$tod_full</varname></primary>
18043 </indexterm>
18044 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18045 +0100. The timezone is always given as a numerical offset from UTC, with
18046 positive values used for timezones that are ahead (east) of UTC, and negative
18047 values for those that are behind (west).
18048 </para>
18049 </listitem></varlistentry>
18050 <varlistentry>
18051 <term><varname>$tod_log</varname></term>
18052 <listitem>
18053 <para>
18054 <indexterm role="variable">
18055 <primary><varname>$tod_log</varname></primary>
18056 </indexterm>
18057 The time and date in the format used for writing Exim&#x2019;s log files, for example:
18058 1995-10-12 15:32:29, but without a timezone.
18059 </para>
18060 </listitem></varlistentry>
18061 <varlistentry>
18062 <term><varname>$tod_logfile</varname></term>
18063 <listitem>
18064 <para>
18065 <indexterm role="variable">
18066 <primary><varname>$tod_logfile</varname></primary>
18067 </indexterm>
18068 This variable contains the date in the format yyyymmdd. This is the format that
18069 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18070 flag.
18071 </para>
18072 </listitem></varlistentry>
18073 <varlistentry>
18074 <term><varname>$tod_zone</varname></term>
18075 <listitem>
18076 <para>
18077 <indexterm role="variable">
18078 <primary><varname>$tod_zone</varname></primary>
18079 </indexterm>
18080 This variable contains the numerical value of the local timezone, for example:
18081 -0500.
18082 </para>
18083 </listitem></varlistentry>
18084 <varlistentry>
18085 <term><varname>$tod_zulu</varname></term>
18086 <listitem>
18087 <para>
18088 <indexterm role="variable">
18089 <primary><varname>$tod_zulu</varname></primary>
18090 </indexterm>
18091 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18092 by ISO 8601, for example: 20030221154023Z.
18093 </para>
18094 </listitem></varlistentry>
18095 <varlistentry>
18096 <term><varname>$value</varname></term>
18097 <listitem>
18098 <para>
18099 <indexterm role="variable">
18100 <primary><varname>$value</varname></primary>
18101 </indexterm>
18102 This variable contains the result of an expansion lookup, extraction operation,
18103 or external command, as described above. It is also used during a
18104 <emphasis role="bold">reduce</emphasis> expansion.
18105 </para>
18106 </listitem></varlistentry>
18107 <varlistentry>
18108 <term><varname>$version_number</varname></term>
18109 <listitem>
18110 <para>
18111 <indexterm role="variable">
18112 <primary><varname>$version_number</varname></primary>
18113 </indexterm>
18114 The version number of Exim.
18115 </para>
18116 </listitem></varlistentry>
18117 <varlistentry>
18118 <term><varname>$warn_message_delay</varname></term>
18119 <listitem>
18120 <para>
18121 <indexterm role="variable">
18122 <primary><varname>$warn_message_delay</varname></primary>
18123 </indexterm>
18124 This variable is set only during the creation of a message warning about a
18125 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18126 </para>
18127 </listitem></varlistentry>
18128 <varlistentry>
18129 <term><varname>$warn_message_recipients</varname></term>
18130 <listitem>
18131 <para>
18132 <indexterm role="variable">
18133 <primary><varname>$warn_message_recipients</varname></primary>
18134 </indexterm>
18135 This variable is set only during the creation of a message warning about a
18136 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18137 </para>
18138 </listitem></varlistentry>
18139 </variablelist>
18140 <para>
18141 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18142 </para>
18143 </section>
18144 </chapter>
18145
18146 <chapter id="CHAPperl">
18147 <title>Embedded Perl</title>
18148 <para>
18149 <indexterm role="concept" id="IIDperl" class="startofrange">
18150 <primary>Perl</primary>
18151 <secondary>calling from Exim</secondary>
18152 </indexterm>
18153 Exim can be built to include an embedded Perl interpreter. When this is done,
18154 Perl subroutines can be called as part of the string expansion process. To make
18155 use of the Perl support, you need version 5.004 or later of Perl installed on
18156 your system. To include the embedded interpreter in the Exim binary, include
18157 the line
18158 </para>
18159 <literallayout class="monospaced">
18160 EXIM_PERL = perl.o
18161 </literallayout>
18162 <para>
18163 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18164 </para>
18165 <section id="SECID85">
18166 <title>Setting up so Perl can be used</title>
18167 <para>
18168 <indexterm role="option">
18169 <primary><option>perl_startup</option></primary>
18170 </indexterm>
18171 Access to Perl subroutines is via a global configuration option called
18172 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18173 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18174 interpreter is started and there is almost no overhead for Exim (since none of
18175 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18176 option then the associated value is taken to be Perl code which is executed in
18177 a newly created Perl interpreter.
18178 </para>
18179 <para>
18180 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18181 need backslashes before any characters to escape special meanings. The option
18182 should usually be something like
18183 </para>
18184 <literallayout class="monospaced">
18185 perl_startup = do '/etc/exim.pl'
18186 </literallayout>
18187 <para>
18188 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18189 use from Exim. Exim can be configured either to start up a Perl interpreter as
18190 soon as it is entered, or to wait until the first time it is needed. Starting
18191 the interpreter at the beginning ensures that it is done while Exim still has
18192 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18193 fact used in a particular run. Also, note that this does not mean that Exim is
18194 necessarily running as root when Perl is called at a later time. By default,
18195 the interpreter is started only when it is needed, but this can be changed in
18196 two ways:
18197 </para>
18198 <itemizedlist>
18199 <listitem>
18200 <para>
18201 <indexterm role="option">
18202 <primary><option>perl_at_start</option></primary>
18203 </indexterm>
18204 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18205 a startup when Exim is entered.
18206 </para>
18207 </listitem>
18208 <listitem>
18209 <para>
18210 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18211 overriding the setting of <option>perl_at_start</option>.
18212 </para>
18213 </listitem>
18214 </itemizedlist>
18215 <para>
18216 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18217 initial startup, even if <option>perl_at_start</option> is set.
18218 </para>
18219 </section>
18220 <section id="SECID86">
18221 <title>Calling Perl subroutines</title>
18222 <para>
18223 When the configuration file includes a <option>perl_startup</option> option you can make use
18224 of the string expansion item to call the Perl subroutines that are defined
18225 by the <option>perl_startup</option> code. The operator is used in any of the following
18226 forms:
18227 </para>
18228 <literallayout class="monospaced">
18229 ${perl{foo}}
18230 ${perl{foo}{argument}}
18231 ${perl{foo}{argument1}{argument2} ... }
18232 </literallayout>
18233 <para>
18234 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18235 arguments may be passed. Passing more than this results in an expansion failure
18236 with an error message of the form
18237 </para>
18238 <literallayout class="monospaced">
18239 Too many arguments passed to Perl subroutine "foo" (max is 8)
18240 </literallayout>
18241 <para>
18242 The return value of the Perl subroutine is evaluated in a scalar context before
18243 it is passed back to Exim to be inserted into the expanded string. If the
18244 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18245 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18246 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
18247 that was passed to <option>die</option>.
18248 </para>
18249 </section>
18250 <section id="SECID87">
18251 <title>Calling Exim functions from Perl</title>
18252 <para>
18253 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18254 is available to call back into Exim&#x2019;s string expansion function. For example,
18255 the Perl code
18256 </para>
18257 <literallayout class="monospaced">
18258 my $lp = Exim::expand_string('$local_part');
18259 </literallayout>
18260 <para>
18261 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18262 Note those are single quotes and not double quotes to protect against
18263 <varname>$local_part</varname> being interpolated as a Perl variable.
18264 </para>
18265 <para>
18266 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18267 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18268 expansion string, the Perl call from the original expansion string fails with
18269 an appropriate error message, in the same way as if <option>die</option> were used.
18270 </para>
18271 <para>
18272 <indexterm role="concept">
18273 <primary>debugging</primary>
18274 <secondary>from embedded Perl</secondary>
18275 </indexterm>
18276 <indexterm role="concept">
18277 <primary>log</primary>
18278 <secondary>writing from embedded Perl</secondary>
18279 </indexterm>
18280 Two other Exim functions are available for use from within Perl code.
18281 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
18282 debugging is enabled. If you want a newline at the end, you must supply it.
18283 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
18284 timestamp. In this case, you should not supply a terminating newline.
18285 </para>
18286 </section>
18287 <section id="SECID88">
18288 <title>Use of standard output and error by Perl</title>
18289 <para>
18290 <indexterm role="concept">
18291 <primary>Perl</primary>
18292 <secondary>standard output and error</secondary>
18293 </indexterm>
18294 You should not write to the standard error or output streams from within your
18295 Perl code, as it is not defined how these are set up. In versions of Exim
18296 before 4.50, it is possible for the standard output or error to refer to the
18297 SMTP connection during message reception via the daemon. Writing to this stream
18298 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18299 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18300 avoided, but the output is lost.
18301 </para>
18302 <para>
18303 <indexterm role="concept">
18304 <primary>Perl</primary>
18305 <secondary>use of <option>warn</option></secondary>
18306 </indexterm>
18307 The Perl <option>warn</option> statement writes to the standard error stream by default.
18308 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18309 you have no control. When Exim starts up the Perl interpreter, it arranges for
18310 output from the <option>warn</option> statement to be written to the Exim main log. You can
18311 change this by including appropriate Perl magic somewhere in your Perl code.
18312 For example, to discard <option>warn</option> output completely, you need this:
18313 </para>
18314 <literallayout class="monospaced">
18315 $SIG{__WARN__} = sub { };
18316 </literallayout>
18317 <para>
18318 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18319 example, the code for the subroutine is empty, so it does nothing, but you can
18320 include any Perl code that you like. The text of the <option>warn</option> message is passed
18321 as the first subroutine argument.
18322 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18323 </para>
18324 </section>
18325 </chapter>
18326
18327 <chapter id="CHAPinterfaces">
18328 <title>Starting the daemon and the use of network interfaces</title>
18329 <titleabbrev>Starting the daemon</titleabbrev>
18330 <para>
18331 <indexterm role="concept">
18332 <primary>daemon</primary>
18333 <secondary>starting</secondary>
18334 </indexterm>
18335 <indexterm role="concept">
18336 <primary>interface</primary>
18337 <secondary>listening</secondary>
18338 </indexterm>
18339 <indexterm role="concept">
18340 <primary>network interface</primary>
18341 </indexterm>
18342 <indexterm role="concept">
18343 <primary>interface</primary>
18344 <secondary>network</secondary>
18345 </indexterm>
18346 <indexterm role="concept">
18347 <primary>IP address</primary>
18348 <secondary>for listening</secondary>
18349 </indexterm>
18350 <indexterm role="concept">
18351 <primary>daemon</primary>
18352 <secondary>listening IP addresses</secondary>
18353 </indexterm>
18354 <indexterm role="concept">
18355 <primary>TCP/IP</primary>
18356 <secondary>setting listening interfaces</secondary>
18357 </indexterm>
18358 <indexterm role="concept">
18359 <primary>TCP/IP</primary>
18360 <secondary>setting listening ports</secondary>
18361 </indexterm>
18362 A host that is connected to a TCP/IP network may have one or more physical
18363 hardware network interfaces. Each of these interfaces may be configured as one
18364 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18365 works with. Each of these logical interfaces is associated with an IP address.
18366 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18367 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18368 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
18369 </para>
18370 <orderedlist numeration="arabic">
18371 <listitem>
18372 <para>
18373 When a listening daemon is started, Exim needs to know which interfaces
18374 and ports to listen on.
18375 </para>
18376 </listitem>
18377 <listitem>
18378 <para>
18379 When Exim is routing an address, it needs to know which IP addresses
18380 are associated with local interfaces. This is required for the correct
18381 processing of MX lists by removing the local host and others with the
18382 same or higher priority values. Also, Exim needs to detect cases
18383 when an address is routed to an IP address that in fact belongs to the
18384 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18385 option of the smtp transport is set (as appropriate), this is treated
18386 as an error situation.
18387 </para>
18388 </listitem>
18389 <listitem>
18390 <para>
18391 When Exim connects to a remote host, it may need to know which interface to use
18392 for the outgoing connection.
18393 </para>
18394 </listitem>
18395 </orderedlist>
18396 <para>
18397 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
18398 of cases. If your host has only one interface, and you want all its IP
18399 addresses to be treated in the same way, and you are using only the
18400 standard SMTP port, you should not need to take any special action. The
18401 rest of this chapter does not apply to you.
18402 </para>
18403 <para>
18404 In a more complicated situation you may want to listen only on certain
18405 interfaces, or on different ports, and for this reason there are a number of
18406 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
18407 chapter describes how they operate.
18408 </para>
18409 <para>
18410 When a message is received over TCP/IP, the interface and port that were
18411 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18412 </para>
18413 <section id="SECID89">
18414 <title>Starting a listening daemon</title>
18415 <para>
18416 When a listening daemon is started (by means of the <option>-bd</option> command line
18417 option), the interfaces and ports on which it listens are controlled by the
18418 following options:
18419 </para>
18420 <itemizedlist>
18421 <listitem>
18422 <para>
18423 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18424 compatibility, this option can also be specified in the singular.)
18425 </para>
18426 </listitem>
18427 <listitem>
18428 <para>
18429 <option>local_interfaces</option> contains list of interface IP addresses on which to
18430 listen. Each item may optionally also specify a port.
18431 </para>
18432 </listitem>
18433 </itemizedlist>
18434 <para>
18435 The default list separator in both cases is a colon, but this can be changed as
18436 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18437 it is usually best to change the separator to avoid having to double all the
18438 colons. For example:
18439 </para>
18440 <literallayout class="monospaced">
18441 local_interfaces = &lt;; 127.0.0.1 ; \
18442                       192.168.23.65 ; \
18443                       ::1 ; \
18444                       3ffe:ffff:836f::fe86:a061
18445 </literallayout>
18446 <para>
18447 There are two different formats for specifying a port along with an IP address
18448 in <option>local_interfaces</option>:
18449 </para>
18450 <orderedlist numeration="arabic">
18451 <listitem>
18452 <para>
18453 The port is added onto the address with a dot separator. For example, to listen
18454 on port 1234 on two different IP addresses:
18455 </para>
18456 <literallayout class="monospaced">
18457 local_interfaces = &lt;; 192.168.23.65.1234 ; \
18458                       3ffe:ffff:836f::fe86:a061.1234
18459 </literallayout>
18460 </listitem>
18461 <listitem>
18462 <para>
18463 The IP address is enclosed in square brackets, and the port is added
18464 with a colon separator, for example:
18465 </para>
18466 <literallayout class="monospaced">
18467 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
18468                       [3ffe:ffff:836f::fe86:a061]:1234
18469 </literallayout>
18470 </listitem>
18471 </orderedlist>
18472 <para>
18473 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18474 default setting contains just one port:
18475 </para>
18476 <literallayout class="monospaced">
18477 daemon_smtp_ports = smtp
18478 </literallayout>
18479 <para>
18480 If more than one port is listed, each interface that does not have its own port
18481 specified listens on all of them. Ports that are listed in
18482 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18483 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18484 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18485 </para>
18486 </section>
18487 <section id="SECID90">
18488 <title>Special IP listening addresses</title>
18489 <para>
18490 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18491 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18492 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18493 instead of setting up separate listening sockets for each interface. The
18494 default value of <option>local_interfaces</option> is
18495 </para>
18496 <literallayout class="monospaced">
18497 local_interfaces = 0.0.0.0
18498 </literallayout>
18499 <para>
18500 when Exim is built without IPv6 support; otherwise it is:
18501 </para>
18502 <literallayout class="monospaced">
18503 local_interfaces = &lt;; ::0 ; 0.0.0.0
18504 </literallayout>
18505 <para>
18506 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18507 </para>
18508 </section>
18509 <section id="SECID91">
18510 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18511 <para>
18512 The <option>-oX</option> command line option can be used to override the values of
18513 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18514 instance. Another way of doing this would be to use macros and the <option>-D</option>
18515 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18516 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18517 exim.
18518 </para>
18519 <para>
18520 The value of <option>-oX</option> is a list of items. The default colon separator can be
18521 changed in the usual way if required. If there are any items that do not
18522 contain dots or colons (that is, are not IP addresses), the value of
18523 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18524 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18525 replaced by those items. Thus, for example,
18526 </para>
18527 <literallayout class="monospaced">
18528 -oX 1225
18529 </literallayout>
18530 <para>
18531 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18532 whereas
18533 </para>
18534 <literallayout class="monospaced">
18535 -oX 192.168.34.5.1125
18536 </literallayout>
18537 <para>
18538 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18539 (However, since <option>local_interfaces</option> now contains no items without ports, the
18540 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18541 </para>
18542 </section>
18543 <section id="SECTsupobssmt">
18544 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18545 <para>
18546 <indexterm role="concept">
18547 <primary>ssmtp protocol</primary>
18548 </indexterm>
18549 <indexterm role="concept">
18550 <primary>smtps protocol</primary>
18551 </indexterm>
18552 <indexterm role="concept">
18553 <primary>SMTP</primary>
18554 <secondary>ssmtp protocol</secondary>
18555 </indexterm>
18556 <indexterm role="concept">
18557 <primary>SMTP</primary>
18558 <secondary>smtps protocol</secondary>
18559 </indexterm>
18560 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18561 before the STARTTLS command was standardized for SMTP. Some legacy clients
18562 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18563 list of port numbers, connections to those ports must use SSMTP. The most
18564 common use of this option is expected to be
18565 </para>
18566 <literallayout class="monospaced">
18567 tls_on_connect_ports = 465
18568 </literallayout>
18569 <para>
18570 because 465 is the usual port number used by the legacy clients. There is also
18571 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18572 this way when a daemon is started.
18573 </para>
18574 <para>
18575 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18576 daemon to listen on those ports. You must still specify them in
18577 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18578 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18579 connections via the daemon.)
18580 </para>
18581 </section>
18582 <section id="SECID92">
18583 <title>IPv6 address scopes</title>
18584 <para>
18585 <indexterm role="concept">
18586 <primary>IPv6</primary>
18587 <secondary>address scopes</secondary>
18588 </indexterm>
18589 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18590 can, in principle, have the same link-local IPv6 address on different
18591 interfaces. Thus, additional information is needed, over and above the IP
18592 address, to distinguish individual interfaces. A convention of using a
18593 percent sign followed by something (often the interface name) has been
18594 adopted in some cases, leading to addresses like this:
18595 </para>
18596 <literallayout class="monospaced">
18597 fe80::202:b3ff:fe03:45c1%eth0
18598 </literallayout>
18599 <para>
18600 To accommodate this usage, a percent sign followed by an arbitrary string is
18601 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18602 to convert a textual IPv6 address for actual use. This function recognizes the
18603 percent convention in operating systems that support it, and it processes the
18604 address appropriately. Unfortunately, some older libraries have problems with
18605 <function>getaddrinfo()</function>. If
18606 </para>
18607 <literallayout class="monospaced">
18608 IPV6_USE_INET_PTON=yes
18609 </literallayout>
18610 <para>
18611 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18612 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18613 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18614 function.) Of course, this means that the additional functionality of
18615 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
18616 </para>
18617 </section>
18618 <section id="SECID93">
18619 <title>Disabling IPv6</title>
18620 <para>
18621 <indexterm role="concept">
18622 <primary>IPv6</primary>
18623 <secondary>disabling</secondary>
18624 </indexterm>
18625 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18626 run on a host whose kernel does not support IPv6. The binary will fall back to
18627 using IPv4, but it may waste resources looking up AAAA records, and trying to
18628 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18629 <indexterm role="option">
18630 <primary><option>disable_ipv6</option></primary>
18631 </indexterm>
18632 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18633 activities take place. AAAA records are never looked up, and any IPv6 addresses
18634 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18635 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18636 to handle IPv6 literal addresses.
18637 </para>
18638 <para>
18639 On the other hand, when IPv6 is in use, there may be times when you want to
18640 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18641 option to globally suppress the lookup of AAAA records for specified domains,
18642 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18643 IPv6 addresses in an individual router.
18644 </para>
18645 </section>
18646 <section id="SECID94">
18647 <title>Examples of starting a listening daemon</title>
18648 <para>
18649 The default case in an IPv6 environment is
18650 </para>
18651 <literallayout class="monospaced">
18652 daemon_smtp_ports = smtp
18653 local_interfaces = &lt;; ::0 ; 0.0.0.0
18654 </literallayout>
18655 <para>
18656 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18657 Either one or two sockets may be used, depending on the characteristics of
18658 the TCP/IP stack. (This is complicated and messy; for more information,
18659 read the comments in the <filename>daemon.c</filename> source file.)
18660 </para>
18661 <para>
18662 To specify listening on ports 25 and 26 on all interfaces:
18663 </para>
18664 <literallayout class="monospaced">
18665 daemon_smtp_ports = 25 : 26
18666 </literallayout>
18667 <para>
18668 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18669 </para>
18670 <literallayout class="monospaced">
18671 local_interfaces = &lt;; ::0.25     ; ::0.26 \
18672                       0.0.0.0.25 ; 0.0.0.0.26
18673 </literallayout>
18674 <para>
18675 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18676 IPv4 loopback address only:
18677 </para>
18678 <literallayout class="monospaced">
18679 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18680 </literallayout>
18681 <para>
18682 To specify listening on the default port on specific interfaces only:
18683 </para>
18684 <literallayout class="monospaced">
18685 local_interfaces = 192.168.34.67 : 192.168.34.67
18686 </literallayout>
18687 <para>
18688 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18689 </para>
18690 </section>
18691 <section id="SECTreclocipadd">
18692 <title>Recognizing the local host</title>
18693 <para>
18694 The <option>local_interfaces</option> option is also used when Exim needs to determine
18695 whether or not an IP address refers to the local host. That is, the IP
18696 addresses of all the interfaces on which a daemon is listening are always
18697 treated as local.
18698 </para>
18699 <para>
18700 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18701 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18702 available interfaces from the operating system, and extracts the relevant
18703 (that is, IPv4 or IPv6) addresses to use for checking.
18704 </para>
18705 <para>
18706 Some systems set up large numbers of virtual interfaces in order to provide
18707 many virtual web servers. In this situation, you may want to listen for
18708 email on only a few of the available interfaces, but nevertheless treat all
18709 interfaces as local when routing. You can do this by setting
18710 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18711 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18712 used for listening. Consider this example:
18713 </para>
18714 <literallayout class="monospaced">
18715 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
18716                       192.168.53.235 ; \
18717                       3ffe:2101:12:1:a00:20ff:fe86:a061
18718
18719 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
18720 </literallayout>
18721 <para>
18722 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18723 address, but all available interface addresses are treated as local when
18724 Exim is routing.
18725 </para>
18726 <para>
18727 In some environments the local host name may be in an MX list, but with an IP
18728 address that is not assigned to any local interface. In other cases it may be
18729 desirable to treat other host names as if they referred to the local host. Both
18730 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18731 This contains host names rather than IP addresses. When a host is referenced
18732 during routing, either via an MX record or directly, it is treated as the local
18733 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18734 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18735 </para>
18736 </section>
18737 <section id="SECID95">
18738 <title>Delivering to a remote host</title>
18739 <para>
18740 Delivery to a remote host is handled by the smtp transport. By default, it
18741 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
18742 there is more than one) when connecting to a remote host. However, the
18743 <option>interface</option> option can be set to specify which interface is used. See the
18744 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18745 details.
18746 </para>
18747 </section>
18748 </chapter>
18749
18750 <chapter id="CHAPmainconfig">
18751 <title>Main configuration</title>
18752 <para>
18753 <indexterm role="concept" id="IIDconfima" class="startofrange">
18754 <primary>configuration file</primary>
18755 <secondary>main section</secondary>
18756 </indexterm>
18757 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18758 <primary>main configuration</primary>
18759 </indexterm>
18760 The first part of the run time configuration file contains three types of item:
18761 </para>
18762 <itemizedlist>
18763 <listitem>
18764 <para>
18765 Macro definitions: These lines start with an upper case letter. See section
18766 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18767 </para>
18768 </listitem>
18769 <listitem>
18770 <para>
18771 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18772 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18773 section <xref linkend="SECTnamedlists"/>.
18774 </para>
18775 </listitem>
18776 <listitem>
18777 <para>
18778 Main configuration settings: Each setting occupies one line of the file
18779 (with possible continuations). If any setting is preceded by the word
18780 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18781 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18782 settings.
18783 </para>
18784 </listitem>
18785 </itemizedlist>
18786 <para>
18787 This chapter specifies all the main configuration options, along with their
18788 types and default values. For ease of finding a particular option, they appear
18789 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18790 are now so many options, they are first listed briefly in functional groups, as
18791 an aid to finding the name of the option you are looking for. Some options are
18792 listed in more than one group.
18793 </para>
18794 <section id="SECID96">
18795 <title>Miscellaneous</title>
18796 <informaltable frame="none">
18797 <tgroup cols="2" colsep="0" rowsep="0">
18798 <colspec colwidth="196pt" align="left"/>
18799 <colspec colwidth="254pt" align="left"/>
18800 <tbody>
18801 <row>
18802 <entry><option>bi_command</option></entry>
18803 <entry>to run for <option>-bi</option> command line option</entry>
18804 </row>
18805 <row>
18806 <entry><option>disable_ipv6</option></entry>
18807 <entry>do no IPv6 processing</entry>
18808 </row>
18809 <row>
18810 <entry><option>keep_malformed</option></entry>
18811 <entry>for broken files &ndash; should not happen</entry>
18812 </row>
18813 <row>
18814 <entry><option>localhost_number</option></entry>
18815 <entry>for unique message ids in clusters</entry>
18816 </row>
18817 <row>
18818 <entry><phrase revisionflag="changed"><option>message_body_newlines</option></phrase></entry>
18819 <entry>retain newlines in <varname>$message_body</varname></entry>
18820 </row>
18821 <row>
18822 <entry><option>message_body_visible</option></entry>
18823 <entry>how much to show in <varname>$message_body</varname></entry>
18824 </row>
18825 <row>
18826 <entry><option>mua_wrapper</option></entry>
18827 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18828 </row>
18829 <row>
18830 <entry><option>print_topbitchars</option></entry>
18831 <entry>top-bit characters are printing</entry>
18832 </row>
18833 <row>
18834 <entry><option>timezone</option></entry>
18835 <entry>force time zone</entry>
18836 </row>
18837 </tbody>
18838 </tgroup>
18839 </informaltable>
18840 </section>
18841 <section id="SECID97">
18842 <title>Exim parameters</title>
18843 <informaltable frame="none">
18844 <tgroup cols="2" colsep="0" rowsep="0">
18845 <colspec colwidth="196pt" align="left"/>
18846 <colspec colwidth="254pt" align="left"/>
18847 <tbody>
18848 <row>
18849 <entry><option>exim_group</option></entry>
18850 <entry>override compiled-in value</entry>
18851 </row>
18852 <row>
18853 <entry><option>exim_path</option></entry>
18854 <entry>override compiled-in value</entry>
18855 </row>
18856 <row>
18857 <entry><option>exim_user</option></entry>
18858 <entry>override compiled-in value</entry>
18859 </row>
18860 <row>
18861 <entry><option>primary_hostname</option></entry>
18862 <entry>default from <function>uname()</function></entry>
18863 </row>
18864 <row>
18865 <entry><option>split_spool_directory</option></entry>
18866 <entry>use multiple directories</entry>
18867 </row>
18868 <row>
18869 <entry><option>spool_directory</option></entry>
18870 <entry>override compiled-in value</entry>
18871 </row>
18872 </tbody>
18873 </tgroup>
18874 </informaltable>
18875 </section>
18876 <section id="SECID98">
18877 <title>Privilege controls</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>admin_groups</option></entry>
18885 <entry>groups that are Exim admin users</entry>
18886 </row>
18887 <row>
18888 <entry><option>deliver_drop_privilege</option></entry>
18889 <entry>drop root for delivery processes</entry>
18890 </row>
18891 <row>
18892 <entry><option>local_from_check</option></entry>
18893 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18894 </row>
18895 <row>
18896 <entry><option>local_from_prefix</option></entry>
18897 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18898 </row>
18899 <row>
18900 <entry><option>local_from_suffix</option></entry>
18901 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18902 </row>
18903 <row>
18904 <entry><option>local_sender_retain</option></entry>
18905 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18906 </row>
18907 <row>
18908 <entry><option>never_users</option></entry>
18909 <entry>do not run deliveries as these</entry>
18910 </row>
18911 <row>
18912 <entry><option>prod_requires_admin</option></entry>
18913 <entry>forced delivery requires admin user</entry>
18914 </row>
18915 <row>
18916 <entry><option>queue_list_requires_admin</option></entry>
18917 <entry>queue listing requires admin user</entry>
18918 </row>
18919 <row>
18920 <entry><option>trusted_groups</option></entry>
18921 <entry>groups that are trusted</entry>
18922 </row>
18923 <row>
18924 <entry><option>trusted_users</option></entry>
18925 <entry>users that are trusted</entry>
18926 </row>
18927 </tbody>
18928 </tgroup>
18929 </informaltable>
18930 </section>
18931 <section id="SECID99">
18932 <title>Logging</title>
18933 <informaltable frame="none">
18934 <tgroup cols="2" colsep="0" rowsep="0">
18935 <colspec colwidth="196pt" align="left"/>
18936 <colspec colwidth="254pt" align="left"/>
18937 <tbody>
18938 <row>
18939 <entry><option>hosts_connection_nolog</option></entry>
18940 <entry>exemption from connect logging</entry>
18941 </row>
18942 <row>
18943 <entry><option>log_file_path</option></entry>
18944 <entry>override compiled-in value</entry>
18945 </row>
18946 <row>
18947 <entry><option>log_selector</option></entry>
18948 <entry>set/unset optional logging</entry>
18949 </row>
18950 <row>
18951 <entry><option>log_timezone</option></entry>
18952 <entry>add timezone to log lines</entry>
18953 </row>
18954 <row>
18955 <entry><option>message_logs</option></entry>
18956 <entry>create per-message logs</entry>
18957 </row>
18958 <row>
18959 <entry><option>preserve_message_logs</option></entry>
18960 <entry>after message completion</entry>
18961 </row>
18962 <row>
18963 <entry><option>process_log_path</option></entry>
18964 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18965 </row>
18966 <row>
18967 <entry><option>syslog_duplication</option></entry>
18968 <entry>controls duplicate log lines on syslog</entry>
18969 </row>
18970 <row>
18971 <entry><option>syslog_facility</option></entry>
18972 <entry>set syslog <quote>facility</quote> field</entry>
18973 </row>
18974 <row>
18975 <entry><option>syslog_processname</option></entry>
18976 <entry>set syslog <quote>ident</quote> field</entry>
18977 </row>
18978 <row>
18979 <entry><option>syslog_timestamp</option></entry>
18980 <entry>timestamp syslog lines</entry>
18981 </row>
18982 <row>
18983 <entry><option>write_rejectlog</option></entry>
18984 <entry>control use of message log</entry>
18985 </row>
18986 </tbody>
18987 </tgroup>
18988 </informaltable>
18989 </section>
18990 <section id="SECID100">
18991 <title>Frozen messages</title>
18992 <informaltable frame="none">
18993 <tgroup cols="2" colsep="0" rowsep="0">
18994 <colspec colwidth="196pt" align="left"/>
18995 <colspec colwidth="254pt" align="left"/>
18996 <tbody>
18997 <row>
18998 <entry><option>auto_thaw</option></entry>
18999 <entry>sets time for retrying frozen messages</entry>
19000 </row>
19001 <row>
19002 <entry><option>freeze_tell</option></entry>
19003 <entry>send message when freezing</entry>
19004 </row>
19005 <row>
19006 <entry><option>move_frozen_messages</option></entry>
19007 <entry>to another directory</entry>
19008 </row>
19009 <row>
19010 <entry><option>timeout_frozen_after</option></entry>
19011 <entry>keep frozen messages only so long</entry>
19012 </row>
19013 </tbody>
19014 </tgroup>
19015 </informaltable>
19016 </section>
19017 <section id="SECID101">
19018 <title>Data lookups</title>
19019 <informaltable frame="none">
19020 <tgroup cols="2" colsep="0" rowsep="0">
19021 <colspec colwidth="196pt" align="left"/>
19022 <colspec colwidth="254pt" align="left"/>
19023 <tbody>
19024 <row>
19025 <entry><phrase revisionflag="changed"><option>ibase_servers</option></phrase></entry>
19026 <entry>InterBase servers</entry>
19027 </row>
19028 <row>
19029 <entry><option>ldap_default_servers</option></entry>
19030 <entry>used if no server in query</entry>
19031 </row>
19032 <row>
19033 <entry><option>ldap_version</option></entry>
19034 <entry>set protocol version</entry>
19035 </row>
19036 <row>
19037 <entry><option>lookup_open_max</option></entry>
19038 <entry>lookup files held open</entry>
19039 </row>
19040 <row>
19041 <entry><phrase revisionflag="changed"><option>mysql_servers</option></phrase></entry>
19042 <entry>default MySQL servers</entry>
19043 </row>
19044 <row>
19045 <entry><phrase revisionflag="changed"><option>oracle_servers</option></phrase></entry>
19046 <entry>Oracle servers</entry>
19047 </row>
19048 <row>
19049 <entry><phrase revisionflag="changed"><option>pgsql_servers</option></phrase></entry>
19050 <entry>default PostgreSQL servers</entry>
19051 </row>
19052 <row>
19053 <entry><option>sqlite_lock_timeout</option></entry>
19054 <entry>as it says</entry>
19055 </row>
19056 </tbody>
19057 </tgroup>
19058 </informaltable>
19059 </section>
19060 <section id="SECID102">
19061 <title>Message ids</title>
19062 <informaltable frame="none">
19063 <tgroup cols="2" colsep="0" rowsep="0">
19064 <colspec colwidth="196pt" align="left"/>
19065 <colspec colwidth="254pt" align="left"/>
19066 <tbody>
19067 <row>
19068 <entry><option>message_id_header_domain</option></entry>
19069 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19070 </row>
19071 <row>
19072 <entry><option>message_id_header_text</option></entry>
19073 <entry>ditto</entry>
19074 </row>
19075 </tbody>
19076 </tgroup>
19077 </informaltable>
19078 </section>
19079 <section id="SECID103">
19080 <title>Embedded Perl Startup</title>
19081 <informaltable frame="none">
19082 <tgroup cols="2" colsep="0" rowsep="0">
19083 <colspec colwidth="196pt" align="left"/>
19084 <colspec colwidth="254pt" align="left"/>
19085 <tbody>
19086 <row>
19087 <entry><option>perl_at_start</option></entry>
19088 <entry>always start the interpreter</entry>
19089 </row>
19090 <row>
19091 <entry><option>perl_startup</option></entry>
19092 <entry>code to obey when starting Perl</entry>
19093 </row>
19094 </tbody>
19095 </tgroup>
19096 </informaltable>
19097 </section>
19098 <section id="SECID104">
19099 <title>Daemon</title>
19100 <informaltable frame="none">
19101 <tgroup cols="2" colsep="0" rowsep="0">
19102 <colspec colwidth="196pt" align="left"/>
19103 <colspec colwidth="254pt" align="left"/>
19104 <tbody>
19105 <row>
19106 <entry><option>daemon_smtp_ports</option></entry>
19107 <entry>default ports</entry>
19108 </row>
19109 <row>
19110 <entry><option>daemon_startup_retries</option></entry>
19111 <entry>number of times to retry</entry>
19112 </row>
19113 <row>
19114 <entry><option>daemon_startup_sleep</option></entry>
19115 <entry>time to sleep between tries</entry>
19116 </row>
19117 <row>
19118 <entry><option>extra_local_interfaces</option></entry>
19119 <entry>not necessarily listened on</entry>
19120 </row>
19121 <row>
19122 <entry><option>local_interfaces</option></entry>
19123 <entry>on which to listen, with optional ports</entry>
19124 </row>
19125 <row>
19126 <entry><option>pid_file_path</option></entry>
19127 <entry>override compiled-in value</entry>
19128 </row>
19129 <row>
19130 <entry><option>queue_run_max</option></entry>
19131 <entry>maximum simultaneous queue runners</entry>
19132 </row>
19133 </tbody>
19134 </tgroup>
19135 </informaltable>
19136 </section>
19137 <section id="SECID105">
19138 <title>Resource control</title>
19139 <informaltable frame="none">
19140 <tgroup cols="2" colsep="0" rowsep="0">
19141 <colspec colwidth="196pt" align="left"/>
19142 <colspec colwidth="254pt" align="left"/>
19143 <tbody>
19144 <row>
19145 <entry><option>check_log_inodes</option></entry>
19146 <entry>before accepting a message</entry>
19147 </row>
19148 <row>
19149 <entry><option>check_log_space</option></entry>
19150 <entry>before accepting a message</entry>
19151 </row>
19152 <row>
19153 <entry><option>check_spool_inodes</option></entry>
19154 <entry>before accepting a message</entry>
19155 </row>
19156 <row>
19157 <entry><option>check_spool_space</option></entry>
19158 <entry>before accepting a message</entry>
19159 </row>
19160 <row>
19161 <entry><option>deliver_queue_load_max</option></entry>
19162 <entry>no queue deliveries if load high</entry>
19163 </row>
19164 <row>
19165 <entry><option>queue_only_load</option></entry>
19166 <entry>queue incoming if load high</entry>
19167 </row>
19168 <row>
19169 <entry><phrase revisionflag="changed"><option>queue_only_load_latch</option></phrase></entry>
19170 <entry>don&#x2019;t re-evaluate load for each message</entry>
19171 </row>
19172 <row>
19173 <entry><option>queue_run_max</option></entry>
19174 <entry>maximum simultaneous queue runners</entry>
19175 </row>
19176 <row>
19177 <entry><option>remote_max_parallel</option></entry>
19178 <entry>parallel SMTP delivery per message</entry>
19179 </row>
19180 <row>
19181 <entry><option>smtp_accept_max</option></entry>
19182 <entry>simultaneous incoming connections</entry>
19183 </row>
19184 <row>
19185 <entry><option>smtp_accept_max_nonmail</option></entry>
19186 <entry>non-mail commands</entry>
19187 </row>
19188 <row>
19189 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19190 <entry>hosts to which the limit applies</entry>
19191 </row>
19192 <row>
19193 <entry><option>smtp_accept_max_per_connection</option></entry>
19194 <entry>messages per connection</entry>
19195 </row>
19196 <row>
19197 <entry><option>smtp_accept_max_per_host</option></entry>
19198 <entry>connections from one host</entry>
19199 </row>
19200 <row>
19201 <entry><option>smtp_accept_queue</option></entry>
19202 <entry>queue mail if more connections</entry>
19203 </row>
19204 <row>
19205 <entry><option>smtp_accept_queue_per_connection</option></entry>
19206 <entry>queue if more messages per connection</entry>
19207 </row>
19208 <row>
19209 <entry><option>smtp_accept_reserve</option></entry>
19210 <entry>only reserve hosts if more connections</entry>
19211 </row>
19212 <row>
19213 <entry><option>smtp_check_spool_space</option></entry>
19214 <entry>from SIZE on MAIL command</entry>
19215 </row>
19216 <row>
19217 <entry><option>smtp_connect_backlog</option></entry>
19218 <entry>passed to TCP/IP stack</entry>
19219 </row>
19220 <row>
19221 <entry><option>smtp_load_reserve</option></entry>
19222 <entry>SMTP from reserved hosts if load high</entry>
19223 </row>
19224 <row>
19225 <entry><option>smtp_reserve_hosts</option></entry>
19226 <entry>these are the reserve hosts</entry>
19227 </row>
19228 </tbody>
19229 </tgroup>
19230 </informaltable>
19231 </section>
19232 <section id="SECID106">
19233 <title>Policy controls</title>
19234 <informaltable frame="none">
19235 <tgroup cols="2" colsep="0" rowsep="0">
19236 <colspec colwidth="196pt" align="left"/>
19237 <colspec colwidth="254pt" align="left"/>
19238 <tbody>
19239 <row>
19240 <entry><option>acl_not_smtp</option></entry>
19241 <entry>ACL for non-SMTP messages</entry>
19242 </row>
19243 <row>
19244 <entry><option>acl_not_smtp_mime</option></entry>
19245 <entry>ACL for non-SMTP MIME parts</entry>
19246 </row>
19247 <row>
19248 <entry><option>acl_not_smtp_start</option></entry>
19249 <entry>ACL for start of non-SMTP message</entry>
19250 </row>
19251 <row>
19252 <entry><option>acl_smtp_auth</option></entry>
19253 <entry>ACL for AUTH</entry>
19254 </row>
19255 <row>
19256 <entry><option>acl_smtp_connect</option></entry>
19257 <entry>ACL for connection</entry>
19258 </row>
19259 <row>
19260 <entry><option>acl_smtp_data</option></entry>
19261 <entry>ACL for DATA</entry>
19262 </row>
19263 <row>
19264 <entry><option>acl_smtp_etrn</option></entry>
19265 <entry>ACL for ETRN</entry>
19266 </row>
19267 <row>
19268 <entry><option>acl_smtp_expn</option></entry>
19269 <entry>ACL for EXPN</entry>
19270 </row>
19271 <row>
19272 <entry><option>acl_smtp_helo</option></entry>
19273 <entry>ACL for EHLO or HELO</entry>
19274 </row>
19275 <row>
19276 <entry><option>acl_smtp_mail</option></entry>
19277 <entry>ACL for MAIL</entry>
19278 </row>
19279 <row>
19280 <entry><option>acl_smtp_mailauth</option></entry>
19281 <entry>ACL for AUTH on MAIL command</entry>
19282 </row>
19283 <row>
19284 <entry><option>acl_smtp_mime</option></entry>
19285 <entry>ACL for MIME parts</entry>
19286 </row>
19287 <row>
19288 <entry><option>acl_smtp_predata</option></entry>
19289 <entry>ACL for start of data</entry>
19290 </row>
19291 <row>
19292 <entry><option>acl_smtp_quit</option></entry>
19293 <entry>ACL for QUIT</entry>
19294 </row>
19295 <row>
19296 <entry><option>acl_smtp_rcpt</option></entry>
19297 <entry>ACL for RCPT</entry>
19298 </row>
19299 <row>
19300 <entry><option>acl_smtp_starttls</option></entry>
19301 <entry>ACL for STARTTLS</entry>
19302 </row>
19303 <row>
19304 <entry><option>acl_smtp_vrfy</option></entry>
19305 <entry>ACL for VRFY</entry>
19306 </row>
19307 <row>
19308 <entry><option>av_scanner</option></entry>
19309 <entry>specify virus scanner</entry>
19310 </row>
19311 <row>
19312 <entry><option>check_rfc2047_length</option></entry>
19313 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19314 </row>
19315 <row>
19316 <entry><option>dns_csa_search_limit</option></entry>
19317 <entry>control CSA parent search depth</entry>
19318 </row>
19319 <row>
19320 <entry><option>dns_csa_use_reverse</option></entry>
19321 <entry>en/disable CSA IP reverse search</entry>
19322 </row>
19323 <row>
19324 <entry><option>header_maxsize</option></entry>
19325 <entry>total size of message header</entry>
19326 </row>
19327 <row>
19328 <entry><option>header_line_maxsize</option></entry>
19329 <entry>individual header line limit</entry>
19330 </row>
19331 <row>
19332 <entry><option>helo_accept_junk_hosts</option></entry>
19333 <entry>allow syntactic junk from these hosts</entry>
19334 </row>
19335 <row>
19336 <entry><option>helo_allow_chars</option></entry>
19337 <entry>allow illegal chars in HELO names</entry>
19338 </row>
19339 <row>
19340 <entry><option>helo_lookup_domains</option></entry>
19341 <entry>lookup hostname for these HELO names</entry>
19342 </row>
19343 <row>
19344 <entry><option>helo_try_verify_hosts</option></entry>
19345 <entry>HELO soft-checked for these hosts</entry>
19346 </row>
19347 <row>
19348 <entry><option>helo_verify_hosts</option></entry>
19349 <entry>HELO hard-checked for these hosts</entry>
19350 </row>
19351 <row>
19352 <entry><option>host_lookup</option></entry>
19353 <entry>host name looked up for these hosts</entry>
19354 </row>
19355 <row>
19356 <entry><option>host_lookup_order</option></entry>
19357 <entry>order of DNS and local name lookups</entry>
19358 </row>
19359 <row>
19360 <entry><option>host_reject_connection</option></entry>
19361 <entry>reject connection from these hosts</entry>
19362 </row>
19363 <row>
19364 <entry><option>hosts_treat_as_local</option></entry>
19365 <entry>useful in some cluster configurations</entry>
19366 </row>
19367 <row>
19368 <entry><option>local_scan_timeout</option></entry>
19369 <entry>timeout for <function>local_scan()</function></entry>
19370 </row>
19371 <row>
19372 <entry><option>message_size_limit</option></entry>
19373 <entry>for all messages</entry>
19374 </row>
19375 <row>
19376 <entry><option>percent_hack_domains</option></entry>
19377 <entry>recognize %-hack for these domains</entry>
19378 </row>
19379 <row>
19380 <entry><option>spamd_address</option></entry>
19381 <entry>set interface to SpamAssassin</entry>
19382 </row>
19383 <row>
19384 <entry><option>strict_acl_vars</option></entry>
19385 <entry>object to unset ACL variables</entry>
19386 </row>
19387 </tbody>
19388 </tgroup>
19389 </informaltable>
19390 </section>
19391 <section id="SECID107">
19392 <title>Callout cache</title>
19393 <informaltable frame="none">
19394 <tgroup cols="2" colsep="0" rowsep="0">
19395 <colspec colwidth="196pt" align="left"/>
19396 <colspec colwidth="254pt" align="left"/>
19397 <tbody>
19398 <row>
19399 <entry><option>callout_domain_negative_expire</option></entry>
19400 <entry>timeout for negative domain cache item</entry>
19401 </row>
19402 <row>
19403 <entry><option>callout_domain_positive_expire</option></entry>
19404 <entry>timeout for positive domain cache item</entry>
19405 </row>
19406 <row>
19407 <entry><option>callout_negative_expire</option></entry>
19408 <entry>timeout for negative address cache item</entry>
19409 </row>
19410 <row>
19411 <entry><option>callout_positive_expire</option></entry>
19412 <entry>timeout for positive address cache item</entry>
19413 </row>
19414 <row>
19415 <entry><option>callout_random_local_part</option></entry>
19416 <entry>string to use for <quote>random</quote> testing</entry>
19417 </row>
19418 </tbody>
19419 </tgroup>
19420 </informaltable>
19421 </section>
19422 <section id="SECID108">
19423 <title>TLS</title>
19424 <informaltable frame="none">
19425 <tgroup cols="2" colsep="0" rowsep="0">
19426 <colspec colwidth="196pt" align="left"/>
19427 <colspec colwidth="254pt" align="left"/>
19428 <tbody>
19429 <row>
19430 <entry><option>gnutls_require_kx</option></entry>
19431 <entry>control GnuTLS key exchanges</entry>
19432 </row>
19433 <row>
19434 <entry><option>gnutls_require_mac</option></entry>
19435 <entry>control GnuTLS MAC algorithms</entry>
19436 </row>
19437 <row>
19438 <entry><option>gnutls_require_protocols</option></entry>
19439 <entry>control GnuTLS protocols</entry>
19440 </row>
19441 <row>
19442 <entry><option>tls_advertise_hosts</option></entry>
19443 <entry>advertise TLS to these hosts</entry>
19444 </row>
19445 <row>
19446 <entry><option>tls_certificate</option></entry>
19447 <entry>location of server certificate</entry>
19448 </row>
19449 <row>
19450 <entry><option>tls_crl</option></entry>
19451 <entry>certificate revocation list</entry>
19452 </row>
19453 <row>
19454 <entry><option>tls_dhparam</option></entry>
19455 <entry>DH parameters for server</entry>
19456 </row>
19457 <row>
19458 <entry><option>tls_on_connect_ports</option></entry>
19459 <entry>specify SSMTP (SMTPS) ports</entry>
19460 </row>
19461 <row>
19462 <entry><option>tls_privatekey</option></entry>
19463 <entry>location of server private key</entry>
19464 </row>
19465 <row>
19466 <entry><option>tls_remember_esmtp</option></entry>
19467 <entry>don&#x2019;t reset after starting TLS</entry>
19468 </row>
19469 <row>
19470 <entry><option>tls_require_ciphers</option></entry>
19471 <entry>specify acceptable ciphers</entry>
19472 </row>
19473 <row>
19474 <entry><option>tls_try_verify_hosts</option></entry>
19475 <entry>try to verify client certificate</entry>
19476 </row>
19477 <row>
19478 <entry><option>tls_verify_certificates</option></entry>
19479 <entry>expected client certificates</entry>
19480 </row>
19481 <row>
19482 <entry><option>tls_verify_hosts</option></entry>
19483 <entry>insist on client certificate verify</entry>
19484 </row>
19485 </tbody>
19486 </tgroup>
19487 </informaltable>
19488 </section>
19489 <section id="SECID109">
19490 <title>Local user handling</title>
19491 <informaltable frame="none">
19492 <tgroup cols="2" colsep="0" rowsep="0">
19493 <colspec colwidth="196pt" align="left"/>
19494 <colspec colwidth="254pt" align="left"/>
19495 <tbody>
19496 <row>
19497 <entry><option>finduser_retries</option></entry>
19498 <entry>useful in NIS environments</entry>
19499 </row>
19500 <row>
19501 <entry><option>gecos_name</option></entry>
19502 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19503 </row>
19504 <row>
19505 <entry><option>gecos_pattern</option></entry>
19506 <entry>ditto</entry>
19507 </row>
19508 <row>
19509 <entry><option>max_username_length</option></entry>
19510 <entry>for systems that truncate</entry>
19511 </row>
19512 <row>
19513 <entry><option>unknown_login</option></entry>
19514 <entry>used when no login name found</entry>
19515 </row>
19516 <row>
19517 <entry><option>unknown_username</option></entry>
19518 <entry>ditto</entry>
19519 </row>
19520 <row>
19521 <entry><option>uucp_from_pattern</option></entry>
19522 <entry>for recognizing <quote>From </quote> lines</entry>
19523 </row>
19524 <row>
19525 <entry><option>uucp_from_sender</option></entry>
19526 <entry>ditto</entry>
19527 </row>
19528 </tbody>
19529 </tgroup>
19530 </informaltable>
19531 </section>
19532 <section id="SECID110">
19533 <title>All incoming messages (SMTP and non-SMTP)</title>
19534 <informaltable frame="none">
19535 <tgroup cols="2" colsep="0" rowsep="0">
19536 <colspec colwidth="196pt" align="left"/>
19537 <colspec colwidth="254pt" align="left"/>
19538 <tbody>
19539 <row>
19540 <entry><option>header_maxsize</option></entry>
19541 <entry>total size of message header</entry>
19542 </row>
19543 <row>
19544 <entry><option>header_line_maxsize</option></entry>
19545 <entry>individual header line limit</entry>
19546 </row>
19547 <row>
19548 <entry><option>message_size_limit</option></entry>
19549 <entry>applies to all messages</entry>
19550 </row>
19551 <row>
19552 <entry><option>percent_hack_domains</option></entry>
19553 <entry>recognize %-hack for these domains</entry>
19554 </row>
19555 <row>
19556 <entry><option>received_header_text</option></entry>
19557 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19558 </row>
19559 <row>
19560 <entry><option>received_headers_max</option></entry>
19561 <entry>for mail loop detection</entry>
19562 </row>
19563 <row>
19564 <entry><option>recipients_max</option></entry>
19565 <entry>limit per message</entry>
19566 </row>
19567 <row>
19568 <entry><option>recipients_max_reject</option></entry>
19569 <entry>permanently reject excess recipients</entry>
19570 </row>
19571 </tbody>
19572 </tgroup>
19573 </informaltable>
19574 </section>
19575 <section id="SECID111">
19576 <title>Non-SMTP incoming messages</title>
19577 <informaltable frame="none">
19578 <tgroup cols="2" colsep="0" rowsep="0">
19579 <colspec colwidth="196pt" align="left"/>
19580 <colspec colwidth="254pt" align="left"/>
19581 <tbody>
19582 <row>
19583 <entry><option>receive_timeout</option></entry>
19584 <entry>for non-SMTP messages</entry>
19585 </row>
19586 </tbody>
19587 </tgroup>
19588 </informaltable>
19589 </section>
19590 <section id="SECID112">
19591 <title>Incoming SMTP messages</title>
19592 <para>
19593 See also the <emphasis>Policy controls</emphasis> section above.
19594 </para>
19595 <informaltable frame="none">
19596 <tgroup cols="2" colsep="0" rowsep="0">
19597 <colspec colwidth="196pt" align="left"/>
19598 <colspec colwidth="254pt" align="left"/>
19599 <tbody>
19600 <row>
19601 <entry><option>host_lookup</option></entry>
19602 <entry>host name looked up for these hosts</entry>
19603 </row>
19604 <row>
19605 <entry><option>host_lookup_order</option></entry>
19606 <entry>order of DNS and local name lookups</entry>
19607 </row>
19608 <row>
19609 <entry><option>recipient_unqualified_hosts</option></entry>
19610 <entry>may send unqualified recipients</entry>
19611 </row>
19612 <row>
19613 <entry><option>rfc1413_hosts</option></entry>
19614 <entry>make ident calls to these hosts</entry>
19615 </row>
19616 <row>
19617 <entry><option>rfc1413_query_timeout</option></entry>
19618 <entry>zero disables ident calls</entry>
19619 </row>
19620 <row>
19621 <entry><option>sender_unqualified_hosts</option></entry>
19622 <entry>may send unqualified senders</entry>
19623 </row>
19624 <row>
19625 <entry><option>smtp_accept_keepalive</option></entry>
19626 <entry>some TCP/IP magic</entry>
19627 </row>
19628 <row>
19629 <entry><option>smtp_accept_max</option></entry>
19630 <entry>simultaneous incoming connections</entry>
19631 </row>
19632 <row>
19633 <entry><option>smtp_accept_max_nonmail</option></entry>
19634 <entry>non-mail commands</entry>
19635 </row>
19636 <row>
19637 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19638 <entry>hosts to which the limit applies</entry>
19639 </row>
19640 <row>
19641 <entry><option>smtp_accept_max_per_connection</option></entry>
19642 <entry>messages per connection</entry>
19643 </row>
19644 <row>
19645 <entry><option>smtp_accept_max_per_host</option></entry>
19646 <entry>connections from one host</entry>
19647 </row>
19648 <row>
19649 <entry><option>smtp_accept_queue</option></entry>
19650 <entry>queue mail if more connections</entry>
19651 </row>
19652 <row>
19653 <entry><option>smtp_accept_queue_per_connection</option></entry>
19654 <entry>queue if more messages per connection</entry>
19655 </row>
19656 <row>
19657 <entry><option>smtp_accept_reserve</option></entry>
19658 <entry>only reserve hosts if more connections</entry>
19659 </row>
19660 <row>
19661 <entry><option>smtp_active_hostname</option></entry>
19662 <entry>host name to use in messages</entry>
19663 </row>
19664 <row>
19665 <entry><option>smtp_banner</option></entry>
19666 <entry>text for welcome banner</entry>
19667 </row>
19668 <row>
19669 <entry><option>smtp_check_spool_space</option></entry>
19670 <entry>from SIZE on MAIL command</entry>
19671 </row>
19672 <row>
19673 <entry><option>smtp_connect_backlog</option></entry>
19674 <entry>passed to TCP/IP stack</entry>
19675 </row>
19676 <row>
19677 <entry><option>smtp_enforce_sync</option></entry>
19678 <entry>of SMTP command/responses</entry>
19679 </row>
19680 <row>
19681 <entry><option>smtp_etrn_command</option></entry>
19682 <entry>what to run for ETRN</entry>
19683 </row>
19684 <row>
19685 <entry><option>smtp_etrn_serialize</option></entry>
19686 <entry>only one at once</entry>
19687 </row>
19688 <row>
19689 <entry><option>smtp_load_reserve</option></entry>
19690 <entry>only reserve hosts if this load</entry>
19691 </row>
19692 <row>
19693 <entry><option>smtp_max_unknown_commands</option></entry>
19694 <entry>before dropping connection</entry>
19695 </row>
19696 <row>
19697 <entry><option>smtp_ratelimit_hosts</option></entry>
19698 <entry>apply ratelimiting to these hosts</entry>
19699 </row>
19700 <row>
19701 <entry><option>smtp_ratelimit_mail</option></entry>
19702 <entry>ratelimit for MAIL commands</entry>
19703 </row>
19704 <row>
19705 <entry><option>smtp_ratelimit_rcpt</option></entry>
19706 <entry>ratelimit for RCPT commands</entry>
19707 </row>
19708 <row>
19709 <entry><option>smtp_receive_timeout</option></entry>
19710 <entry>per command or data line</entry>
19711 </row>
19712 <row>
19713 <entry><option>smtp_reserve_hosts</option></entry>
19714 <entry>these are the reserve hosts</entry>
19715 </row>
19716 <row>
19717 <entry><option>smtp_return_error_details</option></entry>
19718 <entry>give detail on rejections</entry>
19719 </row>
19720 </tbody>
19721 </tgroup>
19722 </informaltable>
19723 </section>
19724 <section id="SECID113">
19725 <title>SMTP extensions</title>
19726 <informaltable frame="none">
19727 <tgroup cols="2" colsep="0" rowsep="0">
19728 <colspec colwidth="196pt" align="left"/>
19729 <colspec colwidth="254pt" align="left"/>
19730 <tbody>
19731 <row>
19732 <entry><option>accept_8bitmime</option></entry>
19733 <entry>advertise 8BITMIME</entry>
19734 </row>
19735 <row>
19736 <entry><option>auth_advertise_hosts</option></entry>
19737 <entry>advertise AUTH to these hosts</entry>
19738 </row>
19739 <row>
19740 <entry><option>ignore_fromline_hosts</option></entry>
19741 <entry>allow <quote>From </quote> from these hosts</entry>
19742 </row>
19743 <row>
19744 <entry><option>ignore_fromline_local</option></entry>
19745 <entry>allow <quote>From </quote> from local SMTP</entry>
19746 </row>
19747 <row>
19748 <entry><option>pipelining_advertise_hosts</option></entry>
19749 <entry>advertise pipelining to these hosts</entry>
19750 </row>
19751 <row>
19752 <entry><option>tls_advertise_hosts</option></entry>
19753 <entry>advertise TLS to these hosts</entry>
19754 </row>
19755 </tbody>
19756 </tgroup>
19757 </informaltable>
19758 </section>
19759 <section id="SECID114">
19760 <title>Processing messages</title>
19761 <informaltable frame="none">
19762 <tgroup cols="2" colsep="0" rowsep="0">
19763 <colspec colwidth="196pt" align="left"/>
19764 <colspec colwidth="254pt" align="left"/>
19765 <tbody>
19766 <row>
19767 <entry><option>allow_domain_literals</option></entry>
19768 <entry>recognize domain literal syntax</entry>
19769 </row>
19770 <row>
19771 <entry><option>allow_mx_to_ip</option></entry>
19772 <entry>allow MX to point to IP address</entry>
19773 </row>
19774 <row>
19775 <entry><option>allow_utf8_domains</option></entry>
19776 <entry>in addresses</entry>
19777 </row>
19778 <row>
19779 <entry><option>check_rfc2047_length</option></entry>
19780 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19781 </row>
19782 <row>
19783 <entry><option>delivery_date_remove</option></entry>
19784 <entry>from incoming messages</entry>
19785 </row>
19786 <row>
19787 <entry><option>envelope_to_remove</option></entry>
19788 <entry>from incoming messages</entry>
19789 </row>
19790 <row>
19791 <entry><option>extract_addresses_remove_arguments</option></entry>
19792 <entry>affects <option>-t</option> processing</entry>
19793 </row>
19794 <row>
19795 <entry><option>headers_charset</option></entry>
19796 <entry>default for translations</entry>
19797 </row>
19798 <row>
19799 <entry><option>qualify_domain</option></entry>
19800 <entry>default for senders</entry>
19801 </row>
19802 <row>
19803 <entry><option>qualify_recipient</option></entry>
19804 <entry>default for recipients</entry>
19805 </row>
19806 <row>
19807 <entry><option>return_path_remove</option></entry>
19808 <entry>from incoming messages</entry>
19809 </row>
19810 <row>
19811 <entry><option>strip_excess_angle_brackets</option></entry>
19812 <entry>in addresses</entry>
19813 </row>
19814 <row>
19815 <entry><option>strip_trailing_dot</option></entry>
19816 <entry>at end of addresses</entry>
19817 </row>
19818 <row>
19819 <entry><option>untrusted_set_sender</option></entry>
19820 <entry>untrusted can set envelope sender</entry>
19821 </row>
19822 </tbody>
19823 </tgroup>
19824 </informaltable>
19825 </section>
19826 <section id="SECID115">
19827 <title>System filter</title>
19828 <informaltable frame="none">
19829 <tgroup cols="2" colsep="0" rowsep="0">
19830 <colspec colwidth="196pt" align="left"/>
19831 <colspec colwidth="254pt" align="left"/>
19832 <tbody>
19833 <row>
19834 <entry><option>system_filter</option></entry>
19835 <entry>locate system filter</entry>
19836 </row>
19837 <row>
19838 <entry><option>system_filter_directory_transport</option></entry>
19839 <entry>transport for delivery to a directory</entry>
19840 </row>
19841 <row>
19842 <entry><option>system_filter_file_transport</option></entry>
19843 <entry>transport for delivery to a file</entry>
19844 </row>
19845 <row>
19846 <entry><option>system_filter_group</option></entry>
19847 <entry>group for filter running</entry>
19848 </row>
19849 <row>
19850 <entry><option>system_filter_pipe_transport</option></entry>
19851 <entry>transport for delivery to a pipe</entry>
19852 </row>
19853 <row>
19854 <entry><option>system_filter_reply_transport</option></entry>
19855 <entry>transport for autoreply delivery</entry>
19856 </row>
19857 <row>
19858 <entry><option>system_filter_user</option></entry>
19859 <entry>user for filter running</entry>
19860 </row>
19861 </tbody>
19862 </tgroup>
19863 </informaltable>
19864 </section>
19865 <section id="SECID116">
19866 <title>Routing and delivery</title>
19867 <informaltable frame="none">
19868 <tgroup cols="2" colsep="0" rowsep="0">
19869 <colspec colwidth="196pt" align="left"/>
19870 <colspec colwidth="254pt" align="left"/>
19871 <tbody>
19872 <row>
19873 <entry><option>disable_ipv6</option></entry>
19874 <entry>do no IPv6 processing</entry>
19875 </row>
19876 <row>
19877 <entry><option>dns_again_means_nonexist</option></entry>
19878 <entry>for broken domains</entry>
19879 </row>
19880 <row>
19881 <entry><option>dns_check_names_pattern</option></entry>
19882 <entry>pre-DNS syntax check</entry>
19883 </row>
19884 <row>
19885 <entry><option>dns_ipv4_lookup</option></entry>
19886 <entry>only v4 lookup for these domains</entry>
19887 </row>
19888 <row>
19889 <entry><option>dns_retrans</option></entry>
19890 <entry>parameter for resolver</entry>
19891 </row>
19892 <row>
19893 <entry><option>dns_retry</option></entry>
19894 <entry>parameter for resolver</entry>
19895 </row>
19896 <row>
19897 <entry><option>hold_domains</option></entry>
19898 <entry>hold delivery for these domains</entry>
19899 </row>
19900 <row>
19901 <entry><option>local_interfaces</option></entry>
19902 <entry>for routing checks</entry>
19903 </row>
19904 <row>
19905 <entry><option>queue_domains</option></entry>
19906 <entry>no immediate delivery for these</entry>
19907 </row>
19908 <row>
19909 <entry><option>queue_only</option></entry>
19910 <entry>no immediate delivery at all</entry>
19911 </row>
19912 <row>
19913 <entry><option>queue_only_file</option></entry>
19914 <entry>no immediate delivery if file exists</entry>
19915 </row>
19916 <row>
19917 <entry><option>queue_only_load</option></entry>
19918 <entry>no immediate delivery if load is high</entry>
19919 </row>
19920 <row>
19921 <entry><phrase revisionflag="changed"><option>queue_only_load_latch</option></phrase></entry>
19922 <entry>don&#x2019;t re-evaluate load for each message</entry>
19923 </row>
19924 <row>
19925 <entry><option>queue_only_override</option></entry>
19926 <entry>allow command line to override</entry>
19927 </row>
19928 <row>
19929 <entry><option>queue_run_in_order</option></entry>
19930 <entry>order of arrival</entry>
19931 </row>
19932 <row>
19933 <entry><option>queue_run_max</option></entry>
19934 <entry>of simultaneous queue runners</entry>
19935 </row>
19936 <row>
19937 <entry><option>queue_smtp_domains</option></entry>
19938 <entry>no immediate SMTP delivery for these</entry>
19939 </row>
19940 <row>
19941 <entry><option>remote_max_parallel</option></entry>
19942 <entry>parallel SMTP delivery per message</entry>
19943 </row>
19944 <row>
19945 <entry><option>remote_sort_domains</option></entry>
19946 <entry>order of remote deliveries</entry>
19947 </row>
19948 <row>
19949 <entry><option>retry_data_expire</option></entry>
19950 <entry>timeout for retry data</entry>
19951 </row>
19952 <row>
19953 <entry><option>retry_interval_max</option></entry>
19954 <entry>safety net for retry rules</entry>
19955 </row>
19956 </tbody>
19957 </tgroup>
19958 </informaltable>
19959 </section>
19960 <section id="SECID117">
19961 <title>Bounce and warning messages</title>
19962 <informaltable frame="none">
19963 <tgroup cols="2" colsep="0" rowsep="0">
19964 <colspec colwidth="196pt" align="left"/>
19965 <colspec colwidth="254pt" align="left"/>
19966 <tbody>
19967 <row>
19968 <entry><option>bounce_message_file</option></entry>
19969 <entry>content of bounce</entry>
19970 </row>
19971 <row>
19972 <entry><option>bounce_message_text</option></entry>
19973 <entry>content of bounce</entry>
19974 </row>
19975 <row>
19976 <entry><option>bounce_return_body</option></entry>
19977 <entry>include body if returning message</entry>
19978 </row>
19979 <row>
19980 <entry><option>bounce_return_message</option></entry>
19981 <entry>include original message in bounce</entry>
19982 </row>
19983 <row>
19984 <entry><option>bounce_return_size_limit</option></entry>
19985 <entry>limit on returned message</entry>
19986 </row>
19987 <row>
19988 <entry><option>bounce_sender_authentication</option></entry>
19989 <entry>send authenticated sender with bounce</entry>
19990 </row>
19991 <row>
19992 <entry><option>dsn_from</option></entry>
19993 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
19994 </row>
19995 <row>
19996 <entry><option>errors_copy</option></entry>
19997 <entry>copy bounce messages</entry>
19998 </row>
19999 <row>
20000 <entry><option>errors_reply_to</option></entry>
20001 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20002 </row>
20003 <row>
20004 <entry><option>delay_warning</option></entry>
20005 <entry>time schedule</entry>
20006 </row>
20007 <row>
20008 <entry><option>delay_warning_condition</option></entry>
20009 <entry>condition for warning messages</entry>
20010 </row>
20011 <row>
20012 <entry><option>ignore_bounce_errors_after</option></entry>
20013 <entry>discard undeliverable bounces</entry>
20014 </row>
20015 <row>
20016 <entry><option>smtp_return_error_details</option></entry>
20017 <entry>give detail on rejections</entry>
20018 </row>
20019 <row>
20020 <entry><option>warn_message_file</option></entry>
20021 <entry>content of warning message</entry>
20022 </row>
20023 </tbody>
20024 </tgroup>
20025 </informaltable>
20026 </section>
20027 <section id="SECTalomo">
20028 <title>Alphabetical list of main options</title>
20029 <para>
20030 Those options that undergo string expansion before use are marked with
20031 &dagger;.
20032 </para>
20033 <para>
20034 <indexterm role="option">
20035 <primary><option>accept_8bitmime</option></primary>
20036 </indexterm>
20037 </para>
20038 <informaltable frame="all">
20039 <tgroup cols="4" colsep="0" rowsep="0">
20040 <colspec colwidth="8*" align="left"/>
20041 <colspec colwidth="6*" align="center"/>
20042 <colspec colwidth="6*" align="center"/>
20043 <colspec colwidth="6*" align="right"/>
20044 <tbody>
20045 <row>
20046 <entry><option>accept_8bitmime</option></entry>
20047 <entry>Use: <emphasis>main</emphasis></entry>
20048 <entry>Type: <emphasis>boolean</emphasis></entry>
20049 <entry>Default: <emphasis>false</emphasis></entry>
20050 </row>
20051 </tbody>
20052 </tgroup>
20053 </informaltable>
20054 <para>
20055 <indexterm role="concept">
20056 <primary>8BITMIME</primary>
20057 </indexterm>
20058 <indexterm role="concept">
20059 <primary>8-bit characters</primary>
20060 </indexterm>
20061 This option causes Exim to send 8BITMIME in its response to an SMTP
20062 EHLO command, and to accept the BODY= parameter on MAIL commands.
20063 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20064 takes no steps to do anything special with messages received by this route.
20065 Consequently, this option is turned off by default.
20066 </para>
20067 <para>
20068 <indexterm role="option">
20069 <primary><option>acl_not_smtp</option></primary>
20070 </indexterm>
20071 </para>
20072 <informaltable frame="all">
20073 <tgroup cols="4" colsep="0" rowsep="0">
20074 <colspec colwidth="8*" align="left"/>
20075 <colspec colwidth="6*" align="center"/>
20076 <colspec colwidth="6*" align="center"/>
20077 <colspec colwidth="6*" align="right"/>
20078 <tbody>
20079 <row>
20080 <entry><option>acl_not_smtp</option></entry>
20081 <entry>Use: <emphasis>main</emphasis></entry>
20082 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20083 <entry>Default: <emphasis>unset</emphasis></entry>
20084 </row>
20085 </tbody>
20086 </tgroup>
20087 </informaltable>
20088 <para>
20089 <indexterm role="concept">
20090 <primary>access control lists (ACLs)</primary>
20091 <secondary>for non-SMTP messages</secondary>
20092 </indexterm>
20093 <indexterm role="concept">
20094 <primary>non-SMTP messages</primary>
20095 <secondary>ACLs for</secondary>
20096 </indexterm>
20097 This option defines the ACL that is run when a non-SMTP message has been
20098 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20099 further details.
20100 </para>
20101 <para>
20102 <indexterm role="option">
20103 <primary><option>acl_not_smtp_mime</option></primary>
20104 </indexterm>
20105 </para>
20106 <informaltable frame="all">
20107 <tgroup cols="4" colsep="0" rowsep="0">
20108 <colspec colwidth="8*" align="left"/>
20109 <colspec colwidth="6*" align="center"/>
20110 <colspec colwidth="6*" align="center"/>
20111 <colspec colwidth="6*" align="right"/>
20112 <tbody>
20113 <row>
20114 <entry><option>acl_not_smtp_mime</option></entry>
20115 <entry>Use: <emphasis>main</emphasis></entry>
20116 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20117 <entry>Default: <emphasis>unset</emphasis></entry>
20118 </row>
20119 </tbody>
20120 </tgroup>
20121 </informaltable>
20122 <para>
20123 This option defines the ACL that is run for individual MIME parts of non-SMTP
20124 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20125 SMTP messages.
20126 </para>
20127 <para>
20128 <indexterm role="option">
20129 <primary><option>acl_not_smtp_start</option></primary>
20130 </indexterm>
20131 </para>
20132 <informaltable frame="all">
20133 <tgroup cols="4" colsep="0" rowsep="0">
20134 <colspec colwidth="8*" align="left"/>
20135 <colspec colwidth="6*" align="center"/>
20136 <colspec colwidth="6*" align="center"/>
20137 <colspec colwidth="6*" align="right"/>
20138 <tbody>
20139 <row>
20140 <entry><option>acl_not_smtp_start</option></entry>
20141 <entry>Use: <emphasis>main</emphasis></entry>
20142 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20143 <entry>Default: <emphasis>unset</emphasis></entry>
20144 </row>
20145 </tbody>
20146 </tgroup>
20147 </informaltable>
20148 <para>
20149 <indexterm role="concept">
20150 <primary>access control lists (ACLs)</primary>
20151 <secondary>at start of non-SMTP message</secondary>
20152 </indexterm>
20153 <indexterm role="concept">
20154 <primary>non-SMTP messages</primary>
20155 <secondary>ACLs for</secondary>
20156 </indexterm>
20157 This option defines the ACL that is run before Exim starts reading a
20158 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20159 </para>
20160 <para>
20161 <indexterm role="option">
20162 <primary><option>acl_smtp_auth</option></primary>
20163 </indexterm>
20164 </para>
20165 <informaltable frame="all">
20166 <tgroup cols="4" colsep="0" rowsep="0">
20167 <colspec colwidth="8*" align="left"/>
20168 <colspec colwidth="6*" align="center"/>
20169 <colspec colwidth="6*" align="center"/>
20170 <colspec colwidth="6*" align="right"/>
20171 <tbody>
20172 <row>
20173 <entry><option>acl_smtp_auth</option></entry>
20174 <entry>Use: <emphasis>main</emphasis></entry>
20175 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20176 <entry>Default: <emphasis>unset</emphasis></entry>
20177 </row>
20178 </tbody>
20179 </tgroup>
20180 </informaltable>
20181 <para>
20182 <indexterm role="concept">
20183 <primary>access control lists (ACLs)</primary>
20184 <secondary>setting up for SMTP commands</secondary>
20185 </indexterm>
20186 <indexterm role="concept">
20187 <primary>AUTH</primary>
20188 <secondary>ACL for</secondary>
20189 </indexterm>
20190 This option defines the ACL that is run when an SMTP AUTH command is
20191 received. See chapter <xref linkend="CHAPACL"/> for further details.
20192 </para>
20193 <para>
20194 <indexterm role="option">
20195 <primary><option>acl_smtp_connect</option></primary>
20196 </indexterm>
20197 </para>
20198 <informaltable frame="all">
20199 <tgroup cols="4" colsep="0" rowsep="0">
20200 <colspec colwidth="8*" align="left"/>
20201 <colspec colwidth="6*" align="center"/>
20202 <colspec colwidth="6*" align="center"/>
20203 <colspec colwidth="6*" align="right"/>
20204 <tbody>
20205 <row>
20206 <entry><option>acl_smtp_connect</option></entry>
20207 <entry>Use: <emphasis>main</emphasis></entry>
20208 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20209 <entry>Default: <emphasis>unset</emphasis></entry>
20210 </row>
20211 </tbody>
20212 </tgroup>
20213 </informaltable>
20214 <para>
20215 <indexterm role="concept">
20216 <primary>access control lists (ACLs)</primary>
20217 <secondary>on SMTP connection</secondary>
20218 </indexterm>
20219 This option defines the ACL that is run when an SMTP connection is received.
20220 See chapter <xref linkend="CHAPACL"/> for further details.
20221 </para>
20222 <para>
20223 <indexterm role="option">
20224 <primary><option>acl_smtp_data</option></primary>
20225 </indexterm>
20226 </para>
20227 <informaltable frame="all">
20228 <tgroup cols="4" colsep="0" rowsep="0">
20229 <colspec colwidth="8*" align="left"/>
20230 <colspec colwidth="6*" align="center"/>
20231 <colspec colwidth="6*" align="center"/>
20232 <colspec colwidth="6*" align="right"/>
20233 <tbody>
20234 <row>
20235 <entry><option>acl_smtp_data</option></entry>
20236 <entry>Use: <emphasis>main</emphasis></entry>
20237 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20238 <entry>Default: <emphasis>unset</emphasis></entry>
20239 </row>
20240 </tbody>
20241 </tgroup>
20242 </informaltable>
20243 <para>
20244 <indexterm role="concept">
20245 <primary>DATA</primary>
20246 <secondary>ACL for</secondary>
20247 </indexterm>
20248 This option defines the ACL that is run after an SMTP DATA command has been
20249 processed and the message itself has been received, but before the final
20250 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20251 </para>
20252 <para>
20253 <indexterm role="option">
20254 <primary><option>acl_smtp_etrn</option></primary>
20255 </indexterm>
20256 </para>
20257 <informaltable frame="all">
20258 <tgroup cols="4" colsep="0" rowsep="0">
20259 <colspec colwidth="8*" align="left"/>
20260 <colspec colwidth="6*" align="center"/>
20261 <colspec colwidth="6*" align="center"/>
20262 <colspec colwidth="6*" align="right"/>
20263 <tbody>
20264 <row>
20265 <entry><option>acl_smtp_etrn</option></entry>
20266 <entry>Use: <emphasis>main</emphasis></entry>
20267 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20268 <entry>Default: <emphasis>unset</emphasis></entry>
20269 </row>
20270 </tbody>
20271 </tgroup>
20272 </informaltable>
20273 <para>
20274 <indexterm role="concept">
20275 <primary>ETRN</primary>
20276 <secondary>ACL for</secondary>
20277 </indexterm>
20278 This option defines the ACL that is run when an SMTP ETRN command is
20279 received. See chapter <xref linkend="CHAPACL"/> for further details.
20280 </para>
20281 <para>
20282 <indexterm role="option">
20283 <primary><option>acl_smtp_expn</option></primary>
20284 </indexterm>
20285 </para>
20286 <informaltable frame="all">
20287 <tgroup cols="4" colsep="0" rowsep="0">
20288 <colspec colwidth="8*" align="left"/>
20289 <colspec colwidth="6*" align="center"/>
20290 <colspec colwidth="6*" align="center"/>
20291 <colspec colwidth="6*" align="right"/>
20292 <tbody>
20293 <row>
20294 <entry><option>acl_smtp_expn</option></entry>
20295 <entry>Use: <emphasis>main</emphasis></entry>
20296 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20297 <entry>Default: <emphasis>unset</emphasis></entry>
20298 </row>
20299 </tbody>
20300 </tgroup>
20301 </informaltable>
20302 <para>
20303 <indexterm role="concept">
20304 <primary>EXPN</primary>
20305 <secondary>ACL for</secondary>
20306 </indexterm>
20307 This option defines the ACL that is run when an SMTP EXPN command is
20308 received. See chapter <xref linkend="CHAPACL"/> for further details.
20309 </para>
20310 <para>
20311 <indexterm role="option">
20312 <primary><option>acl_smtp_helo</option></primary>
20313 </indexterm>
20314 </para>
20315 <informaltable frame="all">
20316 <tgroup cols="4" colsep="0" rowsep="0">
20317 <colspec colwidth="8*" align="left"/>
20318 <colspec colwidth="6*" align="center"/>
20319 <colspec colwidth="6*" align="center"/>
20320 <colspec colwidth="6*" align="right"/>
20321 <tbody>
20322 <row>
20323 <entry><option>acl_smtp_helo</option></entry>
20324 <entry>Use: <emphasis>main</emphasis></entry>
20325 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20326 <entry>Default: <emphasis>unset</emphasis></entry>
20327 </row>
20328 </tbody>
20329 </tgroup>
20330 </informaltable>
20331 <para>
20332 <indexterm role="concept">
20333 <primary>EHLO</primary>
20334 <secondary>ACL for</secondary>
20335 </indexterm>
20336 <indexterm role="concept">
20337 <primary>HELO</primary>
20338 <secondary>ACL for</secondary>
20339 </indexterm>
20340 This option defines the ACL that is run when an SMTP EHLO or HELO
20341 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20342 </para>
20343 <para>
20344 <indexterm role="option">
20345 <primary><option>acl_smtp_mail</option></primary>
20346 </indexterm>
20347 </para>
20348 <informaltable frame="all">
20349 <tgroup cols="4" colsep="0" rowsep="0">
20350 <colspec colwidth="8*" align="left"/>
20351 <colspec colwidth="6*" align="center"/>
20352 <colspec colwidth="6*" align="center"/>
20353 <colspec colwidth="6*" align="right"/>
20354 <tbody>
20355 <row>
20356 <entry><option>acl_smtp_mail</option></entry>
20357 <entry>Use: <emphasis>main</emphasis></entry>
20358 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20359 <entry>Default: <emphasis>unset</emphasis></entry>
20360 </row>
20361 </tbody>
20362 </tgroup>
20363 </informaltable>
20364 <para>
20365 <indexterm role="concept">
20366 <primary>MAIL</primary>
20367 <secondary>ACL for</secondary>
20368 </indexterm>
20369 This option defines the ACL that is run when an SMTP MAIL command is
20370 received. See chapter <xref linkend="CHAPACL"/> for further details.
20371 </para>
20372 <para>
20373 <indexterm role="option">
20374 <primary><option>acl_smtp_mailauth</option></primary>
20375 </indexterm>
20376 </para>
20377 <informaltable frame="all">
20378 <tgroup cols="4" colsep="0" rowsep="0">
20379 <colspec colwidth="8*" align="left"/>
20380 <colspec colwidth="6*" align="center"/>
20381 <colspec colwidth="6*" align="center"/>
20382 <colspec colwidth="6*" align="right"/>
20383 <tbody>
20384 <row>
20385 <entry><option>acl_smtp_mailauth</option></entry>
20386 <entry>Use: <emphasis>main</emphasis></entry>
20387 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20388 <entry>Default: <emphasis>unset</emphasis></entry>
20389 </row>
20390 </tbody>
20391 </tgroup>
20392 </informaltable>
20393 <para>
20394 <indexterm role="concept">
20395 <primary>AUTH</primary>
20396 <secondary>on MAIL command</secondary>
20397 </indexterm>
20398 This option defines the ACL that is run when there is an AUTH parameter on
20399 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20400 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20401 </para>
20402 <para>
20403 <indexterm role="option">
20404 <primary><option>acl_smtp_mime</option></primary>
20405 </indexterm>
20406 </para>
20407 <informaltable frame="all">
20408 <tgroup cols="4" colsep="0" rowsep="0">
20409 <colspec colwidth="8*" align="left"/>
20410 <colspec colwidth="6*" align="center"/>
20411 <colspec colwidth="6*" align="center"/>
20412 <colspec colwidth="6*" align="right"/>
20413 <tbody>
20414 <row>
20415 <entry><option>acl_smtp_mime</option></entry>
20416 <entry>Use: <emphasis>main</emphasis></entry>
20417 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20418 <entry>Default: <emphasis>unset</emphasis></entry>
20419 </row>
20420 </tbody>
20421 </tgroup>
20422 </informaltable>
20423 <para>
20424 <indexterm role="concept">
20425 <primary>MIME content scanning</primary>
20426 <secondary>ACL for</secondary>
20427 </indexterm>
20428 This option is available when Exim is built with the content-scanning
20429 extension. It defines the ACL that is run for each MIME part in a message. See
20430 section <xref linkend="SECTscanmimepart"/> for details.
20431 </para>
20432 <para>
20433 <indexterm role="option">
20434 <primary><option>acl_smtp_predata</option></primary>
20435 </indexterm>
20436 </para>
20437 <informaltable frame="all">
20438 <tgroup cols="4" colsep="0" rowsep="0">
20439 <colspec colwidth="8*" align="left"/>
20440 <colspec colwidth="6*" align="center"/>
20441 <colspec colwidth="6*" align="center"/>
20442 <colspec colwidth="6*" align="right"/>
20443 <tbody>
20444 <row>
20445 <entry><option>acl_smtp_predata</option></entry>
20446 <entry>Use: <emphasis>main</emphasis></entry>
20447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20448 <entry>Default: <emphasis>unset</emphasis></entry>
20449 </row>
20450 </tbody>
20451 </tgroup>
20452 </informaltable>
20453 <para>
20454 This option defines the ACL that is run when an SMTP DATA command is
20455 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20456 further details.
20457 </para>
20458 <para>
20459 <indexterm role="option">
20460 <primary><option>acl_smtp_quit</option></primary>
20461 </indexterm>
20462 </para>
20463 <informaltable frame="all">
20464 <tgroup cols="4" colsep="0" rowsep="0">
20465 <colspec colwidth="8*" align="left"/>
20466 <colspec colwidth="6*" align="center"/>
20467 <colspec colwidth="6*" align="center"/>
20468 <colspec colwidth="6*" align="right"/>
20469 <tbody>
20470 <row>
20471 <entry><option>acl_smtp_quit</option></entry>
20472 <entry>Use: <emphasis>main</emphasis></entry>
20473 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20474 <entry>Default: <emphasis>unset</emphasis></entry>
20475 </row>
20476 </tbody>
20477 </tgroup>
20478 </informaltable>
20479 <para>
20480 <indexterm role="concept">
20481 <primary>QUIT, ACL for</primary>
20482 </indexterm>
20483 This option defines the ACL that is run when an SMTP QUIT command is
20484 received. See chapter <xref linkend="CHAPACL"/> for further details.
20485 </para>
20486 <para>
20487 <indexterm role="option">
20488 <primary><option>acl_smtp_rcpt</option></primary>
20489 </indexterm>
20490 </para>
20491 <informaltable frame="all">
20492 <tgroup cols="4" colsep="0" rowsep="0">
20493 <colspec colwidth="8*" align="left"/>
20494 <colspec colwidth="6*" align="center"/>
20495 <colspec colwidth="6*" align="center"/>
20496 <colspec colwidth="6*" align="right"/>
20497 <tbody>
20498 <row>
20499 <entry><option>acl_smtp_rcpt</option></entry>
20500 <entry>Use: <emphasis>main</emphasis></entry>
20501 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20502 <entry>Default: <emphasis>unset</emphasis></entry>
20503 </row>
20504 </tbody>
20505 </tgroup>
20506 </informaltable>
20507 <para>
20508 <indexterm role="concept">
20509 <primary>RCPT</primary>
20510 <secondary>ACL for</secondary>
20511 </indexterm>
20512 This option defines the ACL that is run when an SMTP RCPT command is
20513 received. See chapter <xref linkend="CHAPACL"/> for further details.
20514 </para>
20515 <para>
20516 <indexterm role="option">
20517 <primary><option>acl_smtp_starttls</option></primary>
20518 </indexterm>
20519 </para>
20520 <informaltable frame="all">
20521 <tgroup cols="4" colsep="0" rowsep="0">
20522 <colspec colwidth="8*" align="left"/>
20523 <colspec colwidth="6*" align="center"/>
20524 <colspec colwidth="6*" align="center"/>
20525 <colspec colwidth="6*" align="right"/>
20526 <tbody>
20527 <row>
20528 <entry><option>acl_smtp_starttls</option></entry>
20529 <entry>Use: <emphasis>main</emphasis></entry>
20530 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20531 <entry>Default: <emphasis>unset</emphasis></entry>
20532 </row>
20533 </tbody>
20534 </tgroup>
20535 </informaltable>
20536 <para>
20537 <indexterm role="concept">
20538 <primary>STARTTLS, ACL for</primary>
20539 </indexterm>
20540 This option defines the ACL that is run when an SMTP STARTTLS command is
20541 received. See chapter <xref linkend="CHAPACL"/> for further details.
20542 </para>
20543 <para>
20544 <indexterm role="option">
20545 <primary><option>acl_smtp_vrfy</option></primary>
20546 </indexterm>
20547 </para>
20548 <informaltable frame="all">
20549 <tgroup cols="4" colsep="0" rowsep="0">
20550 <colspec colwidth="8*" align="left"/>
20551 <colspec colwidth="6*" align="center"/>
20552 <colspec colwidth="6*" align="center"/>
20553 <colspec colwidth="6*" align="right"/>
20554 <tbody>
20555 <row>
20556 <entry><option>acl_smtp_vrfy</option></entry>
20557 <entry>Use: <emphasis>main</emphasis></entry>
20558 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20559 <entry>Default: <emphasis>unset</emphasis></entry>
20560 </row>
20561 </tbody>
20562 </tgroup>
20563 </informaltable>
20564 <para>
20565 <indexterm role="concept">
20566 <primary>VRFY</primary>
20567 <secondary>ACL for</secondary>
20568 </indexterm>
20569 This option defines the ACL that is run when an SMTP VRFY command is
20570 received. See chapter <xref linkend="CHAPACL"/> for further details.
20571 </para>
20572 <para>
20573 <indexterm role="option">
20574 <primary><option>admin_groups</option></primary>
20575 </indexterm>
20576 </para>
20577 <informaltable frame="all">
20578 <tgroup cols="4" colsep="0" rowsep="0">
20579 <colspec colwidth="8*" align="left"/>
20580 <colspec colwidth="6*" align="center"/>
20581 <colspec colwidth="6*" align="center"/>
20582 <colspec colwidth="6*" align="right"/>
20583 <tbody>
20584 <row>
20585 <entry><option>admin_groups</option></entry>
20586 <entry>Use: <emphasis>main</emphasis></entry>
20587 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
20588 <entry>Default: <emphasis>unset</emphasis></entry>
20589 </row>
20590 </tbody>
20591 </tgroup>
20592 </informaltable>
20593 <para>
20594 <indexterm role="concept">
20595 <primary>admin user</primary>
20596 </indexterm>
20597 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
20598 current group or any of the supplementary groups of an Exim caller is in this
20599 colon-separated list, the caller has admin privileges. If all your system
20600 programmers are in a specific group, for example, you can give them all Exim
20601 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20602 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
20603 To permit this, you have to add individuals to the Exim group.
20604 </para>
20605 <para>
20606 <indexterm role="option">
20607 <primary><option>allow_domain_literals</option></primary>
20608 </indexterm>
20609 </para>
20610 <informaltable frame="all">
20611 <tgroup cols="4" colsep="0" rowsep="0">
20612 <colspec colwidth="8*" align="left"/>
20613 <colspec colwidth="6*" align="center"/>
20614 <colspec colwidth="6*" align="center"/>
20615 <colspec colwidth="6*" align="right"/>
20616 <tbody>
20617 <row>
20618 <entry><option>allow_domain_literals</option></entry>
20619 <entry>Use: <emphasis>main</emphasis></entry>
20620 <entry>Type: <emphasis>boolean</emphasis></entry>
20621 <entry>Default: <emphasis>false</emphasis></entry>
20622 </row>
20623 </tbody>
20624 </tgroup>
20625 </informaltable>
20626 <para>
20627 <indexterm role="concept">
20628 <primary>domain literal</primary>
20629 </indexterm>
20630 If this option is set, the RFC 2822 domain literal format is permitted in
20631 email addresses. The option is not set by default, because the domain literal
20632 format is not normally required these days, and few people know about it. It
20633 has, however, been exploited by mail abusers.
20634 </para>
20635 <para>
20636 Unfortunately, it seems that some DNS black list maintainers are using this
20637 format to report black listing to postmasters. If you want to accept messages
20638 addressed to your hosts by IP address, you need to set
20639 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20640 domains (defined in the named domain list <option>local_domains</option> in the default
20641 configuration). This <quote>magic string</quote> matches the domain literal form of all
20642 the local host&#x2019;s IP addresses.
20643 </para>
20644 <para>
20645 <indexterm role="option">
20646 <primary><option>allow_mx_to_ip</option></primary>
20647 </indexterm>
20648 </para>
20649 <informaltable frame="all">
20650 <tgroup cols="4" colsep="0" rowsep="0">
20651 <colspec colwidth="8*" align="left"/>
20652 <colspec colwidth="6*" align="center"/>
20653 <colspec colwidth="6*" align="center"/>
20654 <colspec colwidth="6*" align="right"/>
20655 <tbody>
20656 <row>
20657 <entry><option>allow_mx_to_ip</option></entry>
20658 <entry>Use: <emphasis>main</emphasis></entry>
20659 <entry>Type: <emphasis>boolean</emphasis></entry>
20660 <entry>Default: <emphasis>false</emphasis></entry>
20661 </row>
20662 </tbody>
20663 </tgroup>
20664 </informaltable>
20665 <para>
20666 <indexterm role="concept">
20667 <primary>MX record</primary>
20668 <secondary>pointing to IP address</secondary>
20669 </indexterm>
20670 It appears that more and more DNS zone administrators are breaking the rules
20671 and putting domain names that look like IP addresses on the right hand side of
20672 MX records. Exim follows the rules and rejects this, giving an error message
20673 that explains the mis-configuration. However, some other MTAs support this
20674 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
20675 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20676 recommended, except when you have no other choice.
20677 </para>
20678 <para>
20679 <indexterm role="option">
20680 <primary><option>allow_utf8_domains</option></primary>
20681 </indexterm>
20682 </para>
20683 <informaltable frame="all">
20684 <tgroup cols="4" colsep="0" rowsep="0">
20685 <colspec colwidth="8*" align="left"/>
20686 <colspec colwidth="6*" align="center"/>
20687 <colspec colwidth="6*" align="center"/>
20688 <colspec colwidth="6*" align="right"/>
20689 <tbody>
20690 <row>
20691 <entry><option>allow_utf8_domains</option></entry>
20692 <entry>Use: <emphasis>main</emphasis></entry>
20693 <entry>Type: <emphasis>boolean</emphasis></entry>
20694 <entry>Default: <emphasis>false</emphasis></entry>
20695 </row>
20696 </tbody>
20697 </tgroup>
20698 </informaltable>
20699 <para>
20700 <indexterm role="concept">
20701 <primary>domain</primary>
20702 <secondary>UTF-8 characters in</secondary>
20703 </indexterm>
20704 <indexterm role="concept">
20705 <primary>UTF-8</primary>
20706 <secondary>in domain name</secondary>
20707 </indexterm>
20708 Lots of discussion is going on about internationalized domain names. One
20709 camp is strongly in favour of just using UTF-8 characters, and it seems
20710 that at least two other MTAs permit this. This option allows Exim users to
20711 experiment if they wish.
20712 </para>
20713 <para>
20714 If it is set true, Exim&#x2019;s domain parsing function allows valid
20715 UTF-8 multicharacters to appear in domain name components, in addition to
20716 letters, digits, and hyphens. However, just setting this option is not
20717 enough; if you want to look up these domain names in the DNS, you must also
20718 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20719 suitable setting is:
20720 </para>
20721 <literallayout class="monospaced">
20722 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
20723   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20724 </literallayout>
20725 <para>
20726 Alternatively, you can just disable this feature by setting
20727 </para>
20728 <literallayout class="monospaced">
20729 dns_check_names_pattern =
20730 </literallayout>
20731 <para>
20732 That is, set the option to an empty string so that no check is done.
20733 </para>
20734 <para>
20735 <indexterm role="option">
20736 <primary><option>auth_advertise_hosts</option></primary>
20737 </indexterm>
20738 </para>
20739 <informaltable frame="all">
20740 <tgroup cols="4" colsep="0" rowsep="0">
20741 <colspec colwidth="8*" align="left"/>
20742 <colspec colwidth="6*" align="center"/>
20743 <colspec colwidth="6*" align="center"/>
20744 <colspec colwidth="6*" align="right"/>
20745 <tbody>
20746 <row>
20747 <entry><option>auth_advertise_hosts</option></entry>
20748 <entry>Use: <emphasis>main</emphasis></entry>
20749 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
20750 <entry>Default: <emphasis>*</emphasis></entry>
20751 </row>
20752 </tbody>
20753 </tgroup>
20754 </informaltable>
20755 <para>
20756 <indexterm role="concept">
20757 <primary>authentication</primary>
20758 <secondary>advertising</secondary>
20759 </indexterm>
20760 <indexterm role="concept">
20761 <primary>AUTH</primary>
20762 <secondary>advertising</secondary>
20763 </indexterm>
20764 If any server authentication mechanisms are configured, Exim advertises them in
20765 response to an EHLO command only if the calling host matches this list.
20766 Otherwise, Exim does not advertise AUTH.
20767 Exim does not accept AUTH commands from clients to which it has not
20768 advertised the availability of AUTH. The advertising of individual
20769 authentication mechanisms can be controlled by the use of the
20770 <option>server_advertise_condition</option> generic authenticator option on the individual
20771 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20772 </para>
20773 <para>
20774 Certain mail clients (for example, Netscape) require the user to provide a name
20775 and password for authentication if AUTH is advertised, even though it may
20776 not be needed (the host may accept messages from hosts on its local LAN without
20777 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20778 to make these clients more friendly by excluding them from the set of hosts to
20779 which Exim advertises AUTH.
20780 </para>
20781 <para>
20782 <indexterm role="concept">
20783 <primary>AUTH</primary>
20784 <secondary>advertising when encrypted</secondary>
20785 </indexterm>
20786 If you want to advertise the availability of AUTH only when the connection
20787 is encrypted using TLS, you can make use of the fact that the value of this
20788 option is expanded, with a setting like this:
20789 </para>
20790 <literallayout class="monospaced">
20791 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20792 </literallayout>
20793 <para>
20794 <indexterm role="variable">
20795 <primary><varname>$tls_cipher</varname></primary>
20796 </indexterm>
20797 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20798 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20799 expansion is *, which matches all hosts.
20800 </para>
20801 <para>
20802 <indexterm role="option">
20803 <primary><option>auto_thaw</option></primary>
20804 </indexterm>
20805 </para>
20806 <informaltable frame="all">
20807 <tgroup cols="4" colsep="0" rowsep="0">
20808 <colspec colwidth="8*" align="left"/>
20809 <colspec colwidth="6*" align="center"/>
20810 <colspec colwidth="6*" align="center"/>
20811 <colspec colwidth="6*" align="right"/>
20812 <tbody>
20813 <row>
20814 <entry><option>auto_thaw</option></entry>
20815 <entry>Use: <emphasis>main</emphasis></entry>
20816 <entry>Type: <emphasis>time</emphasis></entry>
20817 <entry>Default: <emphasis>0s</emphasis></entry>
20818 </row>
20819 </tbody>
20820 </tgroup>
20821 </informaltable>
20822 <para>
20823 <indexterm role="concept">
20824 <primary>thawing messages</primary>
20825 </indexterm>
20826 <indexterm role="concept">
20827 <primary>unfreezing messages</primary>
20828 </indexterm>
20829 If this option is set to a time greater than zero, a queue runner will try a
20830 new delivery attempt on any frozen message, other than a bounce message, if
20831 this much time has passed since it was frozen. This may result in the message
20832 being re-frozen if nothing has changed since the last attempt. It is a way of
20833 saying <quote>keep on trying, even though there are big problems</quote>.
20834 </para>
20835 <para>
20836 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20837 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20838 thought to be very useful any more, and its use should probably be avoided.
20839 </para>
20840 <para>
20841 <indexterm role="option">
20842 <primary><option>av_scanner</option></primary>
20843 </indexterm>
20844 </para>
20845 <informaltable frame="all">
20846 <tgroup cols="4" colsep="0" rowsep="0">
20847 <colspec colwidth="8*" align="left"/>
20848 <colspec colwidth="6*" align="center"/>
20849 <colspec colwidth="6*" align="center"/>
20850 <colspec colwidth="6*" align="right"/>
20851 <tbody>
20852 <row>
20853 <entry><option>av_scanner</option></entry>
20854 <entry>Use: <emphasis>main</emphasis></entry>
20855 <entry>Type: <emphasis>string</emphasis></entry>
20856 <entry>Default: <emphasis>see below</emphasis></entry>
20857 </row>
20858 </tbody>
20859 </tgroup>
20860 </informaltable>
20861 <para>
20862 This option is available if Exim is built with the content-scanning extension.
20863 It specifies which anti-virus scanner to use. The default value is:
20864 </para>
20865 <literallayout class="monospaced">
20866 sophie:/var/run/sophie
20867 </literallayout>
20868 <para>
20869 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20870 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20871 </para>
20872 <para>
20873 <indexterm role="option">
20874 <primary><option>bi_command</option></primary>
20875 </indexterm>
20876 </para>
20877 <informaltable frame="all">
20878 <tgroup cols="4" colsep="0" rowsep="0">
20879 <colspec colwidth="8*" align="left"/>
20880 <colspec colwidth="6*" align="center"/>
20881 <colspec colwidth="6*" align="center"/>
20882 <colspec colwidth="6*" align="right"/>
20883 <tbody>
20884 <row>
20885 <entry><option>bi_command</option></entry>
20886 <entry>Use: <emphasis>main</emphasis></entry>
20887 <entry>Type: <emphasis>string</emphasis></entry>
20888 <entry>Default: <emphasis>unset</emphasis></entry>
20889 </row>
20890 </tbody>
20891 </tgroup>
20892 </informaltable>
20893 <para>
20894 <indexterm role="option">
20895 <primary><option>-bi</option></primary>
20896 </indexterm>
20897 This option supplies the name of a command that is run when Exim is called with
20898 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20899 just the command name, it is not a complete command line. If an argument is
20900 required, it must come from the <option>-oA</option> command line option.
20901 </para>
20902 <para>
20903 <indexterm role="option">
20904 <primary><option>bounce_message_file</option></primary>
20905 </indexterm>
20906 </para>
20907 <informaltable frame="all">
20908 <tgroup cols="4" colsep="0" rowsep="0">
20909 <colspec colwidth="8*" align="left"/>
20910 <colspec colwidth="6*" align="center"/>
20911 <colspec colwidth="6*" align="center"/>
20912 <colspec colwidth="6*" align="right"/>
20913 <tbody>
20914 <row>
20915 <entry><option>bounce_message_file</option></entry>
20916 <entry>Use: <emphasis>main</emphasis></entry>
20917 <entry>Type: <emphasis>string</emphasis></entry>
20918 <entry>Default: <emphasis>unset</emphasis></entry>
20919 </row>
20920 </tbody>
20921 </tgroup>
20922 </informaltable>
20923 <para>
20924 <indexterm role="concept">
20925 <primary>bounce message</primary>
20926 <secondary>customizing</secondary>
20927 </indexterm>
20928 <indexterm role="concept">
20929 <primary>customizing</primary>
20930 <secondary>bounce message</secondary>
20931 </indexterm>
20932 This option defines a template file containing paragraphs of text to be used
20933 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
20934 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20935 </para>
20936 <para>
20937 <indexterm role="option">
20938 <primary><option>bounce_message_text</option></primary>
20939 </indexterm>
20940 </para>
20941 <informaltable frame="all">
20942 <tgroup cols="4" colsep="0" rowsep="0">
20943 <colspec colwidth="8*" align="left"/>
20944 <colspec colwidth="6*" align="center"/>
20945 <colspec colwidth="6*" align="center"/>
20946 <colspec colwidth="6*" align="right"/>
20947 <tbody>
20948 <row>
20949 <entry><option>bounce_message_text</option></entry>
20950 <entry>Use: <emphasis>main</emphasis></entry>
20951 <entry>Type: <emphasis>string</emphasis></entry>
20952 <entry>Default: <emphasis>unset</emphasis></entry>
20953 </row>
20954 </tbody>
20955 </tgroup>
20956 </informaltable>
20957 <para>
20958 When this option is set, its contents are included in the default bounce
20959 message immediately after <quote>This message was created automatically by mail
20960 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
20961 </para>
20962 <para>
20963 <indexterm role="option">
20964 <primary><option>bounce_return_body</option></primary>
20965 </indexterm>
20966 </para>
20967 <informaltable frame="all">
20968 <tgroup cols="4" colsep="0" rowsep="0">
20969 <colspec colwidth="8*" align="left"/>
20970 <colspec colwidth="6*" align="center"/>
20971 <colspec colwidth="6*" align="center"/>
20972 <colspec colwidth="6*" align="right"/>
20973 <tbody>
20974 <row>
20975 <entry><option>bounce_return_body</option></entry>
20976 <entry>Use: <emphasis>main</emphasis></entry>
20977 <entry>Type: <emphasis>boolean</emphasis></entry>
20978 <entry>Default: <emphasis>true</emphasis></entry>
20979 </row>
20980 </tbody>
20981 </tgroup>
20982 </informaltable>
20983 <para>
20984 <indexterm role="concept">
20985 <primary>bounce message</primary>
20986 <secondary>including body</secondary>
20987 </indexterm>
20988 This option controls whether the body of an incoming message is included in a
20989 bounce message when <option>bounce_return_message</option> is true. The default setting
20990 causes the entire message, both header and body, to be returned (subject to the
20991 value of <option>bounce_return_size_limit</option>). If this option is false, only the
20992 message header is included. In the case of a non-SMTP message containing an
20993 error that is detected during reception, only those header lines preceding the
20994 point at which the error was detected are returned.
20995 <indexterm role="concept">
20996 <primary>bounce message</primary>
20997 <secondary>including original</secondary>
20998 </indexterm>
20999 </para>
21000 <para>
21001 <indexterm role="option">
21002 <primary><option>bounce_return_message</option></primary>
21003 </indexterm>
21004 </para>
21005 <informaltable frame="all">
21006 <tgroup cols="4" colsep="0" rowsep="0">
21007 <colspec colwidth="8*" align="left"/>
21008 <colspec colwidth="6*" align="center"/>
21009 <colspec colwidth="6*" align="center"/>
21010 <colspec colwidth="6*" align="right"/>
21011 <tbody>
21012 <row>
21013 <entry><option>bounce_return_message</option></entry>
21014 <entry>Use: <emphasis>main</emphasis></entry>
21015 <entry>Type: <emphasis>boolean</emphasis></entry>
21016 <entry>Default: <emphasis>true</emphasis></entry>
21017 </row>
21018 </tbody>
21019 </tgroup>
21020 </informaltable>
21021 <para>
21022 If this option is set false, none of the original message is included in
21023 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21024 <option>bounce_return_body</option>.
21025 </para>
21026 <para>
21027 <indexterm role="option">
21028 <primary><option>bounce_return_size_limit</option></primary>
21029 </indexterm>
21030 </para>
21031 <informaltable frame="all">
21032 <tgroup cols="4" colsep="0" rowsep="0">
21033 <colspec colwidth="8*" align="left"/>
21034 <colspec colwidth="6*" align="center"/>
21035 <colspec colwidth="6*" align="center"/>
21036 <colspec colwidth="6*" align="right"/>
21037 <tbody>
21038 <row>
21039 <entry><option>bounce_return_size_limit</option></entry>
21040 <entry>Use: <emphasis>main</emphasis></entry>
21041 <entry>Type: <emphasis>integer</emphasis></entry>
21042 <entry>Default: <emphasis>100K</emphasis></entry>
21043 </row>
21044 </tbody>
21045 </tgroup>
21046 </informaltable>
21047 <para>
21048 <indexterm role="concept">
21049 <primary>size</primary>
21050 <secondary>of bounce, limit</secondary>
21051 </indexterm>
21052 <indexterm role="concept">
21053 <primary>bounce message</primary>
21054 <secondary>size limit</secondary>
21055 </indexterm>
21056 <indexterm role="concept">
21057 <primary>limit</primary>
21058 <secondary>bounce message size</secondary>
21059 </indexterm>
21060 This option sets a limit in bytes on the size of messages that are returned to
21061 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21062 limit should be less than the value of the global <option>message_size_limit</option> and of
21063 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21064 that Exim generates. If this option is set to zero there is no limit.
21065 </para>
21066 <para>
21067 When the body of any message that is to be included in a bounce message is
21068 greater than the limit, it is truncated, and a comment pointing this out is
21069 added at the top. The actual cutoff may be greater than the value given, owing
21070 to the use of buffering for transferring the message in chunks (typically 8K in
21071 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21072 messages.
21073 </para>
21074 <para>
21075 <indexterm role="option">
21076 <primary><option>bounce_sender_authentication</option></primary>
21077 </indexterm>
21078 </para>
21079 <informaltable frame="all">
21080 <tgroup cols="4" colsep="0" rowsep="0">
21081 <colspec colwidth="8*" align="left"/>
21082 <colspec colwidth="6*" align="center"/>
21083 <colspec colwidth="6*" align="center"/>
21084 <colspec colwidth="6*" align="right"/>
21085 <tbody>
21086 <row>
21087 <entry><option>bounce_sender_authentication</option></entry>
21088 <entry>Use: <emphasis>main</emphasis></entry>
21089 <entry>Type: <emphasis>string</emphasis></entry>
21090 <entry>Default: <emphasis>unset</emphasis></entry>
21091 </row>
21092 </tbody>
21093 </tgroup>
21094 </informaltable>
21095 <para>
21096 <indexterm role="concept">
21097 <primary>bounce message</primary>
21098 <secondary>sender authentication</secondary>
21099 </indexterm>
21100 <indexterm role="concept">
21101 <primary>authentication</primary>
21102 <secondary>bounce message</secondary>
21103 </indexterm>
21104 <indexterm role="concept">
21105 <primary>AUTH</primary>
21106 <secondary>on bounce message</secondary>
21107 </indexterm>
21108 This option provides an authenticated sender address that is sent with any
21109 bounce messages generated by Exim that are sent over an authenticated SMTP
21110 connection. A typical setting might be:
21111 </para>
21112 <literallayout class="monospaced">
21113 bounce_sender_authentication = mailer-daemon@my.domain.example
21114 </literallayout>
21115 <para>
21116 which would cause bounce messages to be sent using the SMTP command:
21117 </para>
21118 <literallayout class="monospaced">
21119 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
21120 </literallayout>
21121 <para>
21122 The value of <option>bounce_sender_authentication</option> must always be a complete email
21123 address.
21124 </para>
21125 <para>
21126 <indexterm role="option">
21127 <primary><option>callout_domain_negative_expire</option></primary>
21128 </indexterm>
21129 </para>
21130 <informaltable frame="all">
21131 <tgroup cols="4" colsep="0" rowsep="0">
21132 <colspec colwidth="8*" align="left"/>
21133 <colspec colwidth="6*" align="center"/>
21134 <colspec colwidth="6*" align="center"/>
21135 <colspec colwidth="6*" align="right"/>
21136 <tbody>
21137 <row>
21138 <entry><option>callout_domain_negative_expire</option></entry>
21139 <entry>Use: <emphasis>main</emphasis></entry>
21140 <entry>Type: <emphasis>time</emphasis></entry>
21141 <entry>Default: <emphasis>3h</emphasis></entry>
21142 </row>
21143 </tbody>
21144 </tgroup>
21145 </informaltable>
21146 <para>
21147 <indexterm role="concept">
21148 <primary>caching</primary>
21149 <secondary>callout timeouts</secondary>
21150 </indexterm>
21151 <indexterm role="concept">
21152 <primary>callout</primary>
21153 <secondary>caching timeouts</secondary>
21154 </indexterm>
21155 This option specifies the expiry time for negative callout cache data for a
21156 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21157 section <xref linkend="SECTcallvercache"/> for details of the caching.
21158 </para>
21159 <para>
21160 <indexterm role="option">
21161 <primary><option>callout_domain_positive_expire</option></primary>
21162 </indexterm>
21163 </para>
21164 <informaltable frame="all">
21165 <tgroup cols="4" colsep="0" rowsep="0">
21166 <colspec colwidth="8*" align="left"/>
21167 <colspec colwidth="6*" align="center"/>
21168 <colspec colwidth="6*" align="center"/>
21169 <colspec colwidth="6*" align="right"/>
21170 <tbody>
21171 <row>
21172 <entry><option>callout_domain_positive_expire</option></entry>
21173 <entry>Use: <emphasis>main</emphasis></entry>
21174 <entry>Type: <emphasis>time</emphasis></entry>
21175 <entry>Default: <emphasis>7d</emphasis></entry>
21176 </row>
21177 </tbody>
21178 </tgroup>
21179 </informaltable>
21180 <para>
21181 This option specifies the expiry time for positive callout cache data for a
21182 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21183 section <xref linkend="SECTcallvercache"/> for details of the caching.
21184 </para>
21185 <para>
21186 <indexterm role="option">
21187 <primary><option>callout_negative_expire</option></primary>
21188 </indexterm>
21189 </para>
21190 <informaltable frame="all">
21191 <tgroup cols="4" colsep="0" rowsep="0">
21192 <colspec colwidth="8*" align="left"/>
21193 <colspec colwidth="6*" align="center"/>
21194 <colspec colwidth="6*" align="center"/>
21195 <colspec colwidth="6*" align="right"/>
21196 <tbody>
21197 <row>
21198 <entry><option>callout_negative_expire</option></entry>
21199 <entry>Use: <emphasis>main</emphasis></entry>
21200 <entry>Type: <emphasis>time</emphasis></entry>
21201 <entry>Default: <emphasis>2h</emphasis></entry>
21202 </row>
21203 </tbody>
21204 </tgroup>
21205 </informaltable>
21206 <para>
21207 This option specifies the expiry time for negative callout cache data for an
21208 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21209 section <xref linkend="SECTcallvercache"/> for details of the caching.
21210 </para>
21211 <para>
21212 <indexterm role="option">
21213 <primary><option>callout_positive_expire</option></primary>
21214 </indexterm>
21215 </para>
21216 <informaltable frame="all">
21217 <tgroup cols="4" colsep="0" rowsep="0">
21218 <colspec colwidth="8*" align="left"/>
21219 <colspec colwidth="6*" align="center"/>
21220 <colspec colwidth="6*" align="center"/>
21221 <colspec colwidth="6*" align="right"/>
21222 <tbody>
21223 <row>
21224 <entry><option>callout_positive_expire</option></entry>
21225 <entry>Use: <emphasis>main</emphasis></entry>
21226 <entry>Type: <emphasis>time</emphasis></entry>
21227 <entry>Default: <emphasis>24h</emphasis></entry>
21228 </row>
21229 </tbody>
21230 </tgroup>
21231 </informaltable>
21232 <para>
21233 This option specifies the expiry time for positive callout cache data for an
21234 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21235 section <xref linkend="SECTcallvercache"/> for details of the caching.
21236 </para>
21237 <para>
21238 <indexterm role="option">
21239 <primary><option>callout_random_local_part</option></primary>
21240 </indexterm>
21241 </para>
21242 <informaltable frame="all">
21243 <tgroup cols="4" colsep="0" rowsep="0">
21244 <colspec colwidth="8*" align="left"/>
21245 <colspec colwidth="6*" align="center"/>
21246 <colspec colwidth="6*" align="center"/>
21247 <colspec colwidth="6*" align="right"/>
21248 <tbody>
21249 <row>
21250 <entry><option>callout_random_local_part</option></entry>
21251 <entry>Use: <emphasis>main</emphasis></entry>
21252 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21253 <entry>Default: <emphasis>see below</emphasis></entry>
21254 </row>
21255 </tbody>
21256 </tgroup>
21257 </informaltable>
21258 <para>
21259 This option defines the <quote>random</quote> local part that can be used as part of
21260 callout verification. The default value is
21261 </para>
21262 <literallayout class="monospaced">
21263 $primary_host_name-$tod_epoch-testing
21264 </literallayout>
21265 <para>
21266 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21267 </para>
21268 <para>
21269 <indexterm role="option">
21270 <primary><option>check_log_inodes</option></primary>
21271 </indexterm>
21272 </para>
21273 <informaltable frame="all">
21274 <tgroup cols="4" colsep="0" rowsep="0">
21275 <colspec colwidth="8*" align="left"/>
21276 <colspec colwidth="6*" align="center"/>
21277 <colspec colwidth="6*" align="center"/>
21278 <colspec colwidth="6*" align="right"/>
21279 <tbody>
21280 <row>
21281 <entry><option>check_log_inodes</option></entry>
21282 <entry>Use: <emphasis>main</emphasis></entry>
21283 <entry>Type: <emphasis>integer</emphasis></entry>
21284 <entry>Default: <emphasis>0</emphasis></entry>
21285 </row>
21286 </tbody>
21287 </tgroup>
21288 </informaltable>
21289 <para>
21290 See <option>check_spool_space</option> below.
21291 </para>
21292 <para>
21293 <indexterm role="option">
21294 <primary><option>check_log_space</option></primary>
21295 </indexterm>
21296 </para>
21297 <informaltable frame="all">
21298 <tgroup cols="4" colsep="0" rowsep="0">
21299 <colspec colwidth="8*" align="left"/>
21300 <colspec colwidth="6*" align="center"/>
21301 <colspec colwidth="6*" align="center"/>
21302 <colspec colwidth="6*" align="right"/>
21303 <tbody>
21304 <row>
21305 <entry><option>check_log_space</option></entry>
21306 <entry>Use: <emphasis>main</emphasis></entry>
21307 <entry>Type: <emphasis>integer</emphasis></entry>
21308 <entry>Default: <emphasis>0</emphasis></entry>
21309 </row>
21310 </tbody>
21311 </tgroup>
21312 </informaltable>
21313 <para>
21314 See <option>check_spool_space</option> below.
21315 </para>
21316 <para>
21317 <indexterm role="option">
21318 <primary><option>check_rfc2047_length</option></primary>
21319 </indexterm>
21320 <indexterm role="concept">
21321 <primary>RFC 2047</primary>
21322 <secondary>disabling length check</secondary>
21323 </indexterm>
21324 <indexterm role="option">
21325 <primary><option>check_rfc2047_length</option></primary>
21326 </indexterm>
21327 </para>
21328 <informaltable frame="all">
21329 <tgroup cols="4" colsep="0" rowsep="0">
21330 <colspec colwidth="8*" align="left"/>
21331 <colspec colwidth="6*" align="center"/>
21332 <colspec colwidth="6*" align="center"/>
21333 <colspec colwidth="6*" align="right"/>
21334 <tbody>
21335 <row>
21336 <entry><option>check_rfc2047_length</option></entry>
21337 <entry>Use: <emphasis>main</emphasis></entry>
21338 <entry>Type: <emphasis>boolean</emphasis></entry>
21339 <entry>Default: <emphasis>true</emphasis></entry>
21340 </row>
21341 </tbody>
21342 </tgroup>
21343 </informaltable>
21344 <para>
21345 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21346 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21347 word; strings to be encoded that exceed this length are supposed to use
21348 multiple encoded words. By default, Exim does not recognize encoded words that
21349 exceed the maximum length. However, it seems that some software, in violation
21350 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21351 set false, Exim recognizes encoded words of any length.
21352 </para>
21353 <para>
21354 <indexterm role="option">
21355 <primary><option>check_spool_inodes</option></primary>
21356 </indexterm>
21357 </para>
21358 <informaltable frame="all">
21359 <tgroup cols="4" colsep="0" rowsep="0">
21360 <colspec colwidth="8*" align="left"/>
21361 <colspec colwidth="6*" align="center"/>
21362 <colspec colwidth="6*" align="center"/>
21363 <colspec colwidth="6*" align="right"/>
21364 <tbody>
21365 <row>
21366 <entry><option>check_spool_inodes</option></entry>
21367 <entry>Use: <emphasis>main</emphasis></entry>
21368 <entry>Type: <emphasis>integer</emphasis></entry>
21369 <entry>Default: <emphasis>0</emphasis></entry>
21370 </row>
21371 </tbody>
21372 </tgroup>
21373 </informaltable>
21374 <para>
21375 See <option>check_spool_space</option> below.
21376 </para>
21377 <para>
21378 <indexterm role="option">
21379 <primary><option>check_spool_space</option></primary>
21380 </indexterm>
21381 </para>
21382 <informaltable frame="all">
21383 <tgroup cols="4" colsep="0" rowsep="0">
21384 <colspec colwidth="8*" align="left"/>
21385 <colspec colwidth="6*" align="center"/>
21386 <colspec colwidth="6*" align="center"/>
21387 <colspec colwidth="6*" align="right"/>
21388 <tbody>
21389 <row>
21390 <entry><option>check_spool_space</option></entry>
21391 <entry>Use: <emphasis>main</emphasis></entry>
21392 <entry>Type: <emphasis>integer</emphasis></entry>
21393 <entry>Default: <emphasis>0</emphasis></entry>
21394 </row>
21395 </tbody>
21396 </tgroup>
21397 </informaltable>
21398 <para>
21399 <indexterm role="concept">
21400 <primary>checking disk space</primary>
21401 </indexterm>
21402 <indexterm role="concept">
21403 <primary>disk space, checking</primary>
21404 </indexterm>
21405 <indexterm role="concept">
21406 <primary>spool directory</primary>
21407 <secondary>checking space</secondary>
21408 </indexterm>
21409 The four <option>check_...</option> options allow for checking of disk resources before a
21410 message is accepted.
21411 </para>
21412 <para>
21413 <indexterm role="variable">
21414 <primary><varname>$log_inodes</varname></primary>
21415 </indexterm>
21416 <indexterm role="variable">
21417 <primary><varname>$log_space</varname></primary>
21418 </indexterm>
21419 <indexterm role="variable">
21420 <primary><varname>$spool_inodes</varname></primary>
21421 </indexterm>
21422 <indexterm role="variable">
21423 <primary><varname>$spool_space</varname></primary>
21424 </indexterm>
21425 When any of these options are set, they apply to all incoming messages. If you
21426 want to apply different checks to different kinds of message, you can do so by
21427 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21428 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21429 </para>
21430 <para>
21431 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21432 either value is greater than zero, for example:
21433 </para>
21434 <literallayout class="monospaced">
21435 check_spool_space = 10M
21436 check_spool_inodes = 100
21437 </literallayout>
21438 <para>
21439 The spool partition is the one that contains the directory defined by
21440 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21441 transit.
21442 </para>
21443 <para>
21444 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
21445 files are written if either is greater than zero. These should be set only if
21446 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21447 </para>
21448 <para>
21449 If there is less space or fewer inodes than requested, Exim refuses to accept
21450 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21451 error response to the MAIL command. If ESMTP is in use and there was a
21452 SIZE parameter on the MAIL command, its value is added to the
21453 <option>check_spool_space</option> value, and the check is performed even if
21454 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21455 </para>
21456 <para>
21457 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21458 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21459 </para>
21460 <para>
21461 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21462 failure a message is written to stderr and Exim exits with a non-zero code, as
21463 it obviously cannot send an error message of any kind.
21464 </para>
21465 <para>
21466 <indexterm role="option">
21467 <primary><option>daemon_smtp_ports</option></primary>
21468 </indexterm>
21469 </para>
21470 <informaltable frame="all">
21471 <tgroup cols="4" colsep="0" rowsep="0">
21472 <colspec colwidth="8*" align="left"/>
21473 <colspec colwidth="6*" align="center"/>
21474 <colspec colwidth="6*" align="center"/>
21475 <colspec colwidth="6*" align="right"/>
21476 <tbody>
21477 <row>
21478 <entry><option>daemon_smtp_ports</option></entry>
21479 <entry>Use: <emphasis>main</emphasis></entry>
21480 <entry>Type: <emphasis>string</emphasis></entry>
21481 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21482 </row>
21483 </tbody>
21484 </tgroup>
21485 </informaltable>
21486 <para>
21487 <indexterm role="concept">
21488 <primary>port</primary>
21489 <secondary>for daemon</secondary>
21490 </indexterm>
21491 <indexterm role="concept">
21492 <primary>TCP/IP</primary>
21493 <secondary>setting listening ports</secondary>
21494 </indexterm>
21495 This option specifies one or more default SMTP ports on which the Exim daemon
21496 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21497 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21498 </para>
21499 <para>
21500 <indexterm role="option">
21501 <primary><option>daemon_startup_retries</option></primary>
21502 </indexterm>
21503 </para>
21504 <informaltable frame="all">
21505 <tgroup cols="4" colsep="0" rowsep="0">
21506 <colspec colwidth="8*" align="left"/>
21507 <colspec colwidth="6*" align="center"/>
21508 <colspec colwidth="6*" align="center"/>
21509 <colspec colwidth="6*" align="right"/>
21510 <tbody>
21511 <row>
21512 <entry><option>daemon_startup_retries</option></entry>
21513 <entry>Use: <emphasis>main</emphasis></entry>
21514 <entry>Type: <emphasis>integer</emphasis></entry>
21515 <entry>Default: <emphasis>9</emphasis></entry>
21516 </row>
21517 </tbody>
21518 </tgroup>
21519 </informaltable>
21520 <para>
21521 <indexterm role="concept">
21522 <primary>daemon startup, retrying</primary>
21523 </indexterm>
21524 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21525 the daemon at startup when it cannot immediately bind a listening socket
21526 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21527 defines the number of retries after the first failure, and
21528 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21529 </para>
21530 <para>
21531 <indexterm role="option">
21532 <primary><option>daemon_startup_sleep</option></primary>
21533 </indexterm>
21534 </para>
21535 <informaltable frame="all">
21536 <tgroup cols="4" colsep="0" rowsep="0">
21537 <colspec colwidth="8*" align="left"/>
21538 <colspec colwidth="6*" align="center"/>
21539 <colspec colwidth="6*" align="center"/>
21540 <colspec colwidth="6*" align="right"/>
21541 <tbody>
21542 <row>
21543 <entry><option>daemon_startup_sleep</option></entry>
21544 <entry>Use: <emphasis>main</emphasis></entry>
21545 <entry>Type: <emphasis>time</emphasis></entry>
21546 <entry>Default: <emphasis>30s</emphasis></entry>
21547 </row>
21548 </tbody>
21549 </tgroup>
21550 </informaltable>
21551 <para>
21552 See <option>daemon_startup_retries</option>.
21553 </para>
21554 <para>
21555 <indexterm role="option">
21556 <primary><option>delay_warning</option></primary>
21557 </indexterm>
21558 </para>
21559 <informaltable frame="all">
21560 <tgroup cols="4" colsep="0" rowsep="0">
21561 <colspec colwidth="8*" align="left"/>
21562 <colspec colwidth="6*" align="center"/>
21563 <colspec colwidth="6*" align="center"/>
21564 <colspec colwidth="6*" align="right"/>
21565 <tbody>
21566 <row>
21567 <entry><option>delay_warning</option></entry>
21568 <entry>Use: <emphasis>main</emphasis></entry>
21569 <entry>Type: <emphasis>time list</emphasis></entry>
21570 <entry>Default: <emphasis>24h</emphasis></entry>
21571 </row>
21572 </tbody>
21573 </tgroup>
21574 </informaltable>
21575 <para>
21576 <indexterm role="concept">
21577 <primary>warning of delay</primary>
21578 </indexterm>
21579 <indexterm role="concept">
21580 <primary>delay warning, specifying</primary>
21581 </indexterm>
21582 When a message is delayed, Exim sends a warning message to the sender at
21583 intervals specified by this option. The data is a colon-separated list of times
21584 after which to send warning messages. If the value of the option is an empty
21585 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21586 message has been on the queue for longer than the last time, the last interval
21587 between the times is used to compute subsequent warning times. For example,
21588 with
21589 </para>
21590 <literallayout class="monospaced">
21591 delay_warning = 4h:8h:24h
21592 </literallayout>
21593 <para>
21594 the first message is sent after 4 hours, the second after 8 hours, and
21595 the third one after 24 hours. After that, messages are sent every 16 hours,
21596 because that is the interval between the last two times on the list. If you set
21597 just one time, it specifies the repeat interval. For example, with:
21598 </para>
21599 <literallayout class="monospaced">
21600 delay_warning = 6h
21601 </literallayout>
21602 <para>
21603 messages are repeated every six hours. To stop warnings after a given time, set
21604 a very large time at the end of the list. For example:
21605 </para>
21606 <literallayout class="monospaced">
21607 delay_warning = 2h:12h:99d
21608 </literallayout>
21609 <para>
21610 <indexterm role="option">
21611 <primary><option>delay_warning_condition</option></primary>
21612 </indexterm>
21613 </para>
21614 <informaltable frame="all">
21615 <tgroup cols="4" colsep="0" rowsep="0">
21616 <colspec colwidth="8*" align="left"/>
21617 <colspec colwidth="6*" align="center"/>
21618 <colspec colwidth="6*" align="center"/>
21619 <colspec colwidth="6*" align="right"/>
21620 <tbody>
21621 <row>
21622 <entry><option>delay_warning_condition</option></entry>
21623 <entry>Use: <emphasis>main</emphasis></entry>
21624 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21625 <entry>Default: <emphasis>see below</emphasis></entry>
21626 </row>
21627 </tbody>
21628 </tgroup>
21629 </informaltable>
21630 <para>
21631 <indexterm role="variable">
21632 <primary><varname>$domain</varname></primary>
21633 </indexterm>
21634 The string is expanded at the time a warning message might be sent. If all the
21635 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21636 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21637 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21638 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21639 not sent. The default is:
21640 </para>
21641 <literallayout class="monospaced">
21642 delay_warning_condition = ${if or {\
21643   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21644   { match{$h_precedence:}{(?i)bulk|list|junk} }\
21645   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21646   } {no}{yes}}
21647 </literallayout>
21648 <para>
21649 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21650 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21651 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21652 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21653 </para>
21654 <para>
21655 <indexterm role="option">
21656 <primary><option>deliver_drop_privilege</option></primary>
21657 </indexterm>
21658 </para>
21659 <informaltable frame="all">
21660 <tgroup cols="4" colsep="0" rowsep="0">
21661 <colspec colwidth="8*" align="left"/>
21662 <colspec colwidth="6*" align="center"/>
21663 <colspec colwidth="6*" align="center"/>
21664 <colspec colwidth="6*" align="right"/>
21665 <tbody>
21666 <row>
21667 <entry><option>deliver_drop_privilege</option></entry>
21668 <entry>Use: <emphasis>main</emphasis></entry>
21669 <entry>Type: <emphasis>boolean</emphasis></entry>
21670 <entry>Default: <emphasis>false</emphasis></entry>
21671 </row>
21672 </tbody>
21673 </tgroup>
21674 </informaltable>
21675 <para>
21676 <indexterm role="concept">
21677 <primary>unprivileged delivery</primary>
21678 </indexterm>
21679 <indexterm role="concept">
21680 <primary>delivery</primary>
21681 <secondary>unprivileged</secondary>
21682 </indexterm>
21683 If this option is set true, Exim drops its root privilege at the start of a
21684 delivery process, and runs as the Exim user throughout. This severely restricts
21685 the kinds of local delivery that are possible, but is viable in certain types
21686 of configuration. There is a discussion about the use of root privilege in
21687 chapter <xref linkend="CHAPsecurity"/>.
21688 </para>
21689 <para>
21690 <indexterm role="option">
21691 <primary><option>deliver_queue_load_max</option></primary>
21692 </indexterm>
21693 </para>
21694 <informaltable frame="all">
21695 <tgroup cols="4" colsep="0" rowsep="0">
21696 <colspec colwidth="8*" align="left"/>
21697 <colspec colwidth="6*" align="center"/>
21698 <colspec colwidth="6*" align="center"/>
21699 <colspec colwidth="6*" align="right"/>
21700 <tbody>
21701 <row>
21702 <entry><option>deliver_queue_load_max</option></entry>
21703 <entry>Use: <emphasis>main</emphasis></entry>
21704 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21705 <entry>Default: <emphasis>unset</emphasis></entry>
21706 </row>
21707 </tbody>
21708 </tgroup>
21709 </informaltable>
21710 <para>
21711 <indexterm role="concept">
21712 <primary>load average</primary>
21713 </indexterm>
21714 <indexterm role="concept">
21715 <primary>queue runner</primary>
21716 <secondary>abandoning</secondary>
21717 </indexterm>
21718 When this option is set, a queue run is abandoned if the system load average
21719 becomes greater than the value of the option. The option has no effect on
21720 ancient operating systems on which Exim cannot determine the load average.
21721 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21722 </para>
21723 <para>
21724 <indexterm role="option">
21725 <primary><option>delivery_date_remove</option></primary>
21726 </indexterm>
21727 </para>
21728 <informaltable frame="all">
21729 <tgroup cols="4" colsep="0" rowsep="0">
21730 <colspec colwidth="8*" align="left"/>
21731 <colspec colwidth="6*" align="center"/>
21732 <colspec colwidth="6*" align="center"/>
21733 <colspec colwidth="6*" align="right"/>
21734 <tbody>
21735 <row>
21736 <entry><option>delivery_date_remove</option></entry>
21737 <entry>Use: <emphasis>main</emphasis></entry>
21738 <entry>Type: <emphasis>boolean</emphasis></entry>
21739 <entry>Default: <emphasis>true</emphasis></entry>
21740 </row>
21741 </tbody>
21742 </tgroup>
21743 </informaltable>
21744 <para>
21745 <indexterm role="concept">
21746 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21747 </indexterm>
21748 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21749 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21750 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21751 should not be present in incoming messages, and this option causes them to be
21752 removed at the time the message is received, to avoid any problems that might
21753 occur when a delivered message is subsequently sent on to some other recipient.
21754 </para>
21755 <para>
21756 <indexterm role="option">
21757 <primary><option>disable_fsync</option></primary>
21758 </indexterm>
21759 </para>
21760 <informaltable frame="all">
21761 <tgroup cols="4" colsep="0" rowsep="0">
21762 <colspec colwidth="8*" align="left"/>
21763 <colspec colwidth="6*" align="center"/>
21764 <colspec colwidth="6*" align="center"/>
21765 <colspec colwidth="6*" align="right"/>
21766 <tbody>
21767 <row>
21768 <entry><option>disable_fsync</option></entry>
21769 <entry>Use: <emphasis>main</emphasis></entry>
21770 <entry>Type: <emphasis>boolean</emphasis></entry>
21771 <entry>Default: <emphasis>false</emphasis></entry>
21772 </row>
21773 </tbody>
21774 </tgroup>
21775 </informaltable>
21776 <para>
21777 <indexterm role="concept">
21778 <primary><function>fsync()</function>, disabling</primary>
21779 </indexterm>
21780 This option is available only if Exim was built with the compile-time option
21781 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
21782 a runtime configuration generates an <quote>unknown option</quote> error. You should not
21783 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
21784 really, really, really understand what you are doing. <emphasis>No pre-compiled
21785 distributions of Exim should ever make this option available.</emphasis>
21786 </para>
21787 <para>
21788 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
21789 updated files&#x2019; data to be written to disc before continuing. Unexpected events
21790 such as crashes and power outages may cause data to be lost or scrambled.
21791 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
21792 </para>
21793 <para>
21794 <indexterm role="option">
21795 <primary><option>disable_ipv6</option></primary>
21796 </indexterm>
21797 </para>
21798 <informaltable frame="all">
21799 <tgroup cols="4" colsep="0" rowsep="0">
21800 <colspec colwidth="8*" align="left"/>
21801 <colspec colwidth="6*" align="center"/>
21802 <colspec colwidth="6*" align="center"/>
21803 <colspec colwidth="6*" align="right"/>
21804 <tbody>
21805 <row>
21806 <entry><option>disable_ipv6</option></entry>
21807 <entry>Use: <emphasis>main</emphasis></entry>
21808 <entry>Type: <emphasis>boolean</emphasis></entry>
21809 <entry>Default: <emphasis>false</emphasis></entry>
21810 </row>
21811 </tbody>
21812 </tgroup>
21813 </informaltable>
21814 <para>
21815 <indexterm role="concept">
21816 <primary>IPv6</primary>
21817 <secondary>disabling</secondary>
21818 </indexterm>
21819 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21820 activities take place. AAAA records are never looked up, and any IPv6 addresses
21821 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21822 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21823 to handle IPv6 literal addresses.
21824 </para>
21825 <para>
21826 <indexterm role="option">
21827 <primary><option>dns_again_means_nonexist</option></primary>
21828 </indexterm>
21829 </para>
21830 <informaltable frame="all">
21831 <tgroup cols="4" colsep="0" rowsep="0">
21832 <colspec colwidth="8*" align="left"/>
21833 <colspec colwidth="6*" align="center"/>
21834 <colspec colwidth="6*" align="center"/>
21835 <colspec colwidth="6*" align="right"/>
21836 <tbody>
21837 <row>
21838 <entry><option>dns_again_means_nonexist</option></entry>
21839 <entry>Use: <emphasis>main</emphasis></entry>
21840 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21841 <entry>Default: <emphasis>unset</emphasis></entry>
21842 </row>
21843 </tbody>
21844 </tgroup>
21845 </informaltable>
21846 <para>
21847 <indexterm role="concept">
21848 <primary>DNS</primary>
21849 <secondary><quote>try again</quote> response; overriding</secondary>
21850 </indexterm>
21851 DNS lookups give a <quote>try again</quote> response for the DNS errors
21852 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21853 keep trying to deliver a message, or to give repeated temporary errors to
21854 incoming mail. Sometimes the effect is caused by a badly set up name server and
21855 may persist for a long time. If a domain which exhibits this problem matches
21856 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21857 This option should be used with care. You can make it apply to reverse lookups
21858 by a setting such as this:
21859 </para>
21860 <literallayout class="monospaced">
21861 dns_again_means_nonexist = *.in-addr.arpa
21862 </literallayout>
21863 <para>
21864 This option applies to all DNS lookups that Exim does. It also applies when the
21865 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21866 since these are most likely to be caused by DNS lookup problems. The
21867 <command>dnslookup</command> router has some options of its own for controlling what happens
21868 when lookups for MX or SRV records give temporary errors. These more specific
21869 options are applied after this global option.
21870 </para>
21871 <para>
21872 <indexterm role="option">
21873 <primary><option>dns_check_names_pattern</option></primary>
21874 </indexterm>
21875 </para>
21876 <informaltable frame="all">
21877 <tgroup cols="4" colsep="0" rowsep="0">
21878 <colspec colwidth="8*" align="left"/>
21879 <colspec colwidth="6*" align="center"/>
21880 <colspec colwidth="6*" align="center"/>
21881 <colspec colwidth="6*" align="right"/>
21882 <tbody>
21883 <row>
21884 <entry><option>dns_check_names_pattern</option></entry>
21885 <entry>Use: <emphasis>main</emphasis></entry>
21886 <entry>Type: <emphasis>string</emphasis></entry>
21887 <entry>Default: <emphasis>see below</emphasis></entry>
21888 </row>
21889 </tbody>
21890 </tgroup>
21891 </informaltable>
21892 <para>
21893 <indexterm role="concept">
21894 <primary>DNS</primary>
21895 <secondary>pre-check of name syntax</secondary>
21896 </indexterm>
21897 When this option is set to a non-empty string, it causes Exim to check domain
21898 names for characters that are not allowed in host names before handing them to
21899 the DNS resolver, because some resolvers give temporary errors for names that
21900 contain unusual characters. If a domain name contains any unwanted characters,
21901 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21902 done by matching the domain name against a regular expression, which is the
21903 value of this option. The default pattern is
21904 </para>
21905 <literallayout class="monospaced">
21906 dns_check_names_pattern = \
21907   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
21908 </literallayout>
21909 <para>
21910 which permits only letters, digits, slashes, and hyphens in components, but
21911 they must start and end with a letter or digit. <phrase revisionflag="changed">Slashes</phrase> are not, in fact,
21912 permitted in host names, but they are found in certain NS records (which can be
21913 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21914 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21915 empty string.
21916 </para>
21917 <para>
21918 <indexterm role="option">
21919 <primary><option>dns_csa_search_limit</option></primary>
21920 </indexterm>
21921 </para>
21922 <informaltable frame="all">
21923 <tgroup cols="4" colsep="0" rowsep="0">
21924 <colspec colwidth="8*" align="left"/>
21925 <colspec colwidth="6*" align="center"/>
21926 <colspec colwidth="6*" align="center"/>
21927 <colspec colwidth="6*" align="right"/>
21928 <tbody>
21929 <row>
21930 <entry><option>dns_csa_search_limit</option></entry>
21931 <entry>Use: <emphasis>main</emphasis></entry>
21932 <entry>Type: <emphasis>integer</emphasis></entry>
21933 <entry>Default: <emphasis>5</emphasis></entry>
21934 </row>
21935 </tbody>
21936 </tgroup>
21937 </informaltable>
21938 <para>
21939 This option controls the depth of parental searching for CSA SRV records in the
21940 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21941 </para>
21942 <para>
21943 <indexterm role="option">
21944 <primary><option>dns_csa_use_reverse</option></primary>
21945 </indexterm>
21946 </para>
21947 <informaltable frame="all">
21948 <tgroup cols="4" colsep="0" rowsep="0">
21949 <colspec colwidth="8*" align="left"/>
21950 <colspec colwidth="6*" align="center"/>
21951 <colspec colwidth="6*" align="center"/>
21952 <colspec colwidth="6*" align="right"/>
21953 <tbody>
21954 <row>
21955 <entry><option>dns_csa_use_reverse</option></entry>
21956 <entry>Use: <emphasis>main</emphasis></entry>
21957 <entry>Type: <emphasis>boolean</emphasis></entry>
21958 <entry>Default: <emphasis>true</emphasis></entry>
21959 </row>
21960 </tbody>
21961 </tgroup>
21962 </informaltable>
21963 <para>
21964 This option controls whether or not an IP address, given as a CSA domain, is
21965 reversed and looked up in the reverse DNS, as described in more detail in
21966 section <xref linkend="SECTverifyCSA"/>.
21967 </para>
21968 <para>
21969 <indexterm role="option">
21970 <primary><option>dns_ipv4_lookup</option></primary>
21971 </indexterm>
21972 </para>
21973 <informaltable frame="all">
21974 <tgroup cols="4" colsep="0" rowsep="0">
21975 <colspec colwidth="8*" align="left"/>
21976 <colspec colwidth="6*" align="center"/>
21977 <colspec colwidth="6*" align="center"/>
21978 <colspec colwidth="6*" align="right"/>
21979 <tbody>
21980 <row>
21981 <entry><option>dns_ipv4_lookup</option></entry>
21982 <entry>Use: <emphasis>main</emphasis></entry>
21983 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21984 <entry>Default: <emphasis>unset</emphasis></entry>
21985 </row>
21986 </tbody>
21987 </tgroup>
21988 </informaltable>
21989 <para>
21990 <indexterm role="concept">
21991 <primary>IPv6</primary>
21992 <secondary>DNS lookup for AAAA records</secondary>
21993 </indexterm>
21994 <indexterm role="concept">
21995 <primary>DNS</primary>
21996 <secondary>IPv6 lookup for AAAA records</secondary>
21997 </indexterm>
21998 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
21999 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22000 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
22001 domain matches this list.
22002 </para>
22003 <para>
22004 This is a fudge to help with name servers that give big delays or otherwise do
22005 not work for the AAAA record type. In due course, when the world&#x2019;s name
22006 servers have all been upgraded, there should be no need for this option.
22007 </para>
22008 <para>
22009 <indexterm role="option">
22010 <primary><option>dns_retrans</option></primary>
22011 </indexterm>
22012 </para>
22013 <informaltable frame="all">
22014 <tgroup cols="4" colsep="0" rowsep="0">
22015 <colspec colwidth="8*" align="left"/>
22016 <colspec colwidth="6*" align="center"/>
22017 <colspec colwidth="6*" align="center"/>
22018 <colspec colwidth="6*" align="right"/>
22019 <tbody>
22020 <row>
22021 <entry><option>dns_retrans</option></entry>
22022 <entry>Use: <emphasis>main</emphasis></entry>
22023 <entry>Type: <emphasis>time</emphasis></entry>
22024 <entry>Default: <emphasis>0s</emphasis></entry>
22025 </row>
22026 </tbody>
22027 </tgroup>
22028 </informaltable>
22029 <para>
22030 <indexterm role="concept">
22031 <primary>DNS</primary>
22032 <secondary>resolver options</secondary>
22033 </indexterm>
22034 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22035 retransmission and retry parameters for DNS lookups. Values of zero (the
22036 defaults) leave the system default settings unchanged. The first value is the
22037 time between retries, and the second is the number of retries. It isn&#x2019;t
22038 totally clear exactly how these settings affect the total time a DNS lookup may
22039 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
22040 parameter values are available in the external resolver interface structure,
22041 but nowhere does it seem to describe how they are used or what you might want
22042 to set in them.
22043 </para>
22044 <para>
22045 <indexterm role="option">
22046 <primary><option>dns_retry</option></primary>
22047 </indexterm>
22048 </para>
22049 <informaltable frame="all">
22050 <tgroup cols="4" colsep="0" rowsep="0">
22051 <colspec colwidth="8*" align="left"/>
22052 <colspec colwidth="6*" align="center"/>
22053 <colspec colwidth="6*" align="center"/>
22054 <colspec colwidth="6*" align="right"/>
22055 <tbody>
22056 <row>
22057 <entry><option>dns_retry</option></entry>
22058 <entry>Use: <emphasis>main</emphasis></entry>
22059 <entry>Type: <emphasis>integer</emphasis></entry>
22060 <entry>Default: <emphasis>0</emphasis></entry>
22061 </row>
22062 </tbody>
22063 </tgroup>
22064 </informaltable>
22065 <para>
22066 See <option>dns_retrans</option> above.
22067 </para>
22068 <para>
22069 <indexterm role="option">
22070 <primary><option>drop_cr</option></primary>
22071 </indexterm>
22072 </para>
22073 <informaltable frame="all">
22074 <tgroup cols="4" colsep="0" rowsep="0">
22075 <colspec colwidth="8*" align="left"/>
22076 <colspec colwidth="6*" align="center"/>
22077 <colspec colwidth="6*" align="center"/>
22078 <colspec colwidth="6*" align="right"/>
22079 <tbody>
22080 <row>
22081 <entry><option>drop_cr</option></entry>
22082 <entry>Use: <emphasis>main</emphasis></entry>
22083 <entry>Type: <emphasis>boolean</emphasis></entry>
22084 <entry>Default: <emphasis>false</emphasis></entry>
22085 </row>
22086 </tbody>
22087 </tgroup>
22088 </informaltable>
22089 <para>
22090 This is an obsolete option that is now a no-op. It used to affect the way Exim
22091 handled CR and LF characters in incoming messages. What happens now is
22092 described in section <xref linkend="SECTlineendings"/>.
22093 </para>
22094 <para>
22095 <indexterm role="option">
22096 <primary><option>dsn_from</option></primary>
22097 </indexterm>
22098 </para>
22099 <informaltable frame="all">
22100 <tgroup cols="4" colsep="0" rowsep="0">
22101 <colspec colwidth="8*" align="left"/>
22102 <colspec colwidth="6*" align="center"/>
22103 <colspec colwidth="6*" align="center"/>
22104 <colspec colwidth="6*" align="right"/>
22105 <tbody>
22106 <row>
22107 <entry><option>dsn_from</option></entry>
22108 <entry>Use: <emphasis>main</emphasis></entry>
22109 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22110 <entry>Default: <emphasis>see below</emphasis></entry>
22111 </row>
22112 </tbody>
22113 </tgroup>
22114 </informaltable>
22115 <para>
22116 <indexterm role="concept">
22117 <primary><emphasis>From:</emphasis> header line</primary>
22118 <secondary>in bounces</secondary>
22119 </indexterm>
22120 <indexterm role="concept">
22121 <primary>bounce messages</primary>
22122 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22123 </indexterm>
22124 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22125 bounces and other automatically generated messages (<quote>Delivery Status
22126 Notifications</quote> &ndash; hence the name of the option). The default setting is:
22127 </para>
22128 <literallayout class="monospaced">
22129 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
22130 </literallayout>
22131 <para>
22132 The value is expanded every time it is needed. If the expansion fails, a
22133 panic is logged, and the default value is used.
22134 </para>
22135 <para>
22136 <indexterm role="option">
22137 <primary><option>envelope_to_remove</option></primary>
22138 </indexterm>
22139 </para>
22140 <informaltable frame="all">
22141 <tgroup cols="4" colsep="0" rowsep="0">
22142 <colspec colwidth="8*" align="left"/>
22143 <colspec colwidth="6*" align="center"/>
22144 <colspec colwidth="6*" align="center"/>
22145 <colspec colwidth="6*" align="right"/>
22146 <tbody>
22147 <row>
22148 <entry><option>envelope_to_remove</option></entry>
22149 <entry>Use: <emphasis>main</emphasis></entry>
22150 <entry>Type: <emphasis>boolean</emphasis></entry>
22151 <entry>Default: <emphasis>true</emphasis></entry>
22152 </row>
22153 </tbody>
22154 </tgroup>
22155 </informaltable>
22156 <para>
22157 <indexterm role="concept">
22158 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22159 </indexterm>
22160 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22161 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22162 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22163 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
22164 be present in incoming messages, and this option causes them to be removed at
22165 the time the message is received, to avoid any problems that might occur when a
22166 delivered message is subsequently sent on to some other recipient.
22167 </para>
22168 <para>
22169 <indexterm role="option">
22170 <primary><option>errors_copy</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>errors_copy</option></entry>
22182 <entry>Use: <emphasis>main</emphasis></entry>
22183 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22184 <entry>Default: <emphasis>unset</emphasis></entry>
22185 </row>
22186 </tbody>
22187 </tgroup>
22188 </informaltable>
22189 <para>
22190 <indexterm role="concept">
22191 <primary>bounce message</primary>
22192 <secondary>copy to other address</secondary>
22193 </indexterm>
22194 <indexterm role="concept">
22195 <primary>copy of bounce message</primary>
22196 </indexterm>
22197 Setting this option causes Exim to send bcc copies of bounce messages that it
22198 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22199 coming from elsewhere. The value of the option is a colon-separated list of
22200 items. Each item consists of a pattern, terminated by white space, followed by
22201 a comma-separated list of email addresses. If a pattern contains spaces, it
22202 must be enclosed in double quotes.
22203 </para>
22204 <para>
22205 Each pattern is processed in the same way as a single item in an address list
22206 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22207 the bounce message, the message is copied to the addresses on the list. The
22208 items are scanned in order, and once a matching one is found, no further items
22209 are examined. For example:
22210 </para>
22211 <literallayout class="monospaced">
22212 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
22213               rqps@mydomain   hostmaster@mydomain.example,\
22214                               postmaster@mydomain.example
22215 </literallayout>
22216 <para>
22217 <indexterm role="variable">
22218 <primary><varname>$domain</varname></primary>
22219 </indexterm>
22220 <indexterm role="variable">
22221 <primary><varname>$local_part</varname></primary>
22222 </indexterm>
22223 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22224 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22225 there was any wildcard matching in the pattern, the expansion
22226 <indexterm role="concept">
22227 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22228 <secondary>in <option>errors_copy</option></secondary>
22229 </indexterm>
22230 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22231 </para>
22232 <para>
22233 <indexterm role="option">
22234 <primary><option>errors_reply_to</option></primary>
22235 </indexterm>
22236 </para>
22237 <informaltable frame="all">
22238 <tgroup cols="4" colsep="0" rowsep="0">
22239 <colspec colwidth="8*" align="left"/>
22240 <colspec colwidth="6*" align="center"/>
22241 <colspec colwidth="6*" align="center"/>
22242 <colspec colwidth="6*" align="right"/>
22243 <tbody>
22244 <row>
22245 <entry><option>errors_reply_to</option></entry>
22246 <entry>Use: <emphasis>main</emphasis></entry>
22247 <entry>Type: <emphasis>string</emphasis></entry>
22248 <entry>Default: <emphasis>unset</emphasis></entry>
22249 </row>
22250 </tbody>
22251 </tgroup>
22252 </informaltable>
22253 <para>
22254 <indexterm role="concept">
22255 <primary>bounce message</primary>
22256 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22257 </indexterm>
22258 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
22259 </para>
22260 <literallayout>
22261 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
22262 </literallayout>
22263 <para>
22264 <indexterm role="option">
22265 <primary><option>quota_warn_message</option></primary>
22266 </indexterm>
22267 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22268 A warning message that is generated by the <option>quota_warn_message</option> option in an
22269 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22270 overrides the default.
22271 </para>
22272 <para>
22273 Experience shows that people reply to bounce messages. If the
22274 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22275 and warning messages. For example:
22276 </para>
22277 <literallayout class="monospaced">
22278 errors_reply_to = postmaster@my.domain.example
22279 </literallayout>
22280 <para>
22281 The value of the option is not expanded. It must specify a valid RFC 2822
22282 address. However, if a warning message that is generated by the
22283 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22284 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22285 not used.
22286 </para>
22287 <para>
22288 <indexterm role="option">
22289 <primary><option>exim_group</option></primary>
22290 </indexterm>
22291 </para>
22292 <informaltable frame="all">
22293 <tgroup cols="4" colsep="0" rowsep="0">
22294 <colspec colwidth="8*" align="left"/>
22295 <colspec colwidth="6*" align="center"/>
22296 <colspec colwidth="6*" align="center"/>
22297 <colspec colwidth="6*" align="right"/>
22298 <tbody>
22299 <row>
22300 <entry><option>exim_group</option></entry>
22301 <entry>Use: <emphasis>main</emphasis></entry>
22302 <entry>Type: <emphasis>string</emphasis></entry>
22303 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22304 </row>
22305 </tbody>
22306 </tgroup>
22307 </informaltable>
22308 <para>
22309 <indexterm role="concept">
22310 <primary>gid (group id)</primary>
22311 <secondary>Exim&#x2019;s own</secondary>
22312 </indexterm>
22313 <indexterm role="concept">
22314 <primary>Exim group</primary>
22315 </indexterm>
22316 This option changes the gid under which Exim runs when it gives up root
22317 privilege. The default value is compiled into the binary. The value of this
22318 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22319 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22320 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22321 security issues.
22322 </para>
22323 <para>
22324 <indexterm role="option">
22325 <primary><option>exim_path</option></primary>
22326 </indexterm>
22327 </para>
22328 <informaltable frame="all">
22329 <tgroup cols="4" colsep="0" rowsep="0">
22330 <colspec colwidth="8*" align="left"/>
22331 <colspec colwidth="6*" align="center"/>
22332 <colspec colwidth="6*" align="center"/>
22333 <colspec colwidth="6*" align="right"/>
22334 <tbody>
22335 <row>
22336 <entry><option>exim_path</option></entry>
22337 <entry>Use: <emphasis>main</emphasis></entry>
22338 <entry>Type: <emphasis>string</emphasis></entry>
22339 <entry>Default: <emphasis>see below</emphasis></entry>
22340 </row>
22341 </tbody>
22342 </tgroup>
22343 </informaltable>
22344 <para>
22345 <indexterm role="concept">
22346 <primary>Exim binary, path name</primary>
22347 </indexterm>
22348 This option specifies the path name of the Exim binary, which is used when Exim
22349 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22350 the directory configured at compile time by the BIN_DIRECTORY setting. It
22351 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22352 other place.
22353 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22354 you will break those Exim utilities that scan the configuration file to find
22355 where the binary is. (They then use the <option>-bP</option> option to extract option
22356 settings such as the value of <option>spool_directory</option>.)
22357 </para>
22358 <para>
22359 <indexterm role="option">
22360 <primary><option>exim_user</option></primary>
22361 </indexterm>
22362 </para>
22363 <informaltable frame="all">
22364 <tgroup cols="4" colsep="0" rowsep="0">
22365 <colspec colwidth="8*" align="left"/>
22366 <colspec colwidth="6*" align="center"/>
22367 <colspec colwidth="6*" align="center"/>
22368 <colspec colwidth="6*" align="right"/>
22369 <tbody>
22370 <row>
22371 <entry><option>exim_user</option></entry>
22372 <entry>Use: <emphasis>main</emphasis></entry>
22373 <entry>Type: <emphasis>string</emphasis></entry>
22374 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22375 </row>
22376 </tbody>
22377 </tgroup>
22378 </informaltable>
22379 <para>
22380 <indexterm role="concept">
22381 <primary>uid (user id)</primary>
22382 <secondary>Exim&#x2019;s own</secondary>
22383 </indexterm>
22384 <indexterm role="concept">
22385 <primary>Exim user</primary>
22386 </indexterm>
22387 This option changes the uid under which Exim runs when it gives up root
22388 privilege. The default value is compiled into the binary. Ownership of the run
22389 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22390 options is checked against the values in the binary, not what is set here.
22391 </para>
22392 <para>
22393 Unless it consists entirely of digits, the string is looked up using
22394 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22395 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22396 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22397 </para>
22398 <para>
22399 <indexterm role="option">
22400 <primary><option>extra_local_interfaces</option></primary>
22401 </indexterm>
22402 </para>
22403 <informaltable frame="all">
22404 <tgroup cols="4" colsep="0" rowsep="0">
22405 <colspec colwidth="8*" align="left"/>
22406 <colspec colwidth="6*" align="center"/>
22407 <colspec colwidth="6*" align="center"/>
22408 <colspec colwidth="6*" align="right"/>
22409 <tbody>
22410 <row>
22411 <entry><option>extra_local_interfaces</option></entry>
22412 <entry>Use: <emphasis>main</emphasis></entry>
22413 <entry>Type: <emphasis>string list</emphasis></entry>
22414 <entry>Default: <emphasis>unset</emphasis></entry>
22415 </row>
22416 </tbody>
22417 </tgroup>
22418 </informaltable>
22419 <para>
22420 This option defines network interfaces that are to be considered local when
22421 routing, but which are not used for listening by the daemon. See section
22422 <xref linkend="SECTreclocipadd"/> for details.
22423 </para>
22424 <para>
22425 <indexterm role="option">
22426 <primary><option>extract_addresses_remove_arguments</option></primary>
22427 </indexterm>
22428 </para>
22429 <informaltable frame="all">
22430 <tgroup cols="4" colsep="0" rowsep="0">
22431 <colspec colwidth="8*" align="left"/>
22432 <colspec colwidth="6*" align="center"/>
22433 <colspec colwidth="6*" align="center"/>
22434 <colspec colwidth="6*" align="right"/>
22435 <tbody>
22436 <row>
22437 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
22438 <entry>Use: <emphasis>main</emphasis></entry>
22439 <entry>Type: <emphasis>boolean</emphasis></entry>
22440 <entry>Default: <emphasis>true</emphasis></entry>
22441 </row>
22442 </tbody>
22443 </tgroup>
22444 </informaltable>
22445 <para>
22446 <indexterm role="option">
22447 <primary><option>-t</option></primary>
22448 </indexterm>
22449 <indexterm role="concept">
22450 <primary>command line</primary>
22451 <secondary>addresses with <option>-t</option></secondary>
22452 </indexterm>
22453 <indexterm role="concept">
22454 <primary>Sendmail compatibility</primary>
22455 <secondary><option>-t</option> option</secondary>
22456 </indexterm>
22457 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22458 are present on the command line when the <option>-t</option> option is used to build an
22459 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22460 line addresses are removed from the recipients list. This is also how Smail
22461 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
22462 command line addresses are added to those obtained from the header lines. When
22463 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22464 argument headers. If it is set false, Exim adds rather than removes argument
22465 addresses.
22466 </para>
22467 <para>
22468 <indexterm role="option">
22469 <primary><option>finduser_retries</option></primary>
22470 </indexterm>
22471 </para>
22472 <informaltable frame="all">
22473 <tgroup cols="4" colsep="0" rowsep="0">
22474 <colspec colwidth="8*" align="left"/>
22475 <colspec colwidth="6*" align="center"/>
22476 <colspec colwidth="6*" align="center"/>
22477 <colspec colwidth="6*" align="right"/>
22478 <tbody>
22479 <row>
22480 <entry><option>finduser_retries</option></entry>
22481 <entry>Use: <emphasis>main</emphasis></entry>
22482 <entry>Type: <emphasis>integer</emphasis></entry>
22483 <entry>Default: <emphasis>0</emphasis></entry>
22484 </row>
22485 </tbody>
22486 </tgroup>
22487 </informaltable>
22488 <para>
22489 <indexterm role="concept">
22490 <primary>NIS, retrying user lookups</primary>
22491 </indexterm>
22492 On systems running NIS or other schemes in which user and group information is
22493 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22494 related functions fail, even when given valid data, because things time out.
22495 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22496 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22497 many extra times to find a user or a group, waiting for one second between
22498 retries.
22499 </para>
22500 <para>
22501 <indexterm role="concept">
22502 <primary><filename>/etc/passwd</filename></primary>
22503 <secondary>multiple reading of</secondary>
22504 </indexterm>
22505 You should not set this option greater than zero if your user information is in
22506 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22507 search the file multiple times for non-existent users, and also cause delay.
22508 </para>
22509 <para>
22510 <indexterm role="option">
22511 <primary><option>freeze_tell</option></primary>
22512 </indexterm>
22513 </para>
22514 <informaltable frame="all">
22515 <tgroup cols="4" colsep="0" rowsep="0">
22516 <colspec colwidth="8*" align="left"/>
22517 <colspec colwidth="6*" align="center"/>
22518 <colspec colwidth="6*" align="center"/>
22519 <colspec colwidth="6*" align="right"/>
22520 <tbody>
22521 <row>
22522 <entry><option>freeze_tell</option></entry>
22523 <entry>Use: <emphasis>main</emphasis></entry>
22524 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22525 <entry>Default: <emphasis>unset</emphasis></entry>
22526 </row>
22527 </tbody>
22528 </tgroup>
22529 </informaltable>
22530 <para>
22531 <indexterm role="concept">
22532 <primary>freezing messages</primary>
22533 <secondary>sending a message when freezing</secondary>
22534 </indexterm>
22535 On encountering certain errors, or when configured to do so in a system filter,
22536 ACL, or special router, Exim freezes a message. This means that no further
22537 delivery attempts take place until an administrator thaws the message, or the
22538 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22539 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22540 warning message whenever it freezes something, unless the message it is
22541 freezing is a locally-generated bounce message. (Without this exception there
22542 is the possibility of looping.) The warning message is sent to the addresses
22543 supplied as the comma-separated value of this option. If several of the
22544 message&#x2019;s addresses cause freezing, only a single message is sent. If the
22545 freezing was automatic, the reason(s) for freezing can be found in the message
22546 log. If you configure freezing in a filter or ACL, you must arrange for any
22547 logging that you require.
22548 </para>
22549 <para>
22550 <indexterm role="option">
22551 <primary><option>gecos_name</option></primary>
22552 </indexterm>
22553 </para>
22554 <informaltable frame="all">
22555 <tgroup cols="4" colsep="0" rowsep="0">
22556 <colspec colwidth="8*" align="left"/>
22557 <colspec colwidth="6*" align="center"/>
22558 <colspec colwidth="6*" align="center"/>
22559 <colspec colwidth="6*" align="right"/>
22560 <tbody>
22561 <row>
22562 <entry><option>gecos_name</option></entry>
22563 <entry>Use: <emphasis>main</emphasis></entry>
22564 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22565 <entry>Default: <emphasis>unset</emphasis></entry>
22566 </row>
22567 </tbody>
22568 </tgroup>
22569 </informaltable>
22570 <para>
22571 <indexterm role="concept">
22572 <primary>HP-UX</primary>
22573 </indexterm>
22574 <indexterm role="concept">
22575 <primary><quote>gecos</quote> field, parsing</primary>
22576 </indexterm>
22577 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22578 password file to hold other information in addition to users&#x2019; real names. Exim
22579 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22580 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22581 of the field are used unchanged, except that, if an ampersand is encountered,
22582 it is replaced by the user&#x2019;s login name with the first character forced to
22583 upper case, since this is a convention that is observed on many systems.
22584 </para>
22585 <para>
22586 When these options are set, <option>gecos_pattern</option> is treated as a regular
22587 expression that is to be applied to the field (again with &amp; replaced by the
22588 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22589 user&#x2019;s name.
22590 </para>
22591 <para>
22592 <indexterm role="concept">
22593 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22594 <secondary>in <option>gecos_name</option></secondary>
22595 </indexterm>
22596 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22597 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
22598 name terminates at the first comma, the following can be used:
22599 </para>
22600 <literallayout class="monospaced">
22601 gecos_pattern = ([^,]*)
22602 gecos_name = $1
22603 </literallayout>
22604 <para>
22605 <indexterm role="option">
22606 <primary><option>gecos_pattern</option></primary>
22607 </indexterm>
22608 </para>
22609 <informaltable frame="all">
22610 <tgroup cols="4" colsep="0" rowsep="0">
22611 <colspec colwidth="8*" align="left"/>
22612 <colspec colwidth="6*" align="center"/>
22613 <colspec colwidth="6*" align="center"/>
22614 <colspec colwidth="6*" align="right"/>
22615 <tbody>
22616 <row>
22617 <entry><option>gecos_pattern</option></entry>
22618 <entry>Use: <emphasis>main</emphasis></entry>
22619 <entry>Type: <emphasis>string</emphasis></entry>
22620 <entry>Default: <emphasis>unset</emphasis></entry>
22621 </row>
22622 </tbody>
22623 </tgroup>
22624 </informaltable>
22625 <para>
22626 See <option>gecos_name</option> above.
22627 </para>
22628 <para>
22629 <indexterm role="option">
22630 <primary><option>gnutls_require_kx</option></primary>
22631 </indexterm>
22632 </para>
22633 <informaltable frame="all">
22634 <tgroup cols="4" colsep="0" rowsep="0">
22635 <colspec colwidth="8*" align="left"/>
22636 <colspec colwidth="6*" align="center"/>
22637 <colspec colwidth="6*" align="center"/>
22638 <colspec colwidth="6*" align="right"/>
22639 <tbody>
22640 <row>
22641 <entry><option>gnutls_require_kx</option></entry>
22642 <entry>Use: <emphasis>main</emphasis></entry>
22643 <entry>Type: <emphasis>string</emphasis></entry>
22644 <entry>Default: <emphasis>unset</emphasis></entry>
22645 </row>
22646 </tbody>
22647 </tgroup>
22648 </informaltable>
22649 <para>
22650 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22651 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22652 </para>
22653 <para>
22654 <indexterm role="option">
22655 <primary><option>gnutls_require_mac</option></primary>
22656 </indexterm>
22657 </para>
22658 <informaltable frame="all">
22659 <tgroup cols="4" colsep="0" rowsep="0">
22660 <colspec colwidth="8*" align="left"/>
22661 <colspec colwidth="6*" align="center"/>
22662 <colspec colwidth="6*" align="center"/>
22663 <colspec colwidth="6*" align="right"/>
22664 <tbody>
22665 <row>
22666 <entry><option>gnutls_require_mac</option></entry>
22667 <entry>Use: <emphasis>main</emphasis></entry>
22668 <entry>Type: <emphasis>string</emphasis></entry>
22669 <entry>Default: <emphasis>unset</emphasis></entry>
22670 </row>
22671 </tbody>
22672 </tgroup>
22673 </informaltable>
22674 <para>
22675 This option controls the MAC algorithms when GnuTLS is used in an Exim
22676 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22677 </para>
22678 <para>
22679 <indexterm role="option">
22680 <primary><option>gnutls_require_protocols</option></primary>
22681 </indexterm>
22682 </para>
22683 <informaltable frame="all">
22684 <tgroup cols="4" colsep="0" rowsep="0">
22685 <colspec colwidth="8*" align="left"/>
22686 <colspec colwidth="6*" align="center"/>
22687 <colspec colwidth="6*" align="center"/>
22688 <colspec colwidth="6*" align="right"/>
22689 <tbody>
22690 <row>
22691 <entry><option>gnutls_require_protocols</option></entry>
22692 <entry>Use: <emphasis>main</emphasis></entry>
22693 <entry>Type: <emphasis>string</emphasis></entry>
22694 <entry>Default: <emphasis>unset</emphasis></entry>
22695 </row>
22696 </tbody>
22697 </tgroup>
22698 </informaltable>
22699 <para>
22700 This option controls the protocols when GnuTLS is used in an Exim
22701 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22702 </para>
22703 <para>
22704 <indexterm role="option">
22705 <primary><option>headers_charset</option></primary>
22706 </indexterm>
22707 </para>
22708 <informaltable frame="all">
22709 <tgroup cols="4" colsep="0" rowsep="0">
22710 <colspec colwidth="8*" align="left"/>
22711 <colspec colwidth="6*" align="center"/>
22712 <colspec colwidth="6*" align="center"/>
22713 <colspec colwidth="6*" align="right"/>
22714 <tbody>
22715 <row>
22716 <entry><option>headers_charset</option></entry>
22717 <entry>Use: <emphasis>main</emphasis></entry>
22718 <entry>Type: <emphasis>string</emphasis></entry>
22719 <entry>Default: <emphasis>see below</emphasis></entry>
22720 </row>
22721 </tbody>
22722 </tgroup>
22723 </informaltable>
22724 <para>
22725 This option sets a default character set for translating from encoded MIME
22726 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22727 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22728 ultimate default is ISO-8859-1. For more details see the description of header
22729 insertions in section <xref linkend="SECTexpansionitems"/>.
22730 </para>
22731 <para>
22732 <indexterm role="option">
22733 <primary><option>header_maxsize</option></primary>
22734 </indexterm>
22735 </para>
22736 <informaltable frame="all">
22737 <tgroup cols="4" colsep="0" rowsep="0">
22738 <colspec colwidth="8*" align="left"/>
22739 <colspec colwidth="6*" align="center"/>
22740 <colspec colwidth="6*" align="center"/>
22741 <colspec colwidth="6*" align="right"/>
22742 <tbody>
22743 <row>
22744 <entry><option>header_maxsize</option></entry>
22745 <entry>Use: <emphasis>main</emphasis></entry>
22746 <entry>Type: <emphasis>integer</emphasis></entry>
22747 <entry>Default: <emphasis>see below</emphasis></entry>
22748 </row>
22749 </tbody>
22750 </tgroup>
22751 </informaltable>
22752 <para>
22753 <indexterm role="concept">
22754 <primary>header section</primary>
22755 <secondary>maximum size of</secondary>
22756 </indexterm>
22757 <indexterm role="concept">
22758 <primary>limit</primary>
22759 <secondary>size of message header section</secondary>
22760 </indexterm>
22761 This option controls the overall maximum size of a message&#x2019;s header
22762 section. The default is the value of HEADER_MAXSIZE in
22763 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
22764 sections are rejected.
22765 </para>
22766 <para>
22767 <indexterm role="option">
22768 <primary><option>header_line_maxsize</option></primary>
22769 </indexterm>
22770 </para>
22771 <informaltable frame="all">
22772 <tgroup cols="4" colsep="0" rowsep="0">
22773 <colspec colwidth="8*" align="left"/>
22774 <colspec colwidth="6*" align="center"/>
22775 <colspec colwidth="6*" align="center"/>
22776 <colspec colwidth="6*" align="right"/>
22777 <tbody>
22778 <row>
22779 <entry><option>header_line_maxsize</option></entry>
22780 <entry>Use: <emphasis>main</emphasis></entry>
22781 <entry>Type: <emphasis>integer</emphasis></entry>
22782 <entry>Default: <emphasis>0</emphasis></entry>
22783 </row>
22784 </tbody>
22785 </tgroup>
22786 </informaltable>
22787 <para>
22788 <indexterm role="concept">
22789 <primary>header lines</primary>
22790 <secondary>maximum size of</secondary>
22791 </indexterm>
22792 <indexterm role="concept">
22793 <primary>limit</primary>
22794 <secondary>size of one header line</secondary>
22795 </indexterm>
22796 This option limits the length of any individual header line in a message, after
22797 all the continuations have been joined together. Messages with individual
22798 header lines that are longer than the limit are rejected. The default value of
22799 zero means <quote>no limit</quote>.
22800 </para>
22801 <para>
22802 <indexterm role="option">
22803 <primary><option>helo_accept_junk_hosts</option></primary>
22804 </indexterm>
22805 </para>
22806 <informaltable frame="all">
22807 <tgroup cols="4" colsep="0" rowsep="0">
22808 <colspec colwidth="8*" align="left"/>
22809 <colspec colwidth="6*" align="center"/>
22810 <colspec colwidth="6*" align="center"/>
22811 <colspec colwidth="6*" align="right"/>
22812 <tbody>
22813 <row>
22814 <entry><option>helo_accept_junk_hosts</option></entry>
22815 <entry>Use: <emphasis>main</emphasis></entry>
22816 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22817 <entry>Default: <emphasis>unset</emphasis></entry>
22818 </row>
22819 </tbody>
22820 </tgroup>
22821 </informaltable>
22822 <para>
22823 <indexterm role="concept">
22824 <primary>HELO</primary>
22825 <secondary>accepting junk data</secondary>
22826 </indexterm>
22827 <indexterm role="concept">
22828 <primary>EHLO</primary>
22829 <secondary>accepting junk data</secondary>
22830 </indexterm>
22831 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
22832 mail, and gives an error response for invalid data. Unfortunately, there are
22833 some SMTP clients that send syntactic junk. They can be accommodated by setting
22834 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
22835 if you want to do semantic checking.
22836 See also <option>helo_allow_chars</option> for a way of extending the permitted character
22837 set.
22838 </para>
22839 <para>
22840 <indexterm role="option">
22841 <primary><option>helo_allow_chars</option></primary>
22842 </indexterm>
22843 </para>
22844 <informaltable frame="all">
22845 <tgroup cols="4" colsep="0" rowsep="0">
22846 <colspec colwidth="8*" align="left"/>
22847 <colspec colwidth="6*" align="center"/>
22848 <colspec colwidth="6*" align="center"/>
22849 <colspec colwidth="6*" align="right"/>
22850 <tbody>
22851 <row>
22852 <entry><option>helo_allow_chars</option></entry>
22853 <entry>Use: <emphasis>main</emphasis></entry>
22854 <entry>Type: <emphasis>string</emphasis></entry>
22855 <entry>Default: <emphasis>unset</emphasis></entry>
22856 </row>
22857 </tbody>
22858 </tgroup>
22859 </informaltable>
22860 <para>
22861 <indexterm role="concept">
22862 <primary>HELO</primary>
22863 <secondary>underscores in</secondary>
22864 </indexterm>
22865 <indexterm role="concept">
22866 <primary>EHLO</primary>
22867 <secondary>underscores in</secondary>
22868 </indexterm>
22869 <indexterm role="concept">
22870 <primary>underscore in EHLO/HELO</primary>
22871 </indexterm>
22872 This option can be set to a string of rogue characters that are permitted in
22873 all EHLO and HELO names in addition to the standard letters, digits,
22874 hyphens, and dots. If you really must allow underscores, you can set
22875 </para>
22876 <literallayout class="monospaced">
22877 helo_allow_chars = _
22878 </literallayout>
22879 <para>
22880 Note that the value is one string, not a list.
22881 </para>
22882 <para>
22883 <indexterm role="option">
22884 <primary><option>helo_lookup_domains</option></primary>
22885 </indexterm>
22886 </para>
22887 <informaltable frame="all">
22888 <tgroup cols="4" colsep="0" rowsep="0">
22889 <colspec colwidth="8*" align="left"/>
22890 <colspec colwidth="6*" align="center"/>
22891 <colspec colwidth="6*" align="center"/>
22892 <colspec colwidth="6*" align="right"/>
22893 <tbody>
22894 <row>
22895 <entry><option>helo_lookup_domains</option></entry>
22896 <entry>Use: <emphasis>main</emphasis></entry>
22897 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22898 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22899 </row>
22900 </tbody>
22901 </tgroup>
22902 </informaltable>
22903 <para>
22904 <indexterm role="concept">
22905 <primary>HELO</primary>
22906 <secondary>forcing reverse lookup</secondary>
22907 </indexterm>
22908 <indexterm role="concept">
22909 <primary>EHLO</primary>
22910 <secondary>forcing reverse lookup</secondary>
22911 </indexterm>
22912 If the domain given by a client in a HELO or EHLO command matches this
22913 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
22914 default forces a lookup if the client host gives the server&#x2019;s name or any of
22915 its IP addresses (in brackets), something that broken clients have been seen to
22916 do.
22917 </para>
22918 <para>
22919 <indexterm role="option">
22920 <primary><option>helo_try_verify_hosts</option></primary>
22921 </indexterm>
22922 </para>
22923 <informaltable frame="all">
22924 <tgroup cols="4" colsep="0" rowsep="0">
22925 <colspec colwidth="8*" align="left"/>
22926 <colspec colwidth="6*" align="center"/>
22927 <colspec colwidth="6*" align="center"/>
22928 <colspec colwidth="6*" align="right"/>
22929 <tbody>
22930 <row>
22931 <entry><option>helo_try_verify_hosts</option></entry>
22932 <entry>Use: <emphasis>main</emphasis></entry>
22933 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22934 <entry>Default: <emphasis>unset</emphasis></entry>
22935 </row>
22936 </tbody>
22937 </tgroup>
22938 </informaltable>
22939 <para>
22940 <indexterm role="concept">
22941 <primary>HELO verifying</primary>
22942 <secondary>optional</secondary>
22943 </indexterm>
22944 <indexterm role="concept">
22945 <primary>EHLO</primary>
22946 <secondary>verifying, optional</secondary>
22947 </indexterm>
22948 By default, Exim just checks the syntax of HELO and EHLO commands (see
22949 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
22950 to do more extensive checking of the data supplied by these commands. The ACL
22951 condition <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is provided to make this possible.
22952 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
22953 to force the check to occur. From release 4.53 onwards, this is no longer
22954 necessary. If the check has not been done before <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is
22955 encountered, it is done at that time. Consequently, this option is obsolete.
22956 Its specification is retained here for backwards compatibility.
22957 </para>
22958 <para>
22959 When an EHLO or HELO command is received, if the calling host matches
22960 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
22961 EHLO command either:
22962 </para>
22963 <itemizedlist>
22964 <listitem>
22965 <para>
22966 is an IP literal matching the calling address of the host, or
22967 </para>
22968 </listitem>
22969 <listitem>
22970 <para>
22971 <indexterm role="concept">
22972 <primary>DNS</primary>
22973 <secondary>reverse lookup</secondary>
22974 </indexterm>
22975 <indexterm role="concept">
22976 <primary>reverse DNS lookup</primary>
22977 </indexterm>
22978 matches the host name that Exim obtains by doing a reverse lookup of the
22979 calling host address, or
22980 </para>
22981 </listitem>
22982 <listitem>
22983 <para>
22984 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
22985 available) yields the calling host address.
22986 </para>
22987 </listitem>
22988 </itemizedlist>
22989 <para>
22990 However, the EHLO or HELO command is not rejected if any of the checks
22991 fail. Processing continues, but the result of the check is remembered, and can
22992 be detected later in an ACL by the <literal>verify</literal> <literal>=</literal> <literal>helo</literal> condition.
22993 </para>
22994 <para>
22995 <indexterm role="option">
22996 <primary><option>helo_verify_hosts</option></primary>
22997 </indexterm>
22998 </para>
22999 <informaltable frame="all">
23000 <tgroup cols="4" colsep="0" rowsep="0">
23001 <colspec colwidth="8*" align="left"/>
23002 <colspec colwidth="6*" align="center"/>
23003 <colspec colwidth="6*" align="center"/>
23004 <colspec colwidth="6*" align="right"/>
23005 <tbody>
23006 <row>
23007 <entry><option>helo_verify_hosts</option></entry>
23008 <entry>Use: <emphasis>main</emphasis></entry>
23009 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23010 <entry>Default: <emphasis>unset</emphasis></entry>
23011 </row>
23012 </tbody>
23013 </tgroup>
23014 </informaltable>
23015 <para>
23016 <indexterm role="concept">
23017 <primary>HELO verifying</primary>
23018 <secondary>mandatory</secondary>
23019 </indexterm>
23020 <indexterm role="concept">
23021 <primary>EHLO</primary>
23022 <secondary>verifying, mandatory</secondary>
23023 </indexterm>
23024 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23025 backwards compatibility. For hosts that match this option, Exim checks the host
23026 name given in the HELO or EHLO in the same way as for
23027 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23028 rejected with a 550 error, and entries are written to the main and reject logs.
23029 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23030 error.
23031 </para>
23032 <para>
23033 <indexterm role="option">
23034 <primary><option>hold_domains</option></primary>
23035 </indexterm>
23036 </para>
23037 <informaltable frame="all">
23038 <tgroup cols="4" colsep="0" rowsep="0">
23039 <colspec colwidth="8*" align="left"/>
23040 <colspec colwidth="6*" align="center"/>
23041 <colspec colwidth="6*" align="center"/>
23042 <colspec colwidth="6*" align="right"/>
23043 <tbody>
23044 <row>
23045 <entry><option>hold_domains</option></entry>
23046 <entry>Use: <emphasis>main</emphasis></entry>
23047 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23048 <entry>Default: <emphasis>unset</emphasis></entry>
23049 </row>
23050 </tbody>
23051 </tgroup>
23052 </informaltable>
23053 <para>
23054 <indexterm role="concept">
23055 <primary>domain</primary>
23056 <secondary>delaying delivery</secondary>
23057 </indexterm>
23058 <indexterm role="concept">
23059 <primary>delivery</primary>
23060 <secondary>delaying certain domains</secondary>
23061 </indexterm>
23062 This option allows mail for particular domains to be held on the queue
23063 manually. The option is overridden if a message delivery is forced with the
23064 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23065 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23066 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23067 it is deferred every time the message is looked at.
23068 </para>
23069 <para>
23070 This option is intended as a temporary operational measure for delaying the
23071 delivery of mail while some problem is being sorted out, or some new
23072 configuration tested. If you just want to delay the processing of some
23073 domains until a queue run occurs, you should use <option>queue_domains</option> or
23074 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23075 </para>
23076 <para>
23077 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
23078 messages from the queue if they have been there longer than the longest retry
23079 time in any retry rule. If you want to hold messages for longer than the normal
23080 retry times, insert a dummy retry rule with a long retry time.
23081 </para>
23082 <para>
23083 <indexterm role="option">
23084 <primary><option>host_lookup</option></primary>
23085 </indexterm>
23086 </para>
23087 <informaltable frame="all">
23088 <tgroup cols="4" colsep="0" rowsep="0">
23089 <colspec colwidth="8*" align="left"/>
23090 <colspec colwidth="6*" align="center"/>
23091 <colspec colwidth="6*" align="center"/>
23092 <colspec colwidth="6*" align="right"/>
23093 <tbody>
23094 <row>
23095 <entry><option>host_lookup</option></entry>
23096 <entry>Use: <emphasis>main</emphasis></entry>
23097 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23098 <entry>Default: <emphasis>unset</emphasis></entry>
23099 </row>
23100 </tbody>
23101 </tgroup>
23102 </informaltable>
23103 <para>
23104 <indexterm role="concept">
23105 <primary>host name</primary>
23106 <secondary>lookup, forcing</secondary>
23107 </indexterm>
23108 Exim does not look up the name of a calling host from its IP address unless it
23109 is required to compare against some host list, or the host matches
23110 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23111 option (which normally contains IP addresses rather than host names). The
23112 default configuration file contains
23113 </para>
23114 <literallayout class="monospaced">
23115 host_lookup = *
23116 </literallayout>
23117 <para>
23118 which causes a lookup to happen for all hosts. If the expense of these lookups
23119 is felt to be too great, the setting can be changed or removed.
23120 </para>
23121 <para>
23122 After a successful reverse lookup, Exim does a forward lookup on the name it
23123 has obtained, to verify that it yields the IP address that it started with. If
23124 this check fails, Exim behaves as if the name lookup failed.
23125 </para>
23126 <para>
23127 <indexterm role="variable">
23128 <primary><varname>$host_lookup_failed</varname></primary>
23129 </indexterm>
23130 <indexterm role="variable">
23131 <primary><varname>$sender_host_name</varname></primary>
23132 </indexterm>
23133 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23134 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23135 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and <literal>verify</literal> <literal>=</literal>
23136 <literal>reverse_host_lookup</literal> in ACLs.
23137 </para>
23138 <para>
23139 <indexterm role="option">
23140 <primary><option>host_lookup_order</option></primary>
23141 </indexterm>
23142 </para>
23143 <informaltable frame="all">
23144 <tgroup cols="4" colsep="0" rowsep="0">
23145 <colspec colwidth="8*" align="left"/>
23146 <colspec colwidth="6*" align="center"/>
23147 <colspec colwidth="6*" align="center"/>
23148 <colspec colwidth="6*" align="right"/>
23149 <tbody>
23150 <row>
23151 <entry><option>host_lookup_order</option></entry>
23152 <entry>Use: <emphasis>main</emphasis></entry>
23153 <entry>Type: <emphasis>string list</emphasis></entry>
23154 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23155 </row>
23156 </tbody>
23157 </tgroup>
23158 </informaltable>
23159 <para>
23160 This option specifies the order of different lookup methods when Exim is trying
23161 to find a host name from an IP address. The default is to do a DNS lookup
23162 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23163 if that fails. You can change the order of these lookups, or omit one entirely,
23164 if you want.
23165 </para>
23166 <para>
23167 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23168 multiple PTR records in the DNS and the IP address is not listed in
23169 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23170 case. That is why the default tries a DNS lookup first.
23171 </para>
23172 <para>
23173 <indexterm role="option">
23174 <primary><option>host_reject_connection</option></primary>
23175 </indexterm>
23176 </para>
23177 <informaltable frame="all">
23178 <tgroup cols="4" colsep="0" rowsep="0">
23179 <colspec colwidth="8*" align="left"/>
23180 <colspec colwidth="6*" align="center"/>
23181 <colspec colwidth="6*" align="center"/>
23182 <colspec colwidth="6*" align="right"/>
23183 <tbody>
23184 <row>
23185 <entry><option>host_reject_connection</option></entry>
23186 <entry>Use: <emphasis>main</emphasis></entry>
23187 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23188 <entry>Default: <emphasis>unset</emphasis></entry>
23189 </row>
23190 </tbody>
23191 </tgroup>
23192 </informaltable>
23193 <para>
23194 <indexterm role="concept">
23195 <primary>host</primary>
23196 <secondary>rejecting connections from</secondary>
23197 </indexterm>
23198 If this option is set, incoming SMTP calls from the hosts listed are rejected
23199 as soon as the connection is made.
23200 This option is obsolete, and retained only for backward compatibility, because
23201 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23202 connections immediately.
23203 </para>
23204 <para>
23205 The ability to give an immediate rejection (either by this option or using an
23206 ACL) is provided for use in unusual cases. Many hosts will just try again,
23207 sometimes without much delay. Normally, it is better to use an ACL to reject
23208 incoming messages at a later stage, such as after RCPT commands. See
23209 chapter <xref linkend="CHAPACL"/>.
23210 </para>
23211 <para>
23212 <indexterm role="option">
23213 <primary><option>hosts_connection_nolog</option></primary>
23214 </indexterm>
23215 </para>
23216 <informaltable frame="all">
23217 <tgroup cols="4" colsep="0" rowsep="0">
23218 <colspec colwidth="8*" align="left"/>
23219 <colspec colwidth="6*" align="center"/>
23220 <colspec colwidth="6*" align="center"/>
23221 <colspec colwidth="6*" align="right"/>
23222 <tbody>
23223 <row>
23224 <entry><option>hosts_connection_nolog</option></entry>
23225 <entry>Use: <emphasis>main</emphasis></entry>
23226 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23227 <entry>Default: <emphasis>unset</emphasis></entry>
23228 </row>
23229 </tbody>
23230 </tgroup>
23231 </informaltable>
23232 <para>
23233 <indexterm role="concept">
23234 <primary>host</primary>
23235 <secondary>not logging connections from</secondary>
23236 </indexterm>
23237 This option defines a list of hosts for which connection logging does not
23238 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23239 you might want not to log SMTP connections from local processes, or from
23240 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23241 the daemon; you should therefore strive to restrict its value to a short inline
23242 list of IP addresses and networks. To disable logging SMTP connections from
23243 local processes, you must create a host list with an empty item. For example:
23244 </para>
23245 <literallayout class="monospaced">
23246 hosts_connection_nolog = :
23247 </literallayout>
23248 <para>
23249 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23250 </para>
23251 <para>
23252 <indexterm role="option">
23253 <primary><option>hosts_treat_as_local</option></primary>
23254 </indexterm>
23255 </para>
23256 <informaltable frame="all">
23257 <tgroup cols="4" colsep="0" rowsep="0">
23258 <colspec colwidth="8*" align="left"/>
23259 <colspec colwidth="6*" align="center"/>
23260 <colspec colwidth="6*" align="center"/>
23261 <colspec colwidth="6*" align="right"/>
23262 <tbody>
23263 <row>
23264 <entry><option>hosts_treat_as_local</option></entry>
23265 <entry>Use: <emphasis>main</emphasis></entry>
23266 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23267 <entry>Default: <emphasis>unset</emphasis></entry>
23268 </row>
23269 </tbody>
23270 </tgroup>
23271 </informaltable>
23272 <para>
23273 <indexterm role="concept">
23274 <primary>local host</primary>
23275 <secondary>domains treated as</secondary>
23276 </indexterm>
23277 <indexterm role="concept">
23278 <primary>host</primary>
23279 <secondary>treated as local</secondary>
23280 </indexterm>
23281 If this option is set, any host names that match the domain list are treated as
23282 if they were the local host when Exim is scanning host lists obtained from MX
23283 records
23284 or other sources. Note that the value of this option is a domain list, not a
23285 host list, because it is always used to check host names, not IP addresses.
23286 </para>
23287 <para>
23288 This option also applies when Exim is matching the special items
23289 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23290 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23291 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23292 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23293 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23294 interfaces and recognizing the local host.
23295 </para>
23296 <para revisionflag="changed">
23297 <indexterm role="option">
23298 <primary><option>ibase_servers</option></primary>
23299 </indexterm>
23300 </para>
23301 <informaltable frame="all" revisionflag="changed">
23302 <tgroup cols="4" colsep="0" rowsep="0">
23303 <colspec colwidth="8*" align="left"/>
23304 <colspec colwidth="6*" align="center"/>
23305 <colspec colwidth="6*" align="center"/>
23306 <colspec colwidth="6*" align="right"/>
23307 <tbody>
23308 <row>
23309 <entry><option>ibase_servers</option></entry>
23310 <entry>Use: <emphasis>main</emphasis></entry>
23311 <entry>Type: <emphasis>string list</emphasis></entry>
23312 <entry>Default: <emphasis>unset</emphasis></entry>
23313 </row>
23314 </tbody>
23315 </tgroup>
23316 </informaltable>
23317 <para revisionflag="changed">
23318 <indexterm role="concept">
23319 <primary>InterBase</primary>
23320 <secondary>server list</secondary>
23321 </indexterm>
23322 This option provides a list of InterBase servers and associated connection data,
23323 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23324 The option is available only if Exim has been built with InterBase support.
23325 </para>
23326 <para>
23327 <indexterm role="option">
23328 <primary><option>ignore_bounce_errors_after</option></primary>
23329 </indexterm>
23330 </para>
23331 <informaltable frame="all">
23332 <tgroup cols="4" colsep="0" rowsep="0">
23333 <colspec colwidth="8*" align="left"/>
23334 <colspec colwidth="6*" align="center"/>
23335 <colspec colwidth="6*" align="center"/>
23336 <colspec colwidth="6*" align="right"/>
23337 <tbody>
23338 <row>
23339 <entry><option>ignore_bounce_errors_after</option></entry>
23340 <entry>Use: <emphasis>main</emphasis></entry>
23341 <entry>Type: <emphasis>time</emphasis></entry>
23342 <entry>Default: <emphasis>10w</emphasis></entry>
23343 </row>
23344 </tbody>
23345 </tgroup>
23346 </informaltable>
23347 <para>
23348 <indexterm role="concept">
23349 <primary>bounce message</primary>
23350 <secondary>discarding</secondary>
23351 </indexterm>
23352 <indexterm role="concept">
23353 <primary>discarding bounce message</primary>
23354 </indexterm>
23355 This option affects the processing of bounce messages that cannot be delivered,
23356 that is, those that suffer a permanent delivery failure. (Bounce messages that
23357 suffer temporary delivery failures are of course retried in the usual way.)
23358 </para>
23359 <para>
23360 After a permanent delivery failure, bounce messages are frozen,
23361 because there is no sender to whom they can be returned. When a frozen bounce
23362 message has been on the queue for more than the given time, it is unfrozen at
23363 the next queue run, and a further delivery is attempted. If delivery fails
23364 again, the bounce message is discarded. This makes it possible to keep failed
23365 bounce messages around for a shorter time than the normal maximum retry time
23366 for frozen messages. For example,
23367 </para>
23368 <literallayout class="monospaced">
23369 ignore_bounce_errors_after = 12h
23370 </literallayout>
23371 <para>
23372 retries failed bounce message deliveries after 12 hours, discarding any further
23373 failures. If the value of this option is set to a zero time period, bounce
23374 failures are discarded immediately. Setting a very long time (as in the default
23375 value) has the effect of disabling this option. For ways of automatically
23376 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23377 <option>timeout_frozen_after</option>.
23378 </para>
23379 <para>
23380 <indexterm role="option">
23381 <primary><option>ignore_fromline_hosts</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>ignore_fromline_hosts</option></entry>
23393 <entry>Use: <emphasis>main</emphasis></entry>
23394 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23395 <entry>Default: <emphasis>unset</emphasis></entry>
23396 </row>
23397 </tbody>
23398 </tgroup>
23399 </informaltable>
23400 <para>
23401 <indexterm role="concept">
23402 <primary><quote>From</quote> line</primary>
23403 </indexterm>
23404 <indexterm role="concept">
23405 <primary>UUCP</primary>
23406 <secondary><quote>From</quote> line</secondary>
23407 </indexterm>
23408 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
23409 the headers of a message. By default this is treated as the start of the
23410 message&#x2019;s body, which means that any following headers are not recognized as
23411 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23412 match those hosts that insist on sending it. If the sender is actually a local
23413 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23414 <option>ignore_fromline_local</option> must be set to achieve this effect.
23415 </para>
23416 <para>
23417 <indexterm role="option">
23418 <primary><option>ignore_fromline_local</option></primary>
23419 </indexterm>
23420 </para>
23421 <informaltable frame="all">
23422 <tgroup cols="4" colsep="0" rowsep="0">
23423 <colspec colwidth="8*" align="left"/>
23424 <colspec colwidth="6*" align="center"/>
23425 <colspec colwidth="6*" align="center"/>
23426 <colspec colwidth="6*" align="right"/>
23427 <tbody>
23428 <row>
23429 <entry><option>ignore_fromline_local</option></entry>
23430 <entry>Use: <emphasis>main</emphasis></entry>
23431 <entry>Type: <emphasis>boolean</emphasis></entry>
23432 <entry>Default: <emphasis>false</emphasis></entry>
23433 </row>
23434 </tbody>
23435 </tgroup>
23436 </informaltable>
23437 <para>
23438 See <option>ignore_fromline_hosts</option> above.
23439 </para>
23440 <para>
23441 <indexterm role="option">
23442 <primary><option>keep_malformed</option></primary>
23443 </indexterm>
23444 </para>
23445 <informaltable frame="all">
23446 <tgroup cols="4" colsep="0" rowsep="0">
23447 <colspec colwidth="8*" align="left"/>
23448 <colspec colwidth="6*" align="center"/>
23449 <colspec colwidth="6*" align="center"/>
23450 <colspec colwidth="6*" align="right"/>
23451 <tbody>
23452 <row>
23453 <entry><option>keep_malformed</option></entry>
23454 <entry>Use: <emphasis>main</emphasis></entry>
23455 <entry>Type: <emphasis>time</emphasis></entry>
23456 <entry>Default: <emphasis>4d</emphasis></entry>
23457 </row>
23458 </tbody>
23459 </tgroup>
23460 </informaltable>
23461 <para>
23462 This option specifies the length of time to keep messages whose spool files
23463 have been corrupted in some way. This should, of course, never happen. At the
23464 next attempt to deliver such a message, it gets removed. The incident is
23465 logged.
23466 </para>
23467 <para>
23468 <indexterm role="option">
23469 <primary><option>ldap_default_servers</option></primary>
23470 </indexterm>
23471 </para>
23472 <informaltable frame="all">
23473 <tgroup cols="4" colsep="0" rowsep="0">
23474 <colspec colwidth="8*" align="left"/>
23475 <colspec colwidth="6*" align="center"/>
23476 <colspec colwidth="6*" align="center"/>
23477 <colspec colwidth="6*" align="right"/>
23478 <tbody>
23479 <row>
23480 <entry><option>ldap_default_servers</option></entry>
23481 <entry>Use: <emphasis>main</emphasis></entry>
23482 <entry>Type: <emphasis>string list</emphasis></entry>
23483 <entry>Default: <emphasis>unset</emphasis></entry>
23484 </row>
23485 </tbody>
23486 </tgroup>
23487 </informaltable>
23488 <para>
23489 <indexterm role="concept">
23490 <primary>LDAP</primary>
23491 <secondary>default servers</secondary>
23492 </indexterm>
23493 This option provides a list of LDAP servers which are tried in turn when an
23494 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
23495 details of LDAP queries. This option is available only when Exim has been built
23496 with LDAP support.
23497 </para>
23498 <para>
23499 <indexterm role="option">
23500 <primary><option>ldap_version</option></primary>
23501 </indexterm>
23502 </para>
23503 <informaltable frame="all">
23504 <tgroup cols="4" colsep="0" rowsep="0">
23505 <colspec colwidth="8*" align="left"/>
23506 <colspec colwidth="6*" align="center"/>
23507 <colspec colwidth="6*" align="center"/>
23508 <colspec colwidth="6*" align="right"/>
23509 <tbody>
23510 <row>
23511 <entry><option>ldap_version</option></entry>
23512 <entry>Use: <emphasis>main</emphasis></entry>
23513 <entry>Type: <emphasis>integer</emphasis></entry>
23514 <entry>Default: <emphasis>unset</emphasis></entry>
23515 </row>
23516 </tbody>
23517 </tgroup>
23518 </informaltable>
23519 <para>
23520 <indexterm role="concept">
23521 <primary>LDAP</primary>
23522 <secondary>protocol version, forcing</secondary>
23523 </indexterm>
23524 This option can be used to force Exim to set a specific protocol version for
23525 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
23526 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
23527 the LDAP headers; otherwise it is 2. This option is available only when Exim
23528 has been built with LDAP support.
23529 </para>
23530 <para>
23531 <indexterm role="option">
23532 <primary><option>local_from_check</option></primary>
23533 </indexterm>
23534 </para>
23535 <informaltable frame="all">
23536 <tgroup cols="4" colsep="0" rowsep="0">
23537 <colspec colwidth="8*" align="left"/>
23538 <colspec colwidth="6*" align="center"/>
23539 <colspec colwidth="6*" align="center"/>
23540 <colspec colwidth="6*" align="right"/>
23541 <tbody>
23542 <row>
23543 <entry><option>local_from_check</option></entry>
23544 <entry>Use: <emphasis>main</emphasis></entry>
23545 <entry>Type: <emphasis>boolean</emphasis></entry>
23546 <entry>Default: <emphasis>true</emphasis></entry>
23547 </row>
23548 </tbody>
23549 </tgroup>
23550 </informaltable>
23551 <para>
23552 <indexterm role="concept">
23553 <primary><emphasis>Sender:</emphasis> header line</primary>
23554 <secondary>disabling addition of</secondary>
23555 </indexterm>
23556 <indexterm role="concept">
23557 <primary><emphasis>From:</emphasis> header line</primary>
23558 <secondary>disabling checking of</secondary>
23559 </indexterm>
23560 When a message is submitted locally (that is, not over a TCP/IP connection) by
23561 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
23562 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
23563 the domain specified by <option>qualify_domain</option>.
23564 </para>
23565 <para>
23566 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
23567 locally submitted message is automatically qualified by Exim, unless the
23568 <option>-bnq</option> command line option is used.
23569 </para>
23570 <para>
23571 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
23572 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
23573 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
23574 and the default qualify domain.
23575 </para>
23576 <para>
23577 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
23578 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
23579 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
23580 <option>local_sender_retain</option> to be true.
23581 </para>
23582 <para>
23583 <indexterm role="concept">
23584 <primary>envelope sender</primary>
23585 </indexterm>
23586 These options affect only the header lines in the message. The envelope sender
23587 is still forced to be the login id at the qualify domain unless
23588 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
23589 </para>
23590 <para>
23591 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
23592 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
23593 has more details about <emphasis>Sender:</emphasis> processing.
23594 </para>
23595 <para>
23596 <indexterm role="option">
23597 <primary><option>local_from_prefix</option></primary>
23598 </indexterm>
23599 </para>
23600 <informaltable frame="all">
23601 <tgroup cols="4" colsep="0" rowsep="0">
23602 <colspec colwidth="8*" align="left"/>
23603 <colspec colwidth="6*" align="center"/>
23604 <colspec colwidth="6*" align="center"/>
23605 <colspec colwidth="6*" align="right"/>
23606 <tbody>
23607 <row>
23608 <entry><option>local_from_prefix</option></entry>
23609 <entry>Use: <emphasis>main</emphasis></entry>
23610 <entry>Type: <emphasis>string</emphasis></entry>
23611 <entry>Default: <emphasis>unset</emphasis></entry>
23612 </row>
23613 </tbody>
23614 </tgroup>
23615 </informaltable>
23616 <para>
23617 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
23618 matching the login id (see <option>local_from_check</option> above), it can be configured to
23619 ignore certain prefixes and suffixes in the local part of the address. This is
23620 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
23621 appropriate lists, in the same form as the <option>local_part_prefix</option> and
23622 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
23623 example, if
23624 </para>
23625 <literallayout class="monospaced">
23626 local_from_prefix = *-
23627 </literallayout>
23628 <para>
23629 is set, a <emphasis>From:</emphasis> line containing
23630 </para>
23631 <literallayout class="monospaced">
23632 From: anything-user@your.domain.example
23633 </literallayout>
23634 <para>
23635 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
23636 matches the actual sender address that is constructed from the login name and
23637 qualify domain.
23638 </para>
23639 <para>
23640 <indexterm role="option">
23641 <primary><option>local_from_suffix</option></primary>
23642 </indexterm>
23643 </para>
23644 <informaltable frame="all">
23645 <tgroup cols="4" colsep="0" rowsep="0">
23646 <colspec colwidth="8*" align="left"/>
23647 <colspec colwidth="6*" align="center"/>
23648 <colspec colwidth="6*" align="center"/>
23649 <colspec colwidth="6*" align="right"/>
23650 <tbody>
23651 <row>
23652 <entry><option>local_from_suffix</option></entry>
23653 <entry>Use: <emphasis>main</emphasis></entry>
23654 <entry>Type: <emphasis>string</emphasis></entry>
23655 <entry>Default: <emphasis>unset</emphasis></entry>
23656 </row>
23657 </tbody>
23658 </tgroup>
23659 </informaltable>
23660 <para>
23661 See <option>local_from_prefix</option> above.
23662 </para>
23663 <para>
23664 <indexterm role="option">
23665 <primary><option>local_interfaces</option></primary>
23666 </indexterm>
23667 </para>
23668 <informaltable frame="all">
23669 <tgroup cols="4" colsep="0" rowsep="0">
23670 <colspec colwidth="8*" align="left"/>
23671 <colspec colwidth="6*" align="center"/>
23672 <colspec colwidth="6*" align="center"/>
23673 <colspec colwidth="6*" align="right"/>
23674 <tbody>
23675 <row>
23676 <entry><option>local_interfaces</option></entry>
23677 <entry>Use: <emphasis>main</emphasis></entry>
23678 <entry>Type: <emphasis>string list</emphasis></entry>
23679 <entry>Default: <emphasis>see below</emphasis></entry>
23680 </row>
23681 </tbody>
23682 </tgroup>
23683 </informaltable>
23684 <para>
23685 This option controls which network interfaces are used by the daemon for
23686 listening; they are also used to identify the local host when routing. Chapter
23687 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23688 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23689 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23690 <option>local_interfaces</option> is
23691 </para>
23692 <literallayout class="monospaced">
23693 local_interfaces = 0.0.0.0
23694 </literallayout>
23695 <para>
23696 when Exim is built without IPv6 support; otherwise it is
23697 </para>
23698 <literallayout class="monospaced">
23699 local_interfaces = &lt;; ::0 ; 0.0.0.0
23700 </literallayout>
23701 <para>
23702 <indexterm role="option">
23703 <primary><option>local_scan_timeout</option></primary>
23704 </indexterm>
23705 </para>
23706 <informaltable frame="all">
23707 <tgroup cols="4" colsep="0" rowsep="0">
23708 <colspec colwidth="8*" align="left"/>
23709 <colspec colwidth="6*" align="center"/>
23710 <colspec colwidth="6*" align="center"/>
23711 <colspec colwidth="6*" align="right"/>
23712 <tbody>
23713 <row>
23714 <entry><option>local_scan_timeout</option></entry>
23715 <entry>Use: <emphasis>main</emphasis></entry>
23716 <entry>Type: <emphasis>time</emphasis></entry>
23717 <entry>Default: <emphasis>5m</emphasis></entry>
23718 </row>
23719 </tbody>
23720 </tgroup>
23721 </informaltable>
23722 <para>
23723 <indexterm role="concept">
23724 <primary>timeout</primary>
23725 <secondary>for <function>local_scan()</function> function</secondary>
23726 </indexterm>
23727 <indexterm role="concept">
23728 <primary><function>local_scan()</function> function</primary>
23729 <secondary>timeout</secondary>
23730 </indexterm>
23731 This timeout applies to the <function>local_scan()</function> function (see chapter
23732 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23733 the incoming message is rejected with a temporary error if it is an SMTP
23734 message. For a non-SMTP message, the message is dropped and Exim ends with a
23735 non-zero code. The incident is logged on the main and reject logs.
23736 </para>
23737 <para>
23738 <indexterm role="option">
23739 <primary><option>local_sender_retain</option></primary>
23740 </indexterm>
23741 </para>
23742 <informaltable frame="all">
23743 <tgroup cols="4" colsep="0" rowsep="0">
23744 <colspec colwidth="8*" align="left"/>
23745 <colspec colwidth="6*" align="center"/>
23746 <colspec colwidth="6*" align="center"/>
23747 <colspec colwidth="6*" align="right"/>
23748 <tbody>
23749 <row>
23750 <entry><option>local_sender_retain</option></entry>
23751 <entry>Use: <emphasis>main</emphasis></entry>
23752 <entry>Type: <emphasis>boolean</emphasis></entry>
23753 <entry>Default: <emphasis>false</emphasis></entry>
23754 </row>
23755 </tbody>
23756 </tgroup>
23757 </informaltable>
23758 <para>
23759 <indexterm role="concept">
23760 <primary><emphasis>Sender:</emphasis> header line</primary>
23761 <secondary>retaining from local submission</secondary>
23762 </indexterm>
23763 When a message is submitted locally (that is, not over a TCP/IP connection) by
23764 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
23765 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
23766 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
23767 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
23768 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
23769 </para>
23770 <para>
23771 <indexterm role="option">
23772 <primary><option>localhost_number</option></primary>
23773 </indexterm>
23774 </para>
23775 <informaltable frame="all">
23776 <tgroup cols="4" colsep="0" rowsep="0">
23777 <colspec colwidth="8*" align="left"/>
23778 <colspec colwidth="6*" align="center"/>
23779 <colspec colwidth="6*" align="center"/>
23780 <colspec colwidth="6*" align="right"/>
23781 <tbody>
23782 <row>
23783 <entry><option>localhost_number</option></entry>
23784 <entry>Use: <emphasis>main</emphasis></entry>
23785 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23786 <entry>Default: <emphasis>unset</emphasis></entry>
23787 </row>
23788 </tbody>
23789 </tgroup>
23790 </informaltable>
23791 <para>
23792 <indexterm role="concept">
23793 <primary>host</primary>
23794 <secondary>locally unique number for</secondary>
23795 </indexterm>
23796 <indexterm role="concept">
23797 <primary>message ids</primary>
23798 <secondary>with multiple hosts</secondary>
23799 </indexterm>
23800 <indexterm role="variable">
23801 <primary><varname>$localhost_number</varname></primary>
23802 </indexterm>
23803 Exim&#x2019;s message ids are normally unique only within the local host. If
23804 uniqueness among a set of hosts is required, each host must set a different
23805 value for the <option>localhost_number</option> option. The string is expanded immediately
23806 after reading the configuration file (so that a number can be computed from the
23807 host name, for example) and the result of the expansion must be a number in the
23808 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
23809 systems). This is available in subsequent string expansions via the variable
23810 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
23811 characters of the message id, instead of just being a fractional part of the
23812 time, are computed from the time and the local host number as described in
23813 section <xref linkend="SECTmessiden"/>.
23814 </para>
23815 <para>
23816 <indexterm role="option">
23817 <primary><option>log_file_path</option></primary>
23818 </indexterm>
23819 </para>
23820 <informaltable frame="all">
23821 <tgroup cols="4" colsep="0" rowsep="0">
23822 <colspec colwidth="8*" align="left"/>
23823 <colspec colwidth="6*" align="center"/>
23824 <colspec colwidth="6*" align="center"/>
23825 <colspec colwidth="6*" align="right"/>
23826 <tbody>
23827 <row>
23828 <entry><option>log_file_path</option></entry>
23829 <entry>Use: <emphasis>main</emphasis></entry>
23830 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23831 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23832 </row>
23833 </tbody>
23834 </tgroup>
23835 </informaltable>
23836 <para>
23837 <indexterm role="concept">
23838 <primary>log</primary>
23839 <secondary>file path for</secondary>
23840 </indexterm>
23841 This option sets the path which is used to determine the names of Exim&#x2019;s log
23842 files, or indicates that logging is to be to syslog, or both. It is expanded
23843 when Exim is entered, so it can, for example, contain a reference to the host
23844 name. If no specific path is set for the log files at compile or run time, they
23845 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
23846 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
23847 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
23848 used. If this string is fixed at your installation (contains no expansion
23849 variables) it is recommended that you do not set this option in the
23850 configuration file, but instead supply the path using LOG_FILE_PATH in
23851 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
23852 early on &ndash; in particular, failure to read the configuration file.
23853 </para>
23854 <para>
23855 <indexterm role="option">
23856 <primary><option>log_selector</option></primary>
23857 </indexterm>
23858 </para>
23859 <informaltable frame="all">
23860 <tgroup cols="4" colsep="0" rowsep="0">
23861 <colspec colwidth="8*" align="left"/>
23862 <colspec colwidth="6*" align="center"/>
23863 <colspec colwidth="6*" align="center"/>
23864 <colspec colwidth="6*" align="right"/>
23865 <tbody>
23866 <row>
23867 <entry><option>log_selector</option></entry>
23868 <entry>Use: <emphasis>main</emphasis></entry>
23869 <entry>Type: <emphasis>string</emphasis></entry>
23870 <entry>Default: <emphasis>unset</emphasis></entry>
23871 </row>
23872 </tbody>
23873 </tgroup>
23874 </informaltable>
23875 <para>
23876 <indexterm role="concept">
23877 <primary>log</primary>
23878 <secondary>selectors</secondary>
23879 </indexterm>
23880 This option can be used to reduce or increase the number of things that Exim
23881 writes to its log files. Its argument is made up of names preceded by plus or
23882 minus characters. For example:
23883 </para>
23884 <literallayout class="monospaced">
23885 log_selector = +arguments -retry_defer
23886 </literallayout>
23887 <para>
23888 A list of possible names and what they control is given in the chapter on
23889 logging, in section <xref linkend="SECTlogselector"/>.
23890 </para>
23891 <para>
23892 <indexterm role="option">
23893 <primary><option>log_timezone</option></primary>
23894 </indexterm>
23895 </para>
23896 <informaltable frame="all">
23897 <tgroup cols="4" colsep="0" rowsep="0">
23898 <colspec colwidth="8*" align="left"/>
23899 <colspec colwidth="6*" align="center"/>
23900 <colspec colwidth="6*" align="center"/>
23901 <colspec colwidth="6*" align="right"/>
23902 <tbody>
23903 <row>
23904 <entry><option>log_timezone</option></entry>
23905 <entry>Use: <emphasis>main</emphasis></entry>
23906 <entry>Type: <emphasis>boolean</emphasis></entry>
23907 <entry>Default: <emphasis>false</emphasis></entry>
23908 </row>
23909 </tbody>
23910 </tgroup>
23911 </informaltable>
23912 <para>
23913 <indexterm role="concept">
23914 <primary>log</primary>
23915 <secondary>timezone for entries</secondary>
23916 </indexterm>
23917 <indexterm role="variable">
23918 <primary><varname>$tod_log</varname></primary>
23919 </indexterm>
23920 <indexterm role="variable">
23921 <primary><varname>$tod_zone</varname></primary>
23922 </indexterm>
23923 By default, the timestamps on log lines are in local time without the
23924 timezone. This means that if your timezone changes twice a year, the timestamps
23925 in log lines are ambiguous for an hour when the clocks go back. One way of
23926 avoiding this problem is to set the timezone to UTC. An alternative is to set
23927 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23928 timestamps in log lines. Turning on this option can add quite a lot to the size
23929 of log files because each line is extended by 6 characters. Note that the
23930 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
23931 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
23932 </para>
23933 <para>
23934 <indexterm role="option">
23935 <primary><option>lookup_open_max</option></primary>
23936 </indexterm>
23937 </para>
23938 <informaltable frame="all">
23939 <tgroup cols="4" colsep="0" rowsep="0">
23940 <colspec colwidth="8*" align="left"/>
23941 <colspec colwidth="6*" align="center"/>
23942 <colspec colwidth="6*" align="center"/>
23943 <colspec colwidth="6*" align="right"/>
23944 <tbody>
23945 <row>
23946 <entry><option>lookup_open_max</option></entry>
23947 <entry>Use: <emphasis>main</emphasis></entry>
23948 <entry>Type: <emphasis>integer</emphasis></entry>
23949 <entry>Default: <emphasis>25</emphasis></entry>
23950 </row>
23951 </tbody>
23952 </tgroup>
23953 </informaltable>
23954 <para>
23955 <indexterm role="concept">
23956 <primary>too many open files</primary>
23957 </indexterm>
23958 <indexterm role="concept">
23959 <primary>open files, too many</primary>
23960 </indexterm>
23961 <indexterm role="concept">
23962 <primary>file</primary>
23963 <secondary>too many open</secondary>
23964 </indexterm>
23965 <indexterm role="concept">
23966 <primary>lookup</primary>
23967 <secondary>maximum open files</secondary>
23968 </indexterm>
23969 <indexterm role="concept">
23970 <primary>limit</primary>
23971 <secondary>open files for lookups</secondary>
23972 </indexterm>
23973 This option limits the number of simultaneously open files for single-key
23974 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
23975 Exim normally keeps these files open during routing, because often the same
23976 file is required several times. If the limit is reached, Exim closes the least
23977 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
23978 actually opens two files for each logical DBM database, though it still counts
23979 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
23980 open files</quote> errors with NDBM, you need to reduce the value of
23981 <option>lookup_open_max</option>.
23982 </para>
23983 <para>
23984 <indexterm role="option">
23985 <primary><option>max_username_length</option></primary>
23986 </indexterm>
23987 </para>
23988 <informaltable frame="all">
23989 <tgroup cols="4" colsep="0" rowsep="0">
23990 <colspec colwidth="8*" align="left"/>
23991 <colspec colwidth="6*" align="center"/>
23992 <colspec colwidth="6*" align="center"/>
23993 <colspec colwidth="6*" align="right"/>
23994 <tbody>
23995 <row>
23996 <entry><option>max_username_length</option></entry>
23997 <entry>Use: <emphasis>main</emphasis></entry>
23998 <entry>Type: <emphasis>integer</emphasis></entry>
23999 <entry>Default: <emphasis>0</emphasis></entry>
24000 </row>
24001 </tbody>
24002 </tgroup>
24003 </informaltable>
24004 <para>
24005 <indexterm role="concept">
24006 <primary>length of login name</primary>
24007 </indexterm>
24008 <indexterm role="concept">
24009 <primary>user name</primary>
24010 <secondary>maximum length</secondary>
24011 </indexterm>
24012 <indexterm role="concept">
24013 <primary>limit</primary>
24014 <secondary>user name length</secondary>
24015 </indexterm>
24016 Some operating systems are broken in that they truncate long arguments to
24017 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24018 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24019 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24020 </para>
24021 <para revisionflag="changed">
24022 <indexterm role="option">
24023 <primary><option>message_body_newlines</option></primary>
24024 </indexterm>
24025 </para>
24026 <informaltable frame="all" revisionflag="changed">
24027 <tgroup cols="4" colsep="0" rowsep="0">
24028 <colspec colwidth="8*" align="left"/>
24029 <colspec colwidth="6*" align="center"/>
24030 <colspec colwidth="6*" align="center"/>
24031 <colspec colwidth="6*" align="right"/>
24032 <tbody>
24033 <row>
24034 <entry><option>message_body_newlines</option></entry>
24035 <entry>Use: <emphasis>main</emphasis></entry>
24036 <entry>Type: <emphasis>bool</emphasis></entry>
24037 <entry>Default: <emphasis>false</emphasis></entry>
24038 </row>
24039 </tbody>
24040 </tgroup>
24041 </informaltable>
24042 <para revisionflag="changed">
24043 <indexterm role="concept">
24044 <primary>message body</primary>
24045 <secondary>newlines in variables</secondary>
24046 </indexterm>
24047 <indexterm role="concept">
24048 <primary>newline</primary>
24049 <secondary>in message body variables</secondary>
24050 </indexterm>
24051 <indexterm role="variable">
24052 <primary><varname>$message_body</varname></primary>
24053 </indexterm>
24054 <indexterm role="variable">
24055 <primary><varname>$message_body_end</varname></primary>
24056 </indexterm>
24057 By default, newlines in the message body are replaced by spaces when setting
24058 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24059 option is set true, this no longer happens.
24060 </para>
24061 <para>
24062 <indexterm role="option">
24063 <primary><option>message_body_visible</option></primary>
24064 </indexterm>
24065 </para>
24066 <informaltable frame="all">
24067 <tgroup cols="4" colsep="0" rowsep="0">
24068 <colspec colwidth="8*" align="left"/>
24069 <colspec colwidth="6*" align="center"/>
24070 <colspec colwidth="6*" align="center"/>
24071 <colspec colwidth="6*" align="right"/>
24072 <tbody>
24073 <row>
24074 <entry><option>message_body_visible</option></entry>
24075 <entry>Use: <emphasis>main</emphasis></entry>
24076 <entry>Type: <emphasis>integer</emphasis></entry>
24077 <entry>Default: <emphasis>500</emphasis></entry>
24078 </row>
24079 </tbody>
24080 </tgroup>
24081 </informaltable>
24082 <para>
24083 <indexterm role="concept">
24084 <primary>body of message</primary>
24085 <secondary>visible size</secondary>
24086 </indexterm>
24087 <indexterm role="concept">
24088 <primary>message body</primary>
24089 <secondary>visible size</secondary>
24090 </indexterm>
24091 <indexterm role="variable">
24092 <primary><varname>$message_body</varname></primary>
24093 </indexterm>
24094 <indexterm role="variable">
24095 <primary><varname>$message_body_end</varname></primary>
24096 </indexterm>
24097 This option specifies how much of a message&#x2019;s body is to be included in the
24098 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24099 </para>
24100 <para>
24101 <indexterm role="option">
24102 <primary><option>message_id_header_domain</option></primary>
24103 </indexterm>
24104 </para>
24105 <informaltable frame="all">
24106 <tgroup cols="4" colsep="0" rowsep="0">
24107 <colspec colwidth="8*" align="left"/>
24108 <colspec colwidth="6*" align="center"/>
24109 <colspec colwidth="6*" align="center"/>
24110 <colspec colwidth="6*" align="right"/>
24111 <tbody>
24112 <row>
24113 <entry><option>message_id_header_domain</option></entry>
24114 <entry>Use: <emphasis>main</emphasis></entry>
24115 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24116 <entry>Default: <emphasis>unset</emphasis></entry>
24117 </row>
24118 </tbody>
24119 </tgroup>
24120 </informaltable>
24121 <para>
24122 <indexterm role="concept">
24123 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24124 </indexterm>
24125 If this option is set, the string is expanded and used as the right hand side
24126 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24127 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24128 means <quote>not received over TCP/IP.</quote>
24129 Otherwise, the primary host name is used.
24130 Only letters, digits, dot and hyphen are accepted; any other characters are
24131 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24132 empty string, the option is ignored.
24133 </para>
24134 <para>
24135 <indexterm role="option">
24136 <primary><option>message_id_header_text</option></primary>
24137 </indexterm>
24138 </para>
24139 <informaltable frame="all">
24140 <tgroup cols="4" colsep="0" rowsep="0">
24141 <colspec colwidth="8*" align="left"/>
24142 <colspec colwidth="6*" align="center"/>
24143 <colspec colwidth="6*" align="center"/>
24144 <colspec colwidth="6*" align="right"/>
24145 <tbody>
24146 <row>
24147 <entry><option>message_id_header_text</option></entry>
24148 <entry>Use: <emphasis>main</emphasis></entry>
24149 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24150 <entry>Default: <emphasis>unset</emphasis></entry>
24151 </row>
24152 </tbody>
24153 </tgroup>
24154 </informaltable>
24155 <para>
24156 If this variable is set, the string is expanded and used to augment the text of
24157 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24158 message does not have one. The text of this header is required by RFC 2822 to
24159 take the form of an address. By default, Exim uses its internal message id as
24160 the local part, and the primary host name as the domain. If this option is set,
24161 it is expanded, and provided the expansion is not forced to fail, and does not
24162 yield an empty string, the result is inserted into the header immediately
24163 before the @, separated from the internal message id by a dot. Any characters
24164 that are illegal in an address are automatically converted into hyphens. This
24165 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24166 colons will become hyphens.
24167 </para>
24168 <para>
24169 <indexterm role="option">
24170 <primary><option>message_logs</option></primary>
24171 </indexterm>
24172 </para>
24173 <informaltable frame="all">
24174 <tgroup cols="4" colsep="0" rowsep="0">
24175 <colspec colwidth="8*" align="left"/>
24176 <colspec colwidth="6*" align="center"/>
24177 <colspec colwidth="6*" align="center"/>
24178 <colspec colwidth="6*" align="right"/>
24179 <tbody>
24180 <row>
24181 <entry><option>message_logs</option></entry>
24182 <entry>Use: <emphasis>main</emphasis></entry>
24183 <entry>Type: <emphasis>boolean</emphasis></entry>
24184 <entry>Default: <emphasis>true</emphasis></entry>
24185 </row>
24186 </tbody>
24187 </tgroup>
24188 </informaltable>
24189 <para>
24190 <indexterm role="concept">
24191 <primary>message logs</primary>
24192 <secondary>disabling</secondary>
24193 </indexterm>
24194 <indexterm role="concept">
24195 <primary>log</primary>
24196 <secondary>message log; disabling</secondary>
24197 </indexterm>
24198 If this option is turned off, per-message log files are not created in the
24199 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24200 Exim, by reducing the number of files involved in handling a message from a
24201 minimum of four (header spool file, body spool file, delivery journal, and
24202 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
24203 which is not affected by this option.
24204 </para>
24205 <para>
24206 <indexterm role="option">
24207 <primary><option>message_size_limit</option></primary>
24208 </indexterm>
24209 </para>
24210 <informaltable frame="all">
24211 <tgroup cols="4" colsep="0" rowsep="0">
24212 <colspec colwidth="8*" align="left"/>
24213 <colspec colwidth="6*" align="center"/>
24214 <colspec colwidth="6*" align="center"/>
24215 <colspec colwidth="6*" align="right"/>
24216 <tbody>
24217 <row>
24218 <entry><option>message_size_limit</option></entry>
24219 <entry>Use: <emphasis>main</emphasis></entry>
24220 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24221 <entry>Default: <emphasis>50M</emphasis></entry>
24222 </row>
24223 </tbody>
24224 </tgroup>
24225 </informaltable>
24226 <para>
24227 <indexterm role="concept">
24228 <primary>message</primary>
24229 <secondary>size limit</secondary>
24230 </indexterm>
24231 <indexterm role="concept">
24232 <primary>limit</primary>
24233 <secondary>message size</secondary>
24234 </indexterm>
24235 <indexterm role="concept">
24236 <primary>size</primary>
24237 <secondary>of message, limit</secondary>
24238 </indexterm>
24239 This option limits the maximum size of message that Exim will process. The
24240 value is expanded for each incoming connection so, for example, it can be made
24241 to depend on the IP address of the remote host for messages arriving via
24242 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24243 optionally followed by K or M.
24244 </para>
24245 <para>
24246 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
24247 other properties of an individual message, because it has to be advertised in
24248 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
24249 error. A value of zero means no limit, but its use is not recommended. See also
24250 <option>bounce_return_size_limit</option>.
24251 </para>
24252 <para>
24253 Incoming SMTP messages are failed with a 552 error if the limit is
24254 exceeded; locally-generated messages either get a stderr message or a delivery
24255 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24256 an oversized message is logged in both the main and the reject logs. See also
24257 the generic transport option <option>message_size_limit</option>, which limits the size of
24258 message that an individual transport can process.
24259 </para>
24260 <para>
24261 <indexterm role="option">
24262 <primary><option>move_frozen_messages</option></primary>
24263 </indexterm>
24264 </para>
24265 <informaltable frame="all">
24266 <tgroup cols="4" colsep="0" rowsep="0">
24267 <colspec colwidth="8*" align="left"/>
24268 <colspec colwidth="6*" align="center"/>
24269 <colspec colwidth="6*" align="center"/>
24270 <colspec colwidth="6*" align="right"/>
24271 <tbody>
24272 <row>
24273 <entry><option>move_frozen_messages</option></entry>
24274 <entry>Use: <emphasis>main</emphasis></entry>
24275 <entry>Type: <emphasis>boolean</emphasis></entry>
24276 <entry>Default: <emphasis>false</emphasis></entry>
24277 </row>
24278 </tbody>
24279 </tgroup>
24280 </informaltable>
24281 <para>
24282 <indexterm role="concept">
24283 <primary>frozen messages</primary>
24284 <secondary>moving</secondary>
24285 </indexterm>
24286 This option, which is available only if Exim has been built with the setting
24287 </para>
24288 <literallayout class="monospaced">
24289 SUPPORT_MOVE_FROZEN_MESSAGES=yes
24290 </literallayout>
24291 <para>
24292 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
24293 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
24294 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
24295 standard utilities for handling such moved messages, and they do not show up in
24296 lists generated by <option>-bp</option> or by the Exim monitor.
24297 </para>
24298 <para>
24299 <indexterm role="option">
24300 <primary><option>mua_wrapper</option></primary>
24301 </indexterm>
24302 </para>
24303 <informaltable frame="all">
24304 <tgroup cols="4" colsep="0" rowsep="0">
24305 <colspec colwidth="8*" align="left"/>
24306 <colspec colwidth="6*" align="center"/>
24307 <colspec colwidth="6*" align="center"/>
24308 <colspec colwidth="6*" align="right"/>
24309 <tbody>
24310 <row>
24311 <entry><option>mua_wrapper</option></entry>
24312 <entry>Use: <emphasis>main</emphasis></entry>
24313 <entry>Type: <emphasis>boolean</emphasis></entry>
24314 <entry>Default: <emphasis>false</emphasis></entry>
24315 </row>
24316 </tbody>
24317 </tgroup>
24318 </informaltable>
24319 <para>
24320 Setting this option true causes Exim to run in a very restrictive mode in which
24321 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24322 contains a full description of this facility.
24323 </para>
24324 <para>
24325 <indexterm role="option">
24326 <primary><option>mysql_servers</option></primary>
24327 </indexterm>
24328 </para>
24329 <informaltable frame="all">
24330 <tgroup cols="4" colsep="0" rowsep="0">
24331 <colspec colwidth="8*" align="left"/>
24332 <colspec colwidth="6*" align="center"/>
24333 <colspec colwidth="6*" align="center"/>
24334 <colspec colwidth="6*" align="right"/>
24335 <tbody>
24336 <row>
24337 <entry><option>mysql_servers</option></entry>
24338 <entry>Use: <emphasis>main</emphasis></entry>
24339 <entry>Type: <emphasis>string list</emphasis></entry>
24340 <entry>Default: <emphasis>unset</emphasis></entry>
24341 </row>
24342 </tbody>
24343 </tgroup>
24344 </informaltable>
24345 <para>
24346 <indexterm role="concept">
24347 <primary>MySQL</primary>
24348 <secondary>server list</secondary>
24349 </indexterm>
24350 This option provides a list of MySQL servers and associated connection data, to
24351 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
24352 option is available only if Exim has been built with MySQL support.
24353 </para>
24354 <para>
24355 <indexterm role="option">
24356 <primary><option>never_users</option></primary>
24357 </indexterm>
24358 </para>
24359 <informaltable frame="all">
24360 <tgroup cols="4" colsep="0" rowsep="0">
24361 <colspec colwidth="8*" align="left"/>
24362 <colspec colwidth="6*" align="center"/>
24363 <colspec colwidth="6*" align="center"/>
24364 <colspec colwidth="6*" align="right"/>
24365 <tbody>
24366 <row>
24367 <entry><option>never_users</option></entry>
24368 <entry>Use: <emphasis>main</emphasis></entry>
24369 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24370 <entry>Default: <emphasis>unset</emphasis></entry>
24371 </row>
24372 </tbody>
24373 </tgroup>
24374 </informaltable>
24375 <para>
24376 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
24377 message deliveries are normally run in processes that are setuid to the
24378 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
24379 It is usually desirable to prevent any deliveries from running as root, as a
24380 safety precaution.
24381 </para>
24382 <para>
24383 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24384 list of users that must not be used for local deliveries. This list is fixed in
24385 the binary and cannot be overridden by the configuration file. By default, it
24386 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24387 can be used to add more users to the fixed list.
24388 </para>
24389 <para>
24390 If a message is to be delivered as one of the users on the fixed list or the
24391 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24392 example is
24393 </para>
24394 <literallayout class="monospaced">
24395 never_users = root:daemon:bin
24396 </literallayout>
24397 <para>
24398 Including root is redundant if it is also on the fixed list, but it does no
24399 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
24400 transport driver.
24401 </para>
24402 <para>
24403 <indexterm role="option">
24404 <primary><option>oracle_servers</option></primary>
24405 </indexterm>
24406 </para>
24407 <informaltable frame="all">
24408 <tgroup cols="4" colsep="0" rowsep="0">
24409 <colspec colwidth="8*" align="left"/>
24410 <colspec colwidth="6*" align="center"/>
24411 <colspec colwidth="6*" align="center"/>
24412 <colspec colwidth="6*" align="right"/>
24413 <tbody>
24414 <row>
24415 <entry><option>oracle_servers</option></entry>
24416 <entry>Use: <emphasis>main</emphasis></entry>
24417 <entry>Type: <emphasis>string list</emphasis></entry>
24418 <entry>Default: <emphasis>unset</emphasis></entry>
24419 </row>
24420 </tbody>
24421 </tgroup>
24422 </informaltable>
24423 <para>
24424 <indexterm role="concept">
24425 <primary>Oracle</primary>
24426 <secondary>server list</secondary>
24427 </indexterm>
24428 This option provides a list of Oracle servers and associated connection data,
24429 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
24430 The option is available only if Exim has been built with Oracle support.
24431 </para>
24432 <para>
24433 <indexterm role="option">
24434 <primary><option>percent_hack_domains</option></primary>
24435 </indexterm>
24436 </para>
24437 <informaltable frame="all">
24438 <tgroup cols="4" colsep="0" rowsep="0">
24439 <colspec colwidth="8*" align="left"/>
24440 <colspec colwidth="6*" align="center"/>
24441 <colspec colwidth="6*" align="center"/>
24442 <colspec colwidth="6*" align="right"/>
24443 <tbody>
24444 <row>
24445 <entry><option>percent_hack_domains</option></entry>
24446 <entry>Use: <emphasis>main</emphasis></entry>
24447 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24448 <entry>Default: <emphasis>unset</emphasis></entry>
24449 </row>
24450 </tbody>
24451 </tgroup>
24452 </informaltable>
24453 <para>
24454 <indexterm role="concept">
24455 <primary><quote>percent hack</quote></primary>
24456 </indexterm>
24457 <indexterm role="concept">
24458 <primary>source routing</primary>
24459 <secondary>in email address</secondary>
24460 </indexterm>
24461 <indexterm role="concept">
24462 <primary>address</primary>
24463 <secondary>source-routed</secondary>
24464 </indexterm>
24465 The <quote>percent hack</quote> is the convention whereby a local part containing a
24466 percent sign is re-interpreted as a new email address, with the percent
24467 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
24468 also applied to RFC 2822 addresses that begin with an @ character. If this
24469 option is set, Exim implements the percent facility for those domains listed,
24470 but no others. This happens before an incoming SMTP address is tested against
24471 an ACL.
24472 </para>
24473 <para>
24474 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
24475 trying to get round relaying restrictions. For this reason, it is best avoided
24476 if at all possible. Unfortunately, a number of less security-conscious MTAs
24477 implement it unconditionally. If you are running Exim on a gateway host, and
24478 routing mail through to internal MTAs without processing the local parts, it is
24479 a good idea to reject recipient addresses with percent characters in their
24480 local parts. Exim&#x2019;s default configuration does this.
24481 </para>
24482 <para>
24483 <indexterm role="option">
24484 <primary><option>perl_at_start</option></primary>
24485 </indexterm>
24486 </para>
24487 <informaltable frame="all">
24488 <tgroup cols="4" colsep="0" rowsep="0">
24489 <colspec colwidth="8*" align="left"/>
24490 <colspec colwidth="6*" align="center"/>
24491 <colspec colwidth="6*" align="center"/>
24492 <colspec colwidth="6*" align="right"/>
24493 <tbody>
24494 <row>
24495 <entry><option>perl_at_start</option></entry>
24496 <entry>Use: <emphasis>main</emphasis></entry>
24497 <entry>Type: <emphasis>boolean</emphasis></entry>
24498 <entry>Default: <emphasis>false</emphasis></entry>
24499 </row>
24500 </tbody>
24501 </tgroup>
24502 </informaltable>
24503 <para>
24504 This option is available only when Exim is built with an embedded Perl
24505 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24506 </para>
24507 <para>
24508 <indexterm role="option">
24509 <primary><option>perl_startup</option></primary>
24510 </indexterm>
24511 </para>
24512 <informaltable frame="all">
24513 <tgroup cols="4" colsep="0" rowsep="0">
24514 <colspec colwidth="8*" align="left"/>
24515 <colspec colwidth="6*" align="center"/>
24516 <colspec colwidth="6*" align="center"/>
24517 <colspec colwidth="6*" align="right"/>
24518 <tbody>
24519 <row>
24520 <entry><option>perl_startup</option></entry>
24521 <entry>Use: <emphasis>main</emphasis></entry>
24522 <entry>Type: <emphasis>string</emphasis></entry>
24523 <entry>Default: <emphasis>unset</emphasis></entry>
24524 </row>
24525 </tbody>
24526 </tgroup>
24527 </informaltable>
24528 <para>
24529 This option is available only when Exim is built with an embedded Perl
24530 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24531 </para>
24532 <para>
24533 <indexterm role="option">
24534 <primary><option>pgsql_servers</option></primary>
24535 </indexterm>
24536 </para>
24537 <informaltable frame="all">
24538 <tgroup cols="4" colsep="0" rowsep="0">
24539 <colspec colwidth="8*" align="left"/>
24540 <colspec colwidth="6*" align="center"/>
24541 <colspec colwidth="6*" align="center"/>
24542 <colspec colwidth="6*" align="right"/>
24543 <tbody>
24544 <row>
24545 <entry><option>pgsql_servers</option></entry>
24546 <entry>Use: <emphasis>main</emphasis></entry>
24547 <entry>Type: <emphasis>string list</emphasis></entry>
24548 <entry>Default: <emphasis>unset</emphasis></entry>
24549 </row>
24550 </tbody>
24551 </tgroup>
24552 </informaltable>
24553 <para>
24554 <indexterm role="concept">
24555 <primary>PostgreSQL lookup type</primary>
24556 <secondary>server list</secondary>
24557 </indexterm>
24558 This option provides a list of PostgreSQL servers and associated connection
24559 data, to be used in conjunction with <command>pgsql</command> lookups (see section
24560 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
24561 PostgreSQL support.
24562 </para>
24563 <para>
24564 <indexterm role="option">
24565 <primary><option>pid_file_path</option></primary>
24566 </indexterm>
24567 </para>
24568 <informaltable frame="all">
24569 <tgroup cols="4" colsep="0" rowsep="0">
24570 <colspec colwidth="8*" align="left"/>
24571 <colspec colwidth="6*" align="center"/>
24572 <colspec colwidth="6*" align="center"/>
24573 <colspec colwidth="6*" align="right"/>
24574 <tbody>
24575 <row>
24576 <entry><option>pid_file_path</option></entry>
24577 <entry>Use: <emphasis>main</emphasis></entry>
24578 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24579 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24580 </row>
24581 </tbody>
24582 </tgroup>
24583 </informaltable>
24584 <para>
24585 <indexterm role="concept">
24586 <primary>daemon</primary>
24587 <secondary>pid file path</secondary>
24588 </indexterm>
24589 <indexterm role="concept">
24590 <primary>pid file, path for</primary>
24591 </indexterm>
24592 This option sets the name of the file to which the Exim daemon writes its
24593 process id. The string is expanded, so it can contain, for example, references
24594 to the host name:
24595 </para>
24596 <literallayout class="monospaced">
24597 pid_file_path = /var/log/$primary_hostname/exim.pid
24598 </literallayout>
24599 <para>
24600 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
24601 spool directory.
24602 The value set by the option can be overridden by the <option>-oP</option> command line
24603 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
24604 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
24605 </para>
24606 <para>
24607 <indexterm role="option">
24608 <primary><option>pipelining_advertise_hosts</option></primary>
24609 </indexterm>
24610 </para>
24611 <informaltable frame="all">
24612 <tgroup cols="4" colsep="0" rowsep="0">
24613 <colspec colwidth="8*" align="left"/>
24614 <colspec colwidth="6*" align="center"/>
24615 <colspec colwidth="6*" align="center"/>
24616 <colspec colwidth="6*" align="right"/>
24617 <tbody>
24618 <row>
24619 <entry><option>pipelining_advertise_hosts</option></entry>
24620 <entry>Use: <emphasis>main</emphasis></entry>
24621 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24622 <entry>Default: <emphasis>*</emphasis></entry>
24623 </row>
24624 </tbody>
24625 </tgroup>
24626 </informaltable>
24627 <para>
24628 <indexterm role="concept">
24629 <primary>PIPELINING</primary>
24630 <secondary>suppressing advertising</secondary>
24631 </indexterm>
24632 This option can be used to suppress the advertisement of the SMTP
24633 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
24634 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
24635 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
24636 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
24637 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
24638 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
24639 </para>
24640 <para>
24641 <indexterm role="option">
24642 <primary><option>preserve_message_logs</option></primary>
24643 </indexterm>
24644 </para>
24645 <informaltable frame="all">
24646 <tgroup cols="4" colsep="0" rowsep="0">
24647 <colspec colwidth="8*" align="left"/>
24648 <colspec colwidth="6*" align="center"/>
24649 <colspec colwidth="6*" align="center"/>
24650 <colspec colwidth="6*" align="right"/>
24651 <tbody>
24652 <row>
24653 <entry><option>preserve_message_logs</option></entry>
24654 <entry>Use: <emphasis>main</emphasis></entry>
24655 <entry>Type: <emphasis>boolean</emphasis></entry>
24656 <entry>Default: <emphasis>false</emphasis></entry>
24657 </row>
24658 </tbody>
24659 </tgroup>
24660 </informaltable>
24661 <para>
24662 <indexterm role="concept">
24663 <primary>message logs</primary>
24664 <secondary>preserving</secondary>
24665 </indexterm>
24666 If this option is set, message log files are not deleted when messages are
24667 completed. Instead, they are moved to a sub-directory of the spool directory
24668 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
24669 purposes. This is a dangerous option to set on systems with any appreciable
24670 volume of mail. Use with care!
24671 </para>
24672 <para>
24673 <indexterm role="option">
24674 <primary><option>primary_hostname</option></primary>
24675 </indexterm>
24676 </para>
24677 <informaltable frame="all">
24678 <tgroup cols="4" colsep="0" rowsep="0">
24679 <colspec colwidth="8*" align="left"/>
24680 <colspec colwidth="6*" align="center"/>
24681 <colspec colwidth="6*" align="center"/>
24682 <colspec colwidth="6*" align="right"/>
24683 <tbody>
24684 <row>
24685 <entry><option>primary_hostname</option></entry>
24686 <entry>Use: <emphasis>main</emphasis></entry>
24687 <entry>Type: <emphasis>string</emphasis></entry>
24688 <entry>Default: <emphasis>see below</emphasis></entry>
24689 </row>
24690 </tbody>
24691 </tgroup>
24692 </informaltable>
24693 <para>
24694 <indexterm role="concept">
24695 <primary>name</primary>
24696 <secondary>of local host</secondary>
24697 </indexterm>
24698 <indexterm role="concept">
24699 <primary>host</primary>
24700 <secondary>name of local</secondary>
24701 </indexterm>
24702 <indexterm role="concept">
24703 <primary>local host</primary>
24704 <secondary>name of</secondary>
24705 </indexterm>
24706 <indexterm role="variable">
24707 <primary><varname>$primary_hostname</varname></primary>
24708 </indexterm>
24709 This specifies the name of the current host. It is used in the default EHLO or
24710 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
24711 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
24712 The value is also used by default in some SMTP response messages from an Exim
24713 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
24714 </para>
24715 <para>
24716 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
24717 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
24718 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
24719 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
24720 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
24721 explicitly by this option, or defaulted.
24722 </para>
24723 <para>
24724 <indexterm role="option">
24725 <primary><option>print_topbitchars</option></primary>
24726 </indexterm>
24727 </para>
24728 <informaltable frame="all">
24729 <tgroup cols="4" colsep="0" rowsep="0">
24730 <colspec colwidth="8*" align="left"/>
24731 <colspec colwidth="6*" align="center"/>
24732 <colspec colwidth="6*" align="center"/>
24733 <colspec colwidth="6*" align="right"/>
24734 <tbody>
24735 <row>
24736 <entry><option>print_topbitchars</option></entry>
24737 <entry>Use: <emphasis>main</emphasis></entry>
24738 <entry>Type: <emphasis>boolean</emphasis></entry>
24739 <entry>Default: <emphasis>false</emphasis></entry>
24740 </row>
24741 </tbody>
24742 </tgroup>
24743 </informaltable>
24744 <para>
24745 <indexterm role="concept">
24746 <primary>printing characters</primary>
24747 </indexterm>
24748 <indexterm role="concept">
24749 <primary>8-bit characters</primary>
24750 </indexterm>
24751 By default, Exim considers only those characters whose codes lie in the range
24752 32&ndash;126 to be printing characters. In a number of circumstances (for example,
24753 when writing log entries) non-printing characters are converted into escape
24754 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
24755 is set, code values of 128 and above are also considered to be printing
24756 characters.
24757 </para>
24758 <para>
24759 This option also affects the header syntax checks performed by the
24760 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
24761 the user&#x2019;s full name when constructing From: and Sender: addresses (as
24762 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
24763 Exim to generate eight bit message headers that do not conform to the
24764 standards.
24765 </para>
24766 <para>
24767 <indexterm role="option">
24768 <primary><option>process_log_path</option></primary>
24769 </indexterm>
24770 </para>
24771 <informaltable frame="all">
24772 <tgroup cols="4" colsep="0" rowsep="0">
24773 <colspec colwidth="8*" align="left"/>
24774 <colspec colwidth="6*" align="center"/>
24775 <colspec colwidth="6*" align="center"/>
24776 <colspec colwidth="6*" align="right"/>
24777 <tbody>
24778 <row>
24779 <entry><option>process_log_path</option></entry>
24780 <entry>Use: <emphasis>main</emphasis></entry>
24781 <entry>Type: <emphasis>string</emphasis></entry>
24782 <entry>Default: <emphasis>unset</emphasis></entry>
24783 </row>
24784 </tbody>
24785 </tgroup>
24786 </informaltable>
24787 <para>
24788 <indexterm role="concept">
24789 <primary>process log path</primary>
24790 </indexterm>
24791 <indexterm role="concept">
24792 <primary>log</primary>
24793 <secondary>process log</secondary>
24794 </indexterm>
24795 <indexterm role="concept">
24796 <primary><emphasis>exiwhat</emphasis></primary>
24797 </indexterm>
24798 This option sets the name of the file to which an Exim process writes its
24799 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
24800 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
24801 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
24802 can be useful in environments where two different Exims are running, using
24803 different spool directories.
24804 </para>
24805 <para>
24806 <indexterm role="option">
24807 <primary><option>prod_requires_admin</option></primary>
24808 </indexterm>
24809 </para>
24810 <informaltable frame="all">
24811 <tgroup cols="4" colsep="0" rowsep="0">
24812 <colspec colwidth="8*" align="left"/>
24813 <colspec colwidth="6*" align="center"/>
24814 <colspec colwidth="6*" align="center"/>
24815 <colspec colwidth="6*" align="right"/>
24816 <tbody>
24817 <row>
24818 <entry><option>prod_requires_admin</option></entry>
24819 <entry>Use: <emphasis>main</emphasis></entry>
24820 <entry>Type: <emphasis>boolean</emphasis></entry>
24821 <entry>Default: <emphasis>true</emphasis></entry>
24822 </row>
24823 </tbody>
24824 </tgroup>
24825 </informaltable>
24826 <para>
24827 <indexterm role="option">
24828 <primary><option>-M</option></primary>
24829 </indexterm>
24830 <indexterm role="option">
24831 <primary><option>-R</option></primary>
24832 </indexterm>
24833 <indexterm role="option">
24834 <primary><option>-q</option></primary>
24835 </indexterm>
24836 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
24837 admin user unless <option>prod_requires_admin</option> is set false. See also
24838 <option>queue_list_requires_admin</option>.
24839 </para>
24840 <para>
24841 <indexterm role="option">
24842 <primary><option>qualify_domain</option></primary>
24843 </indexterm>
24844 </para>
24845 <informaltable frame="all">
24846 <tgroup cols="4" colsep="0" rowsep="0">
24847 <colspec colwidth="8*" align="left"/>
24848 <colspec colwidth="6*" align="center"/>
24849 <colspec colwidth="6*" align="center"/>
24850 <colspec colwidth="6*" align="right"/>
24851 <tbody>
24852 <row>
24853 <entry><option>qualify_domain</option></entry>
24854 <entry>Use: <emphasis>main</emphasis></entry>
24855 <entry>Type: <emphasis>string</emphasis></entry>
24856 <entry>Default: <emphasis>see below</emphasis></entry>
24857 </row>
24858 </tbody>
24859 </tgroup>
24860 </informaltable>
24861 <para>
24862 <indexterm role="concept">
24863 <primary>domain</primary>
24864 <secondary>for qualifying addresses</secondary>
24865 </indexterm>
24866 <indexterm role="concept">
24867 <primary>address</primary>
24868 <secondary>qualification</secondary>
24869 </indexterm>
24870 This option specifies the domain name that is added to any envelope sender
24871 addresses that do not have a domain qualification. It also applies to
24872 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
24873 are accepted by default only for locally-generated messages. Qualification is
24874 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
24875 locally-generated messages, unless the <option>-bnq</option> command line option is used.
24876 </para>
24877 <para>
24878 Messages from external sources must always contain fully qualified addresses,
24879 unless the sending host matches <option>sender_unqualified_hosts</option> or
24880 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
24881 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
24882 necessary. Internally, Exim always works with fully qualified envelope
24883 addresses. If <option>qualify_domain</option> is not set, it defaults to the
24884 <option>primary_hostname</option> value.
24885 </para>
24886 <para>
24887 <indexterm role="option">
24888 <primary><option>qualify_recipient</option></primary>
24889 </indexterm>
24890 </para>
24891 <informaltable frame="all">
24892 <tgroup cols="4" colsep="0" rowsep="0">
24893 <colspec colwidth="8*" align="left"/>
24894 <colspec colwidth="6*" align="center"/>
24895 <colspec colwidth="6*" align="center"/>
24896 <colspec colwidth="6*" align="right"/>
24897 <tbody>
24898 <row>
24899 <entry><option>qualify_recipient</option></entry>
24900 <entry>Use: <emphasis>main</emphasis></entry>
24901 <entry>Type: <emphasis>string</emphasis></entry>
24902 <entry>Default: <emphasis>see below</emphasis></entry>
24903 </row>
24904 </tbody>
24905 </tgroup>
24906 </informaltable>
24907 <para>
24908 This option allows you to specify a different domain for qualifying recipient
24909 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
24910 </para>
24911 <para>
24912 <indexterm role="option">
24913 <primary><option>queue_domains</option></primary>
24914 </indexterm>
24915 </para>
24916 <informaltable frame="all">
24917 <tgroup cols="4" colsep="0" rowsep="0">
24918 <colspec colwidth="8*" align="left"/>
24919 <colspec colwidth="6*" align="center"/>
24920 <colspec colwidth="6*" align="center"/>
24921 <colspec colwidth="6*" align="right"/>
24922 <tbody>
24923 <row>
24924 <entry><option>queue_domains</option></entry>
24925 <entry>Use: <emphasis>main</emphasis></entry>
24926 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24927 <entry>Default: <emphasis>unset</emphasis></entry>
24928 </row>
24929 </tbody>
24930 </tgroup>
24931 </informaltable>
24932 <para>
24933 <indexterm role="concept">
24934 <primary>domain</primary>
24935 <secondary>specifying non-immediate delivery</secondary>
24936 </indexterm>
24937 <indexterm role="concept">
24938 <primary>queueing incoming messages</primary>
24939 </indexterm>
24940 <indexterm role="concept">
24941 <primary>message</primary>
24942 <secondary>queueing certain domains</secondary>
24943 </indexterm>
24944 This option lists domains for which immediate delivery is not required.
24945 A delivery process is started whenever a message is received, but only those
24946 domains that do not match are processed. All other deliveries wait until the
24947 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
24948 </para>
24949 <para>
24950 <indexterm role="option">
24951 <primary><option>queue_list_requires_admin</option></primary>
24952 </indexterm>
24953 </para>
24954 <informaltable frame="all">
24955 <tgroup cols="4" colsep="0" rowsep="0">
24956 <colspec colwidth="8*" align="left"/>
24957 <colspec colwidth="6*" align="center"/>
24958 <colspec colwidth="6*" align="center"/>
24959 <colspec colwidth="6*" align="right"/>
24960 <tbody>
24961 <row>
24962 <entry><option>queue_list_requires_admin</option></entry>
24963 <entry>Use: <emphasis>main</emphasis></entry>
24964 <entry>Type: <emphasis>boolean</emphasis></entry>
24965 <entry>Default: <emphasis>true</emphasis></entry>
24966 </row>
24967 </tbody>
24968 </tgroup>
24969 </informaltable>
24970 <para>
24971 <indexterm role="option">
24972 <primary><option>-bp</option></primary>
24973 </indexterm>
24974 The <option>-bp</option> command-line option, which lists the messages that are on the
24975 queue, requires the caller to be an admin user unless
24976 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
24977 </para>
24978 <para>
24979 <indexterm role="option">
24980 <primary><option>queue_only</option></primary>
24981 </indexterm>
24982 </para>
24983 <informaltable frame="all">
24984 <tgroup cols="4" colsep="0" rowsep="0">
24985 <colspec colwidth="8*" align="left"/>
24986 <colspec colwidth="6*" align="center"/>
24987 <colspec colwidth="6*" align="center"/>
24988 <colspec colwidth="6*" align="right"/>
24989 <tbody>
24990 <row>
24991 <entry><option>queue_only</option></entry>
24992 <entry>Use: <emphasis>main</emphasis></entry>
24993 <entry>Type: <emphasis>boolean</emphasis></entry>
24994 <entry>Default: <emphasis>false</emphasis></entry>
24995 </row>
24996 </tbody>
24997 </tgroup>
24998 </informaltable>
24999 <para>
25000 <indexterm role="concept">
25001 <primary>queueing incoming messages</primary>
25002 </indexterm>
25003 <indexterm role="concept">
25004 <primary>message</primary>
25005 <secondary>queueing unconditionally</secondary>
25006 </indexterm>
25007 If <option>queue_only</option> is set, a delivery process is not automatically started
25008 whenever a message is received. Instead, the message waits on the queue for the
25009 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25010 delivered immediately when certain conditions (such as heavy load) occur.
25011 </para>
25012 <para>
25013 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25014 and <option>-odi</option> command line options override <option>queue_only</option> unless
25015 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25016 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25017 </para>
25018 <para>
25019 <indexterm role="option">
25020 <primary><option>queue_only_file</option></primary>
25021 </indexterm>
25022 </para>
25023 <informaltable frame="all">
25024 <tgroup cols="4" colsep="0" rowsep="0">
25025 <colspec colwidth="8*" align="left"/>
25026 <colspec colwidth="6*" align="center"/>
25027 <colspec colwidth="6*" align="center"/>
25028 <colspec colwidth="6*" align="right"/>
25029 <tbody>
25030 <row>
25031 <entry><option>queue_only_file</option></entry>
25032 <entry>Use: <emphasis>main</emphasis></entry>
25033 <entry>Type: <emphasis>string</emphasis></entry>
25034 <entry>Default: <emphasis>unset</emphasis></entry>
25035 </row>
25036 </tbody>
25037 </tgroup>
25038 </informaltable>
25039 <para>
25040 <indexterm role="concept">
25041 <primary>queueing incoming messages</primary>
25042 </indexterm>
25043 <indexterm role="concept">
25044 <primary>message</primary>
25045 <secondary>queueing by file existence</secondary>
25046 </indexterm>
25047 This option can be set to a colon-separated list of absolute path names, each
25048 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25049 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25050 each path that exists, the corresponding queueing option is set.
25051 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25052 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25053 </para>
25054 <literallayout class="monospaced">
25055 queue_only_file = smtp/some/file
25056 </literallayout>
25057 <para>
25058 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25059 <filename>/some/file</filename> exists.
25060 </para>
25061 <para>
25062 <indexterm role="option">
25063 <primary><option>queue_only_load</option></primary>
25064 </indexterm>
25065 </para>
25066 <informaltable frame="all">
25067 <tgroup cols="4" colsep="0" rowsep="0">
25068 <colspec colwidth="8*" align="left"/>
25069 <colspec colwidth="6*" align="center"/>
25070 <colspec colwidth="6*" align="center"/>
25071 <colspec colwidth="6*" align="right"/>
25072 <tbody>
25073 <row>
25074 <entry><option>queue_only_load</option></entry>
25075 <entry>Use: <emphasis>main</emphasis></entry>
25076 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25077 <entry>Default: <emphasis>unset</emphasis></entry>
25078 </row>
25079 </tbody>
25080 </tgroup>
25081 </informaltable>
25082 <para revisionflag="changed">
25083 <indexterm role="concept">
25084 <primary>load average</primary>
25085 </indexterm>
25086 <indexterm role="concept">
25087 <primary>queueing incoming messages</primary>
25088 </indexterm>
25089 <indexterm role="concept">
25090 <primary>message</primary>
25091 <secondary>queueing by load</secondary>
25092 </indexterm>
25093 If the system load average is higher than this value, incoming messages from
25094 all sources are queued, and no automatic deliveries are started. If this
25095 happens during local or remote SMTP input, all subsequent messages received on
25096 the same SMTP connection are queued by default, whatever happens to the load in
25097 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
25098 false.
25099 </para>
25100 <para>
25101 Deliveries will subsequently be performed by queue runner processes. This
25102 option has no effect on ancient operating systems on which Exim cannot
25103 determine the load average. See also <option>deliver_queue_load_max</option> and
25104 <option>smtp_load_reserve</option>.
25105 </para>
25106 <para revisionflag="changed">
25107 <indexterm role="option">
25108 <primary><option>queue_only_load_latch</option></primary>
25109 </indexterm>
25110 </para>
25111 <informaltable frame="all" revisionflag="changed">
25112 <tgroup cols="4" colsep="0" rowsep="0">
25113 <colspec colwidth="8*" align="left"/>
25114 <colspec colwidth="6*" align="center"/>
25115 <colspec colwidth="6*" align="center"/>
25116 <colspec colwidth="6*" align="right"/>
25117 <tbody>
25118 <row>
25119 <entry><option>queue_only_load_latch</option></entry>
25120 <entry>Use: <emphasis>main</emphasis></entry>
25121 <entry>Type: <emphasis>boolean</emphasis></entry>
25122 <entry>Default: <emphasis>true</emphasis></entry>
25123 </row>
25124 </tbody>
25125 </tgroup>
25126 </informaltable>
25127 <para revisionflag="changed">
25128 <indexterm role="concept">
25129 <primary>load average</primary>
25130 <secondary>re-evaluating per message</secondary>
25131 </indexterm>
25132 When this option is true (the default), once one message has been queued
25133 because the load average is higher than the value set by <option>queue_only_load</option>,
25134 all subsequent messages received on the same SMTP connection are also queued.
25135 This is a deliberate choice; even though the load average may fall below the
25136 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
25137 connection when not delivering earlier ones. However, there are special
25138 circumstances such as very long-lived connections from scanning appliances
25139 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
25140 should be set false. This causes the value of the load average to be
25141 re-evaluated for each message.
25142 </para>
25143 <para>
25144 <indexterm role="option">
25145 <primary><option>queue_only_override</option></primary>
25146 </indexterm>
25147 </para>
25148 <informaltable frame="all">
25149 <tgroup cols="4" colsep="0" rowsep="0">
25150 <colspec colwidth="8*" align="left"/>
25151 <colspec colwidth="6*" align="center"/>
25152 <colspec colwidth="6*" align="center"/>
25153 <colspec colwidth="6*" align="right"/>
25154 <tbody>
25155 <row>
25156 <entry><option>queue_only_override</option></entry>
25157 <entry>Use: <emphasis>main</emphasis></entry>
25158 <entry>Type: <emphasis>boolean</emphasis></entry>
25159 <entry>Default: <emphasis>true</emphasis></entry>
25160 </row>
25161 </tbody>
25162 </tgroup>
25163 </informaltable>
25164 <para>
25165 <indexterm role="concept">
25166 <primary>queueing incoming messages</primary>
25167 </indexterm>
25168 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
25169 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
25170 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
25171 to override; they are accepted, but ignored.
25172 </para>
25173 <para>
25174 <indexterm role="option">
25175 <primary><option>queue_run_in_order</option></primary>
25176 </indexterm>
25177 </para>
25178 <informaltable frame="all">
25179 <tgroup cols="4" colsep="0" rowsep="0">
25180 <colspec colwidth="8*" align="left"/>
25181 <colspec colwidth="6*" align="center"/>
25182 <colspec colwidth="6*" align="center"/>
25183 <colspec colwidth="6*" align="right"/>
25184 <tbody>
25185 <row>
25186 <entry><option>queue_run_in_order</option></entry>
25187 <entry>Use: <emphasis>main</emphasis></entry>
25188 <entry>Type: <emphasis>boolean</emphasis></entry>
25189 <entry>Default: <emphasis>false</emphasis></entry>
25190 </row>
25191 </tbody>
25192 </tgroup>
25193 </informaltable>
25194 <para>
25195 <indexterm role="concept">
25196 <primary>queue runner</primary>
25197 <secondary>processing messages in order</secondary>
25198 </indexterm>
25199 If this option is set, queue runs happen in order of message arrival instead of
25200 in an arbitrary order. For this to happen, a complete list of the entire queue
25201 must be set up before the deliveries start. When the queue is all held in a
25202 single directory (the default), a single list is created for both the ordered
25203 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
25204 single list is not created when <option>queue_run_in_order</option> is false. In this case,
25205 the sub-directories are processed one at a time (in a random order), and this
25206 avoids setting up one huge list for the whole queue. Thus, setting
25207 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
25208 when the queue is large, because of the extra work in setting up the single,
25209 large list. In most situations, <option>queue_run_in_order</option> should not be set.
25210 </para>
25211 <para>
25212 <indexterm role="option">
25213 <primary><option>queue_run_max</option></primary>
25214 </indexterm>
25215 </para>
25216 <informaltable frame="all">
25217 <tgroup cols="4" colsep="0" rowsep="0">
25218 <colspec colwidth="8*" align="left"/>
25219 <colspec colwidth="6*" align="center"/>
25220 <colspec colwidth="6*" align="center"/>
25221 <colspec colwidth="6*" align="right"/>
25222 <tbody>
25223 <row>
25224 <entry><option>queue_run_max</option></entry>
25225 <entry>Use: <emphasis>main</emphasis></entry>
25226 <entry>Type: <emphasis>integer</emphasis></entry>
25227 <entry>Default: <emphasis>5</emphasis></entry>
25228 </row>
25229 </tbody>
25230 </tgroup>
25231 </informaltable>
25232 <para>
25233 <indexterm role="concept">
25234 <primary>queue runner</primary>
25235 <secondary>maximum number of</secondary>
25236 </indexterm>
25237 This controls the maximum number of queue runner processes that an Exim daemon
25238 can run simultaneously. This does not mean that it starts them all at once,
25239 but rather that if the maximum number are still running when the time comes to
25240 start another one, it refrains from starting another one. This can happen with
25241 very large queues and/or very sluggish deliveries. This option does not,
25242 however, interlock with other processes, so additional queue runners can be
25243 started by other means, or by killing and restarting the daemon.
25244 </para>
25245 <para>
25246 Setting this option to zero does not suppress queue runs; rather, it disables
25247 the limit, allowing any number of simultaneous queue runner processes to be
25248 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
25249 the daemon&#x2019;s command line.
25250 </para>
25251 <para>
25252 <indexterm role="option">
25253 <primary><option>queue_smtp_domains</option></primary>
25254 </indexterm>
25255 </para>
25256 <informaltable frame="all">
25257 <tgroup cols="4" colsep="0" rowsep="0">
25258 <colspec colwidth="8*" align="left"/>
25259 <colspec colwidth="6*" align="center"/>
25260 <colspec colwidth="6*" align="center"/>
25261 <colspec colwidth="6*" align="right"/>
25262 <tbody>
25263 <row>
25264 <entry><option>queue_smtp_domains</option></entry>
25265 <entry>Use: <emphasis>main</emphasis></entry>
25266 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25267 <entry>Default: <emphasis>unset</emphasis></entry>
25268 </row>
25269 </tbody>
25270 </tgroup>
25271 </informaltable>
25272 <para>
25273 <indexterm role="concept">
25274 <primary>queueing incoming messages</primary>
25275 </indexterm>
25276 <indexterm role="concept">
25277 <primary>message</primary>
25278 <secondary>queueing remote deliveries</secondary>
25279 </indexterm>
25280 When this option is set, a delivery process is started whenever a message is
25281 received, routing is performed, and local deliveries take place.
25282 However, if any SMTP deliveries are required for domains that match
25283 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
25284 message waits on the queue for the next queue run. Since routing of the message
25285 has taken place, Exim knows to which remote hosts it must be delivered, and so
25286 when the queue run happens, multiple messages for the same host are delivered
25287 over a single SMTP connection. The <option>-odqs</option> command line option causes all
25288 SMTP deliveries to be queued in this way, and is equivalent to setting
25289 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
25290 <option>queue_domains</option>.
25291 </para>
25292 <para>
25293 <indexterm role="option">
25294 <primary><option>receive_timeout</option></primary>
25295 </indexterm>
25296 </para>
25297 <informaltable frame="all">
25298 <tgroup cols="4" colsep="0" rowsep="0">
25299 <colspec colwidth="8*" align="left"/>
25300 <colspec colwidth="6*" align="center"/>
25301 <colspec colwidth="6*" align="center"/>
25302 <colspec colwidth="6*" align="right"/>
25303 <tbody>
25304 <row>
25305 <entry><option>receive_timeout</option></entry>
25306 <entry>Use: <emphasis>main</emphasis></entry>
25307 <entry>Type: <emphasis>time</emphasis></entry>
25308 <entry>Default: <emphasis>0s</emphasis></entry>
25309 </row>
25310 </tbody>
25311 </tgroup>
25312 </informaltable>
25313 <para>
25314 <indexterm role="concept">
25315 <primary>timeout</primary>
25316 <secondary>for non-SMTP input</secondary>
25317 </indexterm>
25318 This option sets the timeout for accepting a non-SMTP message, that is, the
25319 maximum time that Exim waits when reading a message on the standard input. If
25320 the value is zero, it will wait for ever. This setting is overridden by the
25321 <option>-or</option> command line option. The timeout for incoming SMTP messages is
25322 controlled by <option>smtp_receive_timeout</option>.
25323 </para>
25324 <para>
25325 <indexterm role="option">
25326 <primary><option>received_header_text</option></primary>
25327 </indexterm>
25328 </para>
25329 <informaltable frame="all">
25330 <tgroup cols="4" colsep="0" rowsep="0">
25331 <colspec colwidth="8*" align="left"/>
25332 <colspec colwidth="6*" align="center"/>
25333 <colspec colwidth="6*" align="center"/>
25334 <colspec colwidth="6*" align="right"/>
25335 <tbody>
25336 <row>
25337 <entry><option>received_header_text</option></entry>
25338 <entry>Use: <emphasis>main</emphasis></entry>
25339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25340 <entry>Default: <emphasis>see below</emphasis></entry>
25341 </row>
25342 </tbody>
25343 </tgroup>
25344 </informaltable>
25345 <para>
25346 <indexterm role="concept">
25347 <primary>customizing</primary>
25348 <secondary><emphasis>Received:</emphasis> header</secondary>
25349 </indexterm>
25350 <indexterm role="concept">
25351 <primary><emphasis>Received:</emphasis> header line</primary>
25352 <secondary>customizing</secondary>
25353 </indexterm>
25354 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
25355 added to each message, except for the timestamp, which is automatically added
25356 on at the end (preceded by a semicolon). The string is expanded each time it is
25357 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
25358 added to the message. Otherwise, the string should start with the text
25359 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
25360 header lines. The default setting is:
25361 </para>
25362 <literallayout class="monospaced">
25363 received_header_text = Received: \
25364   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
25365   {${if def:sender_ident \
25366   {from ${quote_local_part:$sender_ident} }}\
25367   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
25368   by $primary_hostname \
25369   ${if def:received_protocol {with $received_protocol}} \
25370   ${if def:tls_cipher {($tls_cipher)\n\t}}\
25371   (Exim $version_number)\n\t\
25372   ${if def:sender_address \
25373   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
25374   id $message_exim_id\
25375   ${if def:received_for {\n\tfor $received_for}}
25376 </literallayout>
25377 <para>
25378 The reference to the TLS cipher is omitted when Exim is built without TLS
25379 support. The use of conditional expansions ensures that this works for both
25380 locally generated messages and messages received from remote hosts, giving
25381 header lines such as the following:
25382 </para>
25383 <literallayout class="monospaced">
25384 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
25385 by marley.carol.example with esmtp (Exim 4.00)
25386 (envelope-from &lt;bob@carol.example&gt;)
25387 id 16IOWa-00019l-00
25388 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
25389 Received: by scrooge.carol.example with local (Exim 4.00)
25390 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
25391 </literallayout>
25392 <para>
25393 Until the body of the message has been received, the timestamp is the time when
25394 the message started to be received. Once the body has arrived, and all policy
25395 checks have taken place, the timestamp is updated to the time at which the
25396 message was accepted.
25397 </para>
25398 <para>
25399 <indexterm role="option">
25400 <primary><option>received_headers_max</option></primary>
25401 </indexterm>
25402 </para>
25403 <informaltable frame="all">
25404 <tgroup cols="4" colsep="0" rowsep="0">
25405 <colspec colwidth="8*" align="left"/>
25406 <colspec colwidth="6*" align="center"/>
25407 <colspec colwidth="6*" align="center"/>
25408 <colspec colwidth="6*" align="right"/>
25409 <tbody>
25410 <row>
25411 <entry><option>received_headers_max</option></entry>
25412 <entry>Use: <emphasis>main</emphasis></entry>
25413 <entry>Type: <emphasis>integer</emphasis></entry>
25414 <entry>Default: <emphasis>30</emphasis></entry>
25415 </row>
25416 </tbody>
25417 </tgroup>
25418 </informaltable>
25419 <para>
25420 <indexterm role="concept">
25421 <primary>loop</primary>
25422 <secondary>prevention</secondary>
25423 </indexterm>
25424 <indexterm role="concept">
25425 <primary>mail loop prevention</primary>
25426 </indexterm>
25427 <indexterm role="concept">
25428 <primary><emphasis>Received:</emphasis> header line</primary>
25429 <secondary>counting</secondary>
25430 </indexterm>
25431 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
25432 counted, and if it is greater than this parameter, a mail loop is assumed to
25433 have occurred, the delivery is abandoned, and an error message is generated.
25434 This applies to both local and remote deliveries.
25435 </para>
25436 <para>
25437 <indexterm role="option">
25438 <primary><option>recipient_unqualified_hosts</option></primary>
25439 </indexterm>
25440 </para>
25441 <informaltable frame="all">
25442 <tgroup cols="4" colsep="0" rowsep="0">
25443 <colspec colwidth="8*" align="left"/>
25444 <colspec colwidth="6*" align="center"/>
25445 <colspec colwidth="6*" align="center"/>
25446 <colspec colwidth="6*" align="right"/>
25447 <tbody>
25448 <row>
25449 <entry><option>recipient_unqualified_hosts</option></entry>
25450 <entry>Use: <emphasis>main</emphasis></entry>
25451 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25452 <entry>Default: <emphasis>unset</emphasis></entry>
25453 </row>
25454 </tbody>
25455 </tgroup>
25456 </informaltable>
25457 <para>
25458 <indexterm role="concept">
25459 <primary>unqualified addresses</primary>
25460 </indexterm>
25461 <indexterm role="concept">
25462 <primary>host</primary>
25463 <secondary>unqualified addresses from</secondary>
25464 </indexterm>
25465 This option lists those hosts from which Exim is prepared to accept unqualified
25466 recipient addresses in message envelopes. The addresses are made fully
25467 qualified by the addition of the <option>qualify_recipient</option> value. This option also
25468 affects message header lines. Exim does not reject unqualified recipient
25469 addresses in headers, but it qualifies them only if the message came from a
25470 host that matches <option>recipient_unqualified_hosts</option>,
25471 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
25472 option was not set.
25473 </para>
25474 <para>
25475 <indexterm role="option">
25476 <primary><option>recipients_max</option></primary>
25477 </indexterm>
25478 </para>
25479 <informaltable frame="all">
25480 <tgroup cols="4" colsep="0" rowsep="0">
25481 <colspec colwidth="8*" align="left"/>
25482 <colspec colwidth="6*" align="center"/>
25483 <colspec colwidth="6*" align="center"/>
25484 <colspec colwidth="6*" align="right"/>
25485 <tbody>
25486 <row>
25487 <entry><option>recipients_max</option></entry>
25488 <entry>Use: <emphasis>main</emphasis></entry>
25489 <entry>Type: <emphasis>integer</emphasis></entry>
25490 <entry>Default: <emphasis>0</emphasis></entry>
25491 </row>
25492 </tbody>
25493 </tgroup>
25494 </informaltable>
25495 <para>
25496 <indexterm role="concept">
25497 <primary>limit</primary>
25498 <secondary>number of recipients</secondary>
25499 </indexterm>
25500 <indexterm role="concept">
25501 <primary>recipient</primary>
25502 <secondary>maximum number</secondary>
25503 </indexterm>
25504 If this option is set greater than zero, it specifies the maximum number of
25505 original recipients for any message. Additional recipients that are generated
25506 by aliasing or forwarding do not count. SMTP messages get a 452 response for
25507 all recipients over the limit; earlier recipients are delivered as normal.
25508 Non-SMTP messages with too many recipients are failed, and no deliveries are
25509 done.
25510 </para>
25511 <para>
25512 <indexterm role="concept">
25513 <primary>RCPT</primary>
25514 <secondary>maximum number of incoming</secondary>
25515 </indexterm>
25516 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
25517 RCPT commands in a single message.
25518 </para>
25519 <para>
25520 <indexterm role="option">
25521 <primary><option>recipients_max_reject</option></primary>
25522 </indexterm>
25523 </para>
25524 <informaltable frame="all">
25525 <tgroup cols="4" colsep="0" rowsep="0">
25526 <colspec colwidth="8*" align="left"/>
25527 <colspec colwidth="6*" align="center"/>
25528 <colspec colwidth="6*" align="center"/>
25529 <colspec colwidth="6*" align="right"/>
25530 <tbody>
25531 <row>
25532 <entry><option>recipients_max_reject</option></entry>
25533 <entry>Use: <emphasis>main</emphasis></entry>
25534 <entry>Type: <emphasis>boolean</emphasis></entry>
25535 <entry>Default: <emphasis>false</emphasis></entry>
25536 </row>
25537 </tbody>
25538 </tgroup>
25539 </informaltable>
25540 <para>
25541 If this option is set true, Exim rejects SMTP messages containing too many
25542 recipients by giving 552 errors to the surplus RCPT commands, and a 554
25543 error to the eventual DATA command. Otherwise (the default) it gives a 452
25544 error to the surplus RCPT commands and accepts the message on behalf of the
25545 initial set of recipients. The remote server should then re-send the message
25546 for the remaining recipients at a later time.
25547 </para>
25548 <para>
25549 <indexterm role="option">
25550 <primary><option>remote_max_parallel</option></primary>
25551 </indexterm>
25552 </para>
25553 <informaltable frame="all">
25554 <tgroup cols="4" colsep="0" rowsep="0">
25555 <colspec colwidth="8*" align="left"/>
25556 <colspec colwidth="6*" align="center"/>
25557 <colspec colwidth="6*" align="center"/>
25558 <colspec colwidth="6*" align="right"/>
25559 <tbody>
25560 <row>
25561 <entry><option>remote_max_parallel</option></entry>
25562 <entry>Use: <emphasis>main</emphasis></entry>
25563 <entry>Type: <emphasis>integer</emphasis></entry>
25564 <entry>Default: <emphasis>2</emphasis></entry>
25565 </row>
25566 </tbody>
25567 </tgroup>
25568 </informaltable>
25569 <para>
25570 <indexterm role="concept">
25571 <primary>delivery</primary>
25572 <secondary>parallelism for remote</secondary>
25573 </indexterm>
25574 This option controls parallel delivery of one message to a number of remote
25575 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
25576 does all the remote deliveries for a message one by one. Otherwise, if a single
25577 message has to be delivered to more than one remote host, or if several copies
25578 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
25579 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
25580 deliveries are required, the maximum number of processes are started, and as
25581 each one finishes, another is begun. The order of starting processes is the
25582 same as if sequential delivery were being done, and can be controlled by the
25583 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
25584 with debugging turned on, the debugging output from each delivery process is
25585 tagged with its process id.
25586 </para>
25587 <para>
25588 This option controls only the maximum number of parallel deliveries for one
25589 message in one Exim delivery process. Because Exim has no central queue
25590 manager, there is no way of controlling the total number of simultaneous
25591 deliveries if the configuration allows a delivery attempt as soon as a message
25592 is received.
25593 </para>
25594 <para>
25595 <indexterm role="concept">
25596 <primary>number of deliveries</primary>
25597 </indexterm>
25598 <indexterm role="concept">
25599 <primary>delivery</primary>
25600 <secondary>maximum number of</secondary>
25601 </indexterm>
25602 If you want to control the total number of deliveries on the system, you
25603 need to set the <option>queue_only</option> option. This ensures that all incoming messages
25604 are added to the queue without starting a delivery process. Then set up an Exim
25605 daemon to start queue runner processes at appropriate intervals (probably
25606 fairly often, for example, every minute), and limit the total number of queue
25607 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
25608 delivers only one message at a time, the maximum number of deliveries that can
25609 then take place at once is <option>queue_run_max</option> multiplied by
25610 <option>remote_max_parallel</option>.
25611 </para>
25612 <para>
25613 If it is purely remote deliveries you want to control, use
25614 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
25615 doing the SMTP routing before queueing, so that several messages for the same
25616 host will eventually get delivered down the same connection.
25617 </para>
25618 <para>
25619 <indexterm role="option">
25620 <primary><option>remote_sort_domains</option></primary>
25621 </indexterm>
25622 </para>
25623 <informaltable frame="all">
25624 <tgroup cols="4" colsep="0" rowsep="0">
25625 <colspec colwidth="8*" align="left"/>
25626 <colspec colwidth="6*" align="center"/>
25627 <colspec colwidth="6*" align="center"/>
25628 <colspec colwidth="6*" align="right"/>
25629 <tbody>
25630 <row>
25631 <entry><option>remote_sort_domains</option></entry>
25632 <entry>Use: <emphasis>main</emphasis></entry>
25633 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25634 <entry>Default: <emphasis>unset</emphasis></entry>
25635 </row>
25636 </tbody>
25637 </tgroup>
25638 </informaltable>
25639 <para>
25640 <indexterm role="concept">
25641 <primary>sorting remote deliveries</primary>
25642 </indexterm>
25643 <indexterm role="concept">
25644 <primary>delivery</primary>
25645 <secondary>sorting remote</secondary>
25646 </indexterm>
25647 When there are a number of remote deliveries for a message, they are sorted by
25648 domain into the order given by this list. For example,
25649 </para>
25650 <literallayout class="monospaced">
25651 remote_sort_domains = *.cam.ac.uk:*.uk
25652 </literallayout>
25653 <para>
25654 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
25655 then to those in the <option>uk</option> domain, then to any others.
25656 </para>
25657 <para>
25658 <indexterm role="option">
25659 <primary><option>retry_data_expire</option></primary>
25660 </indexterm>
25661 </para>
25662 <informaltable frame="all">
25663 <tgroup cols="4" colsep="0" rowsep="0">
25664 <colspec colwidth="8*" align="left"/>
25665 <colspec colwidth="6*" align="center"/>
25666 <colspec colwidth="6*" align="center"/>
25667 <colspec colwidth="6*" align="right"/>
25668 <tbody>
25669 <row>
25670 <entry><option>retry_data_expire</option></entry>
25671 <entry>Use: <emphasis>main</emphasis></entry>
25672 <entry>Type: <emphasis>time</emphasis></entry>
25673 <entry>Default: <emphasis>7d</emphasis></entry>
25674 </row>
25675 </tbody>
25676 </tgroup>
25677 </informaltable>
25678 <para>
25679 <indexterm role="concept">
25680 <primary>hints database</primary>
25681 <secondary>data expiry</secondary>
25682 </indexterm>
25683 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
25684 database. Any older retry data is ignored. This means that, for example, once a
25685 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
25686 past failures.
25687 </para>
25688 <para>
25689 <indexterm role="option">
25690 <primary><option>retry_interval_max</option></primary>
25691 </indexterm>
25692 </para>
25693 <informaltable frame="all">
25694 <tgroup cols="4" colsep="0" rowsep="0">
25695 <colspec colwidth="8*" align="left"/>
25696 <colspec colwidth="6*" align="center"/>
25697 <colspec colwidth="6*" align="center"/>
25698 <colspec colwidth="6*" align="right"/>
25699 <tbody>
25700 <row>
25701 <entry><option>retry_interval_max</option></entry>
25702 <entry>Use: <emphasis>main</emphasis></entry>
25703 <entry>Type: <emphasis>time</emphasis></entry>
25704 <entry>Default: <emphasis>24h</emphasis></entry>
25705 </row>
25706 </tbody>
25707 </tgroup>
25708 </informaltable>
25709 <para>
25710 <indexterm role="concept">
25711 <primary>retry</primary>
25712 <secondary>limit on interval</secondary>
25713 </indexterm>
25714 <indexterm role="concept">
25715 <primary>limit</primary>
25716 <secondary>on retry interval</secondary>
25717 </indexterm>
25718 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
25719 intervals between delivery attempts for messages that cannot be delivered
25720 straight away. This option sets an overall limit to the length of time between
25721 retries. It cannot be set greater than 24 hours; any attempt to do so forces
25722 the default value.
25723 </para>
25724 <para>
25725 <indexterm role="option">
25726 <primary><option>return_path_remove</option></primary>
25727 </indexterm>
25728 </para>
25729 <informaltable frame="all">
25730 <tgroup cols="4" colsep="0" rowsep="0">
25731 <colspec colwidth="8*" align="left"/>
25732 <colspec colwidth="6*" align="center"/>
25733 <colspec colwidth="6*" align="center"/>
25734 <colspec colwidth="6*" align="right"/>
25735 <tbody>
25736 <row>
25737 <entry><option>return_path_remove</option></entry>
25738 <entry>Use: <emphasis>main</emphasis></entry>
25739 <entry>Type: <emphasis>boolean</emphasis></entry>
25740 <entry>Default: <emphasis>true</emphasis></entry>
25741 </row>
25742 </tbody>
25743 </tgroup>
25744 </informaltable>
25745 <para>
25746 <indexterm role="concept">
25747 <primary><emphasis>Return-path:</emphasis> header line</primary>
25748 <secondary>removing</secondary>
25749 </indexterm>
25750 RFC 2821, section 4.4, states that an SMTP server must insert a
25751 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
25752 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
25753 MAIL command. This description implies that this header should not be present
25754 in an incoming message. If <option>return_path_remove</option> is true, any existing
25755 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
25756 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
25757 the time of delivery. They are normally used only for final local deliveries.
25758 </para>
25759 <para>
25760 <indexterm role="option">
25761 <primary><option>return_size_limit</option></primary>
25762 </indexterm>
25763 </para>
25764 <informaltable frame="all">
25765 <tgroup cols="4" colsep="0" rowsep="0">
25766 <colspec colwidth="8*" align="left"/>
25767 <colspec colwidth="6*" align="center"/>
25768 <colspec colwidth="6*" align="center"/>
25769 <colspec colwidth="6*" align="right"/>
25770 <tbody>
25771 <row>
25772 <entry><option>return_size_limit</option></entry>
25773 <entry>Use: <emphasis>main</emphasis></entry>
25774 <entry>Type: <emphasis>integer</emphasis></entry>
25775 <entry>Default: <emphasis>100K</emphasis></entry>
25776 </row>
25777 </tbody>
25778 </tgroup>
25779 </informaltable>
25780 <para>
25781 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
25782 </para>
25783 <para>
25784 <indexterm role="option">
25785 <primary><option>rfc1413_hosts</option></primary>
25786 </indexterm>
25787 </para>
25788 <informaltable frame="all">
25789 <tgroup cols="4" colsep="0" rowsep="0">
25790 <colspec colwidth="8*" align="left"/>
25791 <colspec colwidth="6*" align="center"/>
25792 <colspec colwidth="6*" align="center"/>
25793 <colspec colwidth="6*" align="right"/>
25794 <tbody>
25795 <row>
25796 <entry><option>rfc1413_hosts</option></entry>
25797 <entry>Use: <emphasis>main</emphasis></entry>
25798 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25799 <entry>Default: <emphasis>*</emphasis></entry>
25800 </row>
25801 </tbody>
25802 </tgroup>
25803 </informaltable>
25804 <para>
25805 <indexterm role="concept">
25806 <primary>RFC 1413</primary>
25807 </indexterm>
25808 <indexterm role="concept">
25809 <primary>host</primary>
25810 <secondary>for RFC 1413 calls</secondary>
25811 </indexterm>
25812 RFC 1413 identification calls are made to any client host which matches an item
25813 in the list.
25814 </para>
25815 <para>
25816 <indexterm role="option">
25817 <primary><option>rfc1413_query_timeout</option></primary>
25818 </indexterm>
25819 </para>
25820 <informaltable frame="all">
25821 <tgroup cols="4" colsep="0" rowsep="0">
25822 <colspec colwidth="8*" align="left"/>
25823 <colspec colwidth="6*" align="center"/>
25824 <colspec colwidth="6*" align="center"/>
25825 <colspec colwidth="6*" align="right"/>
25826 <tbody>
25827 <row>
25828 <entry><option>rfc1413_query_timeout</option></entry>
25829 <entry>Use: <emphasis>main</emphasis></entry>
25830 <entry>Type: <emphasis>time</emphasis></entry>
25831 <entry>Default: <emphasis>5s</emphasis></entry>
25832 </row>
25833 </tbody>
25834 </tgroup>
25835 </informaltable>
25836 <para>
25837 <indexterm role="concept">
25838 <primary>RFC 1413</primary>
25839 <secondary>query timeout</secondary>
25840 </indexterm>
25841 <indexterm role="concept">
25842 <primary>timeout</primary>
25843 <secondary>for RFC 1413 call</secondary>
25844 </indexterm>
25845 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
25846 no RFC 1413 calls are ever made.
25847 </para>
25848 <para>
25849 <indexterm role="option">
25850 <primary><option>sender_unqualified_hosts</option></primary>
25851 </indexterm>
25852 </para>
25853 <informaltable frame="all">
25854 <tgroup cols="4" colsep="0" rowsep="0">
25855 <colspec colwidth="8*" align="left"/>
25856 <colspec colwidth="6*" align="center"/>
25857 <colspec colwidth="6*" align="center"/>
25858 <colspec colwidth="6*" align="right"/>
25859 <tbody>
25860 <row>
25861 <entry><option>sender_unqualified_hosts</option></entry>
25862 <entry>Use: <emphasis>main</emphasis></entry>
25863 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25864 <entry>Default: <emphasis>unset</emphasis></entry>
25865 </row>
25866 </tbody>
25867 </tgroup>
25868 </informaltable>
25869 <para>
25870 <indexterm role="concept">
25871 <primary>unqualified addresses</primary>
25872 </indexterm>
25873 <indexterm role="concept">
25874 <primary>host</primary>
25875 <secondary>unqualified addresses from</secondary>
25876 </indexterm>
25877 This option lists those hosts from which Exim is prepared to accept unqualified
25878 sender addresses. The addresses are made fully qualified by the addition of
25879 <option>qualify_domain</option>. This option also affects message header lines. Exim does
25880 not reject unqualified addresses in headers that contain sender addresses, but
25881 it qualifies them only if the message came from a host that matches
25882 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
25883 using TCP/IP), and the <option>-bnq</option> option was not set.
25884 </para>
25885 <para>
25886 <indexterm role="option">
25887 <primary><option>smtp_accept_keepalive</option></primary>
25888 </indexterm>
25889 </para>
25890 <informaltable frame="all">
25891 <tgroup cols="4" colsep="0" rowsep="0">
25892 <colspec colwidth="8*" align="left"/>
25893 <colspec colwidth="6*" align="center"/>
25894 <colspec colwidth="6*" align="center"/>
25895 <colspec colwidth="6*" align="right"/>
25896 <tbody>
25897 <row>
25898 <entry><option>smtp_accept_keepalive</option></entry>
25899 <entry>Use: <emphasis>main</emphasis></entry>
25900 <entry>Type: <emphasis>boolean</emphasis></entry>
25901 <entry>Default: <emphasis>true</emphasis></entry>
25902 </row>
25903 </tbody>
25904 </tgroup>
25905 </informaltable>
25906 <para>
25907 <indexterm role="concept">
25908 <primary>keepalive</primary>
25909 <secondary>on incoming connection</secondary>
25910 </indexterm>
25911 This option controls the setting of the SO_KEEPALIVE option on incoming
25912 TCP/IP socket connections. When set, it causes the kernel to probe idle
25913 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
25914 other end of the connection should send an acknowledgment if the connection is
25915 still okay or a reset if the connection has been aborted. The reason for doing
25916 this is that it has the beneficial effect of freeing up certain types of
25917 connection that can get stuck when the remote host is disconnected without
25918 tidying up the TCP/IP call properly. The keepalive mechanism takes several
25919 hours to detect unreachable hosts.
25920 </para>
25921 <para>
25922 <indexterm role="option">
25923 <primary><option>smtp_accept_max</option></primary>
25924 </indexterm>
25925 </para>
25926 <informaltable frame="all">
25927 <tgroup cols="4" colsep="0" rowsep="0">
25928 <colspec colwidth="8*" align="left"/>
25929 <colspec colwidth="6*" align="center"/>
25930 <colspec colwidth="6*" align="center"/>
25931 <colspec colwidth="6*" align="right"/>
25932 <tbody>
25933 <row>
25934 <entry><option>smtp_accept_max</option></entry>
25935 <entry>Use: <emphasis>main</emphasis></entry>
25936 <entry>Type: <emphasis>integer</emphasis></entry>
25937 <entry>Default: <emphasis>20</emphasis></entry>
25938 </row>
25939 </tbody>
25940 </tgroup>
25941 </informaltable>
25942 <para>
25943 <indexterm role="concept">
25944 <primary>limit</primary>
25945 <secondary>incoming SMTP connections</secondary>
25946 </indexterm>
25947 <indexterm role="concept">
25948 <primary>SMTP</primary>
25949 <secondary>incoming connection count</secondary>
25950 </indexterm>
25951 <indexterm role="concept">
25952 <primary>inetd</primary>
25953 </indexterm>
25954 This option specifies the maximum number of simultaneous incoming SMTP calls
25955 that Exim will accept. It applies only to the listening daemon; there is no
25956 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
25957 value is set to zero, no limit is applied. However, it is required to be
25958 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
25959 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
25960 </para>
25961 <para>
25962 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
25963 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
25964 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
25965 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
25966 </para>
25967 <para>
25968 <indexterm role="option">
25969 <primary><option>smtp_accept_max_nonmail</option></primary>
25970 </indexterm>
25971 </para>
25972 <informaltable frame="all">
25973 <tgroup cols="4" colsep="0" rowsep="0">
25974 <colspec colwidth="8*" align="left"/>
25975 <colspec colwidth="6*" align="center"/>
25976 <colspec colwidth="6*" align="center"/>
25977 <colspec colwidth="6*" align="right"/>
25978 <tbody>
25979 <row>
25980 <entry><option>smtp_accept_max_nonmail</option></entry>
25981 <entry>Use: <emphasis>main</emphasis></entry>
25982 <entry>Type: <emphasis>integer</emphasis></entry>
25983 <entry>Default: <emphasis>10</emphasis></entry>
25984 </row>
25985 </tbody>
25986 </tgroup>
25987 </informaltable>
25988 <para>
25989 <indexterm role="concept">
25990 <primary>limit</primary>
25991 <secondary>non-mail SMTP commands</secondary>
25992 </indexterm>
25993 <indexterm role="concept">
25994 <primary>SMTP</primary>
25995 <secondary>limiting non-mail commands</secondary>
25996 </indexterm>
25997 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
25998 the connection if there are too many. This option defines <quote>too many</quote>. The
25999 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26000 client looping sending EHLO, for example. The check is applied only if the
26001 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26002 </para>
26003 <para>
26004 When a new message is expected, one occurrence of RSET is not counted. This
26005 allows a client to send one RSET between messages (this is not necessary,
26006 but some clients do it). Exim also allows one uncounted occurrence of HELO
26007 or EHLO, and one occurrence of STARTTLS between messages. After
26008 starting up a TLS session, another EHLO is expected, and so it too is not
26009 counted. The first occurrence of AUTH in a connection, or immediately
26010 following STARTTLS is not counted. Otherwise, all commands other than
26011 MAIL, RCPT, DATA, and QUIT are counted.
26012 </para>
26013 <para>
26014 <indexterm role="option">
26015 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26016 </indexterm>
26017 </para>
26018 <informaltable frame="all">
26019 <tgroup cols="4" colsep="0" rowsep="0">
26020 <colspec colwidth="8*" align="left"/>
26021 <colspec colwidth="6*" align="center"/>
26022 <colspec colwidth="6*" align="center"/>
26023 <colspec colwidth="6*" align="right"/>
26024 <tbody>
26025 <row>
26026 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26027 <entry>Use: <emphasis>main</emphasis></entry>
26028 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26029 <entry>Default: <emphasis>*</emphasis></entry>
26030 </row>
26031 </tbody>
26032 </tgroup>
26033 </informaltable>
26034 <para>
26035 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26036 check by setting this option. The default value makes it apply to all hosts. By
26037 changing the value, you can exclude any badly-behaved hosts that you have to
26038 live with.
26039 </para>
26040 <para>
26041 <indexterm role="option">
26042 <primary><option>smtp_accept_max_per_connection</option></primary>
26043 </indexterm>
26044 </para>
26045 <informaltable frame="all">
26046 <tgroup cols="4" colsep="0" rowsep="0">
26047 <colspec colwidth="8*" align="left"/>
26048 <colspec colwidth="6*" align="center"/>
26049 <colspec colwidth="6*" align="center"/>
26050 <colspec colwidth="6*" align="right"/>
26051 <tbody>
26052 <row>
26053 <entry><option>smtp_accept_max_per_ &nbsp;&nbsp;connection</option></entry>
26054 <entry>Use: <emphasis>main</emphasis></entry>
26055 <entry>Type: <emphasis>integer</emphasis></entry>
26056 <entry>Default: <emphasis>1000</emphasis></entry>
26057 </row>
26058 </tbody>
26059 </tgroup>
26060 </informaltable>
26061 <para>
26062 <indexterm role="concept">
26063 <primary>SMTP</primary>
26064 <secondary>limiting incoming message count</secondary>
26065 </indexterm>
26066 <indexterm role="concept">
26067 <primary>limit</primary>
26068 <secondary>messages per SMTP connection</secondary>
26069 </indexterm>
26070 The value of this option limits the number of MAIL commands that Exim is
26071 prepared to accept over a single SMTP connection, whether or not each command
26072 results in the transfer of a message. After the limit is reached, a 421
26073 response is given to subsequent MAIL commands. This limit is a safety
26074 precaution against a client that goes mad (incidents of this type have been
26075 seen).
26076 </para>
26077 <para>
26078 <indexterm role="option">
26079 <primary><option>smtp_accept_max_per_host</option></primary>
26080 </indexterm>
26081 </para>
26082 <informaltable frame="all">
26083 <tgroup cols="4" colsep="0" rowsep="0">
26084 <colspec colwidth="8*" align="left"/>
26085 <colspec colwidth="6*" align="center"/>
26086 <colspec colwidth="6*" align="center"/>
26087 <colspec colwidth="6*" align="right"/>
26088 <tbody>
26089 <row>
26090 <entry><option>smtp_accept_max_per_host</option></entry>
26091 <entry>Use: <emphasis>main</emphasis></entry>
26092 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26093 <entry>Default: <emphasis>unset</emphasis></entry>
26094 </row>
26095 </tbody>
26096 </tgroup>
26097 </informaltable>
26098 <para>
26099 <indexterm role="concept">
26100 <primary>limit</primary>
26101 <secondary>SMTP connections from one host</secondary>
26102 </indexterm>
26103 <indexterm role="concept">
26104 <primary>host</primary>
26105 <secondary>limiting SMTP connections from</secondary>
26106 </indexterm>
26107 This option restricts the number of simultaneous IP connections from a single
26108 host (strictly, from a single IP address) to the Exim daemon. The option is
26109 expanded, to enable different limits to be applied to different hosts by
26110 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
26111 connection attempts from the same host are rejected with error code 421. This
26112 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
26113 of zero imposes no limit. If this option is set greater than zero, it is
26114 required that <option>smtp_accept_max</option> be non-zero.
26115 </para>
26116 <para>
26117 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
26118 constructions that take an appreciable amount of time. The expansion and test
26119 happen in the main daemon loop, in order to reject additional connections
26120 without forking additional processes (otherwise a denial-of-service attack
26121 could cause a vast number or processes to be created). While the daemon is
26122 doing this processing, it cannot accept any other incoming connections.
26123 </para>
26124 <para>
26125 <indexterm role="option">
26126 <primary><option>smtp_accept_queue</option></primary>
26127 </indexterm>
26128 </para>
26129 <informaltable frame="all">
26130 <tgroup cols="4" colsep="0" rowsep="0">
26131 <colspec colwidth="8*" align="left"/>
26132 <colspec colwidth="6*" align="center"/>
26133 <colspec colwidth="6*" align="center"/>
26134 <colspec colwidth="6*" align="right"/>
26135 <tbody>
26136 <row>
26137 <entry><option>smtp_accept_queue</option></entry>
26138 <entry>Use: <emphasis>main</emphasis></entry>
26139 <entry>Type: <emphasis>integer</emphasis></entry>
26140 <entry>Default: <emphasis>0</emphasis></entry>
26141 </row>
26142 </tbody>
26143 </tgroup>
26144 </informaltable>
26145 <para revisionflag="changed">
26146 <indexterm role="concept">
26147 <primary>SMTP</primary>
26148 <secondary>incoming connection count</secondary>
26149 </indexterm>
26150 <indexterm role="concept">
26151 <primary>queueing incoming messages</primary>
26152 </indexterm>
26153 <indexterm role="concept">
26154 <primary>message</primary>
26155 <secondary>queueing by SMTP connection count</secondary>
26156 </indexterm>
26157 If the number of simultaneous incoming SMTP connections being handled via the
26158 listening daemon exceeds this value, messages received by SMTP are just placed
26159 on the queue; no delivery processes are started automatically. The count is
26160 fixed at the start of an SMTP connection. It cannot be updated in the
26161 subprocess that receives messages, and so the queueing or not queueing applies
26162 to all messages received in the same connection.
26163 </para>
26164 <para>
26165 A value of zero implies no limit, and clearly any non-zero value is useful only
26166 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
26167 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
26168 various <option>-od</option><emphasis>x</emphasis> command line options.
26169 </para>
26170 <para>
26171 <indexterm role="option">
26172 <primary><option>smtp_accept_queue_per_connection</option></primary>
26173 </indexterm>
26174 </para>
26175 <informaltable frame="all">
26176 <tgroup cols="4" colsep="0" rowsep="0">
26177 <colspec colwidth="8*" align="left"/>
26178 <colspec colwidth="6*" align="center"/>
26179 <colspec colwidth="6*" align="center"/>
26180 <colspec colwidth="6*" align="right"/>
26181 <tbody>
26182 <row>
26183 <entry><option>smtp_accept_queue_per_ &nbsp;&nbsp;connection</option></entry>
26184 <entry>Use: <emphasis>main</emphasis></entry>
26185 <entry>Type: <emphasis>integer</emphasis></entry>
26186 <entry>Default: <emphasis>10</emphasis></entry>
26187 </row>
26188 </tbody>
26189 </tgroup>
26190 </informaltable>
26191 <para>
26192 <indexterm role="concept">
26193 <primary>queueing incoming messages</primary>
26194 </indexterm>
26195 <indexterm role="concept">
26196 <primary>message</primary>
26197 <secondary>queueing by message count</secondary>
26198 </indexterm>
26199 This option limits the number of delivery processes that Exim starts
26200 automatically when receiving messages via SMTP, whether via the daemon or by
26201 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
26202 and the number of messages received in a single SMTP session exceeds this
26203 number, subsequent messages are placed on the queue, but no delivery processes
26204 are started. This helps to limit the number of Exim processes when a server
26205 restarts after downtime and there is a lot of mail waiting for it on other
26206 systems. On large systems, the default should probably be increased, and on
26207 dial-in client systems it should probably be set to zero (that is, disabled).
26208 </para>
26209 <para>
26210 <indexterm role="option">
26211 <primary><option>smtp_accept_reserve</option></primary>
26212 </indexterm>
26213 </para>
26214 <informaltable frame="all">
26215 <tgroup cols="4" colsep="0" rowsep="0">
26216 <colspec colwidth="8*" align="left"/>
26217 <colspec colwidth="6*" align="center"/>
26218 <colspec colwidth="6*" align="center"/>
26219 <colspec colwidth="6*" align="right"/>
26220 <tbody>
26221 <row>
26222 <entry><option>smtp_accept_reserve</option></entry>
26223 <entry>Use: <emphasis>main</emphasis></entry>
26224 <entry>Type: <emphasis>integer</emphasis></entry>
26225 <entry>Default: <emphasis>0</emphasis></entry>
26226 </row>
26227 </tbody>
26228 </tgroup>
26229 </informaltable>
26230 <para>
26231 <indexterm role="concept">
26232 <primary>SMTP</primary>
26233 <secondary>incoming call count</secondary>
26234 </indexterm>
26235 <indexterm role="concept">
26236 <primary>host</primary>
26237 <secondary>reserved</secondary>
26238 </indexterm>
26239 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
26240 number of SMTP connections that are reserved for connections from the hosts
26241 that are specified in <option>smtp_reserve_hosts</option>. The value set in
26242 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
26243 restricted to this number of connections; the option specifies a minimum number
26244 of connection slots for them, not a maximum. It is a guarantee that this group
26245 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
26246 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
26247 individual host.
26248 </para>
26249 <para>
26250 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
26251 set to 5, once there are 45 active connections (from any hosts), new
26252 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
26253 provided the other criteria for acceptance are met.
26254 </para>
26255 <para>
26256 <indexterm role="option">
26257 <primary><option>smtp_active_hostname</option></primary>
26258 </indexterm>
26259 </para>
26260 <informaltable frame="all">
26261 <tgroup cols="4" colsep="0" rowsep="0">
26262 <colspec colwidth="8*" align="left"/>
26263 <colspec colwidth="6*" align="center"/>
26264 <colspec colwidth="6*" align="center"/>
26265 <colspec colwidth="6*" align="right"/>
26266 <tbody>
26267 <row>
26268 <entry><option>smtp_active_hostname</option></entry>
26269 <entry>Use: <emphasis>main</emphasis></entry>
26270 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26271 <entry>Default: <emphasis>unset</emphasis></entry>
26272 </row>
26273 </tbody>
26274 </tgroup>
26275 </informaltable>
26276 <para>
26277 <indexterm role="concept">
26278 <primary>host</primary>
26279 <secondary>name in SMTP responses</secondary>
26280 </indexterm>
26281 <indexterm role="concept">
26282 <primary>SMTP</primary>
26283 <secondary>host name in responses</secondary>
26284 </indexterm>
26285 <indexterm role="variable">
26286 <primary><varname>$primary_hostname</varname></primary>
26287 </indexterm>
26288 This option is provided for multi-homed servers that want to masquerade as
26289 several different hosts. At the start of an incoming SMTP connection, its value
26290 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
26291 responses. For example, it is used as domain name in the response to an
26292 incoming HELO or EHLO command.
26293 </para>
26294 <para>
26295 <indexterm role="variable">
26296 <primary><varname>$smtp_active_hostname</varname></primary>
26297 </indexterm>
26298 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
26299 is saved with any messages that are received. It is therefore available for use
26300 in routers and transports when the message is later delivered.
26301 </para>
26302 <para>
26303 If this option is unset, or if its expansion is forced to fail, or if the
26304 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
26305 used. Other expansion failures cause a message to be written to the main and
26306 panic logs, and the SMTP command receives a temporary error. Typically, the
26307 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
26308 For example:
26309 </para>
26310 <literallayout class="monospaced">
26311 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
26312   {cox.mydomain}{box.mydomain}}
26313 </literallayout>
26314 <para>
26315 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
26316 messages, it is also used as the default for HELO commands in callout
26317 verification if there is no remote transport from which to obtain a
26318 <option>helo_data</option> value.
26319 </para>
26320 <para>
26321 <indexterm role="option">
26322 <primary><option>smtp_banner</option></primary>
26323 </indexterm>
26324 </para>
26325 <informaltable frame="all">
26326 <tgroup cols="4" colsep="0" rowsep="0">
26327 <colspec colwidth="8*" align="left"/>
26328 <colspec colwidth="6*" align="center"/>
26329 <colspec colwidth="6*" align="center"/>
26330 <colspec colwidth="6*" align="right"/>
26331 <tbody>
26332 <row>
26333 <entry><option>smtp_banner</option></entry>
26334 <entry>Use: <emphasis>main</emphasis></entry>
26335 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26336 <entry>Default: <emphasis>see below</emphasis></entry>
26337 </row>
26338 </tbody>
26339 </tgroup>
26340 </informaltable>
26341 <para>
26342 <indexterm role="concept">
26343 <primary>SMTP</primary>
26344 <secondary>welcome banner</secondary>
26345 </indexterm>
26346 <indexterm role="concept">
26347 <primary>banner for SMTP</primary>
26348 </indexterm>
26349 <indexterm role="concept">
26350 <primary>welcome banner for SMTP</primary>
26351 </indexterm>
26352 <indexterm role="concept">
26353 <primary>customizing</primary>
26354 <secondary>SMTP banner</secondary>
26355 </indexterm>
26356 This string, which is expanded every time it is used, is output as the initial
26357 positive response to an SMTP connection. The default setting is:
26358 </para>
26359 <literallayout class="monospaced">
26360 smtp_banner = $smtp_active_hostname ESMTP Exim \
26361   $version_number $tod_full
26362 </literallayout>
26363 <para>
26364 Failure to expand the string causes a panic error. If you want to create a
26365 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
26366 appropriate points, but not at the end. Note that the 220 code is not included
26367 in this string. Exim adds it automatically (several times in the case of a
26368 multiline response).
26369 </para>
26370 <para>
26371 <indexterm role="option">
26372 <primary><option>smtp_check_spool_space</option></primary>
26373 </indexterm>
26374 </para>
26375 <informaltable frame="all">
26376 <tgroup cols="4" colsep="0" rowsep="0">
26377 <colspec colwidth="8*" align="left"/>
26378 <colspec colwidth="6*" align="center"/>
26379 <colspec colwidth="6*" align="center"/>
26380 <colspec colwidth="6*" align="right"/>
26381 <tbody>
26382 <row>
26383 <entry><option>smtp_check_spool_space</option></entry>
26384 <entry>Use: <emphasis>main</emphasis></entry>
26385 <entry>Type: <emphasis>boolean</emphasis></entry>
26386 <entry>Default: <emphasis>true</emphasis></entry>
26387 </row>
26388 </tbody>
26389 </tgroup>
26390 </informaltable>
26391 <para>
26392 <indexterm role="concept">
26393 <primary>checking disk space</primary>
26394 </indexterm>
26395 <indexterm role="concept">
26396 <primary>disk space, checking</primary>
26397 </indexterm>
26398 <indexterm role="concept">
26399 <primary>spool directory</primary>
26400 <secondary>checking space</secondary>
26401 </indexterm>
26402 When this option is set, if an incoming SMTP session encounters the SIZE
26403 option on a MAIL command, it checks that there is enough space in the
26404 spool directory&#x2019;s partition to accept a message of that size, while still
26405 leaving free the amount specified by <option>check_spool_space</option> (even if that value
26406 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
26407 </para>
26408 <para>
26409 <indexterm role="option">
26410 <primary><option>smtp_connect_backlog</option></primary>
26411 </indexterm>
26412 </para>
26413 <informaltable frame="all">
26414 <tgroup cols="4" colsep="0" rowsep="0">
26415 <colspec colwidth="8*" align="left"/>
26416 <colspec colwidth="6*" align="center"/>
26417 <colspec colwidth="6*" align="center"/>
26418 <colspec colwidth="6*" align="right"/>
26419 <tbody>
26420 <row>
26421 <entry><option>smtp_connect_backlog</option></entry>
26422 <entry>Use: <emphasis>main</emphasis></entry>
26423 <entry>Type: <emphasis>integer</emphasis></entry>
26424 <entry>Default: <emphasis>20</emphasis></entry>
26425 </row>
26426 </tbody>
26427 </tgroup>
26428 </informaltable>
26429 <para>
26430 <indexterm role="concept">
26431 <primary>connection backlog</primary>
26432 </indexterm>
26433 <indexterm role="concept">
26434 <primary>SMTP</primary>
26435 <secondary>connection backlog</secondary>
26436 </indexterm>
26437 <indexterm role="concept">
26438 <primary>backlog of connections</primary>
26439 </indexterm>
26440 This option specifies a maximum number of waiting SMTP connections. Exim passes
26441 this value to the TCP/IP system when it sets up its listener. Once this number
26442 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
26443 attempts are refused at the TCP/IP level. At least, that is what the manuals
26444 say; in some circumstances such connection attempts have been observed to time
26445 out instead. For large systems it is probably a good idea to increase the
26446 value (to 50, say). It also gives some protection against denial-of-service
26447 attacks by SYN flooding.
26448 </para>
26449 <para>
26450 <indexterm role="option">
26451 <primary><option>smtp_enforce_sync</option></primary>
26452 </indexterm>
26453 </para>
26454 <informaltable frame="all">
26455 <tgroup cols="4" colsep="0" rowsep="0">
26456 <colspec colwidth="8*" align="left"/>
26457 <colspec colwidth="6*" align="center"/>
26458 <colspec colwidth="6*" align="center"/>
26459 <colspec colwidth="6*" align="right"/>
26460 <tbody>
26461 <row>
26462 <entry><option>smtp_enforce_sync</option></entry>
26463 <entry>Use: <emphasis>main</emphasis></entry>
26464 <entry>Type: <emphasis>boolean</emphasis></entry>
26465 <entry>Default: <emphasis>true</emphasis></entry>
26466 </row>
26467 </tbody>
26468 </tgroup>
26469 </informaltable>
26470 <para>
26471 <indexterm role="concept">
26472 <primary>SMTP</primary>
26473 <secondary>synchronization checking</secondary>
26474 </indexterm>
26475 <indexterm role="concept">
26476 <primary>synchronization checking in SMTP</primary>
26477 </indexterm>
26478 The SMTP protocol specification requires the client to wait for a response from
26479 the server at certain points in the dialogue. Without PIPELINING these
26480 synchronization points are after every command; with PIPELINING they are
26481 fewer, but they still exist.
26482 </para>
26483 <para>
26484 Some spamming sites send out a complete set of SMTP commands without waiting
26485 for any response. Exim protects against this by rejecting a message if the
26486 client has sent further input when it should not have. The error response <quote>554
26487 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
26488 for this error cannot be perfect because of transmission delays (unexpected
26489 input may be on its way but not yet received when Exim checks). However, it
26490 does detect many instances.
26491 </para>
26492 <para>
26493 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
26494 If you want to disable the check selectively (for example, only for certain
26495 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
26496 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
26497 </para>
26498 <para>
26499 <indexterm role="option">
26500 <primary><option>smtp_etrn_command</option></primary>
26501 </indexterm>
26502 </para>
26503 <informaltable frame="all">
26504 <tgroup cols="4" colsep="0" rowsep="0">
26505 <colspec colwidth="8*" align="left"/>
26506 <colspec colwidth="6*" align="center"/>
26507 <colspec colwidth="6*" align="center"/>
26508 <colspec colwidth="6*" align="right"/>
26509 <tbody>
26510 <row>
26511 <entry><option>smtp_etrn_command</option></entry>
26512 <entry>Use: <emphasis>main</emphasis></entry>
26513 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26514 <entry>Default: <emphasis>unset</emphasis></entry>
26515 </row>
26516 </tbody>
26517 </tgroup>
26518 </informaltable>
26519 <para>
26520 <indexterm role="concept">
26521 <primary>ETRN</primary>
26522 <secondary>command to be run</secondary>
26523 </indexterm>
26524 <indexterm role="variable">
26525 <primary><varname>$domain</varname></primary>
26526 </indexterm>
26527 If this option is set, the given command is run whenever an SMTP ETRN
26528 command is received from a host that is permitted to issue such commands (see
26529 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
26530 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
26531 argument of the ETRN command, and no syntax checking is done on it. For
26532 example:
26533 </para>
26534 <literallayout class="monospaced">
26535 smtp_etrn_command = /etc/etrn_command $domain \
26536                     $sender_host_address
26537 </literallayout>
26538 <para>
26539 A new process is created to run the command, but Exim does not wait for it to
26540 complete. Consequently, its status cannot be checked. If the command cannot be
26541 run, a line is written to the panic log, but the ETRN caller still receives
26542 a 250 success response. Exim is normally running under its own uid when
26543 receiving SMTP, so it is not possible for it to change the uid before running
26544 the command.
26545 </para>
26546 <para>
26547 <indexterm role="option">
26548 <primary><option>smtp_etrn_serialize</option></primary>
26549 </indexterm>
26550 </para>
26551 <informaltable frame="all">
26552 <tgroup cols="4" colsep="0" rowsep="0">
26553 <colspec colwidth="8*" align="left"/>
26554 <colspec colwidth="6*" align="center"/>
26555 <colspec colwidth="6*" align="center"/>
26556 <colspec colwidth="6*" align="right"/>
26557 <tbody>
26558 <row>
26559 <entry><option>smtp_etrn_serialize</option></entry>
26560 <entry>Use: <emphasis>main</emphasis></entry>
26561 <entry>Type: <emphasis>boolean</emphasis></entry>
26562 <entry>Default: <emphasis>true</emphasis></entry>
26563 </row>
26564 </tbody>
26565 </tgroup>
26566 </informaltable>
26567 <para>
26568 <indexterm role="concept">
26569 <primary>ETRN</primary>
26570 <secondary>serializing</secondary>
26571 </indexterm>
26572 When this option is set, it prevents the simultaneous execution of more than
26573 one identical command as a result of ETRN in an SMTP connection. See
26574 section <xref linkend="SECTETRN"/> for details.
26575 </para>
26576 <para>
26577 <indexterm role="option">
26578 <primary><option>smtp_load_reserve</option></primary>
26579 </indexterm>
26580 </para>
26581 <informaltable frame="all">
26582 <tgroup cols="4" colsep="0" rowsep="0">
26583 <colspec colwidth="8*" align="left"/>
26584 <colspec colwidth="6*" align="center"/>
26585 <colspec colwidth="6*" align="center"/>
26586 <colspec colwidth="6*" align="right"/>
26587 <tbody>
26588 <row>
26589 <entry><option>smtp_load_reserve</option></entry>
26590 <entry>Use: <emphasis>main</emphasis></entry>
26591 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26592 <entry>Default: <emphasis>unset</emphasis></entry>
26593 </row>
26594 </tbody>
26595 </tgroup>
26596 </informaltable>
26597 <para>
26598 <indexterm role="concept">
26599 <primary>load average</primary>
26600 </indexterm>
26601 If the system load average ever gets higher than this, incoming SMTP calls are
26602 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
26603 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
26604 the load is over the limit. The option has no effect on ancient operating
26605 systems on which Exim cannot determine the load average. See also
26606 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
26607 </para>
26608 <para>
26609 <indexterm role="option">
26610 <primary><option>smtp_max_synprot_errors</option></primary>
26611 </indexterm>
26612 </para>
26613 <informaltable frame="all">
26614 <tgroup cols="4" colsep="0" rowsep="0">
26615 <colspec colwidth="8*" align="left"/>
26616 <colspec colwidth="6*" align="center"/>
26617 <colspec colwidth="6*" align="center"/>
26618 <colspec colwidth="6*" align="right"/>
26619 <tbody>
26620 <row>
26621 <entry><option>smtp_max_synprot_errors</option></entry>
26622 <entry>Use: <emphasis>main</emphasis></entry>
26623 <entry>Type: <emphasis>integer</emphasis></entry>
26624 <entry>Default: <emphasis>3</emphasis></entry>
26625 </row>
26626 </tbody>
26627 </tgroup>
26628 </informaltable>
26629 <para>
26630 <indexterm role="concept">
26631 <primary>SMTP</primary>
26632 <secondary>limiting syntax and protocol errors</secondary>
26633 </indexterm>
26634 <indexterm role="concept">
26635 <primary>limit</primary>
26636 <secondary>SMTP syntax and protocol errors</secondary>
26637 </indexterm>
26638 Exim rejects SMTP commands that contain syntax or protocol errors. In
26639 particular, a syntactically invalid email address, as in this command:
26640 </para>
26641 <literallayout class="monospaced">
26642 RCPT TO:&lt;abc xyz@a.b.c&gt;
26643 </literallayout>
26644 <para>
26645 causes immediate rejection of the command, before any other tests are done.
26646 (The ACL cannot be run if there is no valid address to set up for it.) An
26647 example of a protocol error is receiving RCPT before MAIL. If there are
26648 too many syntax or protocol errors in one SMTP session, the connection is
26649 dropped. The limit is set by this option.
26650 </para>
26651 <para>
26652 <indexterm role="concept">
26653 <primary>PIPELINING</primary>
26654 <secondary>expected errors</secondary>
26655 </indexterm>
26656 When the PIPELINING extension to SMTP is in use, some protocol errors are
26657 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
26658 Exim assumes that PIPELINING will be used if it advertises it (see
26659 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
26660 not count towards the limit.
26661 </para>
26662 <para>
26663 <indexterm role="option">
26664 <primary><option>smtp_max_unknown_commands</option></primary>
26665 </indexterm>
26666 </para>
26667 <informaltable frame="all">
26668 <tgroup cols="4" colsep="0" rowsep="0">
26669 <colspec colwidth="8*" align="left"/>
26670 <colspec colwidth="6*" align="center"/>
26671 <colspec colwidth="6*" align="center"/>
26672 <colspec colwidth="6*" align="right"/>
26673 <tbody>
26674 <row>
26675 <entry><option>smtp_max_unknown_commands</option></entry>
26676 <entry>Use: <emphasis>main</emphasis></entry>
26677 <entry>Type: <emphasis>integer</emphasis></entry>
26678 <entry>Default: <emphasis>3</emphasis></entry>
26679 </row>
26680 </tbody>
26681 </tgroup>
26682 </informaltable>
26683 <para>
26684 <indexterm role="concept">
26685 <primary>SMTP</primary>
26686 <secondary>limiting unknown commands</secondary>
26687 </indexterm>
26688 <indexterm role="concept">
26689 <primary>limit</primary>
26690 <secondary>unknown SMTP commands</secondary>
26691 </indexterm>
26692 If there are too many unrecognized commands in an incoming SMTP session, an
26693 Exim server drops the connection. This is a defence against some kinds of abuse
26694 that subvert web
26695 clients
26696 into making connections to SMTP ports; in these circumstances, a number of
26697 non-SMTP command lines are sent first.
26698 </para>
26699 <para>
26700 <indexterm role="option">
26701 <primary><option>smtp_ratelimit_hosts</option></primary>
26702 </indexterm>
26703 </para>
26704 <informaltable frame="all">
26705 <tgroup cols="4" colsep="0" rowsep="0">
26706 <colspec colwidth="8*" align="left"/>
26707 <colspec colwidth="6*" align="center"/>
26708 <colspec colwidth="6*" align="center"/>
26709 <colspec colwidth="6*" align="right"/>
26710 <tbody>
26711 <row>
26712 <entry><option>smtp_ratelimit_hosts</option></entry>
26713 <entry>Use: <emphasis>main</emphasis></entry>
26714 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26715 <entry>Default: <emphasis>unset</emphasis></entry>
26716 </row>
26717 </tbody>
26718 </tgroup>
26719 </informaltable>
26720 <para>
26721 <indexterm role="concept">
26722 <primary>SMTP</primary>
26723 <secondary>rate limiting</secondary>
26724 </indexterm>
26725 <indexterm role="concept">
26726 <primary>limit</primary>
26727 <secondary>rate of message arrival</secondary>
26728 </indexterm>
26729 <indexterm role="concept">
26730 <primary>RCPT</primary>
26731 <secondary>rate limiting</secondary>
26732 </indexterm>
26733 Some sites find it helpful to be able to limit the rate at which certain hosts
26734 can send them messages, and the rate at which an individual message can specify
26735 recipients.
26736 </para>
26737 <para>
26738 Exim has two rate-limiting facilities. This section describes the older
26739 facility, which can limit rates within a single connection. The newer
26740 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
26741 <xref linkend="SECTratelimiting"/> for details of the newer facility.
26742 </para>
26743 <para>
26744 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
26745 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
26746 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
26747 respectively. Each option, if set, must contain a set of four comma-separated
26748 values:
26749 </para>
26750 <itemizedlist>
26751 <listitem>
26752 <para>
26753 A threshold, before which there is no rate limiting.
26754 </para>
26755 </listitem>
26756 <listitem>
26757 <para>
26758 An initial time delay. Unlike other times in Exim, numbers with decimal
26759 fractional parts are allowed here.
26760 </para>
26761 </listitem>
26762 <listitem>
26763 <para>
26764 A factor by which to increase the delay each time.
26765 </para>
26766 </listitem>
26767 <listitem>
26768 <para>
26769 A maximum value for the delay. This should normally be less than 5 minutes,
26770 because after that time, the client is liable to timeout the SMTP command.
26771 </para>
26772 </listitem>
26773 </itemizedlist>
26774 <para>
26775 For example, these settings have been used successfully at the site which
26776 first suggested this feature, for controlling mail from their customers:
26777 </para>
26778 <literallayout class="monospaced">
26779 smtp_ratelimit_mail = 2,0.5s,1.05,4m
26780 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
26781 </literallayout>
26782 <para>
26783 The first setting specifies delays that are applied to MAIL commands after
26784 two have been received over a single connection. The initial delay is 0.5
26785 seconds, increasing by a factor of 1.05 each time. The second setting applies
26786 delays to RCPT commands when more than four occur in a single message.
26787 </para>
26788 <para>
26789 <indexterm role="option">
26790 <primary><option>smtp_ratelimit_mail</option></primary>
26791 </indexterm>
26792 </para>
26793 <informaltable frame="all">
26794 <tgroup cols="4" colsep="0" rowsep="0">
26795 <colspec colwidth="8*" align="left"/>
26796 <colspec colwidth="6*" align="center"/>
26797 <colspec colwidth="6*" align="center"/>
26798 <colspec colwidth="6*" align="right"/>
26799 <tbody>
26800 <row>
26801 <entry><option>smtp_ratelimit_mail</option></entry>
26802 <entry>Use: <emphasis>main</emphasis></entry>
26803 <entry>Type: <emphasis>string</emphasis></entry>
26804 <entry>Default: <emphasis>unset</emphasis></entry>
26805 </row>
26806 </tbody>
26807 </tgroup>
26808 </informaltable>
26809 <para>
26810 See <option>smtp_ratelimit_hosts</option> above.
26811 </para>
26812 <para>
26813 <indexterm role="option">
26814 <primary><option>smtp_ratelimit_rcpt</option></primary>
26815 </indexterm>
26816 </para>
26817 <informaltable frame="all">
26818 <tgroup cols="4" colsep="0" rowsep="0">
26819 <colspec colwidth="8*" align="left"/>
26820 <colspec colwidth="6*" align="center"/>
26821 <colspec colwidth="6*" align="center"/>
26822 <colspec colwidth="6*" align="right"/>
26823 <tbody>
26824 <row>
26825 <entry><option>smtp_ratelimit_rcpt</option></entry>
26826 <entry>Use: <emphasis>main</emphasis></entry>
26827 <entry>Type: <emphasis>string</emphasis></entry>
26828 <entry>Default: <emphasis>unset</emphasis></entry>
26829 </row>
26830 </tbody>
26831 </tgroup>
26832 </informaltable>
26833 <para>
26834 See <option>smtp_ratelimit_hosts</option> above.
26835 </para>
26836 <para>
26837 <indexterm role="option">
26838 <primary><option>smtp_receive_timeout</option></primary>
26839 </indexterm>
26840 </para>
26841 <informaltable frame="all">
26842 <tgroup cols="4" colsep="0" rowsep="0">
26843 <colspec colwidth="8*" align="left"/>
26844 <colspec colwidth="6*" align="center"/>
26845 <colspec colwidth="6*" align="center"/>
26846 <colspec colwidth="6*" align="right"/>
26847 <tbody>
26848 <row>
26849 <entry><option>smtp_receive_timeout</option></entry>
26850 <entry>Use: <emphasis>main</emphasis></entry>
26851 <entry>Type: <emphasis>time</emphasis></entry>
26852 <entry>Default: <emphasis>5m</emphasis></entry>
26853 </row>
26854 </tbody>
26855 </tgroup>
26856 </informaltable>
26857 <para>
26858 <indexterm role="concept">
26859 <primary>timeout</primary>
26860 <secondary>for SMTP input</secondary>
26861 </indexterm>
26862 <indexterm role="concept">
26863 <primary>SMTP</primary>
26864 <secondary>input timeout</secondary>
26865 </indexterm>
26866 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
26867 input, including batch SMTP. If a line of input (either an SMTP command or a
26868 data line) is not received within this time, the SMTP connection is dropped and
26869 the message is abandoned.
26870 A line is written to the log containing one of the following messages:
26871 </para>
26872 <literallayout class="monospaced">
26873 SMTP command timeout on connection from...
26874 SMTP data timeout on connection from...
26875 </literallayout>
26876 <para>
26877 The former means that Exim was expecting to read an SMTP command; the latter
26878 means that it was in the DATA phase, reading the contents of a message.
26879 </para>
26880 <para>
26881 <indexterm role="option">
26882 <primary><option>-os</option></primary>
26883 </indexterm>
26884 The value set by this option can be overridden by the
26885 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
26886 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
26887 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
26888 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
26889 </para>
26890 <para>
26891 <indexterm role="option">
26892 <primary><option>smtp_reserve_hosts</option></primary>
26893 </indexterm>
26894 </para>
26895 <informaltable frame="all">
26896 <tgroup cols="4" colsep="0" rowsep="0">
26897 <colspec colwidth="8*" align="left"/>
26898 <colspec colwidth="6*" align="center"/>
26899 <colspec colwidth="6*" align="center"/>
26900 <colspec colwidth="6*" align="right"/>
26901 <tbody>
26902 <row>
26903 <entry><option>smtp_reserve_hosts</option></entry>
26904 <entry>Use: <emphasis>main</emphasis></entry>
26905 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26906 <entry>Default: <emphasis>unset</emphasis></entry>
26907 </row>
26908 </tbody>
26909 </tgroup>
26910 </informaltable>
26911 <para>
26912 This option defines hosts for which SMTP connections are reserved; see
26913 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
26914 </para>
26915 <para>
26916 <indexterm role="option">
26917 <primary><option>smtp_return_error_details</option></primary>
26918 </indexterm>
26919 </para>
26920 <informaltable frame="all">
26921 <tgroup cols="4" colsep="0" rowsep="0">
26922 <colspec colwidth="8*" align="left"/>
26923 <colspec colwidth="6*" align="center"/>
26924 <colspec colwidth="6*" align="center"/>
26925 <colspec colwidth="6*" align="right"/>
26926 <tbody>
26927 <row>
26928 <entry><option>smtp_return_error_details</option></entry>
26929 <entry>Use: <emphasis>main</emphasis></entry>
26930 <entry>Type: <emphasis>boolean</emphasis></entry>
26931 <entry>Default: <emphasis>false</emphasis></entry>
26932 </row>
26933 </tbody>
26934 </tgroup>
26935 </informaltable>
26936 <para>
26937 <indexterm role="concept">
26938 <primary>SMTP</primary>
26939 <secondary>details policy failures</secondary>
26940 </indexterm>
26941 <indexterm role="concept">
26942 <primary>policy control</primary>
26943 <secondary>rejection, returning details</secondary>
26944 </indexterm>
26945 In the default state, Exim uses bland messages such as
26946 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
26947 reasons. Many sysadmins like this because it gives away little information
26948 to spammers. However, some other sysadmins who are applying strict checking
26949 policies want to give out much fuller information about failures. Setting
26950 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
26951 example, instead of <quote>Administrative prohibition</quote>, it might give:
26952 </para>
26953 <literallayout class="monospaced">
26954 550-Rejected after DATA: '&gt;' missing at end of address:
26955 550 failing address in "From" header is: &lt;user@dom.ain
26956 </literallayout>
26957 <para>
26958 <indexterm role="option">
26959 <primary><option>spamd_address</option></primary>
26960 </indexterm>
26961 </para>
26962 <informaltable frame="all">
26963 <tgroup cols="4" colsep="0" rowsep="0">
26964 <colspec colwidth="8*" align="left"/>
26965 <colspec colwidth="6*" align="center"/>
26966 <colspec colwidth="6*" align="center"/>
26967 <colspec colwidth="6*" align="right"/>
26968 <tbody>
26969 <row>
26970 <entry><option>spamd_address</option></entry>
26971 <entry>Use: <emphasis>main</emphasis></entry>
26972 <entry>Type: <emphasis>string</emphasis></entry>
26973 <entry>Default: <emphasis>see below</emphasis></entry>
26974 </row>
26975 </tbody>
26976 </tgroup>
26977 </informaltable>
26978 <para>
26979 This option is available when Exim is compiled with the content-scanning
26980 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
26981 The default value is
26982 </para>
26983 <literallayout class="monospaced">
26984 127.0.0.1 783
26985 </literallayout>
26986 <para>
26987 See section <xref linkend="SECTscanspamass"/> for more details.
26988 </para>
26989 <para>
26990 <indexterm role="option">
26991 <primary><option>split_spool_directory</option></primary>
26992 </indexterm>
26993 </para>
26994 <informaltable frame="all">
26995 <tgroup cols="4" colsep="0" rowsep="0">
26996 <colspec colwidth="8*" align="left"/>
26997 <colspec colwidth="6*" align="center"/>
26998 <colspec colwidth="6*" align="center"/>
26999 <colspec colwidth="6*" align="right"/>
27000 <tbody>
27001 <row>
27002 <entry><option>split_spool_directory</option></entry>
27003 <entry>Use: <emphasis>main</emphasis></entry>
27004 <entry>Type: <emphasis>boolean</emphasis></entry>
27005 <entry>Default: <emphasis>false</emphasis></entry>
27006 </row>
27007 </tbody>
27008 </tgroup>
27009 </informaltable>
27010 <para>
27011 <indexterm role="concept">
27012 <primary>multiple spool directories</primary>
27013 </indexterm>
27014 <indexterm role="concept">
27015 <primary>spool directory</primary>
27016 <secondary>split</secondary>
27017 </indexterm>
27018 <indexterm role="concept">
27019 <primary>directories, multiple</primary>
27020 </indexterm>
27021 If this option is set, it causes Exim to split its input directory into 62
27022 subdirectories, each with a single alphanumeric character as its name. The
27023 sixth character of the message id is used to allocate messages to
27024 subdirectories; this is the least significant base-62 digit of the time of
27025 arrival of the message.
27026 </para>
27027 <para>
27028 Splitting up the spool in this way may provide better performance on systems
27029 where there are long mail queues, by reducing the number of files in any one
27030 directory. The msglog directory is also split up in a similar way to the input
27031 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27032 are still placed in the single directory <filename>msglog.OLD</filename>.
27033 </para>
27034 <para>
27035 It is not necessary to take any special action for existing messages when
27036 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27037 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27038 after a period of being on, the subdirectories will eventually empty and be
27039 automatically deleted.
27040 </para>
27041 <para>
27042 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27043 changes. Instead of creating a list of all messages in the queue, and then
27044 trying to deliver each one in turn, it constructs a list of those in one
27045 sub-directory and tries to deliver them, before moving on to the next
27046 sub-directory. The sub-directories are processed in a random order. This
27047 spreads out the scanning of the input directories, and uses less memory. It is
27048 particularly beneficial when there are lots of messages on the queue. However,
27049 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27050 entire queue has to be scanned and sorted before any deliveries can start.
27051 </para>
27052 <para>
27053 <indexterm role="option">
27054 <primary><option>spool_directory</option></primary>
27055 </indexterm>
27056 </para>
27057 <informaltable frame="all">
27058 <tgroup cols="4" colsep="0" rowsep="0">
27059 <colspec colwidth="8*" align="left"/>
27060 <colspec colwidth="6*" align="center"/>
27061 <colspec colwidth="6*" align="center"/>
27062 <colspec colwidth="6*" align="right"/>
27063 <tbody>
27064 <row>
27065 <entry><option>spool_directory</option></entry>
27066 <entry>Use: <emphasis>main</emphasis></entry>
27067 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27068 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27069 </row>
27070 </tbody>
27071 </tgroup>
27072 </informaltable>
27073 <para>
27074 <indexterm role="concept">
27075 <primary>spool directory</primary>
27076 <secondary>path to</secondary>
27077 </indexterm>
27078 This defines the directory in which Exim keeps its spool, that is, the messages
27079 it is waiting to deliver. The default value is taken from the compile-time
27080 configuration setting, if there is one. If not, this option must be set. The
27081 string is expanded, so it can contain, for example, a reference to
27082 <varname>$primary_hostname</varname>.
27083 </para>
27084 <para>
27085 If the spool directory name is fixed on your installation, it is recommended
27086 that you set it at build time rather than from this option, particularly if the
27087 log files are being written to the spool directory (see <option>log_file_path</option>).
27088 Otherwise log files cannot be used for errors that are detected early on, such
27089 as failures in the configuration file.
27090 </para>
27091 <para>
27092 By using this option to override the compiled-in path, it is possible to run
27093 tests of Exim without using the standard spool.
27094 </para>
27095 <para>
27096 <indexterm role="option">
27097 <primary><option>sqlite_lock_timeout</option></primary>
27098 </indexterm>
27099 </para>
27100 <informaltable frame="all">
27101 <tgroup cols="4" colsep="0" rowsep="0">
27102 <colspec colwidth="8*" align="left"/>
27103 <colspec colwidth="6*" align="center"/>
27104 <colspec colwidth="6*" align="center"/>
27105 <colspec colwidth="6*" align="right"/>
27106 <tbody>
27107 <row>
27108 <entry><option>sqlite_lock_timeout</option></entry>
27109 <entry>Use: <emphasis>main</emphasis></entry>
27110 <entry>Type: <emphasis>time</emphasis></entry>
27111 <entry>Default: <emphasis>5s</emphasis></entry>
27112 </row>
27113 </tbody>
27114 </tgroup>
27115 </informaltable>
27116 <para>
27117 <indexterm role="concept">
27118 <primary>sqlite lookup type</primary>
27119 <secondary>lock timeout</secondary>
27120 </indexterm>
27121 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
27122 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
27123 </para>
27124 <para>
27125 <indexterm role="option">
27126 <primary><option>strict_acl_vars</option></primary>
27127 </indexterm>
27128 </para>
27129 <informaltable frame="all">
27130 <tgroup cols="4" colsep="0" rowsep="0">
27131 <colspec colwidth="8*" align="left"/>
27132 <colspec colwidth="6*" align="center"/>
27133 <colspec colwidth="6*" align="center"/>
27134 <colspec colwidth="6*" align="right"/>
27135 <tbody>
27136 <row>
27137 <entry><option>strict_acl_vars</option></entry>
27138 <entry>Use: <emphasis>main</emphasis></entry>
27139 <entry>Type: <emphasis>boolean</emphasis></entry>
27140 <entry>Default: <emphasis>false</emphasis></entry>
27141 </row>
27142 </tbody>
27143 </tgroup>
27144 </informaltable>
27145 <para>
27146 <indexterm role="concept">
27147 <primary>access control lists (ACLs)</primary>
27148 <secondary>variables, handling unset</secondary>
27149 </indexterm>
27150 This option controls what happens if a syntactically valid but undefined ACL
27151 variable is referenced. If it is false (the default), an empty string
27152 is substituted; if it is true, an error is generated. See section
27153 <xref linkend="SECTaclvariables"/> for details of ACL variables.
27154 </para>
27155 <para>
27156 <indexterm role="option">
27157 <primary><option>strip_excess_angle_brackets</option></primary>
27158 </indexterm>
27159 </para>
27160 <informaltable frame="all">
27161 <tgroup cols="4" colsep="0" rowsep="0">
27162 <colspec colwidth="8*" align="left"/>
27163 <colspec colwidth="6*" align="center"/>
27164 <colspec colwidth="6*" align="center"/>
27165 <colspec colwidth="6*" align="right"/>
27166 <tbody>
27167 <row>
27168 <entry><option>strip_excess_angle_brackets</option></entry>
27169 <entry>Use: <emphasis>main</emphasis></entry>
27170 <entry>Type: <emphasis>boolean</emphasis></entry>
27171 <entry>Default: <emphasis>false</emphasis></entry>
27172 </row>
27173 </tbody>
27174 </tgroup>
27175 </informaltable>
27176 <para>
27177 <indexterm role="concept">
27178 <primary>angle brackets, excess</primary>
27179 </indexterm>
27180 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
27181 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
27182 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
27183 passed on to another MTA, the excess angle brackets are not passed on. If this
27184 option is not set, multiple pairs of angle brackets cause a syntax error.
27185 </para>
27186 <para>
27187 <indexterm role="option">
27188 <primary><option>strip_trailing_dot</option></primary>
27189 </indexterm>
27190 </para>
27191 <informaltable frame="all">
27192 <tgroup cols="4" colsep="0" rowsep="0">
27193 <colspec colwidth="8*" align="left"/>
27194 <colspec colwidth="6*" align="center"/>
27195 <colspec colwidth="6*" align="center"/>
27196 <colspec colwidth="6*" align="right"/>
27197 <tbody>
27198 <row>
27199 <entry><option>strip_trailing_dot</option></entry>
27200 <entry>Use: <emphasis>main</emphasis></entry>
27201 <entry>Type: <emphasis>boolean</emphasis></entry>
27202 <entry>Default: <emphasis>false</emphasis></entry>
27203 </row>
27204 </tbody>
27205 </tgroup>
27206 </informaltable>
27207 <para>
27208 <indexterm role="concept">
27209 <primary>trailing dot on domain</primary>
27210 </indexterm>
27211 <indexterm role="concept">
27212 <primary>dot</primary>
27213 <secondary>trailing on domain</secondary>
27214 </indexterm>
27215 If this option is set, a trailing dot at the end of a domain in an address is
27216 ignored. If this is in the envelope and the message is passed on to another
27217 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
27218 domain causes a syntax error.
27219 However, addresses in header lines are checked only when an ACL requests header
27220 syntax checking.
27221 </para>
27222 <para>
27223 <indexterm role="option">
27224 <primary><option>syslog_duplication</option></primary>
27225 </indexterm>
27226 </para>
27227 <informaltable frame="all">
27228 <tgroup cols="4" colsep="0" rowsep="0">
27229 <colspec colwidth="8*" align="left"/>
27230 <colspec colwidth="6*" align="center"/>
27231 <colspec colwidth="6*" align="center"/>
27232 <colspec colwidth="6*" align="right"/>
27233 <tbody>
27234 <row>
27235 <entry><option>syslog_duplication</option></entry>
27236 <entry>Use: <emphasis>main</emphasis></entry>
27237 <entry>Type: <emphasis>boolean</emphasis></entry>
27238 <entry>Default: <emphasis>true</emphasis></entry>
27239 </row>
27240 </tbody>
27241 </tgroup>
27242 </informaltable>
27243 <para>
27244 <indexterm role="concept">
27245 <primary>syslog</primary>
27246 <secondary>duplicate log lines; suppressing</secondary>
27247 </indexterm>
27248 When Exim is logging to syslog, it writes the log lines for its three
27249 separate logs at different syslog priorities so that they can in principle
27250 be separated on the logging hosts. Some installations do not require this
27251 separation, and in those cases, the duplication of certain log lines is a
27252 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
27253 particular log line is written to syslog. For lines that normally go to
27254 both the main log and the reject log, the reject log version (possibly
27255 containing message header lines) is written, at LOG_NOTICE priority.
27256 Lines that normally go to both the main and the panic log are written at
27257 the LOG_ALERT priority.
27258 </para>
27259 <para>
27260 <indexterm role="option">
27261 <primary><option>syslog_facility</option></primary>
27262 </indexterm>
27263 </para>
27264 <informaltable frame="all">
27265 <tgroup cols="4" colsep="0" rowsep="0">
27266 <colspec colwidth="8*" align="left"/>
27267 <colspec colwidth="6*" align="center"/>
27268 <colspec colwidth="6*" align="center"/>
27269 <colspec colwidth="6*" align="right"/>
27270 <tbody>
27271 <row>
27272 <entry><option>syslog_facility</option></entry>
27273 <entry>Use: <emphasis>main</emphasis></entry>
27274 <entry>Type: <emphasis>string</emphasis></entry>
27275 <entry>Default: <emphasis>unset</emphasis></entry>
27276 </row>
27277 </tbody>
27278 </tgroup>
27279 </informaltable>
27280 <para>
27281 <indexterm role="concept">
27282 <primary>syslog</primary>
27283 <secondary>facility; setting</secondary>
27284 </indexterm>
27285 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
27286 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
27287 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
27288 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
27289 details of Exim&#x2019;s logging.
27290 </para>
27291 <para>
27292 <indexterm role="option">
27293 <primary><option>syslog_processname</option></primary>
27294 </indexterm>
27295 </para>
27296 <informaltable frame="all">
27297 <tgroup cols="4" colsep="0" rowsep="0">
27298 <colspec colwidth="8*" align="left"/>
27299 <colspec colwidth="6*" align="center"/>
27300 <colspec colwidth="6*" align="center"/>
27301 <colspec colwidth="6*" align="right"/>
27302 <tbody>
27303 <row>
27304 <entry><option>syslog_processname</option></entry>
27305 <entry>Use: <emphasis>main</emphasis></entry>
27306 <entry>Type: <emphasis>string</emphasis></entry>
27307 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
27308 </row>
27309 </tbody>
27310 </tgroup>
27311 </informaltable>
27312 <para>
27313 <indexterm role="concept">
27314 <primary>syslog</primary>
27315 <secondary>process name; setting</secondary>
27316 </indexterm>
27317 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
27318 syslog. The value must be no longer than 32 characters. See chapter
27319 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
27320 </para>
27321 <para>
27322 <indexterm role="option">
27323 <primary><option>syslog_timestamp</option></primary>
27324 </indexterm>
27325 </para>
27326 <informaltable frame="all">
27327 <tgroup cols="4" colsep="0" rowsep="0">
27328 <colspec colwidth="8*" align="left"/>
27329 <colspec colwidth="6*" align="center"/>
27330 <colspec colwidth="6*" align="center"/>
27331 <colspec colwidth="6*" align="right"/>
27332 <tbody>
27333 <row>
27334 <entry><option>syslog_timestamp</option></entry>
27335 <entry>Use: <emphasis>main</emphasis></entry>
27336 <entry>Type: <emphasis>boolean</emphasis></entry>
27337 <entry>Default: <emphasis>true</emphasis></entry>
27338 </row>
27339 </tbody>
27340 </tgroup>
27341 </informaltable>
27342 <para>
27343 <indexterm role="concept">
27344 <primary>syslog</primary>
27345 <secondary>timestamps</secondary>
27346 </indexterm>
27347 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
27348 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
27349 details of Exim&#x2019;s logging.
27350 </para>
27351 <para>
27352 <indexterm role="option">
27353 <primary><option>system_filter</option></primary>
27354 </indexterm>
27355 </para>
27356 <informaltable frame="all">
27357 <tgroup cols="4" colsep="0" rowsep="0">
27358 <colspec colwidth="8*" align="left"/>
27359 <colspec colwidth="6*" align="center"/>
27360 <colspec colwidth="6*" align="center"/>
27361 <colspec colwidth="6*" align="right"/>
27362 <tbody>
27363 <row>
27364 <entry><option>system_filter</option></entry>
27365 <entry>Use: <emphasis>main</emphasis></entry>
27366 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27367 <entry>Default: <emphasis>unset</emphasis></entry>
27368 </row>
27369 </tbody>
27370 </tgroup>
27371 </informaltable>
27372 <para>
27373 <indexterm role="concept">
27374 <primary>filter</primary>
27375 <secondary>system filter</secondary>
27376 </indexterm>
27377 <indexterm role="concept">
27378 <primary>system filter</primary>
27379 <secondary>specifying</secondary>
27380 </indexterm>
27381 <indexterm role="concept">
27382 <primary>Sieve filter</primary>
27383 <secondary>not available for system filter</secondary>
27384 </indexterm>
27385 This option specifies an Exim filter file that is applied to all messages at
27386 the start of each delivery attempt, before any routing is done. System filters
27387 must be Exim filters; they cannot be Sieve filters. If the system filter
27388 generates any deliveries to files or pipes, or any new mail messages, the
27389 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
27390 which transports are to be used. Details of this facility are given in chapter
27391 <xref linkend="CHAPsystemfilter"/>.
27392 </para>
27393 <para>
27394 <indexterm role="option">
27395 <primary><option>system_filter_directory_transport</option></primary>
27396 </indexterm>
27397 </para>
27398 <informaltable frame="all">
27399 <tgroup cols="4" colsep="0" rowsep="0">
27400 <colspec colwidth="8*" align="left"/>
27401 <colspec colwidth="6*" align="center"/>
27402 <colspec colwidth="6*" align="center"/>
27403 <colspec colwidth="6*" align="right"/>
27404 <tbody>
27405 <row>
27406 <entry><option>system_filter_directory_transport</option></entry>
27407 <entry>Use: <emphasis>main</emphasis></entry>
27408 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27409 <entry>Default: <emphasis>unset</emphasis></entry>
27410 </row>
27411 </tbody>
27412 </tgroup>
27413 </informaltable>
27414 <para>
27415 <indexterm role="variable">
27416 <primary><varname>$address_file</varname></primary>
27417 </indexterm>
27418 This sets the name of the transport driver that is to be used when the
27419 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
27420 implying delivery of each message into a separate file in some directory.
27421 During the delivery, the variable <varname>$address_file</varname> contains the path name.
27422 </para>
27423 <para>
27424 <indexterm role="option">
27425 <primary><option>system_filter_file_transport</option></primary>
27426 </indexterm>
27427 </para>
27428 <informaltable frame="all">
27429 <tgroup cols="4" colsep="0" rowsep="0">
27430 <colspec colwidth="8*" align="left"/>
27431 <colspec colwidth="6*" align="center"/>
27432 <colspec colwidth="6*" align="center"/>
27433 <colspec colwidth="6*" align="right"/>
27434 <tbody>
27435 <row>
27436 <entry><option>system_filter_file_transport</option></entry>
27437 <entry>Use: <emphasis>main</emphasis></entry>
27438 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27439 <entry>Default: <emphasis>unset</emphasis></entry>
27440 </row>
27441 </tbody>
27442 </tgroup>
27443 </informaltable>
27444 <para>
27445 <indexterm role="concept">
27446 <primary>file</primary>
27447 <secondary>transport for system filter</secondary>
27448 </indexterm>
27449 This sets the name of the transport driver that is to be used when the <option>save</option>
27450 command in a system message filter specifies a path not ending in <quote>/</quote>. During
27451 the delivery, the variable <varname>$address_file</varname> contains the path name.
27452 </para>
27453 <para>
27454 <indexterm role="option">
27455 <primary><option>system_filter_group</option></primary>
27456 </indexterm>
27457 </para>
27458 <informaltable frame="all">
27459 <tgroup cols="4" colsep="0" rowsep="0">
27460 <colspec colwidth="8*" align="left"/>
27461 <colspec colwidth="6*" align="center"/>
27462 <colspec colwidth="6*" align="center"/>
27463 <colspec colwidth="6*" align="right"/>
27464 <tbody>
27465 <row>
27466 <entry><option>system_filter_group</option></entry>
27467 <entry>Use: <emphasis>main</emphasis></entry>
27468 <entry>Type: <emphasis>string</emphasis></entry>
27469 <entry>Default: <emphasis>unset</emphasis></entry>
27470 </row>
27471 </tbody>
27472 </tgroup>
27473 </informaltable>
27474 <para>
27475 <indexterm role="concept">
27476 <primary>gid (group id)</primary>
27477 <secondary>system filter</secondary>
27478 </indexterm>
27479 This option is used only when <option>system_filter_user</option> is also set. It sets the
27480 gid under which the system filter is run, overriding any gid that is associated
27481 with the user. The value may be numerical or symbolic.
27482 </para>
27483 <para>
27484 <indexterm role="option">
27485 <primary><option>system_filter_pipe_transport</option></primary>
27486 </indexterm>
27487 </para>
27488 <informaltable frame="all">
27489 <tgroup cols="4" colsep="0" rowsep="0">
27490 <colspec colwidth="8*" align="left"/>
27491 <colspec colwidth="6*" align="center"/>
27492 <colspec colwidth="6*" align="center"/>
27493 <colspec colwidth="6*" align="right"/>
27494 <tbody>
27495 <row>
27496 <entry><option>system_filter_pipe_transport</option></entry>
27497 <entry>Use: <emphasis>main</emphasis></entry>
27498 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27499 <entry>Default: <emphasis>unset</emphasis></entry>
27500 </row>
27501 </tbody>
27502 </tgroup>
27503 </informaltable>
27504 <para>
27505 <indexterm role="concept">
27506 <primary><command>pipe</command> transport</primary>
27507 <secondary>for system filter</secondary>
27508 </indexterm>
27509 <indexterm role="variable">
27510 <primary><varname>$address_pipe</varname></primary>
27511 </indexterm>
27512 This specifies the transport driver that is to be used when a <option>pipe</option> command
27513 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
27514 contains the pipe command.
27515 </para>
27516 <para>
27517 <indexterm role="option">
27518 <primary><option>system_filter_reply_transport</option></primary>
27519 </indexterm>
27520 </para>
27521 <informaltable frame="all">
27522 <tgroup cols="4" colsep="0" rowsep="0">
27523 <colspec colwidth="8*" align="left"/>
27524 <colspec colwidth="6*" align="center"/>
27525 <colspec colwidth="6*" align="center"/>
27526 <colspec colwidth="6*" align="right"/>
27527 <tbody>
27528 <row>
27529 <entry><option>system_filter_reply_transport</option></entry>
27530 <entry>Use: <emphasis>main</emphasis></entry>
27531 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27532 <entry>Default: <emphasis>unset</emphasis></entry>
27533 </row>
27534 </tbody>
27535 </tgroup>
27536 </informaltable>
27537 <para>
27538 <indexterm role="concept">
27539 <primary><command>autoreply</command> transport</primary>
27540 <secondary>for system filter</secondary>
27541 </indexterm>
27542 This specifies the transport driver that is to be used when a <option>mail</option> command
27543 is used in a system filter.
27544 </para>
27545 <para>
27546 <indexterm role="option">
27547 <primary><option>system_filter_user</option></primary>
27548 </indexterm>
27549 </para>
27550 <informaltable frame="all">
27551 <tgroup cols="4" colsep="0" rowsep="0">
27552 <colspec colwidth="8*" align="left"/>
27553 <colspec colwidth="6*" align="center"/>
27554 <colspec colwidth="6*" align="center"/>
27555 <colspec colwidth="6*" align="right"/>
27556 <tbody>
27557 <row>
27558 <entry><option>system_filter_user</option></entry>
27559 <entry>Use: <emphasis>main</emphasis></entry>
27560 <entry>Type: <emphasis>string</emphasis></entry>
27561 <entry>Default: <emphasis>unset</emphasis></entry>
27562 </row>
27563 </tbody>
27564 </tgroup>
27565 </informaltable>
27566 <para>
27567 <indexterm role="concept">
27568 <primary>uid (user id)</primary>
27569 <secondary>system filter</secondary>
27570 </indexterm>
27571 If this option is not set, the system filter is run in the main Exim delivery
27572 process, as root. When the option is set, the system filter runs in a separate
27573 process, as the given user. Unless the string consists entirely of digits, it
27574 is looked up in the password data. Failure to find the named user causes a
27575 configuration error. The gid is either taken from the password data, or
27576 specified by <option>system_filter_group</option>. When the uid is specified numerically,
27577 <option>system_filter_group</option> is required to be set.
27578 </para>
27579 <para>
27580 If the system filter generates any pipe, file, or reply deliveries, the uid
27581 under which the filter is run is used when transporting them, unless a
27582 transport option overrides. Normally you should set <option>system_filter_user</option> if
27583 your system filter generates these kinds of delivery.
27584 </para>
27585 <para>
27586 <indexterm role="option">
27587 <primary><option>tcp_nodelay</option></primary>
27588 </indexterm>
27589 </para>
27590 <informaltable frame="all">
27591 <tgroup cols="4" colsep="0" rowsep="0">
27592 <colspec colwidth="8*" align="left"/>
27593 <colspec colwidth="6*" align="center"/>
27594 <colspec colwidth="6*" align="center"/>
27595 <colspec colwidth="6*" align="right"/>
27596 <tbody>
27597 <row>
27598 <entry><option>tcp_nodelay</option></entry>
27599 <entry>Use: <emphasis>main</emphasis></entry>
27600 <entry>Type: <emphasis>boolean</emphasis></entry>
27601 <entry>Default: <emphasis>true</emphasis></entry>
27602 </row>
27603 </tbody>
27604 </tgroup>
27605 </informaltable>
27606 <para>
27607 <indexterm role="concept">
27608 <primary>daemon</primary>
27609 <secondary>TCP_NODELAY on sockets</secondary>
27610 </indexterm>
27611 <indexterm role="concept">
27612 <primary>Nagle algorithm</primary>
27613 </indexterm>
27614 <indexterm role="concept">
27615 <primary>TCP_NODELAY on listening sockets</primary>
27616 </indexterm>
27617 If this option is set false, it stops the Exim daemon setting the
27618 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
27619 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
27620 performance in interactive (character-by-character) situations. Turning it off
27621 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
27622 However, it appears that some broken clients cannot cope, and time out. Hence
27623 this option. It affects only those sockets that are set up for listening by the
27624 daemon. Sockets created by the smtp transport for delivering mail always set
27625 TCP_NODELAY.
27626 </para>
27627 <para>
27628 <indexterm role="option">
27629 <primary><option>timeout_frozen_after</option></primary>
27630 </indexterm>
27631 </para>
27632 <informaltable frame="all">
27633 <tgroup cols="4" colsep="0" rowsep="0">
27634 <colspec colwidth="8*" align="left"/>
27635 <colspec colwidth="6*" align="center"/>
27636 <colspec colwidth="6*" align="center"/>
27637 <colspec colwidth="6*" align="right"/>
27638 <tbody>
27639 <row>
27640 <entry><option>timeout_frozen_after</option></entry>
27641 <entry>Use: <emphasis>main</emphasis></entry>
27642 <entry>Type: <emphasis>time</emphasis></entry>
27643 <entry>Default: <emphasis>0s</emphasis></entry>
27644 </row>
27645 </tbody>
27646 </tgroup>
27647 </informaltable>
27648 <para>
27649 <indexterm role="concept">
27650 <primary>frozen messages</primary>
27651 <secondary>timing out</secondary>
27652 </indexterm>
27653 <indexterm role="concept">
27654 <primary>timeout</primary>
27655 <secondary>frozen messages</secondary>
27656 </indexterm>
27657 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
27658 message of any kind that has been on the queue for longer than the given time
27659 is automatically cancelled at the next queue run. If the frozen message is a
27660 bounce message, it is just discarded; otherwise, a bounce is sent to the
27661 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
27662 If you want to timeout frozen bounce messages earlier than other kinds of
27663 frozen message, see <option>ignore_bounce_errors_after</option>.
27664 </para>
27665 <para>
27666 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
27667 frozen messages remain on the queue forever (except for any frozen bounce
27668 messages that are released by <option>ignore_bounce_errors_after</option>).
27669 </para>
27670 <para>
27671 <indexterm role="option">
27672 <primary><option>timezone</option></primary>
27673 </indexterm>
27674 </para>
27675 <informaltable frame="all">
27676 <tgroup cols="4" colsep="0" rowsep="0">
27677 <colspec colwidth="8*" align="left"/>
27678 <colspec colwidth="6*" align="center"/>
27679 <colspec colwidth="6*" align="center"/>
27680 <colspec colwidth="6*" align="right"/>
27681 <tbody>
27682 <row>
27683 <entry><option>timezone</option></entry>
27684 <entry>Use: <emphasis>main</emphasis></entry>
27685 <entry>Type: <emphasis>string</emphasis></entry>
27686 <entry>Default: <emphasis>unset</emphasis></entry>
27687 </row>
27688 </tbody>
27689 </tgroup>
27690 </informaltable>
27691 <para>
27692 <indexterm role="concept">
27693 <primary>timezone, setting</primary>
27694 </indexterm>
27695 The value of <option>timezone</option> is used to set the environment variable TZ while
27696 running Exim (if it is different on entry). This ensures that all timestamps
27697 created by Exim are in the required timezone. If you want all your timestamps
27698 to be in UTC (aka GMT) you should set
27699 </para>
27700 <literallayout class="monospaced">
27701 timezone = UTC
27702 </literallayout>
27703 <para>
27704 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
27705 or, if that is not set, from the value of the TZ environment variable when Exim
27706 is built. If <option>timezone</option> is set to the empty string, either at build or run
27707 time, any existing TZ variable is removed from the environment when Exim
27708 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
27709 unfortunately not all, operating systems.
27710 </para>
27711 <para>
27712 <indexterm role="option">
27713 <primary><option>tls_advertise_hosts</option></primary>
27714 </indexterm>
27715 </para>
27716 <informaltable frame="all">
27717 <tgroup cols="4" colsep="0" rowsep="0">
27718 <colspec colwidth="8*" align="left"/>
27719 <colspec colwidth="6*" align="center"/>
27720 <colspec colwidth="6*" align="center"/>
27721 <colspec colwidth="6*" align="right"/>
27722 <tbody>
27723 <row>
27724 <entry><option>tls_advertise_hosts</option></entry>
27725 <entry>Use: <emphasis>main</emphasis></entry>
27726 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27727 <entry>Default: <emphasis>unset</emphasis></entry>
27728 </row>
27729 </tbody>
27730 </tgroup>
27731 </informaltable>
27732 <para>
27733 <indexterm role="concept">
27734 <primary>TLS</primary>
27735 <secondary>advertising</secondary>
27736 </indexterm>
27737 <indexterm role="concept">
27738 <primary>encryption</primary>
27739 <secondary>on SMTP connection</secondary>
27740 </indexterm>
27741 <indexterm role="concept">
27742 <primary>SMTP</primary>
27743 <secondary>encrypted connection</secondary>
27744 </indexterm>
27745 When Exim is built with support for TLS encrypted connections, the availability
27746 of the STARTTLS command to set up an encrypted session is advertised in
27747 response to EHLO only to those client hosts that match this option. See
27748 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
27749 </para>
27750 <para>
27751 <indexterm role="option">
27752 <primary><option>tls_certificate</option></primary>
27753 </indexterm>
27754 </para>
27755 <informaltable frame="all">
27756 <tgroup cols="4" colsep="0" rowsep="0">
27757 <colspec colwidth="8*" align="left"/>
27758 <colspec colwidth="6*" align="center"/>
27759 <colspec colwidth="6*" align="center"/>
27760 <colspec colwidth="6*" align="right"/>
27761 <tbody>
27762 <row>
27763 <entry><option>tls_certificate</option></entry>
27764 <entry>Use: <emphasis>main</emphasis></entry>
27765 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27766 <entry>Default: <emphasis>unset</emphasis></entry>
27767 </row>
27768 </tbody>
27769 </tgroup>
27770 </informaltable>
27771 <para>
27772 <indexterm role="concept">
27773 <primary>TLS</primary>
27774 <secondary>server certificate; location of</secondary>
27775 </indexterm>
27776 <indexterm role="concept">
27777 <primary>certificate</primary>
27778 <secondary>server, location of</secondary>
27779 </indexterm>
27780 The value of this option is expanded, and must then be the absolute path to a
27781 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
27782 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
27783 <xref linkend="CHAPTLS"/> for further details.
27784 </para>
27785 <para>
27786 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
27787 receiving incoming messages as a server. If you want to supply certificates for
27788 use when sending messages as a client, you must set the <option>tls_certificate</option>
27789 option in the relevant <command>smtp</command> transport.
27790 </para>
27791 <para>
27792 <indexterm role="option">
27793 <primary><option>tls_crl</option></primary>
27794 </indexterm>
27795 </para>
27796 <informaltable frame="all">
27797 <tgroup cols="4" colsep="0" rowsep="0">
27798 <colspec colwidth="8*" align="left"/>
27799 <colspec colwidth="6*" align="center"/>
27800 <colspec colwidth="6*" align="center"/>
27801 <colspec colwidth="6*" align="right"/>
27802 <tbody>
27803 <row>
27804 <entry><option>tls_crl</option></entry>
27805 <entry>Use: <emphasis>main</emphasis></entry>
27806 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27807 <entry>Default: <emphasis>unset</emphasis></entry>
27808 </row>
27809 </tbody>
27810 </tgroup>
27811 </informaltable>
27812 <para>
27813 <indexterm role="concept">
27814 <primary>TLS</primary>
27815 <secondary>server certificate revocation list</secondary>
27816 </indexterm>
27817 <indexterm role="concept">
27818 <primary>certificate</primary>
27819 <secondary>revocation list for server</secondary>
27820 </indexterm>
27821 This option specifies a certificate revocation list. The expanded value must
27822 be the name of a file that contains a CRL in PEM format.
27823 </para>
27824 <para>
27825 <indexterm role="option">
27826 <primary><option>tls_dhparam</option></primary>
27827 </indexterm>
27828 </para>
27829 <informaltable frame="all">
27830 <tgroup cols="4" colsep="0" rowsep="0">
27831 <colspec colwidth="8*" align="left"/>
27832 <colspec colwidth="6*" align="center"/>
27833 <colspec colwidth="6*" align="center"/>
27834 <colspec colwidth="6*" align="right"/>
27835 <tbody>
27836 <row>
27837 <entry><option>tls_dhparam</option></entry>
27838 <entry>Use: <emphasis>main</emphasis></entry>
27839 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27840 <entry>Default: <emphasis>unset</emphasis></entry>
27841 </row>
27842 </tbody>
27843 </tgroup>
27844 </informaltable>
27845 <para>
27846 <indexterm role="concept">
27847 <primary>TLS</primary>
27848 <secondary>D-H parameters for server</secondary>
27849 </indexterm>
27850 The value of this option is expanded, and must then be the absolute path to
27851 a file which contains the server&#x2019;s DH parameter values.
27852 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
27853 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
27854 </para>
27855 <para>
27856 <indexterm role="option">
27857 <primary><option>tls_on_connect_ports</option></primary>
27858 </indexterm>
27859 </para>
27860 <informaltable frame="all">
27861 <tgroup cols="4" colsep="0" rowsep="0">
27862 <colspec colwidth="8*" align="left"/>
27863 <colspec colwidth="6*" align="center"/>
27864 <colspec colwidth="6*" align="center"/>
27865 <colspec colwidth="6*" align="right"/>
27866 <tbody>
27867 <row>
27868 <entry><option>tls_on_connect_ports</option></entry>
27869 <entry>Use: <emphasis>main</emphasis></entry>
27870 <entry>Type: <emphasis>string list</emphasis></entry>
27871 <entry>Default: <emphasis>unset</emphasis></entry>
27872 </row>
27873 </tbody>
27874 </tgroup>
27875 </informaltable>
27876 <para>
27877 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
27878 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
27879 set up without waiting for the client to issue a STARTTLS command. For
27880 further details, see section <xref linkend="SECTsupobssmt"/>.
27881 </para>
27882 <para>
27883 <indexterm role="option">
27884 <primary><option>tls_privatekey</option></primary>
27885 </indexterm>
27886 </para>
27887 <informaltable frame="all">
27888 <tgroup cols="4" colsep="0" rowsep="0">
27889 <colspec colwidth="8*" align="left"/>
27890 <colspec colwidth="6*" align="center"/>
27891 <colspec colwidth="6*" align="center"/>
27892 <colspec colwidth="6*" align="right"/>
27893 <tbody>
27894 <row>
27895 <entry><option>tls_privatekey</option></entry>
27896 <entry>Use: <emphasis>main</emphasis></entry>
27897 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27898 <entry>Default: <emphasis>unset</emphasis></entry>
27899 </row>
27900 </tbody>
27901 </tgroup>
27902 </informaltable>
27903 <para>
27904 <indexterm role="concept">
27905 <primary>TLS</primary>
27906 <secondary>server private key; location of</secondary>
27907 </indexterm>
27908 The value of this option is expanded, and must then be the absolute path to a
27909 file which contains the server&#x2019;s private key. If this option is unset, or if
27910 the expansion is forced to fail, or the result is an empty string, the private
27911 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
27912 <xref linkend="CHAPTLS"/> for further details.
27913 </para>
27914 <para>
27915 <indexterm role="option">
27916 <primary><option>tls_remember_esmtp</option></primary>
27917 </indexterm>
27918 </para>
27919 <informaltable frame="all">
27920 <tgroup cols="4" colsep="0" rowsep="0">
27921 <colspec colwidth="8*" align="left"/>
27922 <colspec colwidth="6*" align="center"/>
27923 <colspec colwidth="6*" align="center"/>
27924 <colspec colwidth="6*" align="right"/>
27925 <tbody>
27926 <row>
27927 <entry><option>tls_remember_esmtp</option></entry>
27928 <entry>Use: <emphasis>main</emphasis></entry>
27929 <entry>Type: <emphasis>boolean</emphasis></entry>
27930 <entry>Default: <emphasis>false</emphasis></entry>
27931 </row>
27932 </tbody>
27933 </tgroup>
27934 </informaltable>
27935 <para>
27936 <indexterm role="concept">
27937 <primary>TLS</primary>
27938 <secondary>esmtp state; remembering</secondary>
27939 </indexterm>
27940 <indexterm role="concept">
27941 <primary>TLS</primary>
27942 <secondary>broken clients</secondary>
27943 </indexterm>
27944 If this option is set true, Exim violates the RFCs by remembering that it is in
27945 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
27946 support for broken clients that fail to send a new EHLO after starting a
27947 TLS session.
27948 </para>
27949 <para>
27950 <indexterm role="option">
27951 <primary><option>tls_require_ciphers</option></primary>
27952 </indexterm>
27953 </para>
27954 <informaltable frame="all">
27955 <tgroup cols="4" colsep="0" rowsep="0">
27956 <colspec colwidth="8*" align="left"/>
27957 <colspec colwidth="6*" align="center"/>
27958 <colspec colwidth="6*" align="center"/>
27959 <colspec colwidth="6*" align="right"/>
27960 <tbody>
27961 <row>
27962 <entry><option>tls_require_ciphers</option></entry>
27963 <entry>Use: <emphasis>main</emphasis></entry>
27964 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27965 <entry>Default: <emphasis>unset</emphasis></entry>
27966 </row>
27967 </tbody>
27968 </tgroup>
27969 </informaltable>
27970 <para>
27971 <indexterm role="concept">
27972 <primary>TLS</primary>
27973 <secondary>requiring specific ciphers</secondary>
27974 </indexterm>
27975 <indexterm role="concept">
27976 <primary>cipher</primary>
27977 <secondary>requiring specific</secondary>
27978 </indexterm>
27979 This option controls which ciphers can be used for incoming TLS connections.
27980 The <command>smtp</command> transport has an option of the same name for controlling outgoing
27981 connections. This option is expanded for each connection, so can be varied for
27982 different clients if required. The value of this option must be a list of
27983 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
27984 in somewhat different ways. If GnuTLS is being used, the client controls the
27985 preference order of the available ciphers. Details are given in sections
27986 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
27987 </para>
27988 <para>
27989 <indexterm role="option">
27990 <primary><option>tls_try_verify_hosts</option></primary>
27991 </indexterm>
27992 </para>
27993 <informaltable frame="all">
27994 <tgroup cols="4" colsep="0" rowsep="0">
27995 <colspec colwidth="8*" align="left"/>
27996 <colspec colwidth="6*" align="center"/>
27997 <colspec colwidth="6*" align="center"/>
27998 <colspec colwidth="6*" align="right"/>
27999 <tbody>
28000 <row>
28001 <entry><option>tls_try_verify_hosts</option></entry>
28002 <entry>Use: <emphasis>main</emphasis></entry>
28003 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28004 <entry>Default: <emphasis>unset</emphasis></entry>
28005 </row>
28006 </tbody>
28007 </tgroup>
28008 </informaltable>
28009 <para>
28010 <indexterm role="concept">
28011 <primary>TLS</primary>
28012 <secondary>client certificate verification</secondary>
28013 </indexterm>
28014 <indexterm role="concept">
28015 <primary>certificate</primary>
28016 <secondary>verification of client</secondary>
28017 </indexterm>
28018 See <option>tls_verify_hosts</option> below.
28019 </para>
28020 <para>
28021 <indexterm role="option">
28022 <primary><option>tls_verify_certificates</option></primary>
28023 </indexterm>
28024 </para>
28025 <informaltable frame="all">
28026 <tgroup cols="4" colsep="0" rowsep="0">
28027 <colspec colwidth="8*" align="left"/>
28028 <colspec colwidth="6*" align="center"/>
28029 <colspec colwidth="6*" align="center"/>
28030 <colspec colwidth="6*" align="right"/>
28031 <tbody>
28032 <row>
28033 <entry><option>tls_verify_certificates</option></entry>
28034 <entry>Use: <emphasis>main</emphasis></entry>
28035 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28036 <entry>Default: <emphasis>unset</emphasis></entry>
28037 </row>
28038 </tbody>
28039 </tgroup>
28040 </informaltable>
28041 <para>
28042 <indexterm role="concept">
28043 <primary>TLS</primary>
28044 <secondary>client certificate verification</secondary>
28045 </indexterm>
28046 <indexterm role="concept">
28047 <primary>certificate</primary>
28048 <secondary>verification of client</secondary>
28049 </indexterm>
28050 The value of this option is expanded, and must then be the absolute path to
28051 a file containing permitted certificates for clients that
28052 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
28053 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
28054 directory containing certificate files. This does not work with GnuTLS; the
28055 option must be set to the name of a single file if you are using GnuTLS.
28056 </para>
28057 <para>
28058 <indexterm role="option">
28059 <primary><option>tls_verify_hosts</option></primary>
28060 </indexterm>
28061 </para>
28062 <informaltable frame="all">
28063 <tgroup cols="4" colsep="0" rowsep="0">
28064 <colspec colwidth="8*" align="left"/>
28065 <colspec colwidth="6*" align="center"/>
28066 <colspec colwidth="6*" align="center"/>
28067 <colspec colwidth="6*" align="right"/>
28068 <tbody>
28069 <row>
28070 <entry><option>tls_verify_hosts</option></entry>
28071 <entry>Use: <emphasis>main</emphasis></entry>
28072 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28073 <entry>Default: <emphasis>unset</emphasis></entry>
28074 </row>
28075 </tbody>
28076 </tgroup>
28077 </informaltable>
28078 <para>
28079 <indexterm role="concept">
28080 <primary>TLS</primary>
28081 <secondary>client certificate verification</secondary>
28082 </indexterm>
28083 <indexterm role="concept">
28084 <primary>certificate</primary>
28085 <secondary>verification of client</secondary>
28086 </indexterm>
28087 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
28088 certificates from clients. The expected certificates are defined by
28089 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
28090 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
28091 <option>tls_verify_certificates</option> is not set.
28092 </para>
28093 <para revisionflag="changed">
28094 Any client that matches <option>tls_verify_hosts</option> is constrained by
28095 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
28096 present one of the listed certificates. If it does not, the connection is
28097 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
28098 the host to use TLS. It can still send SMTP commands through unencrypted
28099 connections. Forcing a client to use TLS has to be done separately using an
28100 ACL to reject inappropriate commands when the connection is not encrypted.
28101 </para>
28102 <para>
28103 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
28104 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
28105 certificate and checks it against <option>tls_verify_certificates</option>, but does not
28106 abort the connection if there is no certificate or if it does not match. This
28107 state can be detected in an ACL, which makes it possible to implement policies
28108 such as <quote>accept for relay only if a verified certificate has been received,
28109 but accept for local delivery if encrypted, even without a verified
28110 certificate</quote>.
28111 </para>
28112 <para>
28113 Client hosts that match neither of these lists are not asked to present
28114 certificates.
28115 </para>
28116 <para>
28117 <indexterm role="option">
28118 <primary><option>trusted_groups</option></primary>
28119 </indexterm>
28120 </para>
28121 <informaltable frame="all">
28122 <tgroup cols="4" colsep="0" rowsep="0">
28123 <colspec colwidth="8*" align="left"/>
28124 <colspec colwidth="6*" align="center"/>
28125 <colspec colwidth="6*" align="center"/>
28126 <colspec colwidth="6*" align="right"/>
28127 <tbody>
28128 <row>
28129 <entry><option>trusted_groups</option></entry>
28130 <entry>Use: <emphasis>main</emphasis></entry>
28131 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28132 <entry>Default: <emphasis>unset</emphasis></entry>
28133 </row>
28134 </tbody>
28135 </tgroup>
28136 </informaltable>
28137 <para>
28138 <indexterm role="concept">
28139 <primary>trusted groups</primary>
28140 </indexterm>
28141 <indexterm role="concept">
28142 <primary>groups</primary>
28143 <secondary>trusted</secondary>
28144 </indexterm>
28145 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28146 option is set, any process that is running in one of the listed groups, or
28147 which has one of them as a supplementary group, is trusted. The groups can be
28148 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
28149 details of what trusted callers are permitted to do. If neither
28150 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
28151 are trusted.
28152 </para>
28153 <para>
28154 <indexterm role="option">
28155 <primary><option>trusted_users</option></primary>
28156 </indexterm>
28157 </para>
28158 <informaltable frame="all">
28159 <tgroup cols="4" colsep="0" rowsep="0">
28160 <colspec colwidth="8*" align="left"/>
28161 <colspec colwidth="6*" align="center"/>
28162 <colspec colwidth="6*" align="center"/>
28163 <colspec colwidth="6*" align="right"/>
28164 <tbody>
28165 <row>
28166 <entry><option>trusted_users</option></entry>
28167 <entry>Use: <emphasis>main</emphasis></entry>
28168 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28169 <entry>Default: <emphasis>unset</emphasis></entry>
28170 </row>
28171 </tbody>
28172 </tgroup>
28173 </informaltable>
28174 <para>
28175 <indexterm role="concept">
28176 <primary>trusted users</primary>
28177 </indexterm>
28178 <indexterm role="concept">
28179 <primary>user</primary>
28180 <secondary>trusted</secondary>
28181 </indexterm>
28182 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28183 option is set, any process that is running as one of the listed users is
28184 trusted. The users can be specified numerically or by name. See section
28185 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
28186 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
28187 Exim user are trusted.
28188 </para>
28189 <para>
28190 <indexterm role="option">
28191 <primary><option>unknown_login</option></primary>
28192 </indexterm>
28193 </para>
28194 <informaltable frame="all">
28195 <tgroup cols="4" colsep="0" rowsep="0">
28196 <colspec colwidth="8*" align="left"/>
28197 <colspec colwidth="6*" align="center"/>
28198 <colspec colwidth="6*" align="center"/>
28199 <colspec colwidth="6*" align="right"/>
28200 <tbody>
28201 <row>
28202 <entry><option>unknown_login</option></entry>
28203 <entry>Use: <emphasis>main</emphasis></entry>
28204 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28205 <entry>Default: <emphasis>unset</emphasis></entry>
28206 </row>
28207 </tbody>
28208 </tgroup>
28209 </informaltable>
28210 <para>
28211 <indexterm role="concept">
28212 <primary>uid (user id)</primary>
28213 <secondary>unknown caller</secondary>
28214 </indexterm>
28215 <indexterm role="variable">
28216 <primary><varname>$caller_uid</varname></primary>
28217 </indexterm>
28218 This is a specialized feature for use in unusual configurations. By default, if
28219 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
28220 gives up. The <option>unknown_login</option> option can be used to set a login name to be
28221 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
28222 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
28223 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
28224 <option>-F</option> option.
28225 </para>
28226 <para>
28227 <indexterm role="option">
28228 <primary><option>unknown_username</option></primary>
28229 </indexterm>
28230 </para>
28231 <informaltable frame="all">
28232 <tgroup cols="4" colsep="0" rowsep="0">
28233 <colspec colwidth="8*" align="left"/>
28234 <colspec colwidth="6*" align="center"/>
28235 <colspec colwidth="6*" align="center"/>
28236 <colspec colwidth="6*" align="right"/>
28237 <tbody>
28238 <row>
28239 <entry><option>unknown_username</option></entry>
28240 <entry>Use: <emphasis>main</emphasis></entry>
28241 <entry>Type: <emphasis>string</emphasis></entry>
28242 <entry>Default: <emphasis>unset</emphasis></entry>
28243 </row>
28244 </tbody>
28245 </tgroup>
28246 </informaltable>
28247 <para>
28248 See <option>unknown_login</option>.
28249 </para>
28250 <para>
28251 <indexterm role="option">
28252 <primary><option>untrusted_set_sender</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>untrusted_set_sender</option></entry>
28264 <entry>Use: <emphasis>main</emphasis></entry>
28265 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
28266 <entry>Default: <emphasis>unset</emphasis></entry>
28267 </row>
28268 </tbody>
28269 </tgroup>
28270 </informaltable>
28271 <para>
28272 <indexterm role="concept">
28273 <primary>trusted users</primary>
28274 </indexterm>
28275 <indexterm role="concept">
28276 <primary>sender</primary>
28277 <secondary>setting by untrusted user</secondary>
28278 </indexterm>
28279 <indexterm role="concept">
28280 <primary>untrusted user setting sender</primary>
28281 </indexterm>
28282 <indexterm role="concept">
28283 <primary>user</primary>
28284 <secondary>untrusted setting sender</secondary>
28285 </indexterm>
28286 <indexterm role="concept">
28287 <primary>envelope sender</primary>
28288 </indexterm>
28289 When an untrusted user submits a message to Exim using the standard input, Exim
28290 normally creates an envelope sender address from the user&#x2019;s login and the
28291 default qualification domain. Data from the <option>-f</option> option (for setting envelope
28292 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
28293 is used) is ignored.
28294 </para>
28295 <para>
28296 However, untrusted users are permitted to set an empty envelope sender address,
28297 to declare that a message should never generate any bounces. For example:
28298 </para>
28299 <literallayout class="monospaced">
28300 exim -f '&lt;&gt;' user@domain.example
28301 </literallayout>
28302 <para>
28303 <indexterm role="variable">
28304 <primary><varname>$sender_ident</varname></primary>
28305 </indexterm>
28306 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
28307 other envelope sender addresses in a controlled way. When it is set, untrusted
28308 users are allowed to set envelope sender addresses that match any of the
28309 patterns in the list. Like all address lists, the string is expanded. The
28310 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
28311 users to setting senders that start with their login ids
28312 followed by a hyphen
28313 by a setting like this:
28314 </para>
28315 <literallayout class="monospaced">
28316 untrusted_set_sender = ^$sender_ident-
28317 </literallayout>
28318 <para>
28319 If you want to allow untrusted users to set envelope sender addresses without
28320 restriction, you can use
28321 </para>
28322 <literallayout class="monospaced">
28323 untrusted_set_sender = *
28324 </literallayout>
28325 <para>
28326 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
28327 only to the setting of the envelope sender. It does not permit untrusted users
28328 to use the other options which trusted user can use to override message
28329 parameters. Furthermore, it does not stop Exim from removing an existing
28330 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
28331 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
28332 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
28333 described in section <xref linkend="SECTthesenhea"/>.
28334 </para>
28335 <para>
28336 The log line for a message&#x2019;s arrival shows the envelope sender following
28337 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
28338 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
28339 envelope sender address, the user&#x2019;s login is shown in parentheses after the
28340 sender address.
28341 </para>
28342 <para>
28343 <indexterm role="option">
28344 <primary><option>uucp_from_pattern</option></primary>
28345 </indexterm>
28346 </para>
28347 <informaltable frame="all">
28348 <tgroup cols="4" colsep="0" rowsep="0">
28349 <colspec colwidth="8*" align="left"/>
28350 <colspec colwidth="6*" align="center"/>
28351 <colspec colwidth="6*" align="center"/>
28352 <colspec colwidth="6*" align="right"/>
28353 <tbody>
28354 <row>
28355 <entry><option>uucp_from_pattern</option></entry>
28356 <entry>Use: <emphasis>main</emphasis></entry>
28357 <entry>Type: <emphasis>string</emphasis></entry>
28358 <entry>Default: <emphasis>see below</emphasis></entry>
28359 </row>
28360 </tbody>
28361 </tgroup>
28362 </informaltable>
28363 <para>
28364 <indexterm role="concept">
28365 <primary><quote>From</quote> line</primary>
28366 </indexterm>
28367 <indexterm role="concept">
28368 <primary>UUCP</primary>
28369 <secondary><quote>From</quote> line</secondary>
28370 </indexterm>
28371 Some applications that pass messages to an MTA via a command line interface use
28372 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
28373 particular, this is used by UUCP software. Exim recognizes such a line by means
28374 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
28375 matches, the sender address is constructed by expanding the contents of
28376 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
28377 default pattern recognizes lines in the following two forms:
28378 </para>
28379 <literallayout class="monospaced">
28380 From ph10 Fri Jan  5 12:35 GMT 1996
28381 From ph10 Fri, 7 Jan 97 14:00:00 GMT
28382 </literallayout>
28383 <para>
28384 The pattern can be seen by running
28385 </para>
28386 <literallayout class="monospaced">
28387 exim -bP uucp_from_pattern
28388 </literallayout>
28389 <para>
28390 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
28391 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
28392 regular expression by a parenthesized subpattern. The default value for
28393 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
28394 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
28395 <option>ignore_fromline_hosts</option>.
28396 </para>
28397 <para>
28398 <indexterm role="option">
28399 <primary><option>uucp_from_sender</option></primary>
28400 </indexterm>
28401 </para>
28402 <informaltable frame="all">
28403 <tgroup cols="4" colsep="0" rowsep="0">
28404 <colspec colwidth="8*" align="left"/>
28405 <colspec colwidth="6*" align="center"/>
28406 <colspec colwidth="6*" align="center"/>
28407 <colspec colwidth="6*" align="right"/>
28408 <tbody>
28409 <row>
28410 <entry><option>uucp_from_sender</option></entry>
28411 <entry>Use: <emphasis>main</emphasis></entry>
28412 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28413 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
28414 </row>
28415 </tbody>
28416 </tgroup>
28417 </informaltable>
28418 <para>
28419 See <option>uucp_from_pattern</option> above.
28420 </para>
28421 <para>
28422 <indexterm role="option">
28423 <primary><option>warn_message_file</option></primary>
28424 </indexterm>
28425 </para>
28426 <informaltable frame="all">
28427 <tgroup cols="4" colsep="0" rowsep="0">
28428 <colspec colwidth="8*" align="left"/>
28429 <colspec colwidth="6*" align="center"/>
28430 <colspec colwidth="6*" align="center"/>
28431 <colspec colwidth="6*" align="right"/>
28432 <tbody>
28433 <row>
28434 <entry><option>warn_message_file</option></entry>
28435 <entry>Use: <emphasis>main</emphasis></entry>
28436 <entry>Type: <emphasis>string</emphasis></entry>
28437 <entry>Default: <emphasis>unset</emphasis></entry>
28438 </row>
28439 </tbody>
28440 </tgroup>
28441 </informaltable>
28442 <para>
28443 <indexterm role="concept">
28444 <primary>warning of delay</primary>
28445 <secondary>customizing the message</secondary>
28446 </indexterm>
28447 <indexterm role="concept">
28448 <primary>customizing</primary>
28449 <secondary>warning message</secondary>
28450 </indexterm>
28451 This option defines a template file containing paragraphs of text to be used
28452 for constructing the warning message which is sent by Exim when a message has
28453 been on the queue for a specified amount of time, as specified by
28454 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
28455 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
28456 </para>
28457 <para>
28458 <indexterm role="option">
28459 <primary><option>write_rejectlog</option></primary>
28460 </indexterm>
28461 </para>
28462 <informaltable frame="all">
28463 <tgroup cols="4" colsep="0" rowsep="0">
28464 <colspec colwidth="8*" align="left"/>
28465 <colspec colwidth="6*" align="center"/>
28466 <colspec colwidth="6*" align="center"/>
28467 <colspec colwidth="6*" align="right"/>
28468 <tbody>
28469 <row>
28470 <entry><option>write_rejectlog</option></entry>
28471 <entry>Use: <emphasis>main</emphasis></entry>
28472 <entry>Type: <emphasis>boolean</emphasis></entry>
28473 <entry>Default: <emphasis>true</emphasis></entry>
28474 </row>
28475 </tbody>
28476 </tgroup>
28477 </informaltable>
28478 <para>
28479 <indexterm role="concept">
28480 <primary>reject log</primary>
28481 <secondary>disabling</secondary>
28482 </indexterm>
28483 If this option is set false, Exim no longer writes anything to the reject log.
28484 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
28485 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
28486 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
28487 </para>
28488 </section>
28489 </chapter>
28490
28491 <chapter id="CHAProutergeneric">
28492 <title>Generic options for routers</title>
28493 <para>
28494 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
28495 <primary>options</primary>
28496 <secondary>generic; for routers</secondary>
28497 </indexterm>
28498 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
28499 <primary>generic options</primary>
28500 <secondary>router</secondary>
28501 </indexterm>
28502 This chapter describes the generic options that apply to all routers.
28503 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
28504 </para>
28505 <para>
28506 For a general description of how a router operates, see sections
28507 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
28508 which the preconditions are tested. The order of expansion of the options that
28509 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
28510 <option>headers_remove</option>, <option>transport</option>.
28511 </para>
28512 <para>
28513 <indexterm role="option">
28514 <primary><option>address_data</option></primary>
28515 </indexterm>
28516 </para>
28517 <informaltable frame="all">
28518 <tgroup cols="4" colsep="0" rowsep="0">
28519 <colspec colwidth="8*" align="left"/>
28520 <colspec colwidth="6*" align="center"/>
28521 <colspec colwidth="6*" align="center"/>
28522 <colspec colwidth="6*" align="right"/>
28523 <tbody>
28524 <row>
28525 <entry><option>address_data</option></entry>
28526 <entry>Use: <emphasis>routers</emphasis></entry>
28527 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28528 <entry>Default: <emphasis>unset</emphasis></entry>
28529 </row>
28530 </tbody>
28531 </tgroup>
28532 </informaltable>
28533 <para>
28534 <indexterm role="concept">
28535 <primary>router</primary>
28536 <secondary>data attached to address</secondary>
28537 </indexterm>
28538 The string is expanded just before the router is run, that is, after all the
28539 precondition tests have succeeded. If the expansion is forced to fail, the
28540 router declines, the value of <option>address_data</option> remains unchanged, and the
28541 <option>more</option> option controls what happens next. Other expansion failures cause
28542 delivery of the address to be deferred.
28543 </para>
28544 <para>
28545 <indexterm role="variable">
28546 <primary><varname>$address_data</varname></primary>
28547 </indexterm>
28548 When the expansion succeeds, the value is retained with the address, and can be
28549 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
28550 routers, and the eventual transport.
28551 </para>
28552 <para>
28553 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
28554 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
28555 in the filter. This is not normally a problem, because such data is usually
28556 either not confidential or it <quote>belongs</quote> to the current user, but if you do
28557 put confidential data into <varname>$address_data</varname> you need to remember this point.
28558 </para>
28559 <para>
28560 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
28561 with the address, though it can be changed by another <option>address_data</option> setting
28562 on a subsequent router. If a router generates child addresses, the value of
28563 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
28564 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
28565 </para>
28566 <para>
28567 The idea of <option>address_data</option> is that you can use it to look up a lot of data
28568 for the address once, and then pick out parts of the data later. For example,
28569 you could use a single LDAP lookup to return a string of the form
28570 </para>
28571 <literallayout class="monospaced">
28572 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
28573 </literallayout>
28574 <para>
28575 In the transport you could pick out the mailbox by a setting such as
28576 </para>
28577 <literallayout class="monospaced">
28578 file = ${extract{mailbox}{$address_data}}
28579 </literallayout>
28580 <para>
28581 This makes the configuration file less messy, and also reduces the number of
28582 lookups (though Exim does cache lookups).
28583 </para>
28584 <para>
28585 <indexterm role="variable">
28586 <primary><varname>$sender_address_data</varname></primary>
28587 </indexterm>
28588 <indexterm role="variable">
28589 <primary><varname>$address_data</varname></primary>
28590 </indexterm>
28591 The <option>address_data</option> facility is also useful as a means of passing information
28592 from one router to another, and from a router to a transport. In addition, if
28593 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
28594 ACL, it remains available for use in the rest of the ACL statement. After
28595 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
28596 </para>
28597 <para>
28598 <indexterm role="option">
28599 <primary><option>address_test</option></primary>
28600 </indexterm>
28601 </para>
28602 <informaltable frame="all">
28603 <tgroup cols="4" colsep="0" rowsep="0">
28604 <colspec colwidth="8*" align="left"/>
28605 <colspec colwidth="6*" align="center"/>
28606 <colspec colwidth="6*" align="center"/>
28607 <colspec colwidth="6*" align="right"/>
28608 <tbody>
28609 <row>
28610 <entry><option>address_test</option></entry>
28611 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28612 <entry>Type: <emphasis>boolean</emphasis></entry>
28613 <entry>Default: <emphasis>true</emphasis></entry>
28614 </row>
28615 </tbody>
28616 </tgroup>
28617 </informaltable>
28618 <para>
28619 <indexterm role="option">
28620 <primary><option>-bt</option></primary>
28621 </indexterm>
28622 <indexterm role="concept">
28623 <primary>router</primary>
28624 <secondary>skipping when address testing</secondary>
28625 </indexterm>
28626 If this option is set false, the router is skipped when routing is being tested
28627 by means of the <option>-bt</option> command line option. This can be a convenience when
28628 your first router sends messages to an external scanner, because it saves you
28629 having to set the <quote>already scanned</quote> indicator when testing real address
28630 routing.
28631 </para>
28632 <para>
28633 <indexterm role="option">
28634 <primary><option>cannot_route_message</option></primary>
28635 </indexterm>
28636 </para>
28637 <informaltable frame="all">
28638 <tgroup cols="4" colsep="0" rowsep="0">
28639 <colspec colwidth="8*" align="left"/>
28640 <colspec colwidth="6*" align="center"/>
28641 <colspec colwidth="6*" align="center"/>
28642 <colspec colwidth="6*" align="right"/>
28643 <tbody>
28644 <row>
28645 <entry><option>cannot_route_message</option></entry>
28646 <entry>Use: <emphasis>routers</emphasis></entry>
28647 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28648 <entry>Default: <emphasis>unset</emphasis></entry>
28649 </row>
28650 </tbody>
28651 </tgroup>
28652 </informaltable>
28653 <para>
28654 <indexterm role="concept">
28655 <primary>router</primary>
28656 <secondary>customizing <quote>cannot route</quote> message</secondary>
28657 </indexterm>
28658 <indexterm role="concept">
28659 <primary>customizing</primary>
28660 <secondary><quote>cannot route</quote> message</secondary>
28661 </indexterm>
28662 This option specifies a text message that is used when an address cannot be
28663 routed because Exim has run out of routers. The default message is
28664 <quote>Unrouteable address</quote>. This option is useful only on routers that have
28665 <option>more</option> set false, or on the very last router in a configuration, because the
28666 value that is used is taken from the last router that is considered. This
28667 includes a router that is skipped because its preconditions are not met, as
28668 well as a router that declines. For example, using the default configuration,
28669 you could put:
28670 </para>
28671 <literallayout class="monospaced">
28672 cannot_route_message = Remote domain not found in DNS
28673 </literallayout>
28674 <para>
28675 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
28676 and
28677 </para>
28678 <literallayout class="monospaced">
28679 cannot_route_message = Unknown local user
28680 </literallayout>
28681 <para>
28682 on the final router that checks for local users. If string expansion fails for
28683 this option, the default message is used. Unless the expansion failure was
28684 explicitly forced, a message about the failure is written to the main and panic
28685 logs, in addition to the normal message about the routing failure.
28686 </para>
28687 <para>
28688 <indexterm role="option">
28689 <primary><option>caseful_local_part</option></primary>
28690 </indexterm>
28691 </para>
28692 <informaltable frame="all">
28693 <tgroup cols="4" colsep="0" rowsep="0">
28694 <colspec colwidth="8*" align="left"/>
28695 <colspec colwidth="6*" align="center"/>
28696 <colspec colwidth="6*" align="center"/>
28697 <colspec colwidth="6*" align="right"/>
28698 <tbody>
28699 <row>
28700 <entry><option>caseful_local_part</option></entry>
28701 <entry>Use: <emphasis>routers</emphasis></entry>
28702 <entry>Type: <emphasis>boolean</emphasis></entry>
28703 <entry>Default: <emphasis>false</emphasis></entry>
28704 </row>
28705 </tbody>
28706 </tgroup>
28707 </informaltable>
28708 <para>
28709 <indexterm role="concept">
28710 <primary>case of local parts</primary>
28711 </indexterm>
28712 <indexterm role="concept">
28713 <primary>router</primary>
28714 <secondary>case of local parts</secondary>
28715 </indexterm>
28716 By default, routers handle the local parts of addresses in a case-insensitive
28717 manner, though the actual case is preserved for transmission with the message.
28718 If you want the case of letters to be significant in a router, you must set
28719 this option true. For individual router options that contain address or local
28720 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
28721 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
28722 more details.
28723 </para>
28724 <para>
28725 <indexterm role="variable">
28726 <primary><varname>$local_part</varname></primary>
28727 </indexterm>
28728 <indexterm role="variable">
28729 <primary><varname>$original_local_part</varname></primary>
28730 </indexterm>
28731 <indexterm role="variable">
28732 <primary><varname>$parent_local_part</varname></primary>
28733 </indexterm>
28734 The value of the <varname>$local_part</varname> variable is forced to lower case while a
28735 router is running unless <option>caseful_local_part</option> is set. When a router assigns
28736 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
28737 is the same as it was in the router. Similarly, when a router generates child
28738 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
28739 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
28740 </para>
28741 <para>
28742 This option applies to the processing of an address by a router. When a
28743 recipient address is being processed in an ACL, there is a separate <option>control</option>
28744 modifier that can be used to specify case-sensitive processing within the ACL
28745 (see section <xref linkend="SECTcontrols"/>).
28746 </para>
28747 <para>
28748 <indexterm role="option">
28749 <primary><option>check_local_user</option></primary>
28750 </indexterm>
28751 </para>
28752 <informaltable frame="all">
28753 <tgroup cols="4" colsep="0" rowsep="0">
28754 <colspec colwidth="8*" align="left"/>
28755 <colspec colwidth="6*" align="center"/>
28756 <colspec colwidth="6*" align="center"/>
28757 <colspec colwidth="6*" align="right"/>
28758 <tbody>
28759 <row>
28760 <entry><option>check_local_user</option></entry>
28761 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28762 <entry>Type: <emphasis>boolean</emphasis></entry>
28763 <entry>Default: <emphasis>false</emphasis></entry>
28764 </row>
28765 </tbody>
28766 </tgroup>
28767 </informaltable>
28768 <para>
28769 <indexterm role="concept">
28770 <primary>local user, checking in router</primary>
28771 </indexterm>
28772 <indexterm role="concept">
28773 <primary>router</primary>
28774 <secondary>checking for local user</secondary>
28775 </indexterm>
28776 <indexterm role="concept">
28777 <primary><filename>/etc/passwd</filename></primary>
28778 </indexterm>
28779 <indexterm role="variable">
28780 <primary><varname>$home</varname></primary>
28781 </indexterm>
28782 When this option is true, Exim checks that the local part of the recipient
28783 address (with affixes removed if relevant) is the name of an account on the
28784 local system. The check is done by calling the <function>getpwnam()</function> function rather
28785 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
28786 holding password data (such as NIS) are supported. If the local part is a local
28787 user, <varname>$home</varname> is set from the password data, and can be tested in other
28788 preconditions that are evaluated after this one (the order of evaluation is
28789 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
28790 overridden by <option>router_home_directory</option>. If the local part is not a local user,
28791 the router is skipped.
28792 </para>
28793 <para>
28794 If you want to check that the local part is either the name of a local user
28795 or matches something else, you cannot combine <option>check_local_user</option> with a
28796 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
28797 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
28798 setting to achieve this. For example:
28799 </para>
28800 <literallayout class="monospaced">
28801 local_parts = passwd;$local_part : lsearch;/etc/other/users
28802 </literallayout>
28803 <para>
28804 Note, however, that the side effects of <option>check_local_user</option> (such as setting
28805 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
28806 <option>local_parts</option> (or any other) precondition.
28807 </para>
28808 <para>
28809 <indexterm role="option">
28810 <primary><option>condition</option></primary>
28811 </indexterm>
28812 </para>
28813 <informaltable frame="all">
28814 <tgroup cols="4" colsep="0" rowsep="0">
28815 <colspec colwidth="8*" align="left"/>
28816 <colspec colwidth="6*" align="center"/>
28817 <colspec colwidth="6*" align="center"/>
28818 <colspec colwidth="6*" align="right"/>
28819 <tbody>
28820 <row>
28821 <entry><option>condition</option></entry>
28822 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28823 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28824 <entry>Default: <emphasis>unset</emphasis></entry>
28825 </row>
28826 </tbody>
28827 </tgroup>
28828 </informaltable>
28829 <para>
28830 <indexterm role="concept">
28831 <primary>router</primary>
28832 <secondary>customized precondition</secondary>
28833 </indexterm>
28834 This option specifies a general precondition test that has to succeed for the
28835 router to be called. The <option>condition</option> option is the last precondition to be
28836 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
28837 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
28838 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
28839 router is skipped, and the address is offered to the next one.
28840 </para>
28841 <para>
28842 If the result is any other value, the router is run (as this is the last
28843 precondition to be evaluated, all the other preconditions must be true).
28844 </para>
28845 <para>
28846 The <option>condition</option> option provides a means of applying custom conditions to the
28847 running of routers. Note that in the case of a simple conditional expansion,
28848 the default expansion values are exactly what is wanted. For example:
28849 </para>
28850 <literallayout class="monospaced">
28851 condition = ${if &gt;{$message_age}{600}}
28852 </literallayout>
28853 <para>
28854 Because of the default behaviour of the string expansion, this is equivalent to
28855 </para>
28856 <literallayout class="monospaced">
28857 condition = ${if &gt;{$message_age}{600}{true}{}}
28858 </literallayout>
28859 <para>
28860 If the expansion fails (other than forced failure) delivery is deferred. Some
28861 of the other precondition options are common special cases that could in fact
28862 be specified using <option>condition</option>.
28863 </para>
28864 <para>
28865 <indexterm role="option">
28866 <primary><option>debug_print</option></primary>
28867 </indexterm>
28868 </para>
28869 <informaltable frame="all">
28870 <tgroup cols="4" colsep="0" rowsep="0">
28871 <colspec colwidth="8*" align="left"/>
28872 <colspec colwidth="6*" align="center"/>
28873 <colspec colwidth="6*" align="center"/>
28874 <colspec colwidth="6*" align="right"/>
28875 <tbody>
28876 <row>
28877 <entry><option>debug_print</option></entry>
28878 <entry>Use: <emphasis>routers</emphasis></entry>
28879 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28880 <entry>Default: <emphasis>unset</emphasis></entry>
28881 </row>
28882 </tbody>
28883 </tgroup>
28884 </informaltable>
28885 <para>
28886 <indexterm role="concept">
28887 <primary>testing</primary>
28888 <secondary>variables in drivers</secondary>
28889 </indexterm>
28890 If this option is set and debugging is enabled (see the <option>-d</option> command line
28891 option), the string is expanded and included in the debugging output.
28892 If expansion of the string fails, the error message is written to the debugging
28893 output, and Exim carries on processing.
28894 This option is provided to help with checking out the values of variables and
28895 so on when debugging router configurations. For example, if a <option>condition</option>
28896 option appears not to be working, <option>debug_print</option> can be used to output the
28897 variables it references. The output happens after checks for <option>domains</option>,
28898 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
28899 are tested. A newline is added to the text if it does not end with one.
28900 </para>
28901 <para>
28902 <indexterm role="option">
28903 <primary><option>disable_logging</option></primary>
28904 </indexterm>
28905 </para>
28906 <informaltable frame="all">
28907 <tgroup cols="4" colsep="0" rowsep="0">
28908 <colspec colwidth="8*" align="left"/>
28909 <colspec colwidth="6*" align="center"/>
28910 <colspec colwidth="6*" align="center"/>
28911 <colspec colwidth="6*" align="right"/>
28912 <tbody>
28913 <row>
28914 <entry><option>disable_logging</option></entry>
28915 <entry>Use: <emphasis>routers</emphasis></entry>
28916 <entry>Type: <emphasis>boolean</emphasis></entry>
28917 <entry>Default: <emphasis>false</emphasis></entry>
28918 </row>
28919 </tbody>
28920 </tgroup>
28921 </informaltable>
28922 <para>
28923 If this option is set true, nothing is logged for any routing errors
28924 or for any deliveries caused by this router. You should not set this option
28925 unless you really, really know what you are doing. See also the generic
28926 transport option of the same name.
28927 </para>
28928 <para>
28929 <indexterm role="option">
28930 <primary><option>domains</option></primary>
28931 </indexterm>
28932 </para>
28933 <informaltable frame="all">
28934 <tgroup cols="4" colsep="0" rowsep="0">
28935 <colspec colwidth="8*" align="left"/>
28936 <colspec colwidth="6*" align="center"/>
28937 <colspec colwidth="6*" align="center"/>
28938 <colspec colwidth="6*" align="right"/>
28939 <tbody>
28940 <row>
28941 <entry><option>domains</option></entry>
28942 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28943 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28944 <entry>Default: <emphasis>unset</emphasis></entry>
28945 </row>
28946 </tbody>
28947 </tgroup>
28948 </informaltable>
28949 <para>
28950 <indexterm role="concept">
28951 <primary>router</primary>
28952 <secondary>restricting to specific domains</secondary>
28953 </indexterm>
28954 <indexterm role="variable">
28955 <primary><varname>$domain_data</varname></primary>
28956 </indexterm>
28957 If this option is set, the router is skipped unless the current domain matches
28958 the list. If the match is achieved by means of a file lookup, the data that the
28959 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
28960 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
28961 a list of the order in which preconditions are evaluated.
28962 </para>
28963 <para>
28964 <indexterm role="option">
28965 <primary><option>driver</option></primary>
28966 </indexterm>
28967 </para>
28968 <informaltable frame="all">
28969 <tgroup cols="4" colsep="0" rowsep="0">
28970 <colspec colwidth="8*" align="left"/>
28971 <colspec colwidth="6*" align="center"/>
28972 <colspec colwidth="6*" align="center"/>
28973 <colspec colwidth="6*" align="right"/>
28974 <tbody>
28975 <row>
28976 <entry><option>driver</option></entry>
28977 <entry>Use: <emphasis>routers</emphasis></entry>
28978 <entry>Type: <emphasis>string</emphasis></entry>
28979 <entry>Default: <emphasis>unset</emphasis></entry>
28980 </row>
28981 </tbody>
28982 </tgroup>
28983 </informaltable>
28984 <para>
28985 This option must always be set. It specifies which of the available routers is
28986 to be used.
28987 </para>
28988 <para>
28989 <indexterm role="option">
28990 <primary><option>errors_to</option></primary>
28991 </indexterm>
28992 </para>
28993 <informaltable frame="all">
28994 <tgroup cols="4" colsep="0" rowsep="0">
28995 <colspec colwidth="8*" align="left"/>
28996 <colspec colwidth="6*" align="center"/>
28997 <colspec colwidth="6*" align="center"/>
28998 <colspec colwidth="6*" align="right"/>
28999 <tbody>
29000 <row>
29001 <entry><option>errors_to</option></entry>
29002 <entry>Use: <emphasis>routers</emphasis></entry>
29003 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29004 <entry>Default: <emphasis>unset</emphasis></entry>
29005 </row>
29006 </tbody>
29007 </tgroup>
29008 </informaltable>
29009 <para>
29010 <indexterm role="concept">
29011 <primary>envelope sender</primary>
29012 </indexterm>
29013 <indexterm role="concept">
29014 <primary>router</primary>
29015 <secondary>changing address for errors</secondary>
29016 </indexterm>
29017 If a router successfully handles an address, it may assign the address to a
29018 transport for delivery or it may generate child addresses. In both cases, if
29019 there is a delivery problem during later processing, the resulting bounce
29020 message is sent to the address that results from expanding this string,
29021 provided that the address verifies successfully. The <option>errors_to</option> option is
29022 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
29023 </para>
29024 <para>
29025 The <option>errors_to</option> setting associated with an address can be overridden if it
29026 subsequently passes through other routers that have their own <option>errors_to</option>
29027 settings, or if the message is delivered by a transport with a <option>return_path</option>
29028 setting.
29029 </para>
29030 <para>
29031 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
29032 the expansion fails to verify, the errors address associated with the incoming
29033 address is used. At top level, this is the envelope sender. A non-forced
29034 expansion failure causes delivery to be deferred.
29035 </para>
29036 <para>
29037 If an address for which <option>errors_to</option> has been set ends up being delivered over
29038 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
29039 any bounces that are generated by other MTAs on the delivery route are also
29040 sent there. You can set <option>errors_to</option> to the empty string by either of these
29041 settings:
29042 </para>
29043 <literallayout class="monospaced">
29044 errors_to =
29045 errors_to = ""
29046 </literallayout>
29047 <para>
29048 An expansion item that yields an empty string has the same effect. If you do
29049 this, a locally detected delivery error for addresses processed by this router
29050 no longer gives rise to a bounce message; the error is discarded. If the
29051 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
29052 overridden by the <option>return_path</option> option on the transport.
29053 </para>
29054 <para>
29055 <indexterm role="variable">
29056 <primary><varname>$address_data</varname></primary>
29057 </indexterm>
29058 If for some reason you want to discard local errors, but use a non-empty
29059 MAIL command for remote delivery, you can preserve the original return
29060 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
29061 setting <option>return_path</option>.
29062 </para>
29063 <para>
29064 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
29065 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
29066 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
29067 </para>
29068 <para>
29069 <indexterm role="option">
29070 <primary><option>expn</option></primary>
29071 </indexterm>
29072 </para>
29073 <informaltable frame="all">
29074 <tgroup cols="4" colsep="0" rowsep="0">
29075 <colspec colwidth="8*" align="left"/>
29076 <colspec colwidth="6*" align="center"/>
29077 <colspec colwidth="6*" align="center"/>
29078 <colspec colwidth="6*" align="right"/>
29079 <tbody>
29080 <row>
29081 <entry><option>expn</option></entry>
29082 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29083 <entry>Type: <emphasis>boolean</emphasis></entry>
29084 <entry>Default: <emphasis>true</emphasis></entry>
29085 </row>
29086 </tbody>
29087 </tgroup>
29088 </informaltable>
29089 <para>
29090 <indexterm role="concept">
29091 <primary>address</primary>
29092 <secondary>testing</secondary>
29093 </indexterm>
29094 <indexterm role="concept">
29095 <primary>testing</primary>
29096 <secondary>addresses</secondary>
29097 </indexterm>
29098 <indexterm role="concept">
29099 <primary>EXPN</primary>
29100 <secondary>router skipping</secondary>
29101 </indexterm>
29102 <indexterm role="concept">
29103 <primary>router</primary>
29104 <secondary>skipping for EXPN</secondary>
29105 </indexterm>
29106 If this option is turned off, the router is skipped when testing an address
29107 as a result of processing an SMTP EXPN command. You might, for example,
29108 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
29109 on for the system alias file.
29110 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29111 are evaluated.
29112 </para>
29113 <para>
29114 The use of the SMTP EXPN command is controlled by an ACL (see chapter
29115 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
29116 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
29117 </para>
29118 <para>
29119 <indexterm role="option">
29120 <primary><option>fail_verify</option></primary>
29121 </indexterm>
29122 </para>
29123 <informaltable frame="all">
29124 <tgroup cols="4" colsep="0" rowsep="0">
29125 <colspec colwidth="8*" align="left"/>
29126 <colspec colwidth="6*" align="center"/>
29127 <colspec colwidth="6*" align="center"/>
29128 <colspec colwidth="6*" align="right"/>
29129 <tbody>
29130 <row>
29131 <entry><option>fail_verify</option></entry>
29132 <entry>Use: <emphasis>routers</emphasis></entry>
29133 <entry>Type: <emphasis>boolean</emphasis></entry>
29134 <entry>Default: <emphasis>false</emphasis></entry>
29135 </row>
29136 </tbody>
29137 </tgroup>
29138 </informaltable>
29139 <para>
29140 <indexterm role="concept">
29141 <primary>router</primary>
29142 <secondary>forcing verification failure</secondary>
29143 </indexterm>
29144 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
29145 <option>fail_verify_recipient</option> to the same value.
29146 </para>
29147 <para>
29148 <indexterm role="option">
29149 <primary><option>fail_verify_recipient</option></primary>
29150 </indexterm>
29151 </para>
29152 <informaltable frame="all">
29153 <tgroup cols="4" colsep="0" rowsep="0">
29154 <colspec colwidth="8*" align="left"/>
29155 <colspec colwidth="6*" align="center"/>
29156 <colspec colwidth="6*" align="center"/>
29157 <colspec colwidth="6*" align="right"/>
29158 <tbody>
29159 <row>
29160 <entry><option>fail_verify_recipient</option></entry>
29161 <entry>Use: <emphasis>routers</emphasis></entry>
29162 <entry>Type: <emphasis>boolean</emphasis></entry>
29163 <entry>Default: <emphasis>false</emphasis></entry>
29164 </row>
29165 </tbody>
29166 </tgroup>
29167 </informaltable>
29168 <para>
29169 If this option is true and an address is accepted by this router when
29170 verifying a recipient, verification fails.
29171 </para>
29172 <para>
29173 <indexterm role="option">
29174 <primary><option>fail_verify_sender</option></primary>
29175 </indexterm>
29176 </para>
29177 <informaltable frame="all">
29178 <tgroup cols="4" colsep="0" rowsep="0">
29179 <colspec colwidth="8*" align="left"/>
29180 <colspec colwidth="6*" align="center"/>
29181 <colspec colwidth="6*" align="center"/>
29182 <colspec colwidth="6*" align="right"/>
29183 <tbody>
29184 <row>
29185 <entry><option>fail_verify_sender</option></entry>
29186 <entry>Use: <emphasis>routers</emphasis></entry>
29187 <entry>Type: <emphasis>boolean</emphasis></entry>
29188 <entry>Default: <emphasis>false</emphasis></entry>
29189 </row>
29190 </tbody>
29191 </tgroup>
29192 </informaltable>
29193 <para>
29194 If this option is true and an address is accepted by this router when
29195 verifying a sender, verification fails.
29196 </para>
29197 <para>
29198 <indexterm role="option">
29199 <primary><option>fallback_hosts</option></primary>
29200 </indexterm>
29201 </para>
29202 <informaltable frame="all">
29203 <tgroup cols="4" colsep="0" rowsep="0">
29204 <colspec colwidth="8*" align="left"/>
29205 <colspec colwidth="6*" align="center"/>
29206 <colspec colwidth="6*" align="center"/>
29207 <colspec colwidth="6*" align="right"/>
29208 <tbody>
29209 <row>
29210 <entry><option>fallback_hosts</option></entry>
29211 <entry>Use: <emphasis>routers</emphasis></entry>
29212 <entry>Type: <emphasis>string list</emphasis></entry>
29213 <entry>Default: <emphasis>unset</emphasis></entry>
29214 </row>
29215 </tbody>
29216 </tgroup>
29217 </informaltable>
29218 <para>
29219 <indexterm role="concept">
29220 <primary>router</primary>
29221 <secondary>fallback hosts</secondary>
29222 </indexterm>
29223 <indexterm role="concept">
29224 <primary>fallback</primary>
29225 <secondary>hosts specified on router</secondary>
29226 </indexterm>
29227 String expansion is not applied to this option. The argument must be a
29228 colon-separated list of host names or IP addresses. The list separator can be
29229 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
29230 each name or address. In fact, the format of each item is exactly the same as
29231 defined for the list of hosts in a <command>manualroute</command> router (see section
29232 <xref linkend="SECTformatonehostitem"/>).
29233 </para>
29234 <para>
29235 If a router queues an address for a remote transport, this host list is
29236 associated with the address, and used instead of the transport&#x2019;s fallback host
29237 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
29238 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
29239 transport for further details.
29240 </para>
29241 <para>
29242 <indexterm role="option">
29243 <primary><option>group</option></primary>
29244 </indexterm>
29245 </para>
29246 <informaltable frame="all">
29247 <tgroup cols="4" colsep="0" rowsep="0">
29248 <colspec colwidth="8*" align="left"/>
29249 <colspec colwidth="6*" align="center"/>
29250 <colspec colwidth="6*" align="center"/>
29251 <colspec colwidth="6*" align="right"/>
29252 <tbody>
29253 <row>
29254 <entry><option>group</option></entry>
29255 <entry>Use: <emphasis>routers</emphasis></entry>
29256 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29257 <entry>Default: <emphasis>see below</emphasis></entry>
29258 </row>
29259 </tbody>
29260 </tgroup>
29261 </informaltable>
29262 <para>
29263 <indexterm role="concept">
29264 <primary>gid (group id)</primary>
29265 <secondary>local delivery</secondary>
29266 </indexterm>
29267 <indexterm role="concept">
29268 <primary>local transports</primary>
29269 <secondary>uid and gid</secondary>
29270 </indexterm>
29271 <indexterm role="concept">
29272 <primary>transport</primary>
29273 <secondary>local</secondary>
29274 </indexterm>
29275 <indexterm role="concept">
29276 <primary>router</primary>
29277 <secondary>setting group</secondary>
29278 </indexterm>
29279 When a router queues an address for a transport, and the transport does not
29280 specify a group, the group given here is used when running the delivery
29281 process.
29282 The group may be specified numerically or by name. If expansion fails, the
29283 error is logged and delivery is deferred.
29284 The default is unset, unless <option>check_local_user</option> is set, when the default
29285 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
29286 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29287 </para>
29288 <para>
29289 <indexterm role="option">
29290 <primary><option>headers_add</option></primary>
29291 </indexterm>
29292 </para>
29293 <informaltable frame="all">
29294 <tgroup cols="4" colsep="0" rowsep="0">
29295 <colspec colwidth="8*" align="left"/>
29296 <colspec colwidth="6*" align="center"/>
29297 <colspec colwidth="6*" align="center"/>
29298 <colspec colwidth="6*" align="right"/>
29299 <tbody>
29300 <row>
29301 <entry><option>headers_add</option></entry>
29302 <entry>Use: <emphasis>routers</emphasis></entry>
29303 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29304 <entry>Default: <emphasis>unset</emphasis></entry>
29305 </row>
29306 </tbody>
29307 </tgroup>
29308 </informaltable>
29309 <para>
29310 <indexterm role="concept">
29311 <primary>header lines</primary>
29312 <secondary>adding</secondary>
29313 </indexterm>
29314 <indexterm role="concept">
29315 <primary>router</primary>
29316 <secondary>adding header lines</secondary>
29317 </indexterm>
29318 This option specifies a string of text that is expanded at routing time, and
29319 associated with any addresses that are accepted by the router. However, this
29320 option has no effect when an address is just being verified. The way in which
29321 the text is used to add header lines at transport time is described in section
29322 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
29323 message is in the process of being transported. This means that references to
29324 header lines in string expansions in the transport&#x2019;s configuration do not
29325 <quote>see</quote> the added header lines.
29326 </para>
29327 <para>
29328 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
29329 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
29330 the expansion is forced to fail, the option has no effect. Other expansion
29331 failures are treated as configuration errors.
29332 </para>
29333 <para>
29334 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
29335 router that has the <option>one_time</option> option set.
29336 </para>
29337 <para>
29338 <indexterm role="concept">
29339 <primary>duplicate addresses</primary>
29340 </indexterm>
29341 <indexterm role="option">
29342 <primary><option>unseen</option></primary>
29343 </indexterm>
29344 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29345 additions are deleted when the address is passed on to subsequent routers.
29346 For a <option>redirect</option> router, if a generated address is the same as the incoming
29347 address, this can lead to duplicate addresses with different header
29348 modifications. Exim does not do duplicate deliveries (except, in certain
29349 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
29350 which of the duplicates is discarded, so this ambiguous situation should be
29351 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
29352 </para>
29353 <para>
29354 <indexterm role="option">
29355 <primary><option>headers_remove</option></primary>
29356 </indexterm>
29357 </para>
29358 <informaltable frame="all">
29359 <tgroup cols="4" colsep="0" rowsep="0">
29360 <colspec colwidth="8*" align="left"/>
29361 <colspec colwidth="6*" align="center"/>
29362 <colspec colwidth="6*" align="center"/>
29363 <colspec colwidth="6*" align="right"/>
29364 <tbody>
29365 <row>
29366 <entry><option>headers_remove</option></entry>
29367 <entry>Use: <emphasis>routers</emphasis></entry>
29368 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29369 <entry>Default: <emphasis>unset</emphasis></entry>
29370 </row>
29371 </tbody>
29372 </tgroup>
29373 </informaltable>
29374 <para>
29375 <indexterm role="concept">
29376 <primary>header lines</primary>
29377 <secondary>removing</secondary>
29378 </indexterm>
29379 <indexterm role="concept">
29380 <primary>router</primary>
29381 <secondary>removing header lines</secondary>
29382 </indexterm>
29383 This option specifies a string of text that is expanded at routing time, and
29384 associated with any addresses that are accepted by the router. However, this
29385 option has no effect when an address is just being verified. The way in which
29386 the text is used to remove header lines at transport time is described in
29387 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
29388 the message is in the process of being transported. This means that references
29389 to header lines in string expansions in the transport&#x2019;s configuration still
29390 <quote>see</quote> the original header lines.
29391 </para>
29392 <para>
29393 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
29394 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
29395 the option has no effect. Other expansion failures are treated as configuration
29396 errors.
29397 </para>
29398 <para>
29399 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
29400 router that has the <option>one_time</option> option set.
29401 </para>
29402 <para>
29403 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29404 removal requests are deleted when the address is passed on to subsequent
29405 routers, and this can lead to problems with duplicates -- see the similar
29406 warning for <option>headers_add</option> above.
29407 </para>
29408 <para>
29409 <indexterm role="option">
29410 <primary><option>ignore_target_hosts</option></primary>
29411 </indexterm>
29412 </para>
29413 <informaltable frame="all">
29414 <tgroup cols="4" colsep="0" rowsep="0">
29415 <colspec colwidth="8*" align="left"/>
29416 <colspec colwidth="6*" align="center"/>
29417 <colspec colwidth="6*" align="center"/>
29418 <colspec colwidth="6*" align="right"/>
29419 <tbody>
29420 <row>
29421 <entry><option>ignore_target_hosts</option></entry>
29422 <entry>Use: <emphasis>routers</emphasis></entry>
29423 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29424 <entry>Default: <emphasis>unset</emphasis></entry>
29425 </row>
29426 </tbody>
29427 </tgroup>
29428 </informaltable>
29429 <para>
29430 <indexterm role="concept">
29431 <primary>IP address</primary>
29432 <secondary>discarding</secondary>
29433 </indexterm>
29434 <indexterm role="concept">
29435 <primary>router</primary>
29436 <secondary>discarding IP addresses</secondary>
29437 </indexterm>
29438 Although this option is a host list, it should normally contain IP address
29439 entries rather than names. If any host that is looked up by the router has an
29440 IP address that matches an item in this list, Exim behaves as if that IP
29441 address did not exist. This option allows you to cope with rogue DNS entries
29442 like
29443 </para>
29444 <literallayout class="monospaced">
29445 remote.domain.example.  A  127.0.0.1
29446 </literallayout>
29447 <para>
29448 by setting
29449 </para>
29450 <literallayout class="monospaced">
29451 ignore_target_hosts = 127.0.0.1
29452 </literallayout>
29453 <para>
29454 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
29455 discarded in this way, the router declines. In a conventional configuration, an
29456 attempt to mail to such a domain would normally provoke the <quote>unrouteable
29457 domain</quote> error, and an attempt to verify an address in the domain would fail.
29458 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
29459 router declines if presented with one of the listed addresses.
29460 </para>
29461 <para>
29462 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
29463 means of the first or the second of the following settings, respectively:
29464 </para>
29465 <literallayout class="monospaced">
29466 ignore_target_hosts = 0.0.0.0/0
29467 ignore_target_hosts = &lt;; 0::0/0
29468 </literallayout>
29469 <para>
29470 The pattern in the first line matches all IPv4 addresses, whereas the pattern
29471 in the second line matches all IPv6 addresses.
29472 </para>
29473 <para>
29474 This option may also be useful for ignoring link-local and site-local IPv6
29475 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
29476 is expanded before use as a list, it is possible to make it dependent on the
29477 domain that is being routed.
29478 </para>
29479 <para>
29480 <indexterm role="variable">
29481 <primary><varname>$host_address</varname></primary>
29482 </indexterm>
29483 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
29484 checked.
29485 </para>
29486 <para>
29487 <indexterm role="option">
29488 <primary><option>initgroups</option></primary>
29489 </indexterm>
29490 </para>
29491 <informaltable frame="all">
29492 <tgroup cols="4" colsep="0" rowsep="0">
29493 <colspec colwidth="8*" align="left"/>
29494 <colspec colwidth="6*" align="center"/>
29495 <colspec colwidth="6*" align="center"/>
29496 <colspec colwidth="6*" align="right"/>
29497 <tbody>
29498 <row>
29499 <entry><option>initgroups</option></entry>
29500 <entry>Use: <emphasis>routers</emphasis></entry>
29501 <entry>Type: <emphasis>boolean</emphasis></entry>
29502 <entry>Default: <emphasis>false</emphasis></entry>
29503 </row>
29504 </tbody>
29505 </tgroup>
29506 </informaltable>
29507 <para>
29508 <indexterm role="concept">
29509 <primary>additional groups</primary>
29510 </indexterm>
29511 <indexterm role="concept">
29512 <primary>groups</primary>
29513 <secondary>additional</secondary>
29514 </indexterm>
29515 <indexterm role="concept">
29516 <primary>local transports</primary>
29517 <secondary>uid and gid</secondary>
29518 </indexterm>
29519 <indexterm role="concept">
29520 <primary>transport</primary>
29521 <secondary>local</secondary>
29522 </indexterm>
29523 If the router queues an address for a transport, and this option is true, and
29524 the uid supplied by the router is not overridden by the transport, the
29525 <function>initgroups()</function> function is called when running the transport to ensure that
29526 any additional groups associated with the uid are set up. See also <option>group</option>
29527 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29528 </para>
29529 <para>
29530 <indexterm role="option">
29531 <primary><option>local_part_prefix</option></primary>
29532 </indexterm>
29533 </para>
29534 <informaltable frame="all">
29535 <tgroup cols="4" colsep="0" rowsep="0">
29536 <colspec colwidth="8*" align="left"/>
29537 <colspec colwidth="6*" align="center"/>
29538 <colspec colwidth="6*" align="center"/>
29539 <colspec colwidth="6*" align="right"/>
29540 <tbody>
29541 <row>
29542 <entry><option>local_part_prefix</option></entry>
29543 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29544 <entry>Type: <emphasis>string list</emphasis></entry>
29545 <entry>Default: <emphasis>unset</emphasis></entry>
29546 </row>
29547 </tbody>
29548 </tgroup>
29549 </informaltable>
29550 <para>
29551 <indexterm role="concept">
29552 <primary>router</primary>
29553 <secondary>prefix for local part</secondary>
29554 </indexterm>
29555 <indexterm role="concept">
29556 <primary>prefix</primary>
29557 <secondary>for local part, used in router</secondary>
29558 </indexterm>
29559 If this option is set, the router is skipped unless the local part starts with
29560 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
29561 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
29562 evaluated.
29563 </para>
29564 <para>
29565 The list is scanned from left to right, and the first prefix that matches is
29566 used. A limited form of wildcard is available; if the prefix begins with an
29567 asterisk, it matches the longest possible sequence of arbitrary characters at
29568 the start of the local part. An asterisk should therefore always be followed by
29569 some character that does not occur in normal local parts.
29570 <indexterm role="concept">
29571 <primary>multiple mailboxes</primary>
29572 </indexterm>
29573 <indexterm role="concept">
29574 <primary>mailbox</primary>
29575 <secondary>multiple</secondary>
29576 </indexterm>
29577 Wildcarding can be used to set up multiple user mailboxes, as described in
29578 section <xref linkend="SECTmulbox"/>.
29579 </para>
29580 <para>
29581 <indexterm role="variable">
29582 <primary><varname>$local_part</varname></primary>
29583 </indexterm>
29584 <indexterm role="variable">
29585 <primary><varname>$local_part_prefix</varname></primary>
29586 </indexterm>
29587 During the testing of the <option>local_parts</option> option, and while the router is
29588 running, the prefix is removed from the local part, and is available in the
29589 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
29590 the router accepts the address, this remains true during subsequent delivery by
29591 a transport. In particular, the local part that is transmitted in the RCPT
29592 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
29593 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
29594 the relevant transport.
29595 </para>
29596 <para>
29597 When an address is being verified, <option>local_part_prefix</option> affects only the
29598 behaviour of the router. If the callout feature of verification is in use, this
29599 means that the full address, including the prefix, will be used during the
29600 callout.
29601 </para>
29602 <para>
29603 The prefix facility is commonly used to handle local parts of the form
29604 <option>owner-something</option>. Another common use is to support local parts of the form
29605 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
29606 to tell a user their forwarding is broken &ndash; by placing a router like this one
29607 immediately before the router that handles <filename>.forward</filename> files:
29608 </para>
29609 <literallayout class="monospaced">
29610 real_localuser:
29611   driver = accept
29612   local_part_prefix = real-
29613   check_local_user
29614   transport = local_delivery
29615 </literallayout>
29616 <para revisionflag="changed">
29617 For security, it would probably be a good idea to restrict the use of this
29618 router to locally-generated messages, using a condition such as this:
29619 </para>
29620 <literallayout class="monospaced" revisionflag="changed">
29621   condition = ${if match {$sender_host_address}\
29622                          {\N^(|127\.0\.0\.1)$\N}}
29623 </literallayout>
29624 <para>
29625 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
29626 both conditions must be met if not optional. Care must be taken if wildcards
29627 are used in both a prefix and a suffix on the same router. Different
29628 separator characters must be used to avoid ambiguity.
29629 </para>
29630 <para>
29631 <indexterm role="option">
29632 <primary><option>local_part_prefix_optional</option></primary>
29633 </indexterm>
29634 </para>
29635 <informaltable frame="all">
29636 <tgroup cols="4" colsep="0" rowsep="0">
29637 <colspec colwidth="8*" align="left"/>
29638 <colspec colwidth="6*" align="center"/>
29639 <colspec colwidth="6*" align="center"/>
29640 <colspec colwidth="6*" align="right"/>
29641 <tbody>
29642 <row>
29643 <entry><option>local_part_prefix_optional</option></entry>
29644 <entry>Use: <emphasis>routers</emphasis></entry>
29645 <entry>Type: <emphasis>boolean</emphasis></entry>
29646 <entry>Default: <emphasis>false</emphasis></entry>
29647 </row>
29648 </tbody>
29649 </tgroup>
29650 </informaltable>
29651 <para>
29652 See <option>local_part_prefix</option> above.
29653 </para>
29654 <para>
29655 <indexterm role="option">
29656 <primary><option>local_part_suffix</option></primary>
29657 </indexterm>
29658 </para>
29659 <informaltable frame="all">
29660 <tgroup cols="4" colsep="0" rowsep="0">
29661 <colspec colwidth="8*" align="left"/>
29662 <colspec colwidth="6*" align="center"/>
29663 <colspec colwidth="6*" align="center"/>
29664 <colspec colwidth="6*" align="right"/>
29665 <tbody>
29666 <row>
29667 <entry><option>local_part_suffix</option></entry>
29668 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29669 <entry>Type: <emphasis>string list</emphasis></entry>
29670 <entry>Default: <emphasis>unset</emphasis></entry>
29671 </row>
29672 </tbody>
29673 </tgroup>
29674 </informaltable>
29675 <para>
29676 <indexterm role="concept">
29677 <primary>router</primary>
29678 <secondary>suffix for local part</secondary>
29679 </indexterm>
29680 <indexterm role="concept">
29681 <primary>suffix for local part</primary>
29682 <secondary>used in router</secondary>
29683 </indexterm>
29684 This option operates in the same way as <option>local_part_prefix</option>, except that the
29685 local part must end (rather than start) with the given string, the
29686 <option>local_part_suffix_optional</option> option determines whether the suffix is
29687 mandatory, and the wildcard * character, if present, must be the last
29688 character of the suffix. This option facility is commonly used to handle local
29689 parts of the form <option>something-request</option> and multiple user mailboxes of the form
29690 <option>username-foo</option>.
29691 </para>
29692 <para>
29693 <indexterm role="option">
29694 <primary><option>local_part_suffix_optional</option></primary>
29695 </indexterm>
29696 </para>
29697 <informaltable frame="all">
29698 <tgroup cols="4" colsep="0" rowsep="0">
29699 <colspec colwidth="8*" align="left"/>
29700 <colspec colwidth="6*" align="center"/>
29701 <colspec colwidth="6*" align="center"/>
29702 <colspec colwidth="6*" align="right"/>
29703 <tbody>
29704 <row>
29705 <entry><option>local_part_suffix_optional</option></entry>
29706 <entry>Use: <emphasis>routers</emphasis></entry>
29707 <entry>Type: <emphasis>boolean</emphasis></entry>
29708 <entry>Default: <emphasis>false</emphasis></entry>
29709 </row>
29710 </tbody>
29711 </tgroup>
29712 </informaltable>
29713 <para>
29714 See <option>local_part_suffix</option> above.
29715 </para>
29716 <para>
29717 <indexterm role="option">
29718 <primary><option>local_parts</option></primary>
29719 </indexterm>
29720 </para>
29721 <informaltable frame="all">
29722 <tgroup cols="4" colsep="0" rowsep="0">
29723 <colspec colwidth="8*" align="left"/>
29724 <colspec colwidth="6*" align="center"/>
29725 <colspec colwidth="6*" align="center"/>
29726 <colspec colwidth="6*" align="right"/>
29727 <tbody>
29728 <row>
29729 <entry><option>local_parts</option></entry>
29730 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29731 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
29732 <entry>Default: <emphasis>unset</emphasis></entry>
29733 </row>
29734 </tbody>
29735 </tgroup>
29736 </informaltable>
29737 <para>
29738 <indexterm role="concept">
29739 <primary>router</primary>
29740 <secondary>restricting to specific local parts</secondary>
29741 </indexterm>
29742 <indexterm role="concept">
29743 <primary>local part</primary>
29744 <secondary>checking in router</secondary>
29745 </indexterm>
29746 The router is run only if the local part of the address matches the list.
29747 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29748 are evaluated, and
29749 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
29750 string is expanded, it is possible to make it depend on the domain, for
29751 example:
29752 </para>
29753 <literallayout class="monospaced">
29754 local_parts = dbm;/usr/local/specials/$domain
29755 </literallayout>
29756 <para>
29757 <indexterm role="variable">
29758 <primary><varname>$local_part_data</varname></primary>
29759 </indexterm>
29760 If the match is achieved by a lookup, the data that the lookup returned
29761 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
29762 expansions of the router&#x2019;s private options. You might use this option, for
29763 example, if you have a large number of local virtual domains, and you want to
29764 send all postmaster mail to the same place without having to set up an alias in
29765 each virtual domain:
29766 </para>
29767 <literallayout class="monospaced">
29768 postmaster:
29769   driver = redirect
29770   local_parts = postmaster
29771   data = postmaster@real.domain.example
29772 </literallayout>
29773 <para>
29774 <indexterm role="option">
29775 <primary><option>log_as_local</option></primary>
29776 </indexterm>
29777 </para>
29778 <informaltable frame="all">
29779 <tgroup cols="4" colsep="0" rowsep="0">
29780 <colspec colwidth="8*" align="left"/>
29781 <colspec colwidth="6*" align="center"/>
29782 <colspec colwidth="6*" align="center"/>
29783 <colspec colwidth="6*" align="right"/>
29784 <tbody>
29785 <row>
29786 <entry><option>log_as_local</option></entry>
29787 <entry>Use: <emphasis>routers</emphasis></entry>
29788 <entry>Type: <emphasis>boolean</emphasis></entry>
29789 <entry>Default: <emphasis>see below</emphasis></entry>
29790 </row>
29791 </tbody>
29792 </tgroup>
29793 </informaltable>
29794 <para>
29795 <indexterm role="concept">
29796 <primary>log</primary>
29797 <secondary>delivery line</secondary>
29798 </indexterm>
29799 <indexterm role="concept">
29800 <primary>delivery</primary>
29801 <secondary>log line format</secondary>
29802 </indexterm>
29803 Exim has two logging styles for delivery, the idea being to make local
29804 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
29805 recipient address is given just as the local part, without a domain. The use of
29806 this style is controlled by this option. It defaults to true for the <command>accept</command>
29807 router, and false for all the others. This option applies only when a
29808 router assigns an address to a transport. It has no effect on routers that
29809 redirect addresses.
29810 </para>
29811 <para>
29812 <indexterm role="option">
29813 <primary><option>more</option></primary>
29814 </indexterm>
29815 </para>
29816 <informaltable frame="all">
29817 <tgroup cols="4" colsep="0" rowsep="0">
29818 <colspec colwidth="8*" align="left"/>
29819 <colspec colwidth="6*" align="center"/>
29820 <colspec colwidth="6*" align="center"/>
29821 <colspec colwidth="6*" align="right"/>
29822 <tbody>
29823 <row>
29824 <entry><option>more</option></entry>
29825 <entry>Use: <emphasis>routers</emphasis></entry>
29826 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
29827 <entry>Default: <emphasis>true</emphasis></entry>
29828 </row>
29829 </tbody>
29830 </tgroup>
29831 </informaltable>
29832 <para>
29833 The result of string expansion for this option must be a valid boolean value,
29834 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29835 result causes an error, and delivery is deferred. If the expansion is forced to
29836 fail, the default value for the option (true) is used. Other failures cause
29837 delivery to be deferred.
29838 </para>
29839 <para>
29840 If this option is set false, and the router declines to handle the address, no
29841 further routers are tried, routing fails, and the address is bounced.
29842 <indexterm role="option">
29843 <primary><option>self</option></primary>
29844 </indexterm>
29845 However, if the router explicitly passes an address to the following router by
29846 means of the setting
29847 </para>
29848 <literallayout class="monospaced">
29849 self = pass
29850 </literallayout>
29851 <para>
29852 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
29853 does not affect the behaviour if one of the precondition tests fails. In that
29854 case, the address is always passed to the next router.
29855 </para>
29856 <para>
29857 Note that <option>address_data</option> is not considered to be a precondition. If its
29858 expansion is forced to fail, the router declines, and the value of <option>more</option>
29859 controls what happens next.
29860 </para>
29861 <para>
29862 <indexterm role="option">
29863 <primary><option>pass_on_timeout</option></primary>
29864 </indexterm>
29865 </para>
29866 <informaltable frame="all">
29867 <tgroup cols="4" colsep="0" rowsep="0">
29868 <colspec colwidth="8*" align="left"/>
29869 <colspec colwidth="6*" align="center"/>
29870 <colspec colwidth="6*" align="center"/>
29871 <colspec colwidth="6*" align="right"/>
29872 <tbody>
29873 <row>
29874 <entry><option>pass_on_timeout</option></entry>
29875 <entry>Use: <emphasis>routers</emphasis></entry>
29876 <entry>Type: <emphasis>boolean</emphasis></entry>
29877 <entry>Default: <emphasis>false</emphasis></entry>
29878 </row>
29879 </tbody>
29880 </tgroup>
29881 </informaltable>
29882 <para>
29883 <indexterm role="concept">
29884 <primary>timeout</primary>
29885 <secondary>of router</secondary>
29886 </indexterm>
29887 <indexterm role="concept">
29888 <primary>router</primary>
29889 <secondary>timeout</secondary>
29890 </indexterm>
29891 If a router times out during a host lookup, it normally causes deferral of the
29892 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
29893 router, overriding <option>no_more</option>. This may be helpful for systems that are
29894 intermittently connected to the Internet, or those that want to pass to a smart
29895 host any messages that cannot immediately be delivered.
29896 </para>
29897 <para>
29898 There are occasional other temporary errors that can occur while doing DNS
29899 lookups. They are treated in the same way as a timeout, and this option
29900 applies to all of them.
29901 </para>
29902 <para>
29903 <indexterm role="option">
29904 <primary><option>pass_router</option></primary>
29905 </indexterm>
29906 </para>
29907 <informaltable frame="all">
29908 <tgroup cols="4" colsep="0" rowsep="0">
29909 <colspec colwidth="8*" align="left"/>
29910 <colspec colwidth="6*" align="center"/>
29911 <colspec colwidth="6*" align="center"/>
29912 <colspec colwidth="6*" align="right"/>
29913 <tbody>
29914 <row>
29915 <entry><option>pass_router</option></entry>
29916 <entry>Use: <emphasis>routers</emphasis></entry>
29917 <entry>Type: <emphasis>string</emphasis></entry>
29918 <entry>Default: <emphasis>unset</emphasis></entry>
29919 </row>
29920 </tbody>
29921 </tgroup>
29922 </informaltable>
29923 <para revisionflag="changed">
29924 <indexterm role="concept">
29925 <primary>router</primary>
29926 <secondary>go to after <quote>pass</quote></secondary>
29927 </indexterm>
29928 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
29929 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
29930 routing to continue, and overriding a false setting of <option>more</option>. When one of
29931 these routers returns <quote>pass</quote>, the address is normally handed on to the next
29932 router in sequence. This can be changed by setting <option>pass_router</option> to the name
29933 of another router. However (unlike <option>redirect_router</option>) the named router must
29934 be below the current router, to avoid loops. Note that this option applies only
29935 to the special case of <quote>pass</quote>. It does not apply when a router returns
29936 <quote>decline</quote> because it cannot handle an address.
29937 </para>
29938 <para>
29939 <indexterm role="option">
29940 <primary><option>redirect_router</option></primary>
29941 </indexterm>
29942 </para>
29943 <informaltable frame="all">
29944 <tgroup cols="4" colsep="0" rowsep="0">
29945 <colspec colwidth="8*" align="left"/>
29946 <colspec colwidth="6*" align="center"/>
29947 <colspec colwidth="6*" align="center"/>
29948 <colspec colwidth="6*" align="right"/>
29949 <tbody>
29950 <row>
29951 <entry><option>redirect_router</option></entry>
29952 <entry>Use: <emphasis>routers</emphasis></entry>
29953 <entry>Type: <emphasis>string</emphasis></entry>
29954 <entry>Default: <emphasis>unset</emphasis></entry>
29955 </row>
29956 </tbody>
29957 </tgroup>
29958 </informaltable>
29959 <para>
29960 <indexterm role="concept">
29961 <primary>router</primary>
29962 <secondary>start at after redirection</secondary>
29963 </indexterm>
29964 Sometimes an administrator knows that it is pointless to reprocess addresses
29965 generated from alias or forward files with the same router again. For
29966 example, if an alias file translates real names into login ids there is no
29967 point searching the alias file a second time, especially if it is a large file.
29968 </para>
29969 <para>
29970 The <option>redirect_router</option> option can be set to the name of any router instance.
29971 It causes the routing of any generated addresses to start at the named router
29972 instead of at the first router. This option has no effect if the router in
29973 which it is set does not generate new addresses.
29974 </para>
29975 <para>
29976 <indexterm role="option">
29977 <primary><option>require_files</option></primary>
29978 </indexterm>
29979 </para>
29980 <informaltable frame="all">
29981 <tgroup cols="4" colsep="0" rowsep="0">
29982 <colspec colwidth="8*" align="left"/>
29983 <colspec colwidth="6*" align="center"/>
29984 <colspec colwidth="6*" align="center"/>
29985 <colspec colwidth="6*" align="right"/>
29986 <tbody>
29987 <row>
29988 <entry><option>require_files</option></entry>
29989 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29990 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29991 <entry>Default: <emphasis>unset</emphasis></entry>
29992 </row>
29993 </tbody>
29994 </tgroup>
29995 </informaltable>
29996 <para>
29997 <indexterm role="concept">
29998 <primary>file</primary>
29999 <secondary>requiring for router</secondary>
30000 </indexterm>
30001 <indexterm role="concept">
30002 <primary>router</primary>
30003 <secondary>requiring file existence</secondary>
30004 </indexterm>
30005 This option provides a general mechanism for predicating the running of a
30006 router on the existence or non-existence of certain files or directories.
30007 Before running a router, as one of its precondition tests, Exim works its way
30008 through the <option>require_files</option> list, expanding each item separately.
30009 </para>
30010 <para>
30011 Because the list is split before expansion, any colons in expansion items must
30012 be doubled, or the facility for using a different list separator must be used.
30013 If any expansion is forced to fail, the item is ignored. Other expansion
30014 failures cause routing of the address to be deferred.
30015 </para>
30016 <para>
30017 If any expanded string is empty, it is ignored. Otherwise, except as described
30018 below, each string must be a fully qualified file path, optionally preceded by
30019 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
30020 existence of the files or directories. The router is skipped if any paths not
30021 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
30022 </para>
30023 <para>
30024 <indexterm role="concept">
30025 <primary>NFS</primary>
30026 </indexterm>
30027 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
30028 the message is deferred. This can happen when NFS-mounted filesystems are
30029 unavailable.
30030 </para>
30031 <para>
30032 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
30033 options, so you cannot use it to check for the existence of a file in which to
30034 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
30035 full list of the order in which preconditions are evaluated.) However, as
30036 these options are all expanded, you can use the <option>exists</option> expansion condition
30037 to make such tests. The <option>require_files</option> option is intended for checking files
30038 that the router may be going to use internally, or which are needed by a
30039 transport (for example <filename>.procmailrc</filename>).
30040 </para>
30041 <para>
30042 During delivery, the <function>stat()</function> function is run as root, but there is a
30043 facility for some checking of the accessibility of a file by another user.
30044 This is not a proper permissions check, but just a <quote>rough</quote> check that
30045 operates as follows:
30046 </para>
30047 <para>
30048 If an item in a <option>require_files</option> list does not contain any forward slash
30049 characters, it is taken to be the user (and optional group, separated by a
30050 comma) to be checked for subsequent files in the list. If no group is specified
30051 but the user is specified symbolically, the gid associated with the uid is
30052 used. For example:
30053 </para>
30054 <literallayout class="monospaced">
30055 require_files = mail:/some/file
30056 require_files = $local_part:$home/.procmailrc
30057 </literallayout>
30058 <para>
30059 If a user or group name in a <option>require_files</option> list does not exist, the
30060 <option>require_files</option> condition fails.
30061 </para>
30062 <para>
30063 Exim performs the check by scanning along the components of the file path, and
30064 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
30065 directories, and <quote>r</quote> access on the final file. Note that this means that file
30066 access control lists, if the operating system has them, are ignored.
30067 </para>
30068 <para>
30069 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
30070 incoming SMTP message, Exim is not running as root, but under its own uid. This
30071 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
30072 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
30073 user is not permitted to read one of the directories on the file&#x2019;s path.
30074 </para>
30075 <para>
30076 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
30077 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
30078 without root access. In this case, if a check for access by a particular user
30079 is requested, Exim creates a subprocess that runs as that user, and tries the
30080 check again in that process.
30081 </para>
30082 <para>
30083 The default action for handling an unresolved EACCES is to consider it to
30084 be caused by a configuration error, and routing is deferred because the
30085 existence or non-existence of the file cannot be determined. However, in some
30086 circumstances it may be desirable to treat this condition as if the file did
30087 not exist. If the file name (or the exclamation mark that precedes the file
30088 name for non-existence) is preceded by a plus sign, the EACCES error is treated
30089 as if the file did not exist. For example:
30090 </para>
30091 <literallayout class="monospaced">
30092 require_files = +/some/file
30093 </literallayout>
30094 <para>
30095 If the router is not an essential part of verification (for example, it
30096 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
30097 option false so that the router is skipped when verifying.
30098 </para>
30099 <para>
30100 <indexterm role="option">
30101 <primary><option>retry_use_local_part</option></primary>
30102 </indexterm>
30103 </para>
30104 <informaltable frame="all">
30105 <tgroup cols="4" colsep="0" rowsep="0">
30106 <colspec colwidth="8*" align="left"/>
30107 <colspec colwidth="6*" align="center"/>
30108 <colspec colwidth="6*" align="center"/>
30109 <colspec colwidth="6*" align="right"/>
30110 <tbody>
30111 <row>
30112 <entry><option>retry_use_local_part</option></entry>
30113 <entry>Use: <emphasis>routers</emphasis></entry>
30114 <entry>Type: <emphasis>boolean</emphasis></entry>
30115 <entry>Default: <emphasis>see below</emphasis></entry>
30116 </row>
30117 </tbody>
30118 </tgroup>
30119 </informaltable>
30120 <para>
30121 <indexterm role="concept">
30122 <primary>hints database</primary>
30123 <secondary>retry keys</secondary>
30124 </indexterm>
30125 <indexterm role="concept">
30126 <primary>local part</primary>
30127 <secondary>in retry keys</secondary>
30128 </indexterm>
30129 When a delivery suffers a temporary routing failure, a retry record is created
30130 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
30131 domain, the key for the retry record should not involve the local part, but for
30132 other addresses, both the domain and the local part should be included.
30133 Usually, remote routing is of the former kind, and local routing is of the
30134 latter kind.
30135 </para>
30136 <para>
30137 This option controls whether the local part is used to form the key for retry
30138 hints for addresses that suffer temporary errors while being handled by this
30139 router. The default value is true for any router that has <option>check_local_user</option>
30140 set, and false otherwise. Note that this option does not apply to hints keys
30141 for transport delays; they are controlled by a generic transport option of the
30142 same name.
30143 </para>
30144 <para>
30145 The setting of <option>retry_use_local_part</option> applies only to the router on which it
30146 appears. If the router generates child addresses, they are routed
30147 independently; this setting does not become attached to them.
30148 </para>
30149 <para>
30150 <indexterm role="option">
30151 <primary><option>router_home_directory</option></primary>
30152 </indexterm>
30153 </para>
30154 <informaltable frame="all">
30155 <tgroup cols="4" colsep="0" rowsep="0">
30156 <colspec colwidth="8*" align="left"/>
30157 <colspec colwidth="6*" align="center"/>
30158 <colspec colwidth="6*" align="center"/>
30159 <colspec colwidth="6*" align="right"/>
30160 <tbody>
30161 <row>
30162 <entry><option>router_home_directory</option></entry>
30163 <entry>Use: <emphasis>routers</emphasis></entry>
30164 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30165 <entry>Default: <emphasis>unset</emphasis></entry>
30166 </row>
30167 </tbody>
30168 </tgroup>
30169 </informaltable>
30170 <para>
30171 <indexterm role="concept">
30172 <primary>router</primary>
30173 <secondary>home directory for</secondary>
30174 </indexterm>
30175 <indexterm role="concept">
30176 <primary>home directory</primary>
30177 <secondary>for router</secondary>
30178 </indexterm>
30179 <indexterm role="variable">
30180 <primary><varname>$home</varname></primary>
30181 </indexterm>
30182 This option sets a home directory for use while the router is running. (Compare
30183 <option>transport_home_directory</option>, which sets a home directory for later
30184 transporting.) In particular, if used on a <command>redirect</command> router, this option
30185 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
30186 forced expansion failure causes the option to be ignored &ndash; other failures
30187 cause the router to defer.
30188 </para>
30189 <para>
30190 Expansion of <option>router_home_directory</option> happens immediately after the
30191 <option>check_local_user</option> test (if configured), before any further expansions take
30192 place.
30193 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30194 are evaluated.)
30195 While the router is running, <option>router_home_directory</option> overrides the value of
30196 <varname>$home</varname> that came from <option>check_local_user</option>.
30197 </para>
30198 <para>
30199 When a router accepts an address and assigns it to a local transport (including
30200 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
30201 delivery), the home directory setting for the transport is taken from the first
30202 of these values that is set:
30203 </para>
30204 <itemizedlist>
30205 <listitem>
30206 <para>
30207 The <option>home_directory</option> option on the transport;
30208 </para>
30209 </listitem>
30210 <listitem>
30211 <para>
30212 The <option>transport_home_directory</option> option on the router;
30213 </para>
30214 </listitem>
30215 <listitem>
30216 <para>
30217 The password data if <option>check_local_user</option> is set on the router;
30218 </para>
30219 </listitem>
30220 <listitem>
30221 <para>
30222 The <option>router_home_directory</option> option on the router.
30223 </para>
30224 </listitem>
30225 </itemizedlist>
30226 <para>
30227 In other words, <option>router_home_directory</option> overrides the password data for the
30228 router, but not for the transport.
30229 </para>
30230 <para>
30231 <indexterm role="option">
30232 <primary><option>self</option></primary>
30233 </indexterm>
30234 </para>
30235 <informaltable frame="all">
30236 <tgroup cols="4" colsep="0" rowsep="0">
30237 <colspec colwidth="8*" align="left"/>
30238 <colspec colwidth="6*" align="center"/>
30239 <colspec colwidth="6*" align="center"/>
30240 <colspec colwidth="6*" align="right"/>
30241 <tbody>
30242 <row>
30243 <entry><option>self</option></entry>
30244 <entry>Use: <emphasis>routers</emphasis></entry>
30245 <entry>Type: <emphasis>string</emphasis></entry>
30246 <entry>Default: <emphasis>freeze</emphasis></entry>
30247 </row>
30248 </tbody>
30249 </tgroup>
30250 </informaltable>
30251 <para>
30252 <indexterm role="concept">
30253 <primary>MX record</primary>
30254 <secondary>pointing to local host</secondary>
30255 </indexterm>
30256 <indexterm role="concept">
30257 <primary>local host</primary>
30258 <secondary>MX pointing to</secondary>
30259 </indexterm>
30260 This option applies to those routers that use a recipient address to find a
30261 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
30262 and <command>manualroute</command> routers.
30263 Certain configurations of the <command>queryprogram</command> router can also specify a list
30264 of remote hosts.
30265 Usually such routers are configured to send the message to a remote host via an
30266 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
30267 host on the list turns out to be the local host.
30268 The way in which Exim checks for the local host is described in section
30269 <xref linkend="SECTreclocipadd"/>.
30270 </para>
30271 <para>
30272 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
30273 example, the router should be configured not to process this domain), or an
30274 error in the DNS (for example, the MX should not point to this host). For this
30275 reason, the default action is to log the incident, defer the address, and
30276 freeze the message. The following alternatives are provided for use in special
30277 cases:
30278 </para>
30279 <variablelist>
30280 <varlistentry>
30281 <term><option>defer</option></term>
30282 <listitem>
30283 <para>
30284 Delivery of the message is tried again later, but the message is not frozen.
30285 </para>
30286 </listitem></varlistentry>
30287 <varlistentry>
30288 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
30289 <listitem>
30290 <para>
30291 The domain is changed to the given domain, and the address is passed back to
30292 be reprocessed by the routers. No rewriting of headers takes place. This
30293 behaviour is essentially a redirection.
30294 </para>
30295 </listitem></varlistentry>
30296 <varlistentry>
30297 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
30298 <listitem>
30299 <para>
30300 The domain is changed to the given domain, and the address is passed back to be
30301 reprocessed by the routers. Any headers that contain the original domain are
30302 rewritten.
30303 </para>
30304 </listitem></varlistentry>
30305 <varlistentry>
30306 <term><option>pass</option></term>
30307 <listitem>
30308 <para>
30309 <indexterm role="option">
30310 <primary><option>more</option></primary>
30311 </indexterm>
30312 <indexterm role="variable">
30313 <primary><varname>$self_hostname</varname></primary>
30314 </indexterm>
30315 The router passes the address to the next router, or to the router named in the
30316 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
30317 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
30318 name of the local host that the router encountered. This can be used to
30319 distinguish between different cases for hosts with multiple names. The
30320 combination
30321 </para>
30322 <literallayout class="monospaced">
30323 self = pass
30324 no_more
30325 </literallayout>
30326 <para>
30327 ensures that only those addresses that routed to the local host are passed on.
30328 Without <option>no_more</option>, addresses that were declined for other reasons would also
30329 be passed to the next router.
30330 </para>
30331 </listitem></varlistentry>
30332 <varlistentry>
30333 <term><option>fail</option></term>
30334 <listitem>
30335 <para>
30336 Delivery fails and an error report is generated.
30337 </para>
30338 </listitem></varlistentry>
30339 <varlistentry>
30340 <term><option>send</option></term>
30341 <listitem>
30342 <para>
30343 <indexterm role="concept">
30344 <primary>local host</primary>
30345 <secondary>sending to</secondary>
30346 </indexterm>
30347 The anomaly is ignored and the address is queued for the transport. This
30348 setting should be used with extreme caution. For an <command>smtp</command> transport, it
30349 makes sense only in cases where the program that is listening on the SMTP port
30350 is not this version of Exim. That is, it must be some other MTA, or Exim with a
30351 different configuration file that handles the domain in another way.
30352 </para>
30353 </listitem></varlistentry>
30354 </variablelist>
30355 <para>
30356 <indexterm role="option">
30357 <primary><option>senders</option></primary>
30358 </indexterm>
30359 </para>
30360 <informaltable frame="all">
30361 <tgroup cols="4" colsep="0" rowsep="0">
30362 <colspec colwidth="8*" align="left"/>
30363 <colspec colwidth="6*" align="center"/>
30364 <colspec colwidth="6*" align="center"/>
30365 <colspec colwidth="6*" align="right"/>
30366 <tbody>
30367 <row>
30368 <entry><option>senders</option></entry>
30369 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30370 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
30371 <entry>Default: <emphasis>unset</emphasis></entry>
30372 </row>
30373 </tbody>
30374 </tgroup>
30375 </informaltable>
30376 <para>
30377 <indexterm role="concept">
30378 <primary>router</primary>
30379 <secondary>checking senders</secondary>
30380 </indexterm>
30381 If this option is set, the router is skipped unless the message&#x2019;s sender
30382 address matches something on the list.
30383 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30384 are evaluated.
30385 </para>
30386 <para>
30387 There are issues concerning verification when the running of routers is
30388 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
30389 setting, it sets the sender to the null string. When using the <option>-bt</option> option
30390 to check a configuration file, it is necessary also to use the <option>-f</option> option to
30391 set an appropriate sender. For incoming mail, the sender is unset when
30392 verifying the sender, but is available when verifying any recipients. If the
30393 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
30394 matters.
30395 </para>
30396 <para>
30397 <indexterm role="option">
30398 <primary><option>translate_ip_address</option></primary>
30399 </indexterm>
30400 </para>
30401 <informaltable frame="all">
30402 <tgroup cols="4" colsep="0" rowsep="0">
30403 <colspec colwidth="8*" align="left"/>
30404 <colspec colwidth="6*" align="center"/>
30405 <colspec colwidth="6*" align="center"/>
30406 <colspec colwidth="6*" align="right"/>
30407 <tbody>
30408 <row>
30409 <entry><option>translate_ip_address</option></entry>
30410 <entry>Use: <emphasis>routers</emphasis></entry>
30411 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30412 <entry>Default: <emphasis>unset</emphasis></entry>
30413 </row>
30414 </tbody>
30415 </tgroup>
30416 </informaltable>
30417 <para>
30418 <indexterm role="concept">
30419 <primary>IP address</primary>
30420 <secondary>translating</secondary>
30421 </indexterm>
30422 <indexterm role="concept">
30423 <primary>packet radio</primary>
30424 </indexterm>
30425 <indexterm role="concept">
30426 <primary>router</primary>
30427 <secondary>IP address translation</secondary>
30428 </indexterm>
30429 There exist some rare networking situations (for example, packet radio) where
30430 it is helpful to be able to translate IP addresses generated by normal routing
30431 mechanisms into other IP addresses, thus performing a kind of manual IP
30432 routing. This should be done only if the normal IP routing of the TCP/IP stack
30433 is inadequate or broken. Because this is an extremely uncommon requirement, the
30434 code to support this option is not included in the Exim binary unless
30435 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
30436 </para>
30437 <para>
30438 <indexterm role="variable">
30439 <primary><varname>$host_address</varname></primary>
30440 </indexterm>
30441 The <option>translate_ip_address</option> string is expanded for every IP address generated
30442 by the router, with the generated address set in <varname>$host_address</varname>. If the
30443 expansion is forced to fail, no action is taken.
30444 For any other expansion error, delivery of the message is deferred.
30445 If the result of the expansion is an IP address, that replaces the original
30446 address; otherwise the result is assumed to be a host name &ndash; this is looked
30447 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
30448 produce one or more replacement IP addresses. For example, to subvert all IP
30449 addresses in some specific networks, this could be added to a router:
30450 </para>
30451 <literallayout class="monospaced">
30452 translate_ip_address = \
30453   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
30454     {$value}fail}}
30455 </literallayout>
30456 <para>
30457 The file would contain lines like
30458 </para>
30459 <literallayout class="monospaced">
30460 10.2.3.128/26    some.host
30461 10.8.4.34/26     10.44.8.15
30462 </literallayout>
30463 <para>
30464 You should not make use of this facility unless you really understand what you
30465 are doing.
30466 </para>
30467 <para>
30468 <indexterm role="option">
30469 <primary><option>transport</option></primary>
30470 </indexterm>
30471 </para>
30472 <informaltable frame="all">
30473 <tgroup cols="4" colsep="0" rowsep="0">
30474 <colspec colwidth="8*" align="left"/>
30475 <colspec colwidth="6*" align="center"/>
30476 <colspec colwidth="6*" align="center"/>
30477 <colspec colwidth="6*" align="right"/>
30478 <tbody>
30479 <row>
30480 <entry><option>transport</option></entry>
30481 <entry>Use: <emphasis>routers</emphasis></entry>
30482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30483 <entry>Default: <emphasis>unset</emphasis></entry>
30484 </row>
30485 </tbody>
30486 </tgroup>
30487 </informaltable>
30488 <para>
30489 This option specifies the transport to be used when a router accepts an address
30490 and sets it up for delivery. A transport is never needed if a router is used
30491 only for verification. The value of the option is expanded at routing time,
30492 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
30493 and result must be the name of one of the configured transports. If it is not,
30494 delivery is deferred.
30495 </para>
30496 <para>
30497 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
30498 have some private options that set up transports for pipe and file deliveries
30499 (see chapter <xref linkend="CHAPredirect"/>).
30500 </para>
30501 <para>
30502 <indexterm role="option">
30503 <primary><option>transport_current_directory</option></primary>
30504 </indexterm>
30505 </para>
30506 <informaltable frame="all">
30507 <tgroup cols="4" colsep="0" rowsep="0">
30508 <colspec colwidth="8*" align="left"/>
30509 <colspec colwidth="6*" align="center"/>
30510 <colspec colwidth="6*" align="center"/>
30511 <colspec colwidth="6*" align="right"/>
30512 <tbody>
30513 <row>
30514 <entry><option>transport_current_directory</option></entry>
30515 <entry>Use: <emphasis>routers</emphasis></entry>
30516 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30517 <entry>Default: <emphasis>unset</emphasis></entry>
30518 </row>
30519 </tbody>
30520 </tgroup>
30521 </informaltable>
30522 <para>
30523 <indexterm role="concept">
30524 <primary>current directory for local transport</primary>
30525 </indexterm>
30526 This option associates a current directory with any address that is routed
30527 to a local transport. This can happen either because a transport is
30528 explicitly configured for the router, or because it generates a delivery to a
30529 file or a pipe. During the delivery process (that is, at transport time), this
30530 option string is expanded and is set as the current directory, unless
30531 overridden by a setting on the transport.
30532 If the expansion fails for any reason, including forced failure, an error is
30533 logged, and delivery is deferred.
30534 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
30535 environment.
30536 </para>
30537 <para>
30538 <indexterm role="option">
30539 <primary><option>transport_home_directory</option></primary>
30540 </indexterm>
30541 </para>
30542 <informaltable frame="all">
30543 <tgroup cols="4" colsep="0" rowsep="0">
30544 <colspec colwidth="8*" align="left"/>
30545 <colspec colwidth="6*" align="center"/>
30546 <colspec colwidth="6*" align="center"/>
30547 <colspec colwidth="6*" align="right"/>
30548 <tbody>
30549 <row>
30550 <entry><option>transport_home_directory</option></entry>
30551 <entry>Use: <emphasis>routers</emphasis></entry>
30552 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30553 <entry>Default: <emphasis>see below</emphasis></entry>
30554 </row>
30555 </tbody>
30556 </tgroup>
30557 </informaltable>
30558 <para>
30559 <indexterm role="concept">
30560 <primary>home directory</primary>
30561 <secondary>for local transport</secondary>
30562 </indexterm>
30563 This option associates a home directory with any address that is routed to a
30564 local transport. This can happen either because a transport is explicitly
30565 configured for the router, or because it generates a delivery to a file or a
30566 pipe. During the delivery process (that is, at transport time), the option
30567 string is expanded and is set as the home directory, unless overridden by a
30568 setting of <option>home_directory</option> on the transport.
30569 If the expansion fails for any reason, including forced failure, an error is
30570 logged, and delivery is deferred.
30571 </para>
30572 <para>
30573 If the transport does not specify a home directory, and
30574 <option>transport_home_directory</option> is not set for the router, the home directory for
30575 the transport is taken from the password data if <option>check_local_user</option> is set for
30576 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
30577 is set; if not, no home directory is set for the transport.
30578 </para>
30579 <para>
30580 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
30581 environment.
30582 </para>
30583 <para>
30584 <indexterm role="option">
30585 <primary><option>unseen</option></primary>
30586 </indexterm>
30587 </para>
30588 <informaltable frame="all">
30589 <tgroup cols="4" colsep="0" rowsep="0">
30590 <colspec colwidth="8*" align="left"/>
30591 <colspec colwidth="6*" align="center"/>
30592 <colspec colwidth="6*" align="center"/>
30593 <colspec colwidth="6*" align="right"/>
30594 <tbody>
30595 <row>
30596 <entry><option>unseen</option></entry>
30597 <entry>Use: <emphasis>routers</emphasis></entry>
30598 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
30599 <entry>Default: <emphasis>false</emphasis></entry>
30600 </row>
30601 </tbody>
30602 </tgroup>
30603 </informaltable>
30604 <para>
30605 <indexterm role="concept">
30606 <primary>router</primary>
30607 <secondary>carrying on after success</secondary>
30608 </indexterm>
30609 The result of string expansion for this option must be a valid boolean value,
30610 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30611 result causes an error, and delivery is deferred. If the expansion is forced to
30612 fail, the default value for the option (false) is used. Other failures cause
30613 delivery to be deferred.
30614 </para>
30615 <para>
30616 When this option is set true, routing does not cease if the router accepts the
30617 address. Instead, a copy of the incoming address is passed to the next router,
30618 overriding a false setting of <option>more</option>. There is little point in setting
30619 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
30620 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
30621 sometimes true and sometimes false).
30622 </para>
30623 <para>
30624 <indexterm role="concept">
30625 <primary>copy of message (<option>unseen</option> option)</primary>
30626 </indexterm>
30627 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
30628 qualifier in filter files. It can be used to cause copies of messages to be
30629 delivered to some other destination, while also carrying out a normal delivery.
30630 In effect, the current address is made into a <quote>parent</quote> that has two children
30631 &ndash; one that is delivered as specified by this router, and a clone that goes on
30632 to be routed further. For this reason, <option>unseen</option> may not be combined with the
30633 <option>one_time</option> option in a <command>redirect</command> router.
30634 </para>
30635 <para>
30636 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
30637 this router or by previous routers affect the <quote>unseen</quote> copy of the message
30638 only. The clone that continues to be processed by further routers starts with
30639 no added headers and none specified for removal. For a <option>redirect</option> router, if
30640 a generated address is the same as the incoming address, this can lead to
30641 duplicate addresses with different header modifications. Exim does not do
30642 duplicate deliveries (except, in certain circumstances, to pipes -- see section
30643 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
30644 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
30645 <option>redirect</option> router may be of help.
30646 </para>
30647 <para>
30648 Unlike the handling of header modifications, any data that was set by the
30649 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
30650 subsequent routers.
30651 </para>
30652 <para>
30653 <indexterm role="option">
30654 <primary><option>user</option></primary>
30655 </indexterm>
30656 </para>
30657 <informaltable frame="all">
30658 <tgroup cols="4" colsep="0" rowsep="0">
30659 <colspec colwidth="8*" align="left"/>
30660 <colspec colwidth="6*" align="center"/>
30661 <colspec colwidth="6*" align="center"/>
30662 <colspec colwidth="6*" align="right"/>
30663 <tbody>
30664 <row>
30665 <entry><option>user</option></entry>
30666 <entry>Use: <emphasis>routers</emphasis></entry>
30667 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30668 <entry>Default: <emphasis>see below</emphasis></entry>
30669 </row>
30670 </tbody>
30671 </tgroup>
30672 </informaltable>
30673 <para>
30674 <indexterm role="concept">
30675 <primary>uid (user id)</primary>
30676 <secondary>local delivery</secondary>
30677 </indexterm>
30678 <indexterm role="concept">
30679 <primary>local transports</primary>
30680 <secondary>uid and gid</secondary>
30681 </indexterm>
30682 <indexterm role="concept">
30683 <primary>transport</primary>
30684 <secondary>local</secondary>
30685 </indexterm>
30686 <indexterm role="concept">
30687 <primary>router</primary>
30688 <secondary>user for filter processing</secondary>
30689 </indexterm>
30690 <indexterm role="concept">
30691 <primary>filter</primary>
30692 <secondary>user for processing</secondary>
30693 </indexterm>
30694 When a router queues an address for a transport, and the transport does not
30695 specify a user, the user given here is used when running the delivery process.
30696 The user may be specified numerically or by name. If expansion fails, the
30697 error is logged and delivery is deferred.
30698 This user is also used by the <command>redirect</command> router when running a filter file.
30699 The default is unset, except when <option>check_local_user</option> is set. In this case,
30700 the default is taken from the password information. If the user is specified as
30701 a name, and <option>group</option> is not set, the group associated with the user is used.
30702 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
30703 <xref linkend="CHAPenvironment"/>.
30704 </para>
30705 <para>
30706 <indexterm role="option">
30707 <primary><option>verify</option></primary>
30708 </indexterm>
30709 </para>
30710 <informaltable frame="all">
30711 <tgroup cols="4" colsep="0" rowsep="0">
30712 <colspec colwidth="8*" align="left"/>
30713 <colspec colwidth="6*" align="center"/>
30714 <colspec colwidth="6*" align="center"/>
30715 <colspec colwidth="6*" align="right"/>
30716 <tbody>
30717 <row>
30718 <entry><option>verify</option></entry>
30719 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30720 <entry>Type: <emphasis>boolean</emphasis></entry>
30721 <entry>Default: <emphasis>true</emphasis></entry>
30722 </row>
30723 </tbody>
30724 </tgroup>
30725 </informaltable>
30726 <para>
30727 Setting this option has the effect of setting <option>verify_sender</option> and
30728 <option>verify_recipient</option> to the same value.
30729 </para>
30730 <para>
30731 <indexterm role="option">
30732 <primary><option>verify_only</option></primary>
30733 </indexterm>
30734 </para>
30735 <informaltable frame="all">
30736 <tgroup cols="4" colsep="0" rowsep="0">
30737 <colspec colwidth="8*" align="left"/>
30738 <colspec colwidth="6*" align="center"/>
30739 <colspec colwidth="6*" align="center"/>
30740 <colspec colwidth="6*" align="right"/>
30741 <tbody>
30742 <row>
30743 <entry><option>verify_only</option></entry>
30744 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30745 <entry>Type: <emphasis>boolean</emphasis></entry>
30746 <entry>Default: <emphasis>false</emphasis></entry>
30747 </row>
30748 </tbody>
30749 </tgroup>
30750 </informaltable>
30751 <para>
30752 <indexterm role="concept">
30753 <primary>EXPN</primary>
30754 <secondary>with <option>verify_only</option></secondary>
30755 </indexterm>
30756 <indexterm role="option">
30757 <primary><option>-bv</option></primary>
30758 </indexterm>
30759 <indexterm role="concept">
30760 <primary>router</primary>
30761 <secondary>used only when verifying</secondary>
30762 </indexterm>
30763 If this option is set, the router is used only when verifying an address or
30764 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
30765 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
30766 restricted to verifying only senders or recipients by means of
30767 <option>verify_sender</option> and <option>verify_recipient</option>.
30768 </para>
30769 <para>
30770 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
30771 SMTP message, Exim is not running as root, but under its own uid. If the router
30772 accesses any files, you need to make sure that they are accessible to the Exim
30773 user or group.
30774 </para>
30775 <para>
30776 <indexterm role="option">
30777 <primary><option>verify_recipient</option></primary>
30778 </indexterm>
30779 </para>
30780 <informaltable frame="all">
30781 <tgroup cols="4" colsep="0" rowsep="0">
30782 <colspec colwidth="8*" align="left"/>
30783 <colspec colwidth="6*" align="center"/>
30784 <colspec colwidth="6*" align="center"/>
30785 <colspec colwidth="6*" align="right"/>
30786 <tbody>
30787 <row>
30788 <entry><option>verify_recipient</option></entry>
30789 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30790 <entry>Type: <emphasis>boolean</emphasis></entry>
30791 <entry>Default: <emphasis>true</emphasis></entry>
30792 </row>
30793 </tbody>
30794 </tgroup>
30795 </informaltable>
30796 <para>
30797 If this option is false, the router is skipped when verifying recipient
30798 addresses
30799 or testing recipient verification using <option>-bv</option>.
30800 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30801 are evaluated.
30802 </para>
30803 <para>
30804 <indexterm role="option">
30805 <primary><option>verify_sender</option></primary>
30806 </indexterm>
30807 </para>
30808 <informaltable frame="all">
30809 <tgroup cols="4" colsep="0" rowsep="0">
30810 <colspec colwidth="8*" align="left"/>
30811 <colspec colwidth="6*" align="center"/>
30812 <colspec colwidth="6*" align="center"/>
30813 <colspec colwidth="6*" align="right"/>
30814 <tbody>
30815 <row>
30816 <entry><option>verify_sender</option></entry>
30817 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30818 <entry>Type: <emphasis>boolean</emphasis></entry>
30819 <entry>Default: <emphasis>true</emphasis></entry>
30820 </row>
30821 </tbody>
30822 </tgroup>
30823 </informaltable>
30824 <para>
30825 If this option is false, the router is skipped when verifying sender addresses
30826 or testing sender verification using <option>-bvs</option>.
30827 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30828 are evaluated.
30829 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
30830 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
30831 </para>
30832 </chapter>
30833
30834 <chapter id="CHID4">
30835 <title>The accept router</title>
30836 <para>
30837 <indexterm role="concept">
30838 <primary><command>accept</command> router</primary>
30839 </indexterm>
30840 <indexterm role="concept">
30841 <primary>routers</primary>
30842 <secondary><command>accept</command></secondary>
30843 </indexterm>
30844 The <command>accept</command> router has no private options of its own. Unless it is being
30845 used purely for verification (see <option>verify_only</option>) a transport is required to
30846 be defined by the generic <option>transport</option> option. If the preconditions that are
30847 specified by generic options are met, the router accepts the address and queues
30848 it for the given transport. The most common use of this router is for setting
30849 up deliveries to local mailboxes. For example:
30850 </para>
30851 <literallayout class="monospaced">
30852 localusers:
30853   driver = accept
30854   domains = mydomain.example
30855   check_local_user
30856   transport = local_delivery
30857 </literallayout>
30858 <para>
30859 The <option>domains</option> condition in this example checks the domain of the address, and
30860 <option>check_local_user</option> checks that the local part is the login of a local user.
30861 When both preconditions are met, the <command>accept</command> router runs, and queues the
30862 address for the <command>local_delivery</command> transport.
30863 </para>
30864 </chapter>
30865
30866 <chapter id="CHAPdnslookup">
30867 <title>The dnslookup router</title>
30868 <para>
30869 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
30870 <primary><command>dnslookup</command> router</primary>
30871 </indexterm>
30872 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
30873 <primary>routers</primary>
30874 <secondary><command>dnslookup</command></secondary>
30875 </indexterm>
30876 The <command>dnslookup</command> router looks up the hosts that handle mail for the
30877 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
30878 unless <option>verify_only</option> is set.
30879 </para>
30880 <para>
30881 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
30882 SRV records. If none are found, or if SRV support is not configured,
30883 MX records are looked up. If no MX records exist, address records are sought.
30884 However, <option>mx_domains</option> can be set to disable the direct use of address
30885 records.
30886 </para>
30887 <para>
30888 MX records of equal priority are sorted by Exim into a random order. Exim then
30889 looks for address records for the host names obtained from MX or SRV records.
30890 When a host has more than one IP address, they are sorted into a random order,
30891 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
30892 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
30893 generic option, the router declines.
30894 </para>
30895 <para>
30896 Unless they have the highest priority (lowest MX value), MX records that point
30897 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
30898 are discarded, together with any other MX records of equal or lower priority.
30899 </para>
30900 <para>
30901 <indexterm role="concept">
30902 <primary>MX record</primary>
30903 <secondary>pointing to local host</secondary>
30904 </indexterm>
30905 <indexterm role="concept">
30906 <primary>local host</primary>
30907 <secondary>MX pointing to</secondary>
30908 </indexterm>
30909 <indexterm role="option">
30910 <primary><option>self</option></primary>
30911 <secondary>in <command>dnslookup</command> router</secondary>
30912 </indexterm>
30913 If the host pointed to by the highest priority MX record, or looked up as an
30914 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
30915 happens is controlled by the generic <option>self</option> option.
30916 </para>
30917 <section id="SECTprowitdnsloo">
30918 <title>Problems with DNS lookups</title>
30919 <para>
30920 There have been problems with DNS servers when SRV records are looked up.
30921 Some mis-behaving servers return a DNS error or timeout when a non-existent
30922 SRV record is sought. Similar problems have in the past been reported for
30923 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
30924 problem, but it is heavy-handed because it is a global option.
30925 </para>
30926 <para>
30927 For this reason, there are two options, <option>srv_fail_domains</option> and
30928 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
30929 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
30930 an attempt to look up an SRV or MX record causes one of these results, and the
30931 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
30932 such record</quote>. In the case of an SRV lookup, this means that the router
30933 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
30934 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
30935 case routing fails.
30936 </para>
30937 </section>
30938 <section id="SECID118">
30939 <title>Private options for dnslookup</title>
30940 <para>
30941 <indexterm role="concept">
30942 <primary>options</primary>
30943 <secondary><command>dnslookup</command> router</secondary>
30944 </indexterm>
30945 The private options for the <command>dnslookup</command> router are as follows:
30946 </para>
30947 <para>
30948 <indexterm role="option">
30949 <primary><option>check_secondary_mx</option></primary>
30950 </indexterm>
30951 </para>
30952 <informaltable frame="all">
30953 <tgroup cols="4" colsep="0" rowsep="0">
30954 <colspec colwidth="8*" align="left"/>
30955 <colspec colwidth="6*" align="center"/>
30956 <colspec colwidth="6*" align="center"/>
30957 <colspec colwidth="6*" align="right"/>
30958 <tbody>
30959 <row>
30960 <entry><option>check_secondary_mx</option></entry>
30961 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30962 <entry>Type: <emphasis>boolean</emphasis></entry>
30963 <entry>Default: <emphasis>false</emphasis></entry>
30964 </row>
30965 </tbody>
30966 </tgroup>
30967 </informaltable>
30968 <para>
30969 <indexterm role="concept">
30970 <primary>MX record</primary>
30971 <secondary>checking for secondary</secondary>
30972 </indexterm>
30973 If this option is set, the router declines unless the local host is found in
30974 (and removed from) the list of hosts obtained by MX lookup. This can be used to
30975 process domains for which the local host is a secondary mail exchanger
30976 differently to other domains. The way in which Exim decides whether a host is
30977 the local host is described in section <xref linkend="SECTreclocipadd"/>.
30978 </para>
30979 <para>
30980 <indexterm role="option">
30981 <primary><option>check_srv</option></primary>
30982 </indexterm>
30983 </para>
30984 <informaltable frame="all">
30985 <tgroup cols="4" colsep="0" rowsep="0">
30986 <colspec colwidth="8*" align="left"/>
30987 <colspec colwidth="6*" align="center"/>
30988 <colspec colwidth="6*" align="center"/>
30989 <colspec colwidth="6*" align="right"/>
30990 <tbody>
30991 <row>
30992 <entry><option>check_srv</option></entry>
30993 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30994 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30995 <entry>Default: <emphasis>unset</emphasis></entry>
30996 </row>
30997 </tbody>
30998 </tgroup>
30999 </informaltable>
31000 <para>
31001 <indexterm role="concept">
31002 <primary>SRV record</primary>
31003 <secondary>enabling use of</secondary>
31004 </indexterm>
31005 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
31006 addition to MX and address records. The support is disabled by default. To
31007 enable SRV support, set the <option>check_srv</option> option to the name of the service
31008 required. For example,
31009 </para>
31010 <literallayout class="monospaced">
31011 check_srv = smtp
31012 </literallayout>
31013 <para>
31014 looks for SRV records that refer to the normal smtp service. The option is
31015 expanded, so the service name can vary from message to message or address
31016 to address. This might be helpful if SRV records are being used for a
31017 submission service. If the expansion is forced to fail, the <option>check_srv</option>
31018 option is ignored, and the router proceeds to look for MX records in the
31019 normal way.
31020 </para>
31021 <para>
31022 When the expansion succeeds, the router searches first for SRV records for
31023 the given service (it assumes TCP protocol). A single SRV record with a
31024 host name that consists of just a single dot indicates <quote>no such service for
31025 this domain</quote>; if this is encountered, the router declines. If other kinds of
31026 SRV record are found, they are used to construct a host list for delivery
31027 according to the rules of RFC 2782. MX records are not sought in this case.
31028 </para>
31029 <para>
31030 When no SRV records are found, MX records (and address records) are sought in
31031 the traditional way. In other words, SRV records take precedence over MX
31032 records, just as MX records take precedence over address records. Note that
31033 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
31034 defined it. It is apparently believed that MX records are sufficient for email
31035 and that SRV records should not be used for this purpose. However, SRV records
31036 have an additional <quote>weight</quote> feature which some people might find useful when
31037 trying to split an SMTP load between hosts of different power.
31038 </para>
31039 <para>
31040 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
31041 when there is a DNS lookup error.
31042 </para>
31043 <para>
31044 <indexterm role="option">
31045 <primary><option>mx_domains</option></primary>
31046 </indexterm>
31047 </para>
31048 <informaltable frame="all">
31049 <tgroup cols="4" colsep="0" rowsep="0">
31050 <colspec colwidth="8*" align="left"/>
31051 <colspec colwidth="6*" align="center"/>
31052 <colspec colwidth="6*" align="center"/>
31053 <colspec colwidth="6*" align="right"/>
31054 <tbody>
31055 <row>
31056 <entry><option>mx_domains</option></entry>
31057 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31058 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31059 <entry>Default: <emphasis>unset</emphasis></entry>
31060 </row>
31061 </tbody>
31062 </tgroup>
31063 </informaltable>
31064 <para>
31065 <indexterm role="concept">
31066 <primary>MX record</primary>
31067 <secondary>required to exist</secondary>
31068 </indexterm>
31069 <indexterm role="concept">
31070 <primary>SRV record</primary>
31071 <secondary>required to exist</secondary>
31072 </indexterm>
31073 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
31074 record in order to be recognized. (The name of this option could be improved.)
31075 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
31076 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
31077 setting:
31078 </para>
31079 <literallayout class="monospaced">
31080 mx_domains = ! *.discworld.fict.example : *.fict.example
31081 </literallayout>
31082 <para>
31083 This specifies that messages addressed to a domain that matches the list but
31084 has no MX record should be bounced immediately instead of being routed using
31085 the address record.
31086 </para>
31087 <para>
31088 <indexterm role="option">
31089 <primary><option>mx_fail_domains</option></primary>
31090 </indexterm>
31091 </para>
31092 <informaltable frame="all">
31093 <tgroup cols="4" colsep="0" rowsep="0">
31094 <colspec colwidth="8*" align="left"/>
31095 <colspec colwidth="6*" align="center"/>
31096 <colspec colwidth="6*" align="center"/>
31097 <colspec colwidth="6*" align="right"/>
31098 <tbody>
31099 <row>
31100 <entry><option>mx_fail_domains</option></entry>
31101 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31102 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31103 <entry>Default: <emphasis>unset</emphasis></entry>
31104 </row>
31105 </tbody>
31106 </tgroup>
31107 </informaltable>
31108 <para>
31109 If the DNS lookup for MX records for one of the domains in this list causes a
31110 DNS lookup error, Exim behaves as if no MX records were found. See section
31111 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31112 </para>
31113 <para>
31114 <indexterm role="option">
31115 <primary><option>qualify_single</option></primary>
31116 </indexterm>
31117 </para>
31118 <informaltable frame="all">
31119 <tgroup cols="4" colsep="0" rowsep="0">
31120 <colspec colwidth="8*" align="left"/>
31121 <colspec colwidth="6*" align="center"/>
31122 <colspec colwidth="6*" align="center"/>
31123 <colspec colwidth="6*" align="right"/>
31124 <tbody>
31125 <row>
31126 <entry><option>qualify_single</option></entry>
31127 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31128 <entry>Type: <emphasis>boolean</emphasis></entry>
31129 <entry>Default: <emphasis>true</emphasis></entry>
31130 </row>
31131 </tbody>
31132 </tgroup>
31133 </informaltable>
31134 <para>
31135 <indexterm role="concept">
31136 <primary>DNS</primary>
31137 <secondary>resolver options</secondary>
31138 </indexterm>
31139 <indexterm role="concept">
31140 <primary>DNS</primary>
31141 <secondary>qualifying single-component names</secondary>
31142 </indexterm>
31143 When this option is true, the resolver option RES_DEFNAMES is set for DNS
31144 lookups. Typically, but not standardly, this causes the resolver to qualify
31145 single-component names with the default domain. For example, on a machine
31146 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
31147 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
31148 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
31149 <emphasis>resolv.conf</emphasis>.
31150 </para>
31151 <para>
31152 <indexterm role="option">
31153 <primary><option>rewrite_headers</option></primary>
31154 </indexterm>
31155 </para>
31156 <informaltable frame="all">
31157 <tgroup cols="4" colsep="0" rowsep="0">
31158 <colspec colwidth="8*" align="left"/>
31159 <colspec colwidth="6*" align="center"/>
31160 <colspec colwidth="6*" align="center"/>
31161 <colspec colwidth="6*" align="right"/>
31162 <tbody>
31163 <row>
31164 <entry><option>rewrite_headers</option></entry>
31165 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31166 <entry>Type: <emphasis>boolean</emphasis></entry>
31167 <entry>Default: <emphasis>true</emphasis></entry>
31168 </row>
31169 </tbody>
31170 </tgroup>
31171 </informaltable>
31172 <para>
31173 <indexterm role="concept">
31174 <primary>rewriting</primary>
31175 <secondary>header lines</secondary>
31176 </indexterm>
31177 <indexterm role="concept">
31178 <primary>header lines</primary>
31179 <secondary>rewriting</secondary>
31180 </indexterm>
31181 If the domain name in the address that is being processed is not fully
31182 qualified, it may be expanded to its full form by a DNS lookup. For example, if
31183 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
31184 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
31185 occur as a result of setting the <option>widen_domains</option> option. If
31186 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
31187 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
31188 header lines of the message are rewritten with the full domain name.
31189 </para>
31190 <para>
31191 This option should be turned off only when it is known that no message is
31192 ever going to be sent outside an environment where the abbreviation makes
31193 sense.
31194 </para>
31195 <para>
31196 When an MX record is looked up in the DNS and matches a wildcard record, name
31197 servers normally return a record containing the name that has been looked up,
31198 making it impossible to detect whether a wildcard was present or not. However,
31199 some name servers have recently been seen to return the wildcard entry. If the
31200 name returned by a DNS lookup begins with an asterisk, it is not used for
31201 header rewriting.
31202 </para>
31203 <para>
31204 <indexterm role="option">
31205 <primary><option>same_domain_copy_routing</option></primary>
31206 </indexterm>
31207 </para>
31208 <informaltable frame="all">
31209 <tgroup cols="4" colsep="0" rowsep="0">
31210 <colspec colwidth="8*" align="left"/>
31211 <colspec colwidth="6*" align="center"/>
31212 <colspec colwidth="6*" align="center"/>
31213 <colspec colwidth="6*" align="right"/>
31214 <tbody>
31215 <row>
31216 <entry><option>same_domain_copy_routing</option></entry>
31217 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31218 <entry>Type: <emphasis>boolean</emphasis></entry>
31219 <entry>Default: <emphasis>false</emphasis></entry>
31220 </row>
31221 </tbody>
31222 </tgroup>
31223 </informaltable>
31224 <para>
31225 <indexterm role="concept">
31226 <primary>address</primary>
31227 <secondary>copying routing</secondary>
31228 </indexterm>
31229 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
31230 to the same list of hosts. However, this cannot be presumed, because the router
31231 options and preconditions may refer to the local part of the address. By
31232 default, therefore, Exim routes each address in a message independently. DNS
31233 servers run caches, so repeated DNS lookups are not normally expensive, and in
31234 any case, personal messages rarely have more than a few recipients.
31235 </para>
31236 <para>
31237 If you are running mailing lists with large numbers of subscribers at the same
31238 domain, and you are using a <command>dnslookup</command> router which is independent of the
31239 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31240 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
31241 routes an address to a remote transport, any other unrouted addresses in the
31242 message that have the same domain are automatically given the same routing
31243 without processing them independently,
31244 provided the following conditions are met:
31245 </para>
31246 <itemizedlist>
31247 <listitem>
31248 <para>
31249 No router that processed the address specified <option>headers_add</option> or
31250 <option>headers_remove</option>.
31251 </para>
31252 </listitem>
31253 <listitem>
31254 <para>
31255 The router did not change the address in any way, for example, by <quote>widening</quote>
31256 the domain.
31257 </para>
31258 </listitem>
31259 </itemizedlist>
31260 <para>
31261 <indexterm role="option">
31262 <primary><option>search_parents</option></primary>
31263 </indexterm>
31264 </para>
31265 <informaltable frame="all">
31266 <tgroup cols="4" colsep="0" rowsep="0">
31267 <colspec colwidth="8*" align="left"/>
31268 <colspec colwidth="6*" align="center"/>
31269 <colspec colwidth="6*" align="center"/>
31270 <colspec colwidth="6*" align="right"/>
31271 <tbody>
31272 <row>
31273 <entry><option>search_parents</option></entry>
31274 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31275 <entry>Type: <emphasis>boolean</emphasis></entry>
31276 <entry>Default: <emphasis>false</emphasis></entry>
31277 </row>
31278 </tbody>
31279 </tgroup>
31280 </informaltable>
31281 <para>
31282 <indexterm role="concept">
31283 <primary>DNS</primary>
31284 <secondary>resolver options</secondary>
31285 </indexterm>
31286 When this option is true, the resolver option RES_DNSRCH is set for DNS
31287 lookups. This is different from the <option>qualify_single</option> option in that it
31288 applies to domains containing dots. Typically, but not standardly, it causes
31289 the resolver to search for the name in the current domain and in parent
31290 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
31291 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
31292 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
31293 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
31294 </para>
31295 <para>
31296 Setting this option true can cause problems in domains that have a wildcard MX
31297 record, because any domain that does not have its own MX record matches the
31298 local wildcard.
31299 </para>
31300 <para>
31301 <indexterm role="option">
31302 <primary><option>srv_fail_domains</option></primary>
31303 </indexterm>
31304 </para>
31305 <informaltable frame="all">
31306 <tgroup cols="4" colsep="0" rowsep="0">
31307 <colspec colwidth="8*" align="left"/>
31308 <colspec colwidth="6*" align="center"/>
31309 <colspec colwidth="6*" align="center"/>
31310 <colspec colwidth="6*" align="right"/>
31311 <tbody>
31312 <row>
31313 <entry><option>srv_fail_domains</option></entry>
31314 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31315 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31316 <entry>Default: <emphasis>unset</emphasis></entry>
31317 </row>
31318 </tbody>
31319 </tgroup>
31320 </informaltable>
31321 <para>
31322 If the DNS lookup for SRV records for one of the domains in this list causes a
31323 DNS lookup error, Exim behaves as if no SRV records were found. See section
31324 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31325 </para>
31326 <para>
31327 <indexterm role="option">
31328 <primary><option>widen_domains</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>widen_domains</option></entry>
31340 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31341 <entry>Type: <emphasis>string list</emphasis></entry>
31342 <entry>Default: <emphasis>unset</emphasis></entry>
31343 </row>
31344 </tbody>
31345 </tgroup>
31346 </informaltable>
31347 <para>
31348 <indexterm role="concept">
31349 <primary>domain</primary>
31350 <secondary>partial; widening</secondary>
31351 </indexterm>
31352 If a DNS lookup fails and this option is set, each of its strings in turn is
31353 added onto the end of the domain, and the lookup is tried again. For example,
31354 if
31355 </para>
31356 <literallayout class="monospaced">
31357 widen_domains = fict.example:ref.example
31358 </literallayout>
31359 <para>
31360 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
31361 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
31362 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
31363 and <option>search_parents</option> options can cause some widening to be undertaken inside
31364 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
31365 when verifying, unless <option>rewrite_headers</option> is false (not the default).
31366 </para>
31367 </section>
31368 <section id="SECID119">
31369 <title>Effect of qualify_single and search_parents</title>
31370 <para>
31371 When a domain from an envelope recipient is changed by the resolver as a result
31372 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
31373 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
31374 is set false. Exim then re-routes the address, using the full domain.
31375 </para>
31376 <para>
31377 These two options affect only the DNS lookup that takes place inside the router
31378 for the domain of the address that is being routed. They do not affect lookups
31379 such as that implied by
31380 </para>
31381 <literallayout class="monospaced">
31382 domains = @mx_any
31383 </literallayout>
31384 <para>
31385 that may happen while processing a router precondition before the router is
31386 entered. No widening ever takes place for these lookups.
31387 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
31388 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
31389 </para>
31390 </section>
31391 </chapter>
31392
31393 <chapter id="CHID5">
31394 <title>The ipliteral router</title>
31395 <para>
31396 <indexterm role="concept">
31397 <primary><command>ipliteral</command> router</primary>
31398 </indexterm>
31399 <indexterm role="concept">
31400 <primary>domain literal</primary>
31401 <secondary>routing</secondary>
31402 </indexterm>
31403 <indexterm role="concept">
31404 <primary>routers</primary>
31405 <secondary><command>ipliteral</command></secondary>
31406 </indexterm>
31407 This router has no private options. Unless it is being used purely for
31408 verification (see <option>verify_only</option>) a transport is required to be defined by the
31409 generic <option>transport</option> option. The router accepts the address if its domain part
31410 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
31411 router handles the address
31412 </para>
31413 <literallayout class="monospaced">
31414 root@[192.168.1.1]
31415 </literallayout>
31416 <para>
31417 by setting up delivery to the host with that IP address. IPv4 domain literals
31418 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
31419 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
31420 </para>
31421 <literallayout class="monospaced">
31422 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
31423 </literallayout>
31424 <para>
31425 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
31426 grounds that sooner or later somebody will try it.
31427 </para>
31428 <para>
31429 <indexterm role="option">
31430 <primary><option>self</option></primary>
31431 <secondary>in <command>ipliteral</command> router</secondary>
31432 </indexterm>
31433 If the IP address matches something in <option>ignore_target_hosts</option>, the router
31434 declines. If an IP literal turns out to refer to the local host, the generic
31435 <option>self</option> option determines what happens.
31436 </para>
31437 <para>
31438 The RFCs require support for domain literals; however, their use is
31439 controversial in today&#x2019;s Internet. If you want to use this router, you must
31440 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
31441 Exim will not recognize the domain literal syntax in addresses.
31442 </para>
31443 </chapter>
31444
31445 <chapter id="CHID6">
31446 <title>The iplookup router</title>
31447 <para>
31448 <indexterm role="concept">
31449 <primary><command>iplookup</command> router</primary>
31450 </indexterm>
31451 <indexterm role="concept">
31452 <primary>routers</primary>
31453 <secondary><command>iplookup</command></secondary>
31454 </indexterm>
31455 The <command>iplookup</command> router was written to fulfil a specific requirement in
31456 Cambridge University (which in fact no longer exists). For this reason, it is
31457 not included in the binary of Exim by default. If you want to include it, you
31458 must set
31459 </para>
31460 <literallayout class="monospaced">
31461 ROUTER_IPLOOKUP=yes
31462 </literallayout>
31463 <para>
31464 in your <filename>Local/Makefile</filename> configuration file.
31465 </para>
31466 <para>
31467 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
31468 connection to one or more specific hosts. The host can then return the same or
31469 a different address &ndash; in effect rewriting the recipient address in the
31470 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
31471 this process fails, the address can be passed on to other routers, or delivery
31472 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
31473 must not be specified for it.
31474 </para>
31475 <para>
31476 <indexterm role="concept">
31477 <primary>options</primary>
31478 <secondary><command>iplookup</command> router</secondary>
31479 </indexterm>
31480 <indexterm role="option">
31481 <primary><option>hosts</option></primary>
31482 </indexterm>
31483 </para>
31484 <informaltable frame="all">
31485 <tgroup cols="4" colsep="0" rowsep="0">
31486 <colspec colwidth="8*" align="left"/>
31487 <colspec colwidth="6*" align="center"/>
31488 <colspec colwidth="6*" align="center"/>
31489 <colspec colwidth="6*" align="right"/>
31490 <tbody>
31491 <row>
31492 <entry><option>hosts</option></entry>
31493 <entry>Use: <emphasis>iplookup</emphasis></entry>
31494 <entry>Type: <emphasis>string</emphasis></entry>
31495 <entry>Default: <emphasis>unset</emphasis></entry>
31496 </row>
31497 </tbody>
31498 </tgroup>
31499 </informaltable>
31500 <para>
31501 This option must be supplied. Its value is a colon-separated list of host
31502 names. The hosts are looked up using <function>gethostbyname()</function>
31503 (or <function>getipnodebyname()</function> when available)
31504 and are tried in order until one responds to the query. If none respond, what
31505 happens is controlled by <option>optional</option>.
31506 </para>
31507 <para>
31508 <indexterm role="option">
31509 <primary><option>optional</option></primary>
31510 </indexterm>
31511 </para>
31512 <informaltable frame="all">
31513 <tgroup cols="4" colsep="0" rowsep="0">
31514 <colspec colwidth="8*" align="left"/>
31515 <colspec colwidth="6*" align="center"/>
31516 <colspec colwidth="6*" align="center"/>
31517 <colspec colwidth="6*" align="right"/>
31518 <tbody>
31519 <row>
31520 <entry><option>optional</option></entry>
31521 <entry>Use: <emphasis>iplookup</emphasis></entry>
31522 <entry>Type: <emphasis>boolean</emphasis></entry>
31523 <entry>Default: <emphasis>false</emphasis></entry>
31524 </row>
31525 </tbody>
31526 </tgroup>
31527 </informaltable>
31528 <para>
31529 If <option>optional</option> is true, if no response is obtained from any host, the address
31530 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
31531 delivery to the address is deferred.
31532 </para>
31533 <para>
31534 <indexterm role="option">
31535 <primary><option>port</option></primary>
31536 </indexterm>
31537 </para>
31538 <informaltable frame="all">
31539 <tgroup cols="4" colsep="0" rowsep="0">
31540 <colspec colwidth="8*" align="left"/>
31541 <colspec colwidth="6*" align="center"/>
31542 <colspec colwidth="6*" align="center"/>
31543 <colspec colwidth="6*" align="right"/>
31544 <tbody>
31545 <row>
31546 <entry><option>port</option></entry>
31547 <entry>Use: <emphasis>iplookup</emphasis></entry>
31548 <entry>Type: <emphasis>integer</emphasis></entry>
31549 <entry>Default: <emphasis>0</emphasis></entry>
31550 </row>
31551 </tbody>
31552 </tgroup>
31553 </informaltable>
31554 <para>
31555 <indexterm role="concept">
31556 <primary>port</primary>
31557 <secondary><command>iplookup</command> router</secondary>
31558 </indexterm>
31559 This option must be supplied. It specifies the port number for the TCP or UDP
31560 call.
31561 </para>
31562 <para>
31563 <indexterm role="option">
31564 <primary><option>protocol</option></primary>
31565 </indexterm>
31566 </para>
31567 <informaltable frame="all">
31568 <tgroup cols="4" colsep="0" rowsep="0">
31569 <colspec colwidth="8*" align="left"/>
31570 <colspec colwidth="6*" align="center"/>
31571 <colspec colwidth="6*" align="center"/>
31572 <colspec colwidth="6*" align="right"/>
31573 <tbody>
31574 <row>
31575 <entry><option>protocol</option></entry>
31576 <entry>Use: <emphasis>iplookup</emphasis></entry>
31577 <entry>Type: <emphasis>string</emphasis></entry>
31578 <entry>Default: <emphasis>udp</emphasis></entry>
31579 </row>
31580 </tbody>
31581 </tgroup>
31582 </informaltable>
31583 <para>
31584 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
31585 protocols is to be used.
31586 </para>
31587 <para>
31588 <indexterm role="option">
31589 <primary><option>query</option></primary>
31590 </indexterm>
31591 </para>
31592 <informaltable frame="all">
31593 <tgroup cols="4" colsep="0" rowsep="0">
31594 <colspec colwidth="8*" align="left"/>
31595 <colspec colwidth="6*" align="center"/>
31596 <colspec colwidth="6*" align="center"/>
31597 <colspec colwidth="6*" align="right"/>
31598 <tbody>
31599 <row>
31600 <entry><option>query</option></entry>
31601 <entry>Use: <emphasis>iplookup</emphasis></entry>
31602 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31603 <entry>Default: <emphasis>see below</emphasis></entry>
31604 </row>
31605 </tbody>
31606 </tgroup>
31607 </informaltable>
31608 <para>
31609 This defines the content of the query that is sent to the remote hosts. The
31610 default value is:
31611 </para>
31612 <literallayout class="monospaced">
31613 $local_part@$domain $local_part@$domain
31614 </literallayout>
31615 <para>
31616 The repetition serves as a way of checking that a response is to the correct
31617 query in the default case (see <option>response_pattern</option> below).
31618 </para>
31619 <para>
31620 <indexterm role="option">
31621 <primary><option>reroute</option></primary>
31622 </indexterm>
31623 </para>
31624 <informaltable frame="all">
31625 <tgroup cols="4" colsep="0" rowsep="0">
31626 <colspec colwidth="8*" align="left"/>
31627 <colspec colwidth="6*" align="center"/>
31628 <colspec colwidth="6*" align="center"/>
31629 <colspec colwidth="6*" align="right"/>
31630 <tbody>
31631 <row>
31632 <entry><option>reroute</option></entry>
31633 <entry>Use: <emphasis>iplookup</emphasis></entry>
31634 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31635 <entry>Default: <emphasis>unset</emphasis></entry>
31636 </row>
31637 </tbody>
31638 </tgroup>
31639 </informaltable>
31640 <para>
31641 If this option is not set, the rerouted address is precisely the byte string
31642 returned by the remote host, up to the first white space, if any. If set, the
31643 string is expanded to form the rerouted address. It can include parts matched
31644 in the response by <option>response_pattern</option> by means of numeric variables such as
31645 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
31646 whether or not a pattern is in use. In all cases, the rerouted address must end
31647 up in the form <emphasis>local_part@domain</emphasis>.
31648 </para>
31649 <para>
31650 <indexterm role="option">
31651 <primary><option>response_pattern</option></primary>
31652 </indexterm>
31653 </para>
31654 <informaltable frame="all">
31655 <tgroup cols="4" colsep="0" rowsep="0">
31656 <colspec colwidth="8*" align="left"/>
31657 <colspec colwidth="6*" align="center"/>
31658 <colspec colwidth="6*" align="center"/>
31659 <colspec colwidth="6*" align="right"/>
31660 <tbody>
31661 <row>
31662 <entry><option>response_pattern</option></entry>
31663 <entry>Use: <emphasis>iplookup</emphasis></entry>
31664 <entry>Type: <emphasis>string</emphasis></entry>
31665 <entry>Default: <emphasis>unset</emphasis></entry>
31666 </row>
31667 </tbody>
31668 </tgroup>
31669 </informaltable>
31670 <para>
31671 This option can be set to a regular expression that is applied to the string
31672 returned from the remote host. If the pattern does not match the response, the
31673 router declines. If <option>response_pattern</option> is not set, no checking of the
31674 response is done, unless the query was defaulted, in which case there is a
31675 check that the text returned after the first white space is the original
31676 address. This checks that the answer that has been received is in response to
31677 the correct question. For example, if the response is just a new domain, the
31678 following could be used:
31679 </para>
31680 <literallayout class="monospaced">
31681 response_pattern = ^([^@]+)$
31682 reroute = $local_part@$1
31683 </literallayout>
31684 <para>
31685 <indexterm role="option">
31686 <primary><option>timeout</option></primary>
31687 </indexterm>
31688 </para>
31689 <informaltable frame="all">
31690 <tgroup cols="4" colsep="0" rowsep="0">
31691 <colspec colwidth="8*" align="left"/>
31692 <colspec colwidth="6*" align="center"/>
31693 <colspec colwidth="6*" align="center"/>
31694 <colspec colwidth="6*" align="right"/>
31695 <tbody>
31696 <row>
31697 <entry><option>timeout</option></entry>
31698 <entry>Use: <emphasis>iplookup</emphasis></entry>
31699 <entry>Type: <emphasis>time</emphasis></entry>
31700 <entry>Default: <emphasis>5s</emphasis></entry>
31701 </row>
31702 </tbody>
31703 </tgroup>
31704 </informaltable>
31705 <para>
31706 This specifies the amount of time to wait for a response from the remote
31707 machine. The same timeout is used for the <function>connect()</function> function for a TCP
31708 call. It does not apply to UDP.
31709 </para>
31710 </chapter>
31711
31712 <chapter id="CHID7">
31713 <title>The manualroute router</title>
31714 <para>
31715 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
31716 <primary><command>manualroute</command> router</primary>
31717 </indexterm>
31718 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
31719 <primary>routers</primary>
31720 <secondary><command>manualroute</command></secondary>
31721 </indexterm>
31722 <indexterm role="concept">
31723 <primary>domain</primary>
31724 <secondary>manually routing</secondary>
31725 </indexterm>
31726 The <command>manualroute</command> router is so-called because it provides a way of manually
31727 routing an address according to its domain. It is mainly used when you want to
31728 route addresses to remote hosts according to your own rules, bypassing the
31729 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
31730 route to local transports, a facility that may be useful if you want to save
31731 messages for dial-in hosts in local files.
31732 </para>
31733 <para>
31734 The <command>manualroute</command> router compares a list of domain patterns with the domain
31735 it is trying to route. If there is no match, the router declines. Each pattern
31736 has associated with it a list of hosts and some other optional data, which may
31737 include a transport. The combination of a pattern and its data is called a
31738 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
31739 generic <option>transport</option> option must specify a transport, unless the router is
31740 being used purely for verification (see <option>verify_only</option>).
31741 </para>
31742 <para>
31743 <indexterm role="variable">
31744 <primary><varname>$host</varname></primary>
31745 </indexterm>
31746 In the case of verification, matching the domain pattern is sufficient for the
31747 router to accept the address. When actually routing an address for delivery,
31748 an address that matches a domain pattern is queued for the associated
31749 transport. If the transport is not a local one, a host list must be associated
31750 with the pattern; IP addresses are looked up for the hosts, and these are
31751 passed to the transport along with the mail address. For local transports, a
31752 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
31753 text string.
31754 </para>
31755 <para>
31756 The list of routing rules can be provided as an inline string in
31757 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
31758 or database by setting <option>route_data</option>. Only one of these settings may appear in
31759 any one instance of <command>manualroute</command>. The format of routing rules is described
31760 below, following the list of private options.
31761 </para>
31762 <section id="SECTprioptman">
31763 <title>Private options for manualroute</title>
31764 <para>
31765 <indexterm role="concept">
31766 <primary>options</primary>
31767 <secondary><command>manualroute</command> router</secondary>
31768 </indexterm>
31769 The private options for the <command>manualroute</command> router are as follows:
31770 </para>
31771 <para>
31772 <indexterm role="option">
31773 <primary><option>host_all_ignored</option></primary>
31774 </indexterm>
31775 </para>
31776 <informaltable frame="all">
31777 <tgroup cols="4" colsep="0" rowsep="0">
31778 <colspec colwidth="8*" align="left"/>
31779 <colspec colwidth="6*" align="center"/>
31780 <colspec colwidth="6*" align="center"/>
31781 <colspec colwidth="6*" align="right"/>
31782 <tbody>
31783 <row>
31784 <entry><option>host_all_ignored</option></entry>
31785 <entry>Use: <emphasis>manualroute</emphasis></entry>
31786 <entry>Type: <emphasis>string</emphasis></entry>
31787 <entry>Default: <emphasis>defer</emphasis></entry>
31788 </row>
31789 </tbody>
31790 </tgroup>
31791 </informaltable>
31792 <para>
31793 See <option>host_find_failed</option>.
31794 </para>
31795 <para>
31796 <indexterm role="option">
31797 <primary><option>host_find_failed</option></primary>
31798 </indexterm>
31799 </para>
31800 <informaltable frame="all">
31801 <tgroup cols="4" colsep="0" rowsep="0">
31802 <colspec colwidth="8*" align="left"/>
31803 <colspec colwidth="6*" align="center"/>
31804 <colspec colwidth="6*" align="center"/>
31805 <colspec colwidth="6*" align="right"/>
31806 <tbody>
31807 <row>
31808 <entry><option>host_find_failed</option></entry>
31809 <entry>Use: <emphasis>manualroute</emphasis></entry>
31810 <entry>Type: <emphasis>string</emphasis></entry>
31811 <entry>Default: <emphasis>freeze</emphasis></entry>
31812 </row>
31813 </tbody>
31814 </tgroup>
31815 </informaltable>
31816 <para>
31817 This option controls what happens when <command>manualroute</command> tries to find an IP
31818 address for a host, and the host does not exist. The option can be set to one
31819 of the following values:
31820 </para>
31821 <literallayout class="monospaced">
31822 decline
31823 defer
31824 fail
31825 freeze
31826 ignore
31827 pass
31828 </literallayout>
31829 <para>
31830 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
31831 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
31832 forces the address to be passed to the next router (or the router defined by
31833 <option>pass_router</option>),
31834 <indexterm role="option">
31835 <primary><option>more</option></primary>
31836 </indexterm>
31837 overriding <option>no_more</option>, whereas the latter passes the address to the next
31838 router only if <option>more</option> is true.
31839 </para>
31840 <para>
31841 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
31842 cannot be found. If all the hosts in the list are ignored, the behaviour is
31843 controlled by the <option>host_all_ignored</option> option. This takes the same values
31844 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
31845 </para>
31846 <para>
31847 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
31848 state; if a host lookup gets a temporary error, delivery is deferred unless the
31849 generic <option>pass_on_timeout</option> option is set.
31850 </para>
31851 <para>
31852 <indexterm role="option">
31853 <primary><option>hosts_randomize</option></primary>
31854 </indexterm>
31855 </para>
31856 <informaltable frame="all">
31857 <tgroup cols="4" colsep="0" rowsep="0">
31858 <colspec colwidth="8*" align="left"/>
31859 <colspec colwidth="6*" align="center"/>
31860 <colspec colwidth="6*" align="center"/>
31861 <colspec colwidth="6*" align="right"/>
31862 <tbody>
31863 <row>
31864 <entry><option>hosts_randomize</option></entry>
31865 <entry>Use: <emphasis>manualroute</emphasis></entry>
31866 <entry>Type: <emphasis>boolean</emphasis></entry>
31867 <entry>Default: <emphasis>false</emphasis></entry>
31868 </row>
31869 </tbody>
31870 </tgroup>
31871 </informaltable>
31872 <para>
31873 <indexterm role="concept">
31874 <primary>randomized host list</primary>
31875 </indexterm>
31876 <indexterm role="concept">
31877 <primary>host</primary>
31878 <secondary>list of; randomized</secondary>
31879 </indexterm>
31880 If this option is set, the order of the items in a host list in a routing rule
31881 is randomized each time the list is used, unless an option in the routing rule
31882 overrides (see below). Randomizing the order of a host list can be used to do
31883 crude load sharing. However, if more than one mail address is routed by the
31884 same router to the same host list, the host lists are considered to be the same
31885 (even though they may be randomized into different orders) for the purpose of
31886 deciding whether to batch the deliveries into a single SMTP transaction.
31887 </para>
31888 <para>
31889 When <option>hosts_randomize</option> is true, a host list may be split
31890 into groups whose order is separately randomized. This makes it possible to
31891 set up MX-like behaviour. The boundaries between groups are indicated by an
31892 item that is just <literal>+</literal> in the host list. For example:
31893 </para>
31894 <literallayout class="monospaced">
31895 route_list = * host1:host2:host3:+:host4:host5
31896 </literallayout>
31897 <para>
31898 The order of the first three hosts and the order of the last two hosts is
31899 randomized for each use, but the first three always end up before the last two.
31900 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
31901 randomized host list is passed to an <command>smtp</command> transport that also has
31902 <option>hosts_randomize set</option>, the list is not re-randomized.
31903 </para>
31904 <para>
31905 <indexterm role="option">
31906 <primary><option>route_data</option></primary>
31907 </indexterm>
31908 </para>
31909 <informaltable frame="all">
31910 <tgroup cols="4" colsep="0" rowsep="0">
31911 <colspec colwidth="8*" align="left"/>
31912 <colspec colwidth="6*" align="center"/>
31913 <colspec colwidth="6*" align="center"/>
31914 <colspec colwidth="6*" align="right"/>
31915 <tbody>
31916 <row>
31917 <entry><option>route_data</option></entry>
31918 <entry>Use: <emphasis>manualroute</emphasis></entry>
31919 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31920 <entry>Default: <emphasis>unset</emphasis></entry>
31921 </row>
31922 </tbody>
31923 </tgroup>
31924 </informaltable>
31925 <para>
31926 If this option is set, it must expand to yield the data part of a routing rule.
31927 Typically, the expansion string includes a lookup based on the domain. For
31928 example:
31929 </para>
31930 <literallayout class="monospaced">
31931 route_data = ${lookup{$domain}dbm{/etc/routes}}
31932 </literallayout>
31933 <para>
31934 If the expansion is forced to fail, or the result is an empty string, the
31935 router declines. Other kinds of expansion failure cause delivery to be
31936 deferred.
31937 </para>
31938 <para>
31939 <indexterm role="option">
31940 <primary><option>route_list</option></primary>
31941 </indexterm>
31942 </para>
31943 <informaltable frame="all">
31944 <tgroup cols="4" colsep="0" rowsep="0">
31945 <colspec colwidth="8*" align="left"/>
31946 <colspec colwidth="6*" align="center"/>
31947 <colspec colwidth="6*" align="center"/>
31948 <colspec colwidth="6*" align="right"/>
31949 <tbody>
31950 <row>
31951 <entry><option>route_list</option></entry>
31952 <entry>Use: <emphasis>manualroute</emphasis></entry>
31953 <entry>Type: <emphasis>string list</emphasis></entry>
31954 <entry>Default: <emphasis>unset</emphasis></entry>
31955 </row>
31956 </tbody>
31957 </tgroup>
31958 </informaltable>
31959 <para>
31960 This string is a list of routing rules, in the form defined below. Note that,
31961 unlike most string lists, the items are separated by semicolons. This is so
31962 that they may contain colon-separated host lists.
31963 </para>
31964 <para>
31965 <indexterm role="option">
31966 <primary><option>same_domain_copy_routing</option></primary>
31967 </indexterm>
31968 </para>
31969 <informaltable frame="all">
31970 <tgroup cols="4" colsep="0" rowsep="0">
31971 <colspec colwidth="8*" align="left"/>
31972 <colspec colwidth="6*" align="center"/>
31973 <colspec colwidth="6*" align="center"/>
31974 <colspec colwidth="6*" align="right"/>
31975 <tbody>
31976 <row>
31977 <entry><option>same_domain_copy_routing</option></entry>
31978 <entry>Use: <emphasis>manualroute</emphasis></entry>
31979 <entry>Type: <emphasis>boolean</emphasis></entry>
31980 <entry>Default: <emphasis>false</emphasis></entry>
31981 </row>
31982 </tbody>
31983 </tgroup>
31984 </informaltable>
31985 <para>
31986 <indexterm role="concept">
31987 <primary>address</primary>
31988 <secondary>copying routing</secondary>
31989 </indexterm>
31990 Addresses with the same domain are normally routed by the <command>manualroute</command>
31991 router to the same list of hosts. However, this cannot be presumed, because the
31992 router options and preconditions may refer to the local part of the address. By
31993 default, therefore, Exim routes each address in a message independently. DNS
31994 servers run caches, so repeated DNS lookups are not normally expensive, and in
31995 any case, personal messages rarely have more than a few recipients.
31996 </para>
31997 <para>
31998 If you are running mailing lists with large numbers of subscribers at the same
31999 domain, and you are using a <command>manualroute</command> router which is independent of the
32000 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32001 lookups for identical domains in one message. In this case, when
32002 <command>manualroute</command> routes an address to a remote transport, any other unrouted
32003 addresses in the message that have the same domain are automatically given the
32004 same routing without processing them independently. However, this is only done
32005 if <option>headers_add</option> and <option>headers_remove</option> are unset.
32006 </para>
32007 </section>
32008 <section id="SECID120">
32009 <title>Routing rules in route_list</title>
32010 <para>
32011 The value of <option>route_list</option> is a string consisting of a sequence of routing
32012 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
32013 entered as two semicolons. Alternatively, the list separator can be changed as
32014 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
32015 Empty rules are ignored. The format of each rule is
32016 </para>
32017 <literallayout>
32018 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
32019 </literallayout>
32020 <para>
32021 The following example contains two rules, each with a simple domain pattern and
32022 no options:
32023 </para>
32024 <literallayout class="monospaced">
32025 route_list = \
32026   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
32027   thes.ref.example  mail-3.ref.example:mail-4.ref.example
32028 </literallayout>
32029 <para>
32030 The three parts of a rule are separated by white space. The pattern and the
32031 list of hosts can be enclosed in quotes if necessary, and if they are, the
32032 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
32033 single domain pattern, which is the only mandatory item in the rule. The
32034 pattern is in the same format as one item in a domain list (see section
32035 <xref linkend="SECTdomainlist"/>),
32036 except that it may not be the name of an interpolated file.
32037 That is, it may be wildcarded, or a regular expression, or a file or database
32038 lookup (with semicolons doubled, because of the use of semicolon as a separator
32039 in a <option>route_list</option>).
32040 </para>
32041 <para>
32042 The rules in <option>route_list</option> are searched in order until one of the patterns
32043 matches the domain that is being routed. The list of hosts and then options are
32044 then used as described below. If there is no match, the router declines. When
32045 <option>route_list</option> is set, <option>route_data</option> must not be set.
32046 </para>
32047 </section>
32048 <section id="SECID121">
32049 <title>Routing rules in route_data</title>
32050 <para>
32051 The use of <option>route_list</option> is convenient when there are only a small number of
32052 routing rules. For larger numbers, it is easier to use a file or database to
32053 hold the routing information, and use the <option>route_data</option> option instead.
32054 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
32055 Most commonly, <option>route_data</option> is set as a string that contains an
32056 expansion lookup. For example, suppose we place two routing rules in a file
32057 like this:
32058 </para>
32059 <literallayout class="monospaced">
32060 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
32061 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
32062 </literallayout>
32063 <para>
32064 This data can be accessed by setting
32065 </para>
32066 <literallayout class="monospaced">
32067 route_data = ${lookup{$domain}lsearch{/the/file/name}}
32068 </literallayout>
32069 <para>
32070 Failure of the lookup results in an empty string, causing the router to
32071 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
32072 requirement is that the result of expanding the string is a list of hosts,
32073 possibly followed by options, separated by white space. The list of hosts must
32074 be enclosed in quotes if it contains white space.
32075 </para>
32076 </section>
32077 <section id="SECID122">
32078 <title>Format of the list of hosts</title>
32079 <para>
32080 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
32081 always separately expanded before use. If the expansion fails, the router
32082 declines. The result of the expansion must be a colon-separated list of names
32083 and/or IP addresses, optionally also including ports. The format of each item
32084 in the list is described in the next section. The list separator can be changed
32085 as described in section <xref linkend="SECTlistconstruct"/>.
32086 </para>
32087 <para>
32088 If the list of hosts was obtained from a <option>route_list</option> item, the following
32089 variables are set during its expansion:
32090 </para>
32091 <itemizedlist>
32092 <listitem>
32093 <para>
32094 <indexterm role="concept">
32095 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
32096 <secondary>in <command>manualroute</command> router</secondary>
32097 </indexterm>
32098 If the domain was matched against a regular expression, the numeric variables
32099 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
32100 </para>
32101 <literallayout class="monospaced">
32102 route_list = ^domain(\d+)   host-$1.text.example
32103 </literallayout>
32104 </listitem>
32105 <listitem>
32106 <para>
32107 <varname>$0</varname> is always set to the entire domain.
32108 </para>
32109 </listitem>
32110 <listitem>
32111 <para>
32112 <varname>$1</varname> is also set when partial matching is done in a file lookup.
32113 </para>
32114 </listitem>
32115 <listitem>
32116 <para>
32117 <indexterm role="variable">
32118 <primary><varname>$value</varname></primary>
32119 </indexterm>
32120 If the pattern that matched the domain was a lookup item, the data that was
32121 looked up is available in the expansion variable <varname>$value</varname>. For example:
32122 </para>
32123 <literallayout class="monospaced">
32124 route_list = lsearch;;/some/file.routes  $value
32125 </literallayout>
32126 </listitem>
32127 </itemizedlist>
32128 <para>
32129 Note the doubling of the semicolon in the pattern that is necessary because
32130 semicolon is the default route list separator.
32131 </para>
32132 </section>
32133 <section id="SECTformatonehostitem">
32134 <title>Format of one host item</title>
32135 <para>
32136 Each item in the list of hosts is either a host name or an IP address,
32137 optionally with an attached port number. When no port is given, an IP address
32138 is not enclosed in brackets. When a port is specified, it overrides the port
32139 specification on the transport. The port is separated from the name or address
32140 by a colon. This leads to some complications:
32141 </para>
32142 <itemizedlist>
32143 <listitem>
32144 <para>
32145 Because colon is the default separator for the list of hosts, either
32146 the colon that specifies a port must be doubled, or the list separator must
32147 be changed. The following two examples have the same effect:
32148 </para>
32149 <literallayout class="monospaced">
32150 route_list = * "host1.tld::1225 : host2.tld::1226"
32151 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
32152 </literallayout>
32153 </listitem>
32154 <listitem>
32155 <para>
32156 When IPv6 addresses are involved, it gets worse, because they contain
32157 colons of their own. To make this case easier, it is permitted to
32158 enclose an IP address (either v4 or v6) in square brackets if a port
32159 number follows. For example:
32160 </para>
32161 <literallayout class="monospaced">
32162 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
32163 </literallayout>
32164 </listitem>
32165 </itemizedlist>
32166 </section>
32167 <section id="SECThostshowused">
32168 <title>How the list of hosts is used</title>
32169 <para>
32170 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
32171 the hosts is tried, in the order specified, when carrying out the SMTP
32172 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
32173 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
32174 transport.
32175 </para>
32176 <para>
32177 Hosts may be listed by name or by IP address. An unadorned name in the list of
32178 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
32179 interpreted as an indirection to a sublist of hosts obtained by looking up MX
32180 records in the DNS. For example:
32181 </para>
32182 <literallayout class="monospaced">
32183 route_list = *  x.y.z:p.q.r/MX:e.f.g
32184 </literallayout>
32185 <para>
32186 If this feature is used with a port specifier, the port must come last. For
32187 example:
32188 </para>
32189 <literallayout class="monospaced">
32190 route_list = *  dom1.tld/mx::1225
32191 </literallayout>
32192 <para>
32193 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
32194 randomized before any lookups are done. Exim then scans the list; for any name
32195 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
32196 be an interface on the local host and the item is not the first in the list,
32197 Exim discards it and any subsequent items. If it is the first item, what
32198 happens is controlled by the
32199 <indexterm role="option">
32200 <primary><option>self</option></primary>
32201 <secondary>in <command>manualroute</command> router</secondary>
32202 </indexterm>
32203 <option>self</option> option of the router.
32204 </para>
32205 <para>
32206 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
32207 hosts obtained by looking up MX records for the name. This is always a DNS
32208 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
32209 below) are not relevant here. The order of these hosts is determined by the
32210 preference values in the MX records, according to the usual rules. Because
32211 randomizing happens before the MX lookup, it does not affect the order that is
32212 defined by MX preferences.
32213 </para>
32214 <para>
32215 If the local host is present in the sublist obtained from MX records, but is
32216 not the most preferred host in that list, it and any equally or less
32217 preferred hosts are removed before the sublist is inserted into the main list.
32218 </para>
32219 <para>
32220 If the local host is the most preferred host in the MX list, what happens
32221 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
32222 is not the first item (that is, there are previous hosts in the main list),
32223 Exim discards this name and any subsequent items in the main list.
32224 </para>
32225 <para>
32226 If the MX item is first in the list of hosts, and the local host is the
32227 most preferred host, what happens is controlled by the <option>self</option> option of the
32228 router.
32229 </para>
32230 <para>
32231 DNS failures when lookup up the MX records are treated in the same way as DNS
32232 failures when looking up IP addresses: <option>pass_on_timeout</option> and
32233 <option>host_find_failed</option> are used when relevant.
32234 </para>
32235 <para>
32236 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
32237 whether obtained from an MX lookup or not.
32238 </para>
32239 </section>
32240 <section id="SECThowoptused">
32241 <title>How the options are used</title>
32242 <para>
32243 The options are a sequence of words; in practice no more than three are ever
32244 present. One of the words can be the name of a transport; this overrides the
32245 <option>transport</option> option on the router for this particular routing rule only. The
32246 other words (if present) control randomization of the list of hosts on a
32247 per-rule basis, and how the IP addresses of the hosts are to be found when
32248 routing to a remote transport. These options are as follows:
32249 </para>
32250 <itemizedlist>
32251 <listitem>
32252 <para>
32253 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
32254 setting of <option>hosts_randomize</option> for this routing rule only.
32255 </para>
32256 </listitem>
32257 <listitem>
32258 <para>
32259 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
32260 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
32261 </para>
32262 </listitem>
32263 <listitem>
32264 <para>
32265 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
32266 find IP addresses. This function may ultimately cause a DNS lookup, but it may
32267 also look in <filename>/etc/hosts</filename> or other sources of information.
32268 </para>
32269 </listitem>
32270 <listitem>
32271 <para>
32272 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
32273 no address records are found. If there is a temporary DNS error (such as a
32274 timeout), delivery is deferred.
32275 </para>
32276 </listitem>
32277 </itemizedlist>
32278 <para>
32279 For example:
32280 </para>
32281 <literallayout class="monospaced">
32282 route_list = domain1  host1:host2:host3  randomize bydns;\
32283              domain2  host4:host5
32284 </literallayout>
32285 <para>
32286 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
32287 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
32288 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
32289 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
32290 call.
32291 </para>
32292 <para>
32293 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
32294 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
32295 instead of TRY_AGAIN. That is why the default action is to try a DNS
32296 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
32297 function called.
32298 </para>
32299 <para>
32300 If no IP address for a host can be found, what happens is controlled by the
32301 <option>host_find_failed</option> option.
32302 </para>
32303 <para>
32304 <indexterm role="variable">
32305 <primary><varname>$host</varname></primary>
32306 </indexterm>
32307 When an address is routed to a local transport, IP addresses are not looked up.
32308 The host list is passed to the transport in the <varname>$host</varname> variable.
32309 </para>
32310 </section>
32311 <section id="SECID123">
32312 <title>Manualroute examples</title>
32313 <para>
32314 In some of the examples that follow, the presence of the <option>remote_smtp</option>
32315 transport, as defined in the default configuration file, is assumed:
32316 </para>
32317 <itemizedlist>
32318 <listitem>
32319 <para>
32320 <indexterm role="concept">
32321 <primary>smart host</primary>
32322 <secondary>example router</secondary>
32323 </indexterm>
32324 The <command>manualroute</command> router can be used to forward all external mail to a
32325 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
32326 named domain list that contains your local domains, for example:
32327 </para>
32328 <literallayout class="monospaced">
32329 domainlist local_domains = my.domain.example
32330 </literallayout>
32331 <para>
32332 You can arrange for all other domains to be routed to a smart host by making
32333 your first router something like this:
32334 </para>
32335 <literallayout class="monospaced">
32336 smart_route:
32337   driver = manualroute
32338   domains = !+local_domains
32339   transport = remote_smtp
32340   route_list = * smarthost.ref.example
32341 </literallayout>
32342 <para>
32343 This causes all non-local addresses to be sent to the single host
32344 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
32345 they are tried in order
32346 (but you can use <option>hosts_randomize</option> to vary the order each time).
32347 Another way of configuring the same thing is this:
32348 </para>
32349 <literallayout class="monospaced">
32350 smart_route:
32351   driver = manualroute
32352   transport = remote_smtp
32353   route_list = !+local_domains  smarthost.ref.example
32354 </literallayout>
32355 <para>
32356 There is no difference in behaviour between these two routers as they stand.
32357 However, they behave differently if <option>no_more</option> is added to them. In the first
32358 example, the router is skipped if the domain does not match the <option>domains</option>
32359 precondition; the following router is always tried. If the router runs, it
32360 always matches the domain and so can never decline. Therefore, <option>no_more</option>
32361 would have no effect. In the second case, the router is never skipped; it
32362 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
32363 <option>no_more</option> would prevent subsequent routers from running.
32364 </para>
32365 </listitem>
32366 <listitem>
32367 <para>
32368 <indexterm role="concept">
32369 <primary>mail hub example</primary>
32370 </indexterm>
32371 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
32372 records in the DNS and delivers it via its own private routing mechanism. Often
32373 the final destinations are behind a firewall, with the mail hub being the one
32374 machine that can connect to machines both inside and outside the firewall. The
32375 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
32376 to the correct hosts. For a small number of domains, the routing can be inline,
32377 using the <option>route_list</option> option, but for a larger number a file or database
32378 lookup is easier to manage.
32379 </para>
32380 <para>
32381 If the domain names are in fact the names of the machines to which the mail is
32382 to be sent by the mail hub, the configuration can be quite simple. For
32383 example:
32384 </para>
32385 <literallayout class="monospaced">
32386 hub_route:
32387   driver = manualroute
32388   transport = remote_smtp
32389   route_list = *.rhodes.tvs.example  $domain
32390 </literallayout>
32391 <para>
32392 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
32393 whose names are the same as the mail domains. A similar approach can be taken
32394 if the host name can be obtained from the domain name by a string manipulation
32395 that the expansion facilities can handle. Otherwise, a lookup based on the
32396 domain can be used to find the host:
32397 </para>
32398 <literallayout class="monospaced">
32399 through_firewall:
32400   driver = manualroute
32401   transport = remote_smtp
32402   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
32403 </literallayout>
32404 <para>
32405 The result of the lookup must be the name or IP address of the host (or
32406 hosts) to which the address is to be routed. If the lookup fails, the route
32407 data is empty, causing the router to decline. The address then passes to the
32408 next router.
32409 </para>
32410 </listitem>
32411 <listitem>
32412 <para>
32413 <indexterm role="concept">
32414 <primary>batched SMTP output example</primary>
32415 </indexterm>
32416 <indexterm role="concept">
32417 <primary>SMTP</primary>
32418 <secondary>batched outgoing; example</secondary>
32419 </indexterm>
32420 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
32421 SMTP format for onward transportation by some other means. This is one way of
32422 storing mail for a dial-up host when it is not connected. The route list entry
32423 can be as simple as a single domain name in a configuration like this:
32424 </para>
32425 <literallayout class="monospaced">
32426 save_in_file:
32427   driver = manualroute
32428   transport = batchsmtp_appendfile
32429   route_list = saved.domain.example
32430 </literallayout>
32431 <para>
32432 though often a pattern is used to pick up more than one domain. If there are
32433 several domains or groups of domains with different transport requirements,
32434 different transports can be listed in the routing information:
32435 </para>
32436 <literallayout class="monospaced">
32437 save_in_file:
32438   driver = manualroute
32439   route_list = \
32440     *.saved.domain1.example  $domain  batch_appendfile; \
32441     *.saved.domain2.example  \
32442       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
32443       batch_pipe
32444 </literallayout>
32445 <para>
32446 <indexterm role="variable">
32447 <primary><varname>$domain</varname></primary>
32448 </indexterm>
32449 <indexterm role="variable">
32450 <primary><varname>$host</varname></primary>
32451 </indexterm>
32452 The first of these just passes the domain in the <varname>$host</varname> variable, which
32453 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
32454 file lookup to find a value to pass, causing the router to decline to handle
32455 the address if the lookup fails.
32456 </para>
32457 </listitem>
32458 <listitem>
32459 <para>
32460 <indexterm role="concept">
32461 <primary>UUCP</primary>
32462 <secondary>example of router for</secondary>
32463 </indexterm>
32464 Routing mail directly to UUCP software is a specific case of the use of
32465 <command>manualroute</command> in a gateway to another mail environment. This is an example of
32466 one way it can be done:
32467 </para>
32468 <literallayout class="monospaced">
32469 # Transport
32470 uucp:
32471   driver = pipe
32472   user = nobody
32473   command = /usr/local/bin/uux -r - \
32474     ${substr_-5:$host}!rmail ${local_part}
32475   return_fail_output = true
32476
32477 # Router
32478 uucphost:
32479   transport = uucp
32480   driver = manualroute
32481   route_data = \
32482     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
32483 </literallayout>
32484 <para>
32485 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
32486 </para>
32487 <literallayout class="monospaced">
32488 darksite.ethereal.example:           darksite.UUCP
32489 </literallayout>
32490 <para>
32491 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
32492 makes clear the distinction between the domain name
32493 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
32494 </para>
32495 </listitem>
32496 </itemizedlist>
32497 <para>
32498 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
32499 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
32500 </para>
32501 </section>
32502 </chapter>
32503
32504 <chapter id="CHAPdriverlast">
32505 <title>The queryprogram router</title>
32506 <para>
32507 <indexterm role="concept" id="IIDquerou1" class="startofrange">
32508 <primary><command>queryprogram</command> router</primary>
32509 </indexterm>
32510 <indexterm role="concept" id="IIDquerou2" class="startofrange">
32511 <primary>routers</primary>
32512 <secondary><command>queryprogram</command></secondary>
32513 </indexterm>
32514 <indexterm role="concept">
32515 <primary>routing</primary>
32516 <secondary>by external program</secondary>
32517 </indexterm>
32518 The <command>queryprogram</command> router routes an address by running an external command
32519 and acting on its output. This is an expensive way to route, and is intended
32520 mainly for use in lightly-loaded systems, or for performing experiments.
32521 However, if it is possible to use the precondition options (<option>domains</option>,
32522 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
32523 be used in special cases, even on a busy host. There are the following private
32524 options:
32525 <indexterm role="concept">
32526 <primary>options</primary>
32527 <secondary><command>queryprogram</command> router</secondary>
32528 </indexterm>
32529 </para>
32530 <para>
32531 <indexterm role="option">
32532 <primary><option>command</option></primary>
32533 </indexterm>
32534 </para>
32535 <informaltable frame="all">
32536 <tgroup cols="4" colsep="0" rowsep="0">
32537 <colspec colwidth="8*" align="left"/>
32538 <colspec colwidth="6*" align="center"/>
32539 <colspec colwidth="6*" align="center"/>
32540 <colspec colwidth="6*" align="right"/>
32541 <tbody>
32542 <row>
32543 <entry><option>command</option></entry>
32544 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32546 <entry>Default: <emphasis>unset</emphasis></entry>
32547 </row>
32548 </tbody>
32549 </tgroup>
32550 </informaltable>
32551 <para>
32552 This option must be set. It specifies the command that is to be run. The
32553 command is split up into a command name and arguments, and then each is
32554 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
32555 <xref linkend="CHAPpipetransport"/>).
32556 </para>
32557 <para>
32558 <indexterm role="option">
32559 <primary><option>command_group</option></primary>
32560 </indexterm>
32561 </para>
32562 <informaltable frame="all">
32563 <tgroup cols="4" colsep="0" rowsep="0">
32564 <colspec colwidth="8*" align="left"/>
32565 <colspec colwidth="6*" align="center"/>
32566 <colspec colwidth="6*" align="center"/>
32567 <colspec colwidth="6*" align="right"/>
32568 <tbody>
32569 <row>
32570 <entry><option>command_group</option></entry>
32571 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32572 <entry>Type: <emphasis>string</emphasis></entry>
32573 <entry>Default: <emphasis>unset</emphasis></entry>
32574 </row>
32575 </tbody>
32576 </tgroup>
32577 </informaltable>
32578 <para>
32579 <indexterm role="concept">
32580 <primary>gid (group id)</primary>
32581 <secondary>in <command>queryprogram</command> router</secondary>
32582 </indexterm>
32583 This option specifies a gid to be set when running the command while routing an
32584 address for deliver. It must be set if <option>command_user</option> specifies a numerical
32585 uid. If it begins with a digit, it is interpreted as the numerical value of the
32586 gid. Otherwise it is looked up using <function>getgrnam()</function>.
32587 </para>
32588 <para>
32589 <indexterm role="option">
32590 <primary><option>command_user</option></primary>
32591 </indexterm>
32592 </para>
32593 <informaltable frame="all">
32594 <tgroup cols="4" colsep="0" rowsep="0">
32595 <colspec colwidth="8*" align="left"/>
32596 <colspec colwidth="6*" align="center"/>
32597 <colspec colwidth="6*" align="center"/>
32598 <colspec colwidth="6*" align="right"/>
32599 <tbody>
32600 <row>
32601 <entry><option>command_user</option></entry>
32602 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32603 <entry>Type: <emphasis>string</emphasis></entry>
32604 <entry>Default: <emphasis>unset</emphasis></entry>
32605 </row>
32606 </tbody>
32607 </tgroup>
32608 </informaltable>
32609 <para>
32610 <indexterm role="concept">
32611 <primary>uid (user id)</primary>
32612 <secondary>for <command>queryprogram</command></secondary>
32613 </indexterm>
32614 This option must be set. It specifies the uid which is set when running the
32615 command while routing an address for delivery. If the value begins with a digit,
32616 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
32617 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
32618 not set, a value for the gid also.
32619 </para>
32620 <para>
32621 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
32622 root, which it does during a normal delivery in a conventional configuration.
32623 However, when an address is being verified during message reception, Exim is
32624 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
32625 is called from a non-root process, Exim cannot change uid or gid before running
32626 the command. In this circumstance the command runs under the current uid and
32627 gid.
32628 </para>
32629 <para>
32630 <indexterm role="option">
32631 <primary><option>current_directory</option></primary>
32632 </indexterm>
32633 </para>
32634 <informaltable frame="all">
32635 <tgroup cols="4" colsep="0" rowsep="0">
32636 <colspec colwidth="8*" align="left"/>
32637 <colspec colwidth="6*" align="center"/>
32638 <colspec colwidth="6*" align="center"/>
32639 <colspec colwidth="6*" align="right"/>
32640 <tbody>
32641 <row>
32642 <entry><option>current_directory</option></entry>
32643 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32644 <entry>Type: <emphasis>string</emphasis></entry>
32645 <entry>Default: <emphasis>/</emphasis></entry>
32646 </row>
32647 </tbody>
32648 </tgroup>
32649 </informaltable>
32650 <para>
32651 This option specifies an absolute path which is made the current directory
32652 before running the command.
32653 </para>
32654 <para>
32655 <indexterm role="option">
32656 <primary><option>timeout</option></primary>
32657 </indexterm>
32658 </para>
32659 <informaltable frame="all">
32660 <tgroup cols="4" colsep="0" rowsep="0">
32661 <colspec colwidth="8*" align="left"/>
32662 <colspec colwidth="6*" align="center"/>
32663 <colspec colwidth="6*" align="center"/>
32664 <colspec colwidth="6*" align="right"/>
32665 <tbody>
32666 <row>
32667 <entry><option>timeout</option></entry>
32668 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32669 <entry>Type: <emphasis>time</emphasis></entry>
32670 <entry>Default: <emphasis>1h</emphasis></entry>
32671 </row>
32672 </tbody>
32673 </tgroup>
32674 </informaltable>
32675 <para>
32676 If the command does not complete within the timeout period, its process group
32677 is killed and the message is frozen. A value of zero time specifies no
32678 timeout.
32679 </para>
32680 <para>
32681 The standard output of the command is connected to a pipe, which is read when
32682 the command terminates. It should consist of a single line of output,
32683 containing up to five fields, separated by white space. The maximum length of
32684 the line is 1023 characters. Longer lines are silently truncated. The first
32685 field is one of the following words (case-insensitive):
32686 </para>
32687 <itemizedlist>
32688 <listitem>
32689 <para>
32690 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
32691 below).
32692 </para>
32693 </listitem>
32694 <listitem>
32695 <para>
32696 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
32697 <option>no_more</option> is set.
32698 </para>
32699 </listitem>
32700 <listitem>
32701 <para>
32702 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
32703 subsequent text on the line is an error message. If the router is run as part
32704 of address verification during an incoming SMTP message, the message is
32705 included in the SMTP response.
32706 </para>
32707 </listitem>
32708 <listitem>
32709 <para>
32710 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
32711 subsequent text on the line is an error message which is logged. It is not
32712 included in any SMTP response.
32713 </para>
32714 </listitem>
32715 <listitem>
32716 <para>
32717 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
32718 </para>
32719 </listitem>
32720 <listitem>
32721 <para>
32722 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
32723 <option>pass_router</option>), overriding <option>no_more</option>.
32724 </para>
32725 </listitem>
32726 <listitem>
32727 <para>
32728 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
32729 new addresses, which are routed independently, starting with the first router,
32730 or the router specified by <option>redirect_router</option>, if set.
32731 </para>
32732 </listitem>
32733 </itemizedlist>
32734 <para>
32735 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
32736 number of keyed data values, as follows (split into two lines here, to fit on
32737 the page):
32738 </para>
32739 <literallayout class="monospaced">
32740 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
32741 LOOKUP=byname|bydns DATA=&lt;text&gt;
32742 </literallayout>
32743 <para>
32744 The data items can be given in any order, and all are optional. If no transport
32745 is included, the transport specified by the generic <option>transport</option> option is
32746 used. The list of hosts and the lookup type are needed only if the transport is
32747 an <command>smtp</command> transport that does not itself supply a list of hosts.
32748 </para>
32749 <para>
32750 The format of the list of hosts is the same as for the <command>manualroute</command> router.
32751 As well as host names and IP addresses with optional port numbers, as described
32752 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
32753 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
32754 (see section <xref linkend="SECThostshowused"/>).
32755 </para>
32756 <para>
32757 If the lookup type is not specified, Exim behaves as follows when trying to
32758 find an IP address for each host: First, a DNS lookup is done. If this yields
32759 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
32760 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
32761 result of the lookup is the result of that call.
32762 </para>
32763 <para>
32764 <indexterm role="variable">
32765 <primary><varname>$address_data</varname></primary>
32766 </indexterm>
32767 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
32768 variable. For example, this return line
32769 </para>
32770 <literallayout class="monospaced">
32771 accept hosts=x1.y.example:x2.y.example data="rule1"
32772 </literallayout>
32773 <para>
32774 routes the address to the default transport, passing a list of two hosts. When
32775 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
32776 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
32777 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
32778 </para>
32779 </chapter>
32780
32781 <chapter id="CHAPredirect">
32782 <title>The redirect router</title>
32783 <para>
32784 <indexterm role="concept" id="IIDredrou1" class="startofrange">
32785 <primary><command>redirect</command> router</primary>
32786 </indexterm>
32787 <indexterm role="concept" id="IIDredrou2" class="startofrange">
32788 <primary>routers</primary>
32789 <secondary><command>redirect</command></secondary>
32790 </indexterm>
32791 <indexterm role="concept">
32792 <primary>alias file</primary>
32793 <secondary>in a <command>redirect</command> router</secondary>
32794 </indexterm>
32795 <indexterm role="concept">
32796 <primary>address redirection</primary>
32797 <secondary><command>redirect</command> router</secondary>
32798 </indexterm>
32799 The <command>redirect</command> router handles several kinds of address redirection. Its most
32800 common uses are for resolving local part aliases from a central alias file
32801 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
32802 files, but it has many other potential uses. The incoming address can be
32803 redirected in several different ways:
32804 </para>
32805 <itemizedlist>
32806 <listitem>
32807 <para>
32808 It can be replaced by one or more new addresses which are themselves routed
32809 independently.
32810 </para>
32811 </listitem>
32812 <listitem>
32813 <para>
32814 It can be routed to be delivered to a given file or directory.
32815 </para>
32816 </listitem>
32817 <listitem>
32818 <para>
32819 It can be routed to be delivered to a specified pipe command.
32820 </para>
32821 </listitem>
32822 <listitem>
32823 <para>
32824 It can cause an automatic reply to be generated.
32825 </para>
32826 </listitem>
32827 <listitem>
32828 <para>
32829 It can be forced to fail, optionally with a custom error message.
32830 </para>
32831 </listitem>
32832 <listitem>
32833 <para>
32834 It can be temporarily deferred, optionally with a custom message.
32835 </para>
32836 </listitem>
32837 <listitem>
32838 <para>
32839 It can be discarded.
32840 </para>
32841 </listitem>
32842 </itemizedlist>
32843 <para>
32844 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
32845 However, there are some private options which define transports for delivery to
32846 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
32847 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
32848 </para>
32849 <section id="SECID124">
32850 <title>Redirection data</title>
32851 <para>
32852 The router operates by interpreting a text string which it obtains either by
32853 expanding the contents of the <option>data</option> option, or by reading the entire
32854 contents of a file whose name is given in the <option>file</option> option. These two
32855 options are mutually exclusive. The first is commonly used for handling system
32856 aliases, in a configuration like this:
32857 </para>
32858 <literallayout class="monospaced">
32859 system_aliases:
32860   driver = redirect
32861   data = ${lookup{$local_part}lsearch{/etc/aliases}}
32862 </literallayout>
32863 <para>
32864 If the lookup fails, the expanded string in this example is empty. When the
32865 expansion of <option>data</option> results in an empty string, the router declines. A forced
32866 expansion failure also causes the router to decline; other expansion failures
32867 cause delivery to be deferred.
32868 </para>
32869 <para>
32870 A configuration using <option>file</option> is commonly used for handling users&#x2019;
32871 <filename>.forward</filename> files, like this:
32872 </para>
32873 <literallayout class="monospaced">
32874 userforward:
32875   driver = redirect
32876   check_local_user
32877   file = $home/.forward
32878   no_verify
32879 </literallayout>
32880 <para>
32881 If the file does not exist, or causes no action to be taken (for example, it is
32882 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
32883 is not the case when the file contains syntactically valid items that happen to
32884 yield empty addresses, for example, items containing only RFC 2822 address
32885 comments.
32886 </para>
32887 </section>
32888 <section id="SECID125">
32889 <title>Forward files and address verification</title>
32890 <para>
32891 <indexterm role="concept">
32892 <primary>address redirection</primary>
32893 <secondary>while verifying</secondary>
32894 </indexterm>
32895 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
32896 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
32897 </para>
32898 <itemizedlist>
32899 <listitem>
32900 <para>
32901 When Exim is receiving an incoming SMTP message from a remote host, it is
32902 running under the Exim uid, not as root. Exim is unable to change uid to read
32903 the file as the user, and it may not be able to read it as the Exim user. So in
32904 practice the router may not be able to operate.
32905 </para>
32906 </listitem>
32907 <listitem>
32908 <para>
32909 However, even when the router can operate, the existence of a <filename>.forward</filename> file
32910 is unimportant when verifying an address. What should be checked is whether the
32911 local part is a valid user name or not. Cutting out the redirection processing
32912 saves some resources.
32913 </para>
32914 </listitem>
32915 </itemizedlist>
32916 </section>
32917 <section id="SECID126">
32918 <title>Interpreting redirection data</title>
32919 <para>
32920 <indexterm role="concept">
32921 <primary>Sieve filter</primary>
32922 <secondary>specifying in redirection data</secondary>
32923 </indexterm>
32924 <indexterm role="concept">
32925 <primary>filter</primary>
32926 <secondary>specifying in redirection data</secondary>
32927 </indexterm>
32928 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
32929 can be interpreted in two different ways:
32930 </para>
32931 <itemizedlist>
32932 <listitem>
32933 <para>
32934 If the <option>allow_filter</option> option is set true, and the data begins with the text
32935 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
32936 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
32937 respectively. Details of the syntax and semantics of filter files are described
32938 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
32939 document is intended for use by end users.
32940 </para>
32941 </listitem>
32942 <listitem>
32943 <para>
32944 Otherwise, the data must be a comma-separated list of redirection items, as
32945 described in the next section.
32946 </para>
32947 </listitem>
32948 </itemizedlist>
32949 <para>
32950 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
32951 in a non-filter redirection list must always be an absolute path. A filter may
32952 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
32953 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
32954 for the <command>appendfile</command> transport.
32955 </para>
32956 </section>
32957 <section id="SECTitenonfilred">
32958 <title>Items in a non-filter redirection list</title>
32959 <para>
32960 <indexterm role="concept">
32961 <primary>address redirection</primary>
32962 <secondary>non-filter list items</secondary>
32963 </indexterm>
32964 When the redirection data is not an Exim or Sieve filter, for example, if it
32965 comes from a conventional alias or forward file, it consists of a list of
32966 addresses, file names, pipe commands, or certain special items (see section
32967 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
32968 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
32969 depending on their default values. The items in the list are separated by
32970 commas or newlines.
32971 If a comma is required in an item, the entire item must be enclosed in double
32972 quotes.
32973 </para>
32974 <para>
32975 Lines starting with a # character are comments, and are ignored, and # may
32976 also appear following a comma, in which case everything between the # and the
32977 next newline character is ignored.
32978 </para>
32979 <para>
32980 If an item is entirely enclosed in double quotes, these are removed. Otherwise
32981 double quotes are retained because some forms of mail address require their use
32982 (but never to enclose the entire address). In the following description,
32983 <quote>item</quote> refers to what remains after any surrounding double quotes have been
32984 removed.
32985 </para>
32986 <para>
32987 <indexterm role="variable">
32988 <primary><varname>$local_part</varname></primary>
32989 </indexterm>
32990 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
32991 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
32992 of the <option>quote_local_part</option> expansion operator, in case the local part contains
32993 special characters. For example, to redirect all mail for the domain
32994 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
32995 setting:
32996 </para>
32997 <literallayout class="monospaced">
32998 data = ${quote_local_part:$local_part}@newdomain.example
32999 </literallayout>
33000 </section>
33001 <section id="SECTredlocmai">
33002 <title>Redirecting to a local mailbox</title>
33003 <para>
33004 <indexterm role="concept">
33005 <primary>routing</primary>
33006 <secondary>loops in</secondary>
33007 </indexterm>
33008 <indexterm role="concept">
33009 <primary>loop</primary>
33010 <secondary>while routing, avoidance of</secondary>
33011 </indexterm>
33012 <indexterm role="concept">
33013 <primary>address redirection</primary>
33014 <secondary>to local mailbox</secondary>
33015 </indexterm>
33016 A redirection item may safely be the same as the address currently under
33017 consideration. This does not cause a routing loop, because a router is
33018 automatically skipped if any ancestor of the address that is being processed
33019 is the same as the current address and was processed by the current router.
33020 Such an address is therefore passed to the following routers, so it is handled
33021 as if there were no redirection. When making this loop-avoidance test, the
33022 complete local part, including any prefix or suffix, is used.
33023 </para>
33024 <para>
33025 <indexterm role="concept">
33026 <primary>address redirection</primary>
33027 <secondary>local part without domain</secondary>
33028 </indexterm>
33029 Specifying the same local part without a domain is a common usage in personal
33030 filter files when the user wants to have messages delivered to the local
33031 mailbox and also forwarded elsewhere. For example, the user whose login is
33032 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
33033 </para>
33034 <literallayout class="monospaced">
33035 cleo, cleopatra@egypt.example
33036 </literallayout>
33037 <para>
33038 <indexterm role="concept">
33039 <primary>backslash in alias file</primary>
33040 </indexterm>
33041 <indexterm role="concept">
33042 <primary>alias file</primary>
33043 <secondary>backslash in</secondary>
33044 </indexterm>
33045 For compatibility with other MTAs, such unqualified local parts may be
33046 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
33047 it does make a difference if more than one domain is being handled
33048 synonymously.
33049 </para>
33050 <para>
33051 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
33052 2822 address that does not include a domain, the item is qualified using the
33053 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
33054 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
33055 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
33056 </para>
33057 <para>
33058 Care must be taken if there are alias names for local users.
33059 Consider an MTA handling a single local domain where the system alias file
33060 contains:
33061 </para>
33062 <literallayout class="monospaced">
33063 Sam.Reman: spqr
33064 </literallayout>
33065 <para>
33066 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
33067 messages in the local mailbox, and also forward copies elsewhere. He creates
33068 this forward file:
33069 </para>
33070 <literallayout class="monospaced">
33071 Sam.Reman, spqr@reme.elsewhere.example
33072 </literallayout>
33073 <para>
33074 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
33075 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
33076 second time round, because it has previously routed it,
33077 and the following routers presumably cannot handle the alias. The forward file
33078 should really contain
33079 </para>
33080 <literallayout class="monospaced">
33081 spqr, spqr@reme.elsewhere.example
33082 </literallayout>
33083 <para>
33084 but because this is such a common error, the <option>check_ancestor</option> option (see
33085 below) exists to provide a way to get round it. This is normally set on a
33086 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
33087 </para>
33088 </section>
33089 <section id="SECTspecitredli">
33090 <title>Special items in redirection lists</title>
33091 <para>
33092 In addition to addresses, the following types of item may appear in redirection
33093 lists (that is, in non-filter redirection data):
33094 </para>
33095 <itemizedlist>
33096 <listitem>
33097 <para>
33098 <indexterm role="concept">
33099 <primary>pipe</primary>
33100 <secondary>in redirection list</secondary>
33101 </indexterm>
33102 <indexterm role="concept">
33103 <primary>address redirection</primary>
33104 <secondary>to pipe</secondary>
33105 </indexterm>
33106 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
33107 as a valid RFC 2822 address that includes a domain. A transport for running the
33108 command must be specified by the <option>pipe_transport</option> option.
33109 Normally, either the router or the transport specifies a user and a group under
33110 which to run the delivery. The default is to use the Exim user and group.
33111 </para>
33112 <para>
33113 Single or double quotes can be used for enclosing the individual arguments of
33114 the pipe command; no interpretation of escapes is done for single quotes. If
33115 the command contains a comma character, it is necessary to put the whole item
33116 in double quotes, for example:
33117 </para>
33118 <literallayout class="monospaced">
33119 "|/some/command ready,steady,go"
33120 </literallayout>
33121 <para>
33122 since items in redirection lists are terminated by commas. Do not, however,
33123 quote just the command. An item such as
33124 </para>
33125 <literallayout class="monospaced">
33126 |"/some/command ready,steady,go"
33127 </literallayout>
33128 <para>
33129 is interpreted as a pipe with a rather strange command name, and no arguments.
33130 </para>
33131 </listitem>
33132 <listitem>
33133 <para>
33134 <indexterm role="concept">
33135 <primary>file</primary>
33136 <secondary>in redirection list</secondary>
33137 </indexterm>
33138 <indexterm role="concept">
33139 <primary>address redirection</primary>
33140 <secondary>to file</secondary>
33141 </indexterm>
33142 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
33143 parse as a valid RFC 2822 address that includes a domain. For example,
33144 </para>
33145 <literallayout class="monospaced">
33146 /home/world/minbari
33147 </literallayout>
33148 <para>
33149 is treated as a file name, but
33150 </para>
33151 <literallayout class="monospaced">
33152 /s=molari/o=babylon/@x400gate.way
33153 </literallayout>
33154 <para>
33155 is treated as an address. For a file name, a transport must be specified using
33156 the <option>file_transport</option> option. However, if the generated path name ends with a
33157 forward slash character, it is interpreted as a directory name rather than a
33158 file name, and <option>directory_transport</option> is used instead.
33159 </para>
33160 <para>
33161 Normally, either the router or the transport specifies a user and a group under
33162 which to run the delivery. The default is to use the Exim user and group.
33163 </para>
33164 <para>
33165 <indexterm role="concept">
33166 <primary><filename>/dev/null</filename></primary>
33167 </indexterm>
33168 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
33169 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
33170 instead of a transport name. In this case the user and group are not used.
33171 </para>
33172 </listitem>
33173 <listitem>
33174 <para>
33175 <indexterm role="concept">
33176 <primary>included address list</primary>
33177 </indexterm>
33178 <indexterm role="concept">
33179 <primary>address redirection</primary>
33180 <secondary>included external list</secondary>
33181 </indexterm>
33182 If an item is of the form
33183 </para>
33184 <literallayout class="monospaced">
33185 :include:&lt;path name&gt;
33186 </literallayout>
33187 <para>
33188 a list of further items is taken from the given file and included at that
33189 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
33190 out-of-line addition to the list. The items in the included list are separated
33191 by commas or newlines and are not subject to expansion. If this is the first
33192 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
33193 the alias name. This example is incorrect:
33194 </para>
33195 <literallayout class="monospaced">
33196 list1    :include:/opt/lists/list1
33197 </literallayout>
33198 <para>
33199 It must be given as
33200 </para>
33201 <literallayout class="monospaced">
33202 list1:   :include:/opt/lists/list1
33203 </literallayout>
33204 </listitem>
33205 <listitem>
33206 <para>
33207 <indexterm role="concept">
33208 <primary>address redirection</primary>
33209 <secondary>to black hole</secondary>
33210 </indexterm>
33211 Sometimes you want to throw away mail to a particular local part. Making the
33212 <option>data</option> option expand to an empty string does not work, because that causes
33213 the router to decline. Instead, the alias item
33214 <indexterm role="concept">
33215 <primary>black hole</primary>
33216 </indexterm>
33217 <indexterm role="concept">
33218 <primary>abandoning mail</primary>
33219 </indexterm>
33220 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
33221 done, and no error message is generated. This has the same effect as specifing
33222 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
33223 </para>
33224 <para>
33225 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
33226 delivery is done for the original local part, even if other redirection items
33227 are present. If you are generating a multi-item list (for example, by reading a
33228 database) and need the ability to provide a no-op item, you must use
33229 <filename>/dev/null</filename>.
33230 </para>
33231 </listitem>
33232 <listitem>
33233 <para>
33234 <indexterm role="concept">
33235 <primary>delivery</primary>
33236 <secondary>forcing failure</secondary>
33237 </indexterm>
33238 <indexterm role="concept">
33239 <primary>delivery</primary>
33240 <secondary>forcing deferral</secondary>
33241 </indexterm>
33242 <indexterm role="concept">
33243 <primary>failing delivery</primary>
33244 <secondary>forcing</secondary>
33245 </indexterm>
33246 <indexterm role="concept">
33247 <primary>deferred delivery, forcing</primary>
33248 </indexterm>
33249 <indexterm role="concept">
33250 <primary>customizing</primary>
33251 <secondary>failure message</secondary>
33252 </indexterm>
33253 An attempt to deliver a particular address can be deferred or forced to fail by
33254 redirection items of the form
33255 </para>
33256 <literallayout class="monospaced">
33257 :defer:
33258 :fail:
33259 </literallayout>
33260 <para>
33261 respectively. When a redirection list contains such an item, it applies to the
33262 entire redirection; any other items in the list are ignored (<emphasis>:blackhole:</emphasis> is
33263 different). Any text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error
33264 text associated with the failure. For example, an alias file might contain:
33265 </para>
33266 <literallayout class="monospaced">
33267 X.Employee:  :fail: Gone away, no forwarding address
33268 </literallayout>
33269 <para>
33270 In the case of an address that is being verified from an ACL or as the subject
33271 of a
33272 <indexterm role="concept">
33273 <primary>VRFY</primary>
33274 <secondary>error text, display of</secondary>
33275 </indexterm>
33276 VRFY command, the text is included in the SMTP error response by
33277 default.
33278 <indexterm role="concept">
33279 <primary>EXPN</primary>
33280 <secondary>error text, display of</secondary>
33281 </indexterm>
33282 The text is not included in the response to an EXPN command. In non-SMTP cases
33283 the text is included in the error message that Exim generates.
33284 </para>
33285 <para>
33286 <indexterm role="concept">
33287 <primary>SMTP</primary>
33288 <secondary>error codes</secondary>
33289 </indexterm>
33290 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
33291 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
33292 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
33293 followed by a space, and the very first digit is the same as the default error
33294 code, the code from the message is used instead. If the very first digit is
33295 incorrect, a panic error is logged, and the default code is used. You can
33296 suppress the use of the supplied code in a redirect router by setting the
33297 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
33298 ignored.
33299 </para>
33300 <para>
33301 <indexterm role="variable">
33302 <primary><varname>$acl_verify_message</varname></primary>
33303 </indexterm>
33304 In an ACL, an explicitly provided message overrides the default, but the
33305 default message is available in the variable <varname>$acl_verify_message</varname> and can
33306 therefore be included in a custom message if this is desired.
33307 </para>
33308 <para>
33309 Normally the error text is the rest of the redirection list &ndash; a comma does
33310 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
33311 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
33312 as part of the continuation process, but they may exist in other kinds of
33313 lookup and in <emphasis>:include:</emphasis> files.
33314 </para>
33315 <para>
33316 During routing for message delivery (as opposed to verification), a redirection
33317 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
33318 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
33319 subsequent delivery attempt can happen at a later time. If an address is
33320 deferred for too long, it will ultimately fail, because the normal retry
33321 rules still apply.
33322 </para>
33323 </listitem>
33324 <listitem>
33325 <para>
33326 <indexterm role="concept">
33327 <primary>alias file</primary>
33328 <secondary>exception to default</secondary>
33329 </indexterm>
33330 Sometimes it is useful to use a single-key search type with a default (see
33331 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
33332 for exceptions to the default. These can be handled by aliasing them to
33333 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
33334 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
33335 results in an empty redirection list has the same effect.
33336 </para>
33337 </listitem>
33338 </itemizedlist>
33339 </section>
33340 <section id="SECTdupaddr">
33341 <title>Duplicate addresses</title>
33342 <para>
33343 <indexterm role="concept">
33344 <primary>duplicate addresses</primary>
33345 </indexterm>
33346 <indexterm role="concept">
33347 <primary>address duplicate, discarding</primary>
33348 </indexterm>
33349 <indexterm role="concept">
33350 <primary>pipe</primary>
33351 <secondary>duplicated</secondary>
33352 </indexterm>
33353 Exim removes duplicate addresses from the list to which it is delivering, so as
33354 to deliver just one copy to each address. This does not apply to deliveries
33355 routed to pipes by different immediate parent addresses, but an indirect
33356 aliasing scheme of the type
33357 </para>
33358 <literallayout class="monospaced">
33359 pipe:       |/some/command $local_part
33360 localpart1: pipe
33361 localpart2: pipe
33362 </literallayout>
33363 <para>
33364 does not work with a message that is addressed to both local parts, because
33365 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
33366 discarded as being the same as a previously handled address. However, a scheme
33367 such as
33368 </para>
33369 <literallayout class="monospaced">
33370 localpart1: |/some/command $local_part
33371 localpart2: |/some/command $local_part
33372 </literallayout>
33373 <para>
33374 does result in two different pipe deliveries, because the immediate parents of
33375 the pipes are distinct.
33376 </para>
33377 </section>
33378 <section id="SECID128">
33379 <title>Repeated redirection expansion</title>
33380 <para>
33381 <indexterm role="concept">
33382 <primary>repeated redirection expansion</primary>
33383 </indexterm>
33384 <indexterm role="concept">
33385 <primary>address redirection</primary>
33386 <secondary>repeated for each delivery attempt</secondary>
33387 </indexterm>
33388 When a message cannot be delivered to all of its recipients immediately,
33389 leading to two or more delivery attempts, redirection expansion is carried out
33390 afresh each time for those addresses whose children were not all previously
33391 delivered. If redirection is being used as a mailing list, this can lead to new
33392 members of the list receiving copies of old messages. The <option>one_time</option> option
33393 can be used to avoid this.
33394 </para>
33395 </section>
33396 <section id="SECID129">
33397 <title>Errors in redirection lists</title>
33398 <para>
33399 <indexterm role="concept">
33400 <primary>address redirection</primary>
33401 <secondary>errors</secondary>
33402 </indexterm>
33403 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
33404 error is skipped, and an entry is written to the main log. This may be useful
33405 for mailing lists that are automatically managed. Otherwise, if an error is
33406 detected while generating the list of new addresses, the original address is
33407 deferred. See also <option>syntax_errors_to</option>.
33408 </para>
33409 </section>
33410 <section id="SECID130">
33411 <title>Private options for the redirect router</title>
33412 <para>
33413 <indexterm role="concept">
33414 <primary>options</primary>
33415 <secondary><command>redirect</command> router</secondary>
33416 </indexterm>
33417 The private options for the <command>redirect</command> router are as follows:
33418 </para>
33419 <para>
33420 <indexterm role="option">
33421 <primary><option>allow_defer</option></primary>
33422 </indexterm>
33423 </para>
33424 <informaltable frame="all">
33425 <tgroup cols="4" colsep="0" rowsep="0">
33426 <colspec colwidth="8*" align="left"/>
33427 <colspec colwidth="6*" align="center"/>
33428 <colspec colwidth="6*" align="center"/>
33429 <colspec colwidth="6*" align="right"/>
33430 <tbody>
33431 <row>
33432 <entry><option>allow_defer</option></entry>
33433 <entry>Use: <emphasis>redirect</emphasis></entry>
33434 <entry>Type: <emphasis>boolean</emphasis></entry>
33435 <entry>Default: <emphasis>false</emphasis></entry>
33436 </row>
33437 </tbody>
33438 </tgroup>
33439 </informaltable>
33440 <para>
33441 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
33442 data, or the <option>defer</option> command in an Exim filter file.
33443 </para>
33444 <para>
33445 <indexterm role="option">
33446 <primary><option>allow_fail</option></primary>
33447 </indexterm>
33448 </para>
33449 <informaltable frame="all">
33450 <tgroup cols="4" colsep="0" rowsep="0">
33451 <colspec colwidth="8*" align="left"/>
33452 <colspec colwidth="6*" align="center"/>
33453 <colspec colwidth="6*" align="center"/>
33454 <colspec colwidth="6*" align="right"/>
33455 <tbody>
33456 <row>
33457 <entry><option>allow_fail</option></entry>
33458 <entry>Use: <emphasis>redirect</emphasis></entry>
33459 <entry>Type: <emphasis>boolean</emphasis></entry>
33460 <entry>Default: <emphasis>false</emphasis></entry>
33461 </row>
33462 </tbody>
33463 </tgroup>
33464 </informaltable>
33465 <para>
33466 <indexterm role="concept">
33467 <primary>failing delivery</primary>
33468 <secondary>from filter</secondary>
33469 </indexterm>
33470 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
33471 and the <option>fail</option> command may be used in an Exim filter file.
33472 </para>
33473 <para>
33474 <indexterm role="option">
33475 <primary><option>allow_filter</option></primary>
33476 </indexterm>
33477 </para>
33478 <informaltable frame="all">
33479 <tgroup cols="4" colsep="0" rowsep="0">
33480 <colspec colwidth="8*" align="left"/>
33481 <colspec colwidth="6*" align="center"/>
33482 <colspec colwidth="6*" align="center"/>
33483 <colspec colwidth="6*" align="right"/>
33484 <tbody>
33485 <row>
33486 <entry><option>allow_filter</option></entry>
33487 <entry>Use: <emphasis>redirect</emphasis></entry>
33488 <entry>Type: <emphasis>boolean</emphasis></entry>
33489 <entry>Default: <emphasis>false</emphasis></entry>
33490 </row>
33491 </tbody>
33492 </tgroup>
33493 </informaltable>
33494 <para>
33495 <indexterm role="concept">
33496 <primary>filter</primary>
33497 <secondary>enabling use of</secondary>
33498 </indexterm>
33499 <indexterm role="concept">
33500 <primary>Sieve filter</primary>
33501 <secondary>enabling use of</secondary>
33502 </indexterm>
33503 Setting this option allows Exim to interpret redirection data that starts with
33504 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
33505 are some features of Exim filter files that some administrators may wish to
33506 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
33507 </para>
33508 <para>
33509 It is also possible to lock out Exim filters or Sieve filters while allowing
33510 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
33511 </para>
33512 <para>
33513 The filter is run using the uid and gid set by the generic <option>user</option> and
33514 <option>group</option> options. These take their defaults from the password data if
33515 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
33516 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
33517 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
33518 </para>
33519 <para>
33520 <indexterm role="option">
33521 <primary><option>allow_freeze</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>allow_freeze</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>freezing messages</primary>
33543 <secondary>allowing in filter</secondary>
33544 </indexterm>
33545 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
33546 This command is more normally encountered in system filters, and is disabled by
33547 default for redirection filters because it isn&#x2019;t something you usually want to
33548 let ordinary users do.
33549 </para>
33550 <para>
33551 <indexterm role="option">
33552 <primary><option>check_ancestor</option></primary>
33553 </indexterm>
33554 </para>
33555 <informaltable frame="all">
33556 <tgroup cols="4" colsep="0" rowsep="0">
33557 <colspec colwidth="8*" align="left"/>
33558 <colspec colwidth="6*" align="center"/>
33559 <colspec colwidth="6*" align="center"/>
33560 <colspec colwidth="6*" align="right"/>
33561 <tbody>
33562 <row>
33563 <entry><option>check_ancestor</option></entry>
33564 <entry>Use: <emphasis>redirect</emphasis></entry>
33565 <entry>Type: <emphasis>boolean</emphasis></entry>
33566 <entry>Default: <emphasis>false</emphasis></entry>
33567 </row>
33568 </tbody>
33569 </tgroup>
33570 </informaltable>
33571 <para>
33572 This option is concerned with handling generated addresses that are the same
33573 as some address in the list of redirection ancestors of the current address.
33574 Although it is turned off by default in the code, it is set in the default
33575 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
33576 for this use of the <command>redirect</command> router.
33577 </para>
33578 <para>
33579 When <option>check_ancestor</option> is set, if a generated address (including the domain)
33580 is the same as any ancestor of the current address, it is replaced by a copy of
33581 the current address. This helps in the case where local part A is aliased to B,
33582 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
33583 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
33584 <filename>&nbsp;jb/.forward</filename> contains:
33585 </para>
33586 <literallayout class="monospaced">
33587 \Joe.Bloggs, &lt;other item(s)&gt;
33588 </literallayout>
33589 <para>
33590 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
33591 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
33592 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
33593 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
33594 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
33595 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
33596 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
33597 original address. See also the <option>repeat_use</option> option below.
33598 </para>
33599 <para>
33600 <indexterm role="option">
33601 <primary><option>check_group</option></primary>
33602 </indexterm>
33603 </para>
33604 <informaltable frame="all">
33605 <tgroup cols="4" colsep="0" rowsep="0">
33606 <colspec colwidth="8*" align="left"/>
33607 <colspec colwidth="6*" align="center"/>
33608 <colspec colwidth="6*" align="center"/>
33609 <colspec colwidth="6*" align="right"/>
33610 <tbody>
33611 <row>
33612 <entry><option>check_group</option></entry>
33613 <entry>Use: <emphasis>redirect</emphasis></entry>
33614 <entry>Type: <emphasis>boolean</emphasis></entry>
33615 <entry>Default: <emphasis>see below</emphasis></entry>
33616 </row>
33617 </tbody>
33618 </tgroup>
33619 </informaltable>
33620 <para>
33621 When the <option>file</option> option is used, the group owner of the file is checked only
33622 when this option is set. The permitted groups are those listed in the
33623 <option>owngroups</option> option, together with the user&#x2019;s default group if
33624 <option>check_local_user</option> is set. If the file has the wrong group, routing is
33625 deferred. The default setting for this option is true if <option>check_local_user</option>
33626 is set and the <option>modemask</option> option permits the group write bit, or if the
33627 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
33628 </para>
33629 <para>
33630 <indexterm role="option">
33631 <primary><option>check_owner</option></primary>
33632 </indexterm>
33633 </para>
33634 <informaltable frame="all">
33635 <tgroup cols="4" colsep="0" rowsep="0">
33636 <colspec colwidth="8*" align="left"/>
33637 <colspec colwidth="6*" align="center"/>
33638 <colspec colwidth="6*" align="center"/>
33639 <colspec colwidth="6*" align="right"/>
33640 <tbody>
33641 <row>
33642 <entry><option>check_owner</option></entry>
33643 <entry>Use: <emphasis>redirect</emphasis></entry>
33644 <entry>Type: <emphasis>boolean</emphasis></entry>
33645 <entry>Default: <emphasis>see below</emphasis></entry>
33646 </row>
33647 </tbody>
33648 </tgroup>
33649 </informaltable>
33650 <para>
33651 When the <option>file</option> option is used, the owner of the file is checked only when
33652 this option is set. If <option>check_local_user</option> is set, the local user is
33653 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
33654 option. The default value for this option is true if <option>check_local_user</option> or
33655 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
33656 </para>
33657 <para>
33658 <indexterm role="option">
33659 <primary><option>data</option></primary>
33660 </indexterm>
33661 </para>
33662 <informaltable frame="all">
33663 <tgroup cols="4" colsep="0" rowsep="0">
33664 <colspec colwidth="8*" align="left"/>
33665 <colspec colwidth="6*" align="center"/>
33666 <colspec colwidth="6*" align="center"/>
33667 <colspec colwidth="6*" align="right"/>
33668 <tbody>
33669 <row>
33670 <entry><option>data</option></entry>
33671 <entry>Use: <emphasis>redirect</emphasis></entry>
33672 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33673 <entry>Default: <emphasis>unset</emphasis></entry>
33674 </row>
33675 </tbody>
33676 </tgroup>
33677 </informaltable>
33678 <para>
33679 This option is mutually exclusive with <option>file</option>. One or other of them must be
33680 set, but not both. The contents of <option>data</option> are expanded, and then used as the
33681 list of forwarding items, or as a set of filtering instructions. If the
33682 expansion is forced to fail, or the result is an empty string or a string that
33683 has no effect (consists entirely of comments), the router declines.
33684 </para>
33685 <para>
33686 When filtering instructions are used, the string must begin with <quote>#Exim
33687 filter</quote>, and all comments in the string, including this initial one, must be
33688 terminated with newline characters. For example:
33689 </para>
33690 <literallayout class="monospaced">
33691 data = #Exim filter\n\
33692        if $h_to: contains Exim then save $home/mail/exim endif
33693 </literallayout>
33694 <para>
33695 If you are reading the data from a database where newlines cannot be included,
33696 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
33697 choice into a newline.
33698 </para>
33699 <para>
33700 <indexterm role="option">
33701 <primary><option>directory_transport</option></primary>
33702 </indexterm>
33703 </para>
33704 <informaltable frame="all">
33705 <tgroup cols="4" colsep="0" rowsep="0">
33706 <colspec colwidth="8*" align="left"/>
33707 <colspec colwidth="6*" align="center"/>
33708 <colspec colwidth="6*" align="center"/>
33709 <colspec colwidth="6*" align="right"/>
33710 <tbody>
33711 <row>
33712 <entry><option>directory_transport</option></entry>
33713 <entry>Use: <emphasis>redirect</emphasis></entry>
33714 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33715 <entry>Default: <emphasis>unset</emphasis></entry>
33716 </row>
33717 </tbody>
33718 </tgroup>
33719 </informaltable>
33720 <para>
33721 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
33722 ending with a slash is specified as a new <quote>address</quote>. The transport used is
33723 specified by this option, which, after expansion, must be the name of a
33724 configured transport. This should normally be an <command>appendfile</command> transport.
33725 </para>
33726 <para>
33727 <indexterm role="option">
33728 <primary><option>file</option></primary>
33729 </indexterm>
33730 </para>
33731 <informaltable frame="all">
33732 <tgroup cols="4" colsep="0" rowsep="0">
33733 <colspec colwidth="8*" align="left"/>
33734 <colspec colwidth="6*" align="center"/>
33735 <colspec colwidth="6*" align="center"/>
33736 <colspec colwidth="6*" align="right"/>
33737 <tbody>
33738 <row>
33739 <entry><option>file</option></entry>
33740 <entry>Use: <emphasis>redirect</emphasis></entry>
33741 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33742 <entry>Default: <emphasis>unset</emphasis></entry>
33743 </row>
33744 </tbody>
33745 </tgroup>
33746 </informaltable>
33747 <para>
33748 This option specifies the name of a file that contains the redirection data. It
33749 is mutually exclusive with the <option>data</option> option. The string is expanded before
33750 use; if the expansion is forced to fail, the router declines. Other expansion
33751 failures cause delivery to be deferred. The result of a successful expansion
33752 must be an absolute path. The entire file is read and used as the redirection
33753 data. If the data is an empty string or a string that has no effect (consists
33754 entirely of comments), the router declines.
33755 </para>
33756 <para>
33757 <indexterm role="concept">
33758 <primary>NFS</primary>
33759 <secondary>checking for file existence</secondary>
33760 </indexterm>
33761 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
33762 runs a check on the containing directory,
33763 unless <option>ignore_enotdir</option> is true (see below).
33764 If the directory does not appear to exist, delivery is deferred. This can
33765 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
33766 is a mount problem. If the containing directory does exist, but the file does
33767 not, the router declines.
33768 </para>
33769 <para>
33770 <indexterm role="option">
33771 <primary><option>file_transport</option></primary>
33772 </indexterm>
33773 </para>
33774 <informaltable frame="all">
33775 <tgroup cols="4" colsep="0" rowsep="0">
33776 <colspec colwidth="8*" align="left"/>
33777 <colspec colwidth="6*" align="center"/>
33778 <colspec colwidth="6*" align="center"/>
33779 <colspec colwidth="6*" align="right"/>
33780 <tbody>
33781 <row>
33782 <entry><option>file_transport</option></entry>
33783 <entry>Use: <emphasis>redirect</emphasis></entry>
33784 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33785 <entry>Default: <emphasis>unset</emphasis></entry>
33786 </row>
33787 </tbody>
33788 </tgroup>
33789 </informaltable>
33790 <para>
33791 <indexterm role="variable">
33792 <primary><varname>$address_file</varname></primary>
33793 </indexterm>
33794 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
33795 ending in a slash is specified as a new <quote>address</quote>. The transport used is
33796 specified by this option, which, after expansion, must be the name of a
33797 configured transport. This should normally be an <command>appendfile</command> transport. When
33798 it is running, the file name is in <varname>$address_file</varname>.
33799 </para>
33800 <para>
33801 <indexterm role="option">
33802 <primary><option>filter_prepend_home</option></primary>
33803 </indexterm>
33804 </para>
33805 <informaltable frame="all">
33806 <tgroup cols="4" colsep="0" rowsep="0">
33807 <colspec colwidth="8*" align="left"/>
33808 <colspec colwidth="6*" align="center"/>
33809 <colspec colwidth="6*" align="center"/>
33810 <colspec colwidth="6*" align="right"/>
33811 <tbody>
33812 <row>
33813 <entry><option>filter_prepend_home</option></entry>
33814 <entry>Use: <emphasis>redirect</emphasis></entry>
33815 <entry>Type: <emphasis>boolean</emphasis></entry>
33816 <entry>Default: <emphasis>true</emphasis></entry>
33817 </row>
33818 </tbody>
33819 </tgroup>
33820 </informaltable>
33821 <para>
33822 When this option is true, if a <command>save</command> command in an Exim filter specifies a
33823 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
33824 relative path. If this option is set false, this action does not happen. The
33825 relative path is then passed to the transport unmodified.
33826 </para>
33827 <para>
33828 <indexterm role="option">
33829 <primary><option>forbid_blackhole</option></primary>
33830 </indexterm>
33831 </para>
33832 <informaltable frame="all">
33833 <tgroup cols="4" colsep="0" rowsep="0">
33834 <colspec colwidth="8*" align="left"/>
33835 <colspec colwidth="6*" align="center"/>
33836 <colspec colwidth="6*" align="center"/>
33837 <colspec colwidth="6*" align="right"/>
33838 <tbody>
33839 <row>
33840 <entry><option>forbid_blackhole</option></entry>
33841 <entry>Use: <emphasis>redirect</emphasis></entry>
33842 <entry>Type: <emphasis>boolean</emphasis></entry>
33843 <entry>Default: <emphasis>false</emphasis></entry>
33844 </row>
33845 </tbody>
33846 </tgroup>
33847 </informaltable>
33848 <para>
33849 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
33850 redirection list.
33851 </para>
33852 <para>
33853 <indexterm role="option">
33854 <primary><option>forbid_exim_filter</option></primary>
33855 </indexterm>
33856 </para>
33857 <informaltable frame="all">
33858 <tgroup cols="4" colsep="0" rowsep="0">
33859 <colspec colwidth="8*" align="left"/>
33860 <colspec colwidth="6*" align="center"/>
33861 <colspec colwidth="6*" align="center"/>
33862 <colspec colwidth="6*" align="right"/>
33863 <tbody>
33864 <row>
33865 <entry><option>forbid_exim_filter</option></entry>
33866 <entry>Use: <emphasis>redirect</emphasis></entry>
33867 <entry>Type: <emphasis>boolean</emphasis></entry>
33868 <entry>Default: <emphasis>false</emphasis></entry>
33869 </row>
33870 </tbody>
33871 </tgroup>
33872 </informaltable>
33873 <para>
33874 If this option is set true, only Sieve filters are permitted when
33875 <option>allow_filter</option> is true.
33876 </para>
33877 <para>
33878 <indexterm role="option">
33879 <primary><option>forbid_file</option></primary>
33880 </indexterm>
33881 </para>
33882 <informaltable frame="all">
33883 <tgroup cols="4" colsep="0" rowsep="0">
33884 <colspec colwidth="8*" align="left"/>
33885 <colspec colwidth="6*" align="center"/>
33886 <colspec colwidth="6*" align="center"/>
33887 <colspec colwidth="6*" align="right"/>
33888 <tbody>
33889 <row>
33890 <entry><option>forbid_file</option></entry>
33891 <entry>Use: <emphasis>redirect</emphasis></entry>
33892 <entry>Type: <emphasis>boolean</emphasis></entry>
33893 <entry>Default: <emphasis>false</emphasis></entry>
33894 </row>
33895 </tbody>
33896 </tgroup>
33897 </informaltable>
33898 <para>
33899 <indexterm role="concept">
33900 <primary>delivery</primary>
33901 <secondary>to file; forbidding</secondary>
33902 </indexterm>
33903 <indexterm role="concept">
33904 <primary>Sieve filter</primary>
33905 <secondary>forbidding delivery to a file</secondary>
33906 </indexterm>
33907 <indexterm role="concept">
33908 <primary>Sieve filter</primary>
33909 <secondary><quote>keep</quote> facility; disabling</secondary>
33910 </indexterm>
33911 If this option is true, this router may not generate a new address that
33912 specifies delivery to a local file or directory, either from a filter or from a
33913 conventional forward file. This option is forced to be true if <option>one_time</option> is
33914 set. It applies to Sieve filters as well as to Exim filters, but if true, it
33915 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
33916 </para>
33917 <para>
33918 <indexterm role="option">
33919 <primary><option>forbid_filter_dlfunc</option></primary>
33920 </indexterm>
33921 </para>
33922 <informaltable frame="all">
33923 <tgroup cols="4" colsep="0" rowsep="0">
33924 <colspec colwidth="8*" align="left"/>
33925 <colspec colwidth="6*" align="center"/>
33926 <colspec colwidth="6*" align="center"/>
33927 <colspec colwidth="6*" align="right"/>
33928 <tbody>
33929 <row>
33930 <entry><option>forbid_filter_dlfunc</option></entry>
33931 <entry>Use: <emphasis>redirect</emphasis></entry>
33932 <entry>Type: <emphasis>boolean</emphasis></entry>
33933 <entry>Default: <emphasis>false</emphasis></entry>
33934 </row>
33935 </tbody>
33936 </tgroup>
33937 </informaltable>
33938 <para>
33939 <indexterm role="concept">
33940 <primary>filter</primary>
33941 <secondary>locking out certain features</secondary>
33942 </indexterm>
33943 If this option is true, string expansions in Exim filters are not allowed to
33944 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
33945 functions.
33946 </para>
33947 <para>
33948 <indexterm role="option">
33949 <primary><option>forbid_filter_existstest</option></primary>
33950 </indexterm>
33951 </para>
33952 <informaltable frame="all">
33953 <tgroup cols="4" colsep="0" rowsep="0">
33954 <colspec colwidth="8*" align="left"/>
33955 <colspec colwidth="6*" align="center"/>
33956 <colspec colwidth="6*" align="center"/>
33957 <colspec colwidth="6*" align="right"/>
33958 <tbody>
33959 <row>
33960 <entry><option>forbid_filter_existstest</option></entry>
33961 <entry>Use: <emphasis>redirect</emphasis></entry>
33962 <entry>Type: <emphasis>boolean</emphasis></entry>
33963 <entry>Default: <emphasis>false</emphasis></entry>
33964 </row>
33965 </tbody>
33966 </tgroup>
33967 </informaltable>
33968 <para>
33969 <indexterm role="concept">
33970 <primary>expansion</primary>
33971 <secondary>statting a file</secondary>
33972 </indexterm>
33973 If this option is true, string expansions in Exim filters are not allowed to
33974 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
33975 </para>
33976 <para>
33977 <indexterm role="option">
33978 <primary><option>forbid_filter_logwrite</option></primary>
33979 </indexterm>
33980 </para>
33981 <informaltable frame="all">
33982 <tgroup cols="4" colsep="0" rowsep="0">
33983 <colspec colwidth="8*" align="left"/>
33984 <colspec colwidth="6*" align="center"/>
33985 <colspec colwidth="6*" align="center"/>
33986 <colspec colwidth="6*" align="right"/>
33987 <tbody>
33988 <row>
33989 <entry><option>forbid_filter_logwrite</option></entry>
33990 <entry>Use: <emphasis>redirect</emphasis></entry>
33991 <entry>Type: <emphasis>boolean</emphasis></entry>
33992 <entry>Default: <emphasis>false</emphasis></entry>
33993 </row>
33994 </tbody>
33995 </tgroup>
33996 </informaltable>
33997 <para>
33998 If this option is true, use of the logging facility in Exim filters is not
33999 permitted. Logging is in any case available only if the filter is being run
34000 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
34001 <filename>.forward</filename> files).
34002 </para>
34003 <para>
34004 <indexterm role="option">
34005 <primary><option>forbid_filter_lookup</option></primary>
34006 </indexterm>
34007 </para>
34008 <informaltable frame="all">
34009 <tgroup cols="4" colsep="0" rowsep="0">
34010 <colspec colwidth="8*" align="left"/>
34011 <colspec colwidth="6*" align="center"/>
34012 <colspec colwidth="6*" align="center"/>
34013 <colspec colwidth="6*" align="right"/>
34014 <tbody>
34015 <row>
34016 <entry><option>forbid_filter_lookup</option></entry>
34017 <entry>Use: <emphasis>redirect</emphasis></entry>
34018 <entry>Type: <emphasis>boolean</emphasis></entry>
34019 <entry>Default: <emphasis>false</emphasis></entry>
34020 </row>
34021 </tbody>
34022 </tgroup>
34023 </informaltable>
34024 <para>
34025 If this option is true, string expansions in Exim filter files are not allowed
34026 to make use of <option>lookup</option> items.
34027 </para>
34028 <para>
34029 <indexterm role="option">
34030 <primary><option>forbid_filter_perl</option></primary>
34031 </indexterm>
34032 </para>
34033 <informaltable frame="all">
34034 <tgroup cols="4" colsep="0" rowsep="0">
34035 <colspec colwidth="8*" align="left"/>
34036 <colspec colwidth="6*" align="center"/>
34037 <colspec colwidth="6*" align="center"/>
34038 <colspec colwidth="6*" align="right"/>
34039 <tbody>
34040 <row>
34041 <entry><option>forbid_filter_perl</option></entry>
34042 <entry>Use: <emphasis>redirect</emphasis></entry>
34043 <entry>Type: <emphasis>boolean</emphasis></entry>
34044 <entry>Default: <emphasis>false</emphasis></entry>
34045 </row>
34046 </tbody>
34047 </tgroup>
34048 </informaltable>
34049 <para>
34050 This option has an effect only if Exim is built with embedded Perl support. If
34051 it is true, string expansions in Exim filter files are not allowed to make use
34052 of the embedded Perl support.
34053 </para>
34054 <para>
34055 <indexterm role="option">
34056 <primary><option>forbid_filter_readfile</option></primary>
34057 </indexterm>
34058 </para>
34059 <informaltable frame="all">
34060 <tgroup cols="4" colsep="0" rowsep="0">
34061 <colspec colwidth="8*" align="left"/>
34062 <colspec colwidth="6*" align="center"/>
34063 <colspec colwidth="6*" align="center"/>
34064 <colspec colwidth="6*" align="right"/>
34065 <tbody>
34066 <row>
34067 <entry><option>forbid_filter_readfile</option></entry>
34068 <entry>Use: <emphasis>redirect</emphasis></entry>
34069 <entry>Type: <emphasis>boolean</emphasis></entry>
34070 <entry>Default: <emphasis>false</emphasis></entry>
34071 </row>
34072 </tbody>
34073 </tgroup>
34074 </informaltable>
34075 <para>
34076 If this option is true, string expansions in Exim filter files are not allowed
34077 to make use of <option>readfile</option> items.
34078 </para>
34079 <para>
34080 <indexterm role="option">
34081 <primary><option>forbid_filter_readsocket</option></primary>
34082 </indexterm>
34083 </para>
34084 <informaltable frame="all">
34085 <tgroup cols="4" colsep="0" rowsep="0">
34086 <colspec colwidth="8*" align="left"/>
34087 <colspec colwidth="6*" align="center"/>
34088 <colspec colwidth="6*" align="center"/>
34089 <colspec colwidth="6*" align="right"/>
34090 <tbody>
34091 <row>
34092 <entry><option>forbid_filter_readsocket</option></entry>
34093 <entry>Use: <emphasis>redirect</emphasis></entry>
34094 <entry>Type: <emphasis>boolean</emphasis></entry>
34095 <entry>Default: <emphasis>false</emphasis></entry>
34096 </row>
34097 </tbody>
34098 </tgroup>
34099 </informaltable>
34100 <para>
34101 If this option is true, string expansions in Exim filter files are not allowed
34102 to make use of <option>readsocket</option> items.
34103 </para>
34104 <para>
34105 <indexterm role="option">
34106 <primary><option>forbid_filter_reply</option></primary>
34107 </indexterm>
34108 </para>
34109 <informaltable frame="all">
34110 <tgroup cols="4" colsep="0" rowsep="0">
34111 <colspec colwidth="8*" align="left"/>
34112 <colspec colwidth="6*" align="center"/>
34113 <colspec colwidth="6*" align="center"/>
34114 <colspec colwidth="6*" align="right"/>
34115 <tbody>
34116 <row>
34117 <entry><option>forbid_filter_reply</option></entry>
34118 <entry>Use: <emphasis>redirect</emphasis></entry>
34119 <entry>Type: <emphasis>boolean</emphasis></entry>
34120 <entry>Default: <emphasis>false</emphasis></entry>
34121 </row>
34122 </tbody>
34123 </tgroup>
34124 </informaltable>
34125 <para>
34126 If this option is true, this router may not generate an automatic reply
34127 message. Automatic replies can be generated only from Exim or Sieve filter
34128 files, not from traditional forward files. This option is forced to be true if
34129 <option>one_time</option> is set.
34130 </para>
34131 <para>
34132 <indexterm role="option">
34133 <primary><option>forbid_filter_run</option></primary>
34134 </indexterm>
34135 </para>
34136 <informaltable frame="all">
34137 <tgroup cols="4" colsep="0" rowsep="0">
34138 <colspec colwidth="8*" align="left"/>
34139 <colspec colwidth="6*" align="center"/>
34140 <colspec colwidth="6*" align="center"/>
34141 <colspec colwidth="6*" align="right"/>
34142 <tbody>
34143 <row>
34144 <entry><option>forbid_filter_run</option></entry>
34145 <entry>Use: <emphasis>redirect</emphasis></entry>
34146 <entry>Type: <emphasis>boolean</emphasis></entry>
34147 <entry>Default: <emphasis>false</emphasis></entry>
34148 </row>
34149 </tbody>
34150 </tgroup>
34151 </informaltable>
34152 <para>
34153 If this option is true, string expansions in Exim filter files are not allowed
34154 to make use of <option>run</option> items.
34155 </para>
34156 <para>
34157 <indexterm role="option">
34158 <primary><option>forbid_include</option></primary>
34159 </indexterm>
34160 </para>
34161 <informaltable frame="all">
34162 <tgroup cols="4" colsep="0" rowsep="0">
34163 <colspec colwidth="8*" align="left"/>
34164 <colspec colwidth="6*" align="center"/>
34165 <colspec colwidth="6*" align="center"/>
34166 <colspec colwidth="6*" align="right"/>
34167 <tbody>
34168 <row>
34169 <entry><option>forbid_include</option></entry>
34170 <entry>Use: <emphasis>redirect</emphasis></entry>
34171 <entry>Type: <emphasis>boolean</emphasis></entry>
34172 <entry>Default: <emphasis>false</emphasis></entry>
34173 </row>
34174 </tbody>
34175 </tgroup>
34176 </informaltable>
34177 <para>
34178 If this option is true, items of the form
34179 </para>
34180 <literallayout class="monospaced">
34181 :include:&lt;path name&gt;
34182 </literallayout>
34183 <para>
34184 are not permitted in non-filter redirection lists.
34185 </para>
34186 <para>
34187 <indexterm role="option">
34188 <primary><option>forbid_pipe</option></primary>
34189 </indexterm>
34190 </para>
34191 <informaltable frame="all">
34192 <tgroup cols="4" colsep="0" rowsep="0">
34193 <colspec colwidth="8*" align="left"/>
34194 <colspec colwidth="6*" align="center"/>
34195 <colspec colwidth="6*" align="center"/>
34196 <colspec colwidth="6*" align="right"/>
34197 <tbody>
34198 <row>
34199 <entry><option>forbid_pipe</option></entry>
34200 <entry>Use: <emphasis>redirect</emphasis></entry>
34201 <entry>Type: <emphasis>boolean</emphasis></entry>
34202 <entry>Default: <emphasis>false</emphasis></entry>
34203 </row>
34204 </tbody>
34205 </tgroup>
34206 </informaltable>
34207 <para>
34208 <indexterm role="concept">
34209 <primary>delivery</primary>
34210 <secondary>to pipe; forbidding</secondary>
34211 </indexterm>
34212 If this option is true, this router may not generate a new address which
34213 specifies delivery to a pipe, either from an Exim filter or from a conventional
34214 forward file. This option is forced to be true if <option>one_time</option> is set.
34215 </para>
34216 <para>
34217 <indexterm role="option">
34218 <primary><option>forbid_sieve_filter</option></primary>
34219 </indexterm>
34220 </para>
34221 <informaltable frame="all">
34222 <tgroup cols="4" colsep="0" rowsep="0">
34223 <colspec colwidth="8*" align="left"/>
34224 <colspec colwidth="6*" align="center"/>
34225 <colspec colwidth="6*" align="center"/>
34226 <colspec colwidth="6*" align="right"/>
34227 <tbody>
34228 <row>
34229 <entry><option>forbid_sieve_filter</option></entry>
34230 <entry>Use: <emphasis>redirect</emphasis></entry>
34231 <entry>Type: <emphasis>boolean</emphasis></entry>
34232 <entry>Default: <emphasis>false</emphasis></entry>
34233 </row>
34234 </tbody>
34235 </tgroup>
34236 </informaltable>
34237 <para>
34238 If this option is set true, only Exim filters are permitted when
34239 <option>allow_filter</option> is true.
34240 </para>
34241 <para>
34242 <indexterm role="concept">
34243 <primary>SMTP</primary>
34244 <secondary>error codes</secondary>
34245 </indexterm>
34246 <indexterm role="option">
34247 <primary><option>forbid_smtp_code</option></primary>
34248 </indexterm>
34249 </para>
34250 <informaltable frame="all">
34251 <tgroup cols="4" colsep="0" rowsep="0">
34252 <colspec colwidth="8*" align="left"/>
34253 <colspec colwidth="6*" align="center"/>
34254 <colspec colwidth="6*" align="center"/>
34255 <colspec colwidth="6*" align="right"/>
34256 <tbody>
34257 <row>
34258 <entry><option>forbid_smtp_code</option></entry>
34259 <entry>Use: <emphasis>redirect</emphasis></entry>
34260 <entry>Type: <emphasis>boolean</emphasis></entry>
34261 <entry>Default: <emphasis>false</emphasis></entry>
34262 </row>
34263 </tbody>
34264 </tgroup>
34265 </informaltable>
34266 <para>
34267 If this option is set true, any SMTP error codes that are present at the start
34268 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
34269 the default codes (451 and 550, respectively) are always used.
34270 </para>
34271 <para>
34272 <indexterm role="option">
34273 <primary><option>hide_child_in_errmsg</option></primary>
34274 </indexterm>
34275 </para>
34276 <informaltable frame="all">
34277 <tgroup cols="4" colsep="0" rowsep="0">
34278 <colspec colwidth="8*" align="left"/>
34279 <colspec colwidth="6*" align="center"/>
34280 <colspec colwidth="6*" align="center"/>
34281 <colspec colwidth="6*" align="right"/>
34282 <tbody>
34283 <row>
34284 <entry><option>hide_child_in_errmsg</option></entry>
34285 <entry>Use: <emphasis>redirect</emphasis></entry>
34286 <entry>Type: <emphasis>boolean</emphasis></entry>
34287 <entry>Default: <emphasis>false</emphasis></entry>
34288 </row>
34289 </tbody>
34290 </tgroup>
34291 </informaltable>
34292 <para>
34293 <indexterm role="concept">
34294 <primary>bounce message</primary>
34295 <secondary>redirection details; suppressing</secondary>
34296 </indexterm>
34297 If this option is true, it prevents Exim from quoting a child address if it
34298 generates a bounce or delay message for it. Instead it says <quote>an address
34299 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
34300 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
34301 bounce may well quote the generated address.
34302 </para>
34303 <para>
34304 <indexterm role="option">
34305 <primary><option>ignore_eacces</option></primary>
34306 </indexterm>
34307 </para>
34308 <informaltable frame="all">
34309 <tgroup cols="4" colsep="0" rowsep="0">
34310 <colspec colwidth="8*" align="left"/>
34311 <colspec colwidth="6*" align="center"/>
34312 <colspec colwidth="6*" align="center"/>
34313 <colspec colwidth="6*" align="right"/>
34314 <tbody>
34315 <row>
34316 <entry><option>ignore_eacces</option></entry>
34317 <entry>Use: <emphasis>redirect</emphasis></entry>
34318 <entry>Type: <emphasis>boolean</emphasis></entry>
34319 <entry>Default: <emphasis>false</emphasis></entry>
34320 </row>
34321 </tbody>
34322 </tgroup>
34323 </informaltable>
34324 <para>
34325 <indexterm role="concept">
34326 <primary>EACCES</primary>
34327 </indexterm>
34328 If this option is set and an attempt to open a redirection file yields the
34329 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
34330 file did not exist.
34331 </para>
34332 <para>
34333 <indexterm role="option">
34334 <primary><option>ignore_enotdir</option></primary>
34335 </indexterm>
34336 </para>
34337 <informaltable frame="all">
34338 <tgroup cols="4" colsep="0" rowsep="0">
34339 <colspec colwidth="8*" align="left"/>
34340 <colspec colwidth="6*" align="center"/>
34341 <colspec colwidth="6*" align="center"/>
34342 <colspec colwidth="6*" align="right"/>
34343 <tbody>
34344 <row>
34345 <entry><option>ignore_enotdir</option></entry>
34346 <entry>Use: <emphasis>redirect</emphasis></entry>
34347 <entry>Type: <emphasis>boolean</emphasis></entry>
34348 <entry>Default: <emphasis>false</emphasis></entry>
34349 </row>
34350 </tbody>
34351 </tgroup>
34352 </informaltable>
34353 <para>
34354 <indexterm role="concept">
34355 <primary>ENOTDIR</primary>
34356 </indexterm>
34357 If this option is set and an attempt to open a redirection file yields the
34358 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
34359 router behaves as if the file did not exist.
34360 </para>
34361 <para>
34362 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
34363 router that has the <option>file</option> option set discovers that the file does not exist
34364 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
34365 against unmounted NFS directories. If the parent can not be statted, delivery
34366 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
34367 is set, because that option tells Exim to ignore <quote>something on the path is not
34368 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
34369 that some operating systems give ENOENT where others give ENOTDIR.
34370 </para>
34371 <para>
34372 <indexterm role="option">
34373 <primary><option>include_directory</option></primary>
34374 </indexterm>
34375 </para>
34376 <informaltable frame="all">
34377 <tgroup cols="4" colsep="0" rowsep="0">
34378 <colspec colwidth="8*" align="left"/>
34379 <colspec colwidth="6*" align="center"/>
34380 <colspec colwidth="6*" align="center"/>
34381 <colspec colwidth="6*" align="right"/>
34382 <tbody>
34383 <row>
34384 <entry><option>include_directory</option></entry>
34385 <entry>Use: <emphasis>redirect</emphasis></entry>
34386 <entry>Type: <emphasis>string</emphasis></entry>
34387 <entry>Default: <emphasis>unset</emphasis></entry>
34388 </row>
34389 </tbody>
34390 </tgroup>
34391 </informaltable>
34392 <para>
34393 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
34394 redirection list must start with this directory.
34395 </para>
34396 <para>
34397 <indexterm role="option">
34398 <primary><option>modemask</option></primary>
34399 </indexterm>
34400 </para>
34401 <informaltable frame="all">
34402 <tgroup cols="4" colsep="0" rowsep="0">
34403 <colspec colwidth="8*" align="left"/>
34404 <colspec colwidth="6*" align="center"/>
34405 <colspec colwidth="6*" align="center"/>
34406 <colspec colwidth="6*" align="right"/>
34407 <tbody>
34408 <row>
34409 <entry><option>modemask</option></entry>
34410 <entry>Use: <emphasis>redirect</emphasis></entry>
34411 <entry>Type: <emphasis>octal integer</emphasis></entry>
34412 <entry>Default: <emphasis>022</emphasis></entry>
34413 </row>
34414 </tbody>
34415 </tgroup>
34416 </informaltable>
34417 <para>
34418 This specifies mode bits which must not be set for a file specified by the
34419 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
34420 </para>
34421 <para>
34422 <indexterm role="option">
34423 <primary><option>one_time</option></primary>
34424 </indexterm>
34425 </para>
34426 <informaltable frame="all">
34427 <tgroup cols="4" colsep="0" rowsep="0">
34428 <colspec colwidth="8*" align="left"/>
34429 <colspec colwidth="6*" align="center"/>
34430 <colspec colwidth="6*" align="center"/>
34431 <colspec colwidth="6*" align="right"/>
34432 <tbody>
34433 <row>
34434 <entry><option>one_time</option></entry>
34435 <entry>Use: <emphasis>redirect</emphasis></entry>
34436 <entry>Type: <emphasis>boolean</emphasis></entry>
34437 <entry>Default: <emphasis>false</emphasis></entry>
34438 </row>
34439 </tbody>
34440 </tgroup>
34441 </informaltable>
34442 <para>
34443 <indexterm role="concept">
34444 <primary>one-time aliasing/forwarding expansion</primary>
34445 </indexterm>
34446 <indexterm role="concept">
34447 <primary>alias file</primary>
34448 <secondary>one-time expansion</secondary>
34449 </indexterm>
34450 <indexterm role="concept">
34451 <primary>forward file</primary>
34452 <secondary>one-time expansion</secondary>
34453 </indexterm>
34454 <indexterm role="concept">
34455 <primary>mailing lists</primary>
34456 <secondary>one-time expansion</secondary>
34457 </indexterm>
34458 <indexterm role="concept">
34459 <primary>address redirection</primary>
34460 <secondary>one-time expansion</secondary>
34461 </indexterm>
34462 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
34463 files each time it tries to deliver a message causes a problem when one or more
34464 of the generated addresses fails be delivered at the first attempt. The problem
34465 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
34466 but of what happens when the redirection list changes during the time that the
34467 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
34468 lists, where new subscribers might receive copies of messages that were posted
34469 before they subscribed.
34470 </para>
34471 <para>
34472 If <option>one_time</option> is set and any addresses generated by the router fail to
34473 deliver at the first attempt, the failing addresses are added to the message as
34474 <quote>top level</quote> addresses, and the parent address that generated them is marked
34475 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
34476 attempt.
34477 </para>
34478 <para>
34479 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
34480 router would be lost if delivery did not succeed at the first attempt. For this
34481 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
34482 permitted when <option>one_time</option> is set.
34483 </para>
34484 <para>
34485 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
34486 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
34487 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
34488 </para>
34489 <para>
34490 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
34491 <option>one_time</option>.
34492 </para>
34493 <para>
34494 The original top-level address is remembered with each of the generated
34495 addresses, and is output in any log messages. However, any intermediate parent
34496 addresses are not recorded. This makes a difference to the log only if
34497 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
34498 typically be used for mailing lists, where there is normally just one level of
34499 expansion.
34500 </para>
34501 <para>
34502 <indexterm role="option">
34503 <primary><option>owners</option></primary>
34504 </indexterm>
34505 </para>
34506 <informaltable frame="all">
34507 <tgroup cols="4" colsep="0" rowsep="0">
34508 <colspec colwidth="8*" align="left"/>
34509 <colspec colwidth="6*" align="center"/>
34510 <colspec colwidth="6*" align="center"/>
34511 <colspec colwidth="6*" align="right"/>
34512 <tbody>
34513 <row>
34514 <entry><option>owners</option></entry>
34515 <entry>Use: <emphasis>redirect</emphasis></entry>
34516 <entry>Type: <emphasis>string list</emphasis></entry>
34517 <entry>Default: <emphasis>unset</emphasis></entry>
34518 </row>
34519 </tbody>
34520 </tgroup>
34521 </informaltable>
34522 <para>
34523 <indexterm role="concept">
34524 <primary>ownership</primary>
34525 <secondary>alias file</secondary>
34526 </indexterm>
34527 <indexterm role="concept">
34528 <primary>ownership</primary>
34529 <secondary>forward file</secondary>
34530 </indexterm>
34531 <indexterm role="concept">
34532 <primary>alias file</primary>
34533 <secondary>ownership</secondary>
34534 </indexterm>
34535 <indexterm role="concept">
34536 <primary>forward file</primary>
34537 <secondary>ownership</secondary>
34538 </indexterm>
34539 This specifies a list of permitted owners for the file specified by <option>file</option>.
34540 This list is in addition to the local user when <option>check_local_user</option> is set.
34541 See <option>check_owner</option> above.
34542 </para>
34543 <para>
34544 <indexterm role="option">
34545 <primary><option>owngroups</option></primary>
34546 </indexterm>
34547 </para>
34548 <informaltable frame="all">
34549 <tgroup cols="4" colsep="0" rowsep="0">
34550 <colspec colwidth="8*" align="left"/>
34551 <colspec colwidth="6*" align="center"/>
34552 <colspec colwidth="6*" align="center"/>
34553 <colspec colwidth="6*" align="right"/>
34554 <tbody>
34555 <row>
34556 <entry><option>owngroups</option></entry>
34557 <entry>Use: <emphasis>redirect</emphasis></entry>
34558 <entry>Type: <emphasis>string list</emphasis></entry>
34559 <entry>Default: <emphasis>unset</emphasis></entry>
34560 </row>
34561 </tbody>
34562 </tgroup>
34563 </informaltable>
34564 <para>
34565 This specifies a list of permitted groups for the file specified by <option>file</option>.
34566 The list is in addition to the local user&#x2019;s primary group when
34567 <option>check_local_user</option> is set. See <option>check_group</option> above.
34568 </para>
34569 <para>
34570 <indexterm role="option">
34571 <primary><option>pipe_transport</option></primary>
34572 </indexterm>
34573 </para>
34574 <informaltable frame="all">
34575 <tgroup cols="4" colsep="0" rowsep="0">
34576 <colspec colwidth="8*" align="left"/>
34577 <colspec colwidth="6*" align="center"/>
34578 <colspec colwidth="6*" align="center"/>
34579 <colspec colwidth="6*" align="right"/>
34580 <tbody>
34581 <row>
34582 <entry><option>pipe_transport</option></entry>
34583 <entry>Use: <emphasis>redirect</emphasis></entry>
34584 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34585 <entry>Default: <emphasis>unset</emphasis></entry>
34586 </row>
34587 </tbody>
34588 </tgroup>
34589 </informaltable>
34590 <para>
34591 <indexterm role="variable">
34592 <primary><varname>$address_pipe</varname></primary>
34593 </indexterm>
34594 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
34595 starting with a vertical bar character is specified as a new <quote>address</quote>. The
34596 transport used is specified by this option, which, after expansion, must be the
34597 name of a configured transport. This should normally be a <command>pipe</command> transport.
34598 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
34599 </para>
34600 <para>
34601 <indexterm role="option">
34602 <primary><option>qualify_domain</option></primary>
34603 </indexterm>
34604 </para>
34605 <informaltable frame="all">
34606 <tgroup cols="4" colsep="0" rowsep="0">
34607 <colspec colwidth="8*" align="left"/>
34608 <colspec colwidth="6*" align="center"/>
34609 <colspec colwidth="6*" align="center"/>
34610 <colspec colwidth="6*" align="right"/>
34611 <tbody>
34612 <row>
34613 <entry><option>qualify_domain</option></entry>
34614 <entry>Use: <emphasis>redirect</emphasis></entry>
34615 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34616 <entry>Default: <emphasis>unset</emphasis></entry>
34617 </row>
34618 </tbody>
34619 </tgroup>
34620 </informaltable>
34621 <para>
34622 <indexterm role="variable">
34623 <primary><varname>$qualify_recipient</varname></primary>
34624 </indexterm>
34625 If this option is set, and an unqualified address (one without a domain) is
34626 generated, and that address would normally be qualified by the global setting
34627 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
34628 expanding this string. If the expansion fails, the router declines. If you want
34629 to revert to the default, you can have the expansion generate
34630 <varname>$qualify_recipient</varname>.
34631 </para>
34632 <para>
34633 This option applies to all unqualified addresses generated by Exim filters,
34634 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
34635 not preceded by a backslash. Sieve filters cannot generate unqualified
34636 addresses.
34637 </para>
34638 <para>
34639 <indexterm role="option">
34640 <primary><option>qualify_preserve_domain</option></primary>
34641 </indexterm>
34642 </para>
34643 <informaltable frame="all">
34644 <tgroup cols="4" colsep="0" rowsep="0">
34645 <colspec colwidth="8*" align="left"/>
34646 <colspec colwidth="6*" align="center"/>
34647 <colspec colwidth="6*" align="center"/>
34648 <colspec colwidth="6*" align="right"/>
34649 <tbody>
34650 <row>
34651 <entry><option>qualify_preserve_domain</option></entry>
34652 <entry>Use: <emphasis>redirect</emphasis></entry>
34653 <entry>Type: <emphasis>boolean</emphasis></entry>
34654 <entry>Default: <emphasis>false</emphasis></entry>
34655 </row>
34656 </tbody>
34657 </tgroup>
34658 </informaltable>
34659 <para>
34660 <indexterm role="concept">
34661 <primary>domain</primary>
34662 <secondary>in redirection; preserving</secondary>
34663 </indexterm>
34664 <indexterm role="concept">
34665 <primary>preserving domain in redirection</primary>
34666 </indexterm>
34667 <indexterm role="concept">
34668 <primary>address redirection</primary>
34669 <secondary>domain; preserving</secondary>
34670 </indexterm>
34671 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
34672 set (a configuration error occurs if it is). If an unqualified address (one
34673 without a domain) is generated, it is qualified with the domain of the parent
34674 address (the immediately preceding ancestor) instead of the global
34675 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
34676 this applies whether or not the address is preceded by a backslash.
34677 </para>
34678 <para>
34679 <indexterm role="option">
34680 <primary><option>repeat_use</option></primary>
34681 </indexterm>
34682 </para>
34683 <informaltable frame="all">
34684 <tgroup cols="4" colsep="0" rowsep="0">
34685 <colspec colwidth="8*" align="left"/>
34686 <colspec colwidth="6*" align="center"/>
34687 <colspec colwidth="6*" align="center"/>
34688 <colspec colwidth="6*" align="right"/>
34689 <tbody>
34690 <row>
34691 <entry><option>repeat_use</option></entry>
34692 <entry>Use: <emphasis>redirect</emphasis></entry>
34693 <entry>Type: <emphasis>boolean</emphasis></entry>
34694 <entry>Default: <emphasis>true</emphasis></entry>
34695 </row>
34696 </tbody>
34697 </tgroup>
34698 </informaltable>
34699 <para>
34700 If this option is set false, the router is skipped for a child address that has
34701 any ancestor that was routed by this router. This test happens before any of
34702 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
34703 only when the ancestor is the same as the current address. See also
34704 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
34705 </para>
34706 <para>
34707 <indexterm role="option">
34708 <primary><option>reply_transport</option></primary>
34709 </indexterm>
34710 </para>
34711 <informaltable frame="all">
34712 <tgroup cols="4" colsep="0" rowsep="0">
34713 <colspec colwidth="8*" align="left"/>
34714 <colspec colwidth="6*" align="center"/>
34715 <colspec colwidth="6*" align="center"/>
34716 <colspec colwidth="6*" align="right"/>
34717 <tbody>
34718 <row>
34719 <entry><option>reply_transport</option></entry>
34720 <entry>Use: <emphasis>redirect</emphasis></entry>
34721 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34722 <entry>Default: <emphasis>unset</emphasis></entry>
34723 </row>
34724 </tbody>
34725 </tgroup>
34726 </informaltable>
34727 <para>
34728 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
34729 <option>vacation</option> command is used in a filter file. The transport used is specified
34730 by this option, which, after expansion, must be the name of a configured
34731 transport. This should normally be an <command>autoreply</command> transport. Other transports
34732 are unlikely to do anything sensible or useful.
34733 </para>
34734 <para>
34735 <indexterm role="option">
34736 <primary><option>rewrite</option></primary>
34737 </indexterm>
34738 </para>
34739 <informaltable frame="all">
34740 <tgroup cols="4" colsep="0" rowsep="0">
34741 <colspec colwidth="8*" align="left"/>
34742 <colspec colwidth="6*" align="center"/>
34743 <colspec colwidth="6*" align="center"/>
34744 <colspec colwidth="6*" align="right"/>
34745 <tbody>
34746 <row>
34747 <entry><option>rewrite</option></entry>
34748 <entry>Use: <emphasis>redirect</emphasis></entry>
34749 <entry>Type: <emphasis>boolean</emphasis></entry>
34750 <entry>Default: <emphasis>true</emphasis></entry>
34751 </row>
34752 </tbody>
34753 </tgroup>
34754 </informaltable>
34755 <para>
34756 <indexterm role="concept">
34757 <primary>address redirection</primary>
34758 <secondary>disabling rewriting</secondary>
34759 </indexterm>
34760 If this option is set false, addresses generated by the router are not
34761 subject to address rewriting. Otherwise, they are treated like new addresses
34762 and are rewritten according to the global rewriting rules.
34763 </para>
34764 <para>
34765 <indexterm role="option">
34766 <primary><option>sieve_subaddress</option></primary>
34767 </indexterm>
34768 </para>
34769 <informaltable frame="all">
34770 <tgroup cols="4" colsep="0" rowsep="0">
34771 <colspec colwidth="8*" align="left"/>
34772 <colspec colwidth="6*" align="center"/>
34773 <colspec colwidth="6*" align="center"/>
34774 <colspec colwidth="6*" align="right"/>
34775 <tbody>
34776 <row>
34777 <entry><option>sieve_subaddress</option></entry>
34778 <entry>Use: <emphasis>redirect</emphasis></entry>
34779 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34780 <entry>Default: <emphasis>unset</emphasis></entry>
34781 </row>
34782 </tbody>
34783 </tgroup>
34784 </informaltable>
34785 <para>
34786 The value of this option is passed to a Sieve filter to specify the
34787 :subaddress part of an address.
34788 </para>
34789 <para>
34790 <indexterm role="option">
34791 <primary><option>sieve_useraddress</option></primary>
34792 </indexterm>
34793 </para>
34794 <informaltable frame="all">
34795 <tgroup cols="4" colsep="0" rowsep="0">
34796 <colspec colwidth="8*" align="left"/>
34797 <colspec colwidth="6*" align="center"/>
34798 <colspec colwidth="6*" align="center"/>
34799 <colspec colwidth="6*" align="right"/>
34800 <tbody>
34801 <row>
34802 <entry><option>sieve_useraddress</option></entry>
34803 <entry>Use: <emphasis>redirect</emphasis></entry>
34804 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34805 <entry>Default: <emphasis>unset</emphasis></entry>
34806 </row>
34807 </tbody>
34808 </tgroup>
34809 </informaltable>
34810 <para>
34811 The value of this option is passed to a Sieve filter to specify the :user part
34812 of an address. However, if it is unset, the entire original local part
34813 (including any prefix or suffix) is used for :user.
34814 </para>
34815 <para>
34816 <indexterm role="option">
34817 <primary><option>sieve_vacation_directory</option></primary>
34818 </indexterm>
34819 </para>
34820 <informaltable frame="all">
34821 <tgroup cols="4" colsep="0" rowsep="0">
34822 <colspec colwidth="8*" align="left"/>
34823 <colspec colwidth="6*" align="center"/>
34824 <colspec colwidth="6*" align="center"/>
34825 <colspec colwidth="6*" align="right"/>
34826 <tbody>
34827 <row>
34828 <entry><option>sieve_vacation_directory</option></entry>
34829 <entry>Use: <emphasis>redirect</emphasis></entry>
34830 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34831 <entry>Default: <emphasis>unset</emphasis></entry>
34832 </row>
34833 </tbody>
34834 </tgroup>
34835 </informaltable>
34836 <para>
34837 <indexterm role="concept">
34838 <primary>Sieve filter</primary>
34839 <secondary>vacation directory</secondary>
34840 </indexterm>
34841 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
34842 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
34843 (do not put anything else in that directory), and ensure that the
34844 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
34845 needs their own directory; Exim will create it if necessary.
34846 </para>
34847 <para>
34848 <indexterm role="option">
34849 <primary><option>skip_syntax_errors</option></primary>
34850 </indexterm>
34851 </para>
34852 <informaltable frame="all">
34853 <tgroup cols="4" colsep="0" rowsep="0">
34854 <colspec colwidth="8*" align="left"/>
34855 <colspec colwidth="6*" align="center"/>
34856 <colspec colwidth="6*" align="center"/>
34857 <colspec colwidth="6*" align="right"/>
34858 <tbody>
34859 <row>
34860 <entry><option>skip_syntax_errors</option></entry>
34861 <entry>Use: <emphasis>redirect</emphasis></entry>
34862 <entry>Type: <emphasis>boolean</emphasis></entry>
34863 <entry>Default: <emphasis>false</emphasis></entry>
34864 </row>
34865 </tbody>
34866 </tgroup>
34867 </informaltable>
34868 <para>
34869 <indexterm role="concept">
34870 <primary>forward file</primary>
34871 <secondary>broken</secondary>
34872 </indexterm>
34873 <indexterm role="concept">
34874 <primary>address redirection</primary>
34875 <secondary>broken files</secondary>
34876 </indexterm>
34877 <indexterm role="concept">
34878 <primary>alias file</primary>
34879 <secondary>broken</secondary>
34880 </indexterm>
34881 <indexterm role="concept">
34882 <primary>broken alias or forward files</primary>
34883 </indexterm>
34884 <indexterm role="concept">
34885 <primary>ignoring faulty addresses</primary>
34886 </indexterm>
34887 <indexterm role="concept">
34888 <primary>skipping faulty addresses</primary>
34889 </indexterm>
34890 <indexterm role="concept">
34891 <primary>error</primary>
34892 <secondary>skipping bad syntax</secondary>
34893 </indexterm>
34894 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
34895 non-filter redirection data are skipped, and each failing address is logged. If
34896 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
34897 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
34898 are expanded and placed at the head of the error message generated by
34899 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
34900 be the same address as the generic <option>errors_to</option> option. The
34901 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
34902 </para>
34903 <para>
34904 If all the addresses in a redirection list are skipped because of syntax
34905 errors, the router declines to handle the original address, and it is passed to
34906 the following routers.
34907 </para>
34908 <para>
34909 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
34910 error in the filter causes filtering to be abandoned without any action being
34911 taken. The incident is logged, and the router declines to handle the address,
34912 so it is passed to the following routers.
34913 </para>
34914 <para>
34915 <indexterm role="concept">
34916 <primary>Sieve filter</primary>
34917 <secondary>syntax errors in</secondary>
34918 </indexterm>
34919 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
34920 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
34921 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
34922 </para>
34923 <para>
34924 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
34925 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
34926 option, used with an address that does not get redirected, can be used to
34927 notify users of these errors, by means of a router like this:
34928 </para>
34929 <literallayout class="monospaced">
34930 userforward:
34931   driver = redirect
34932   allow_filter
34933   check_local_user
34934   file = $home/.forward
34935   file_transport = address_file
34936   pipe_transport = address_pipe
34937   reply_transport = address_reply
34938   no_verify
34939   skip_syntax_errors
34940   syntax_errors_to = real-$local_part@$domain
34941   syntax_errors_text = \
34942    This is an automatically generated message. An error has\n\
34943    been found in your .forward file. Details of the error are\n\
34944    reported below. While this error persists, you will receive\n\
34945    a copy of this message for every message that is addressed\n\
34946    to you. If your .forward file is a filter file, or if it is\n\
34947    a non-filter file containing no valid forwarding addresses,\n\
34948    a copy of each incoming message will be put in your normal\n\
34949    mailbox. If a non-filter file contains at least one valid\n\
34950    forwarding address, forwarding to the valid addresses will\n\
34951    happen, and those will be the only deliveries that occur.
34952 </literallayout>
34953 <para>
34954 You also need a router to ensure that local addresses that are prefixed by
34955 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
34956 put this immediately before the <command>userforward</command> router:
34957 </para>
34958 <literallayout class="monospaced">
34959 real_localuser:
34960   driver = accept
34961   check_local_user
34962   local_part_prefix = real-
34963   transport = local_delivery
34964 </literallayout>
34965 <para revisionflag="changed">
34966 For security, it would probably be a good idea to restrict the use of this
34967 router to locally-generated messages, using a condition such as this:
34968 </para>
34969 <literallayout class="monospaced" revisionflag="changed">
34970   condition = ${if match {$sender_host_address}\
34971                          {\N^(|127\.0\.0\.1)$\N}}
34972 </literallayout>
34973 <para>
34974 <indexterm role="option">
34975 <primary><option>syntax_errors_text</option></primary>
34976 </indexterm>
34977 </para>
34978 <informaltable frame="all">
34979 <tgroup cols="4" colsep="0" rowsep="0">
34980 <colspec colwidth="8*" align="left"/>
34981 <colspec colwidth="6*" align="center"/>
34982 <colspec colwidth="6*" align="center"/>
34983 <colspec colwidth="6*" align="right"/>
34984 <tbody>
34985 <row>
34986 <entry><option>syntax_errors_text</option></entry>
34987 <entry>Use: <emphasis>redirect</emphasis></entry>
34988 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34989 <entry>Default: <emphasis>unset</emphasis></entry>
34990 </row>
34991 </tbody>
34992 </tgroup>
34993 </informaltable>
34994 <para>
34995 See <option>skip_syntax_errors</option> above.
34996 </para>
34997 <para>
34998 <indexterm role="option">
34999 <primary><option>syntax_errors_to</option></primary>
35000 </indexterm>
35001 </para>
35002 <informaltable frame="all">
35003 <tgroup cols="4" colsep="0" rowsep="0">
35004 <colspec colwidth="8*" align="left"/>
35005 <colspec colwidth="6*" align="center"/>
35006 <colspec colwidth="6*" align="center"/>
35007 <colspec colwidth="6*" align="right"/>
35008 <tbody>
35009 <row>
35010 <entry><option>syntax_errors_to</option></entry>
35011 <entry>Use: <emphasis>redirect</emphasis></entry>
35012 <entry>Type: <emphasis>string</emphasis></entry>
35013 <entry>Default: <emphasis>unset</emphasis></entry>
35014 </row>
35015 </tbody>
35016 </tgroup>
35017 </informaltable>
35018 <para>
35019 See <option>skip_syntax_errors</option> above.
35020 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
35021 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
35022 </para>
35023 </section>
35024 </chapter>
35025
35026 <chapter id="CHAPenvironment">
35027 <title>Environment for running local transports</title>
35028 <titleabbrev>Environment for local transports</titleabbrev>
35029 <para>
35030 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
35031 <primary>local transports</primary>
35032 <secondary>environment for</secondary>
35033 </indexterm>
35034 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
35035 <primary>environment for local transports</primary>
35036 </indexterm>
35037 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
35038 <primary>transport</primary>
35039 <secondary>local; environment for</secondary>
35040 </indexterm>
35041 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
35042 transport can be thought of as similar to a pipe.) Exim always runs transports
35043 in subprocesses, under specified uids and gids. Typical deliveries to local
35044 mailboxes run under the uid and gid of the local user.
35045 </para>
35046 <para>
35047 Exim also sets a specific current directory while running the transport; for
35048 some transports a home directory setting is also relevant. The <command>pipe</command>
35049 transport is the only one that sets up environment variables; see section
35050 <xref linkend="SECTpipeenv"/> for details.
35051 </para>
35052 <para>
35053 The values used for the uid, gid, and the directories may come from several
35054 different places. In many cases, the router that handles the address associates
35055 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
35056 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
35057 configuration, and these override anything that comes from the router.
35058 </para>
35059 <section id="SECID131">
35060 <title>Concurrent deliveries</title>
35061 <para>
35062 <indexterm role="concept">
35063 <primary>concurrent deliveries</primary>
35064 </indexterm>
35065 <indexterm role="concept">
35066 <primary>simultaneous deliveries</primary>
35067 </indexterm>
35068 If two different messages for the same local recipient arrive more or less
35069 simultaneously, the two delivery processes are likely to run concurrently. When
35070 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
35071 rules to stop concurrent processes from writing to the same file at the same
35072 time.
35073 </para>
35074 <para>
35075 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
35076 locking that is needed. Here is a silly example:
35077 </para>
35078 <literallayout class="monospaced">
35079 my_transport:
35080   driver = pipe
35081   command = /bin/sh -c 'cat &gt;&gt;/some/file'
35082 </literallayout>
35083 <para>
35084 This is supposed to write the message at the end of the file. However, if two
35085 messages arrive at the same time, the file will be scrambled. You can use the
35086 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
35087 file using the same algorithm that Exim itself uses.
35088 </para>
35089 </section>
35090 <section id="SECTenvuidgid">
35091 <title>Uids and gids</title>
35092 <para>
35093 <indexterm role="concept">
35094 <primary>local transports</primary>
35095 <secondary>uid and gid</secondary>
35096 </indexterm>
35097 <indexterm role="concept">
35098 <primary>transport</primary>
35099 <secondary>local; uid and gid</secondary>
35100 </indexterm>
35101 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
35102 overrides any group that the router set in the address, even if <option>user</option> is not
35103 set for the transport. This makes it possible, for example, to run local mail
35104 delivery under the uid of the recipient (set by the router), but in a special
35105 group (set by the transport). For example:
35106 </para>
35107 <literallayout class="monospaced">
35108 # Routers ...
35109 # User/group are set by check_local_user in this router
35110 local_users:
35111   driver = accept
35112   check_local_user
35113   transport = group_delivery
35114
35115 # Transports ...
35116 # This transport overrides the group
35117 group_delivery:
35118   driver = appendfile
35119   file = /var/spool/mail/$local_part
35120   group = mail
35121 </literallayout>
35122 <para>
35123 If <option>user</option> is set for a transport, its value overrides what is set in the
35124 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
35125 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
35126 set.
35127 </para>
35128 <para>
35129 <indexterm role="option">
35130 <primary><option>initgroups</option></primary>
35131 </indexterm>
35132 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
35133 function is called for the groups associated with that uid if the
35134 <option>initgroups</option> option is set for the transport. When the uid is not specified
35135 by the transport, but is associated with the address by a router, the option
35136 for calling <function>initgroups()</function> is taken from the router configuration.
35137 </para>
35138 <para>
35139 <indexterm role="concept">
35140 <primary><command>pipe</command> transport</primary>
35141 <secondary>uid for</secondary>
35142 </indexterm>
35143 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
35144 is set and <option>user</option> is not set, the uid of the process that called Exim to
35145 receive the message is used, and if <option>group</option> is not set, the corresponding
35146 original gid is also used.
35147 </para>
35148 <para>
35149 This is the detailed preference order for obtaining a gid; the first of the
35150 following that is set is used:
35151 </para>
35152 <itemizedlist>
35153 <listitem>
35154 <para>
35155 A <option>group</option> setting of the transport;
35156 </para>
35157 </listitem>
35158 <listitem>
35159 <para>
35160 A <option>group</option> setting of the router;
35161 </para>
35162 </listitem>
35163 <listitem>
35164 <para>
35165 A gid associated with a user setting of the router, either as a result of
35166 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
35167 </para>
35168 </listitem>
35169 <listitem>
35170 <para>
35171 The group associated with a non-numeric <option>user</option> setting of the transport;
35172 </para>
35173 </listitem>
35174 <listitem>
35175 <para>
35176 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
35177 the uid is the creator&#x2019;s uid;
35178 </para>
35179 </listitem>
35180 <listitem>
35181 <para>
35182 The Exim gid if the Exim uid is being used as a default.
35183 </para>
35184 </listitem>
35185 </itemizedlist>
35186 <para>
35187 If, for example, the user is specified numerically on the router and there are
35188 no group settings, no gid is available. In this situation, an error occurs.
35189 This is different for the uid, for which there always is an ultimate default.
35190 The first of the following that is set is used:
35191 </para>
35192 <itemizedlist>
35193 <listitem>
35194 <para>
35195 A <option>user</option> setting of the transport;
35196 </para>
35197 </listitem>
35198 <listitem>
35199 <para>
35200 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
35201 </para>
35202 </listitem>
35203 <listitem>
35204 <para>
35205 A <option>user</option> setting of the router;
35206 </para>
35207 </listitem>
35208 <listitem>
35209 <para>
35210 A <option>check_local_user</option> setting of the router;
35211 </para>
35212 </listitem>
35213 <listitem>
35214 <para>
35215 The Exim uid.
35216 </para>
35217 </listitem>
35218 </itemizedlist>
35219 <para>
35220 Of course, an error will still occur if the uid that is chosen is on the
35221 <option>never_users</option> list.
35222 </para>
35223 </section>
35224 <section id="SECID132">
35225 <title>Current and home directories</title>
35226 <para>
35227 <indexterm role="concept">
35228 <primary>current directory for local transport</primary>
35229 </indexterm>
35230 <indexterm role="concept">
35231 <primary>home directory</primary>
35232 <secondary>for local transport</secondary>
35233 </indexterm>
35234 <indexterm role="concept">
35235 <primary>transport</primary>
35236 <secondary>local; home directory for</secondary>
35237 </indexterm>
35238 <indexterm role="concept">
35239 <primary>transport</primary>
35240 <secondary>local; current directory for</secondary>
35241 </indexterm>
35242 Routers may set current and home directories for local transports by means of
35243 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
35244 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
35245 are set, they override the router&#x2019;s values. In detail, the home directory
35246 for a local transport is taken from the first of these values that is set:
35247 </para>
35248 <itemizedlist>
35249 <listitem>
35250 <para>
35251 The <option>home_directory</option> option on the transport;
35252 </para>
35253 </listitem>
35254 <listitem>
35255 <para>
35256 The <option>transport_home_directory</option> option on the router;
35257 </para>
35258 </listitem>
35259 <listitem>
35260 <para>
35261 The password data if <option>check_local_user</option> is set on the router;
35262 </para>
35263 </listitem>
35264 <listitem>
35265 <para>
35266 The <option>router_home_directory</option> option on the router.
35267 </para>
35268 </listitem>
35269 </itemizedlist>
35270 <para>
35271 The current directory is taken from the first of these values that is set:
35272 </para>
35273 <itemizedlist>
35274 <listitem>
35275 <para>
35276 The <option>current_directory</option> option on the transport;
35277 </para>
35278 </listitem>
35279 <listitem>
35280 <para>
35281 The <option>transport_current_directory</option> option on the router.
35282 </para>
35283 </listitem>
35284 </itemizedlist>
35285 <para>
35286 If neither the router nor the transport sets a current directory, Exim uses the
35287 value of the home directory, if it is set. Otherwise it sets the current
35288 directory to <filename>/</filename> before running a local transport.
35289 </para>
35290 </section>
35291 <section id="SECID133">
35292 <title>Expansion variables derived from the address</title>
35293 <para>
35294 <indexterm role="variable">
35295 <primary><varname>$domain</varname></primary>
35296 </indexterm>
35297 <indexterm role="variable">
35298 <primary><varname>$local_part</varname></primary>
35299 </indexterm>
35300 <indexterm role="variable">
35301 <primary><varname>$original_domain</varname></primary>
35302 </indexterm>
35303 Normally a local delivery is handling a single address, and in that case the
35304 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
35305 deliveries. However, in some circumstances more than one address may be handled
35306 at once (for example, while writing batch SMTP for onward transmission by some
35307 other means). In this case, the variables associated with the local part are
35308 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
35309 and <varname>$original_domain</varname> is never set.
35310 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
35311 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
35312 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
35313 </para>
35314 </section>
35315 </chapter>
35316
35317 <chapter id="CHAPtransportgeneric">
35318 <title>Generic options for transports</title>
35319 <para>
35320 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
35321 <primary>generic options</primary>
35322 <secondary>transport</secondary>
35323 </indexterm>
35324 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
35325 <primary>options</primary>
35326 <secondary>generic; for transports</secondary>
35327 </indexterm>
35328 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
35329 <primary>transport</primary>
35330 <secondary>generic options for</secondary>
35331 </indexterm>
35332 The following generic options apply to all transports:
35333 </para>
35334 <para>
35335 <indexterm role="option">
35336 <primary><option>body_only</option></primary>
35337 </indexterm>
35338 </para>
35339 <informaltable frame="all">
35340 <tgroup cols="4" colsep="0" rowsep="0">
35341 <colspec colwidth="8*" align="left"/>
35342 <colspec colwidth="6*" align="center"/>
35343 <colspec colwidth="6*" align="center"/>
35344 <colspec colwidth="6*" align="right"/>
35345 <tbody>
35346 <row>
35347 <entry><option>body_only</option></entry>
35348 <entry>Use: <emphasis>transports</emphasis></entry>
35349 <entry>Type: <emphasis>boolean</emphasis></entry>
35350 <entry>Default: <emphasis>false</emphasis></entry>
35351 </row>
35352 </tbody>
35353 </tgroup>
35354 </informaltable>
35355 <para>
35356 <indexterm role="concept">
35357 <primary>transport</primary>
35358 <secondary>body only</secondary>
35359 </indexterm>
35360 <indexterm role="concept">
35361 <primary>message</primary>
35362 <secondary>transporting body only</secondary>
35363 </indexterm>
35364 <indexterm role="concept">
35365 <primary>body of message</primary>
35366 <secondary>transporting</secondary>
35367 </indexterm>
35368 If this option is set, the message&#x2019;s headers are not transported. It is
35369 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
35370 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
35371 <option>message_suffix</option> should be checked, because this option does not
35372 automatically suppress them.
35373 </para>
35374 <para>
35375 <indexterm role="option">
35376 <primary><option>current_directory</option></primary>
35377 </indexterm>
35378 </para>
35379 <informaltable frame="all">
35380 <tgroup cols="4" colsep="0" rowsep="0">
35381 <colspec colwidth="8*" align="left"/>
35382 <colspec colwidth="6*" align="center"/>
35383 <colspec colwidth="6*" align="center"/>
35384 <colspec colwidth="6*" align="right"/>
35385 <tbody>
35386 <row>
35387 <entry><option>current_directory</option></entry>
35388 <entry>Use: <emphasis>transports</emphasis></entry>
35389 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35390 <entry>Default: <emphasis>unset</emphasis></entry>
35391 </row>
35392 </tbody>
35393 </tgroup>
35394 </informaltable>
35395 <para>
35396 <indexterm role="concept">
35397 <primary>transport</primary>
35398 <secondary>current directory for</secondary>
35399 </indexterm>
35400 This specifies the current directory that is to be set while running the
35401 transport, overriding any value that may have been set by the router.
35402 If the expansion fails for any reason, including forced failure, an error is
35403 logged, and delivery is deferred.
35404 </para>
35405 <para>
35406 <indexterm role="option">
35407 <primary><option>disable_logging</option></primary>
35408 </indexterm>
35409 </para>
35410 <informaltable frame="all">
35411 <tgroup cols="4" colsep="0" rowsep="0">
35412 <colspec colwidth="8*" align="left"/>
35413 <colspec colwidth="6*" align="center"/>
35414 <colspec colwidth="6*" align="center"/>
35415 <colspec colwidth="6*" align="right"/>
35416 <tbody>
35417 <row>
35418 <entry><option>disable_logging</option></entry>
35419 <entry>Use: <emphasis>transports</emphasis></entry>
35420 <entry>Type: <emphasis>boolean</emphasis></entry>
35421 <entry>Default: <emphasis>false</emphasis></entry>
35422 </row>
35423 </tbody>
35424 </tgroup>
35425 </informaltable>
35426 <para>
35427 If this option is set true, nothing is logged for any
35428 deliveries by the transport or for any
35429 transport errors. You should not set this option unless you really, really know
35430 what you are doing.
35431 </para>
35432 <para>
35433 <indexterm role="option">
35434 <primary><option>debug_print</option></primary>
35435 </indexterm>
35436 </para>
35437 <informaltable frame="all">
35438 <tgroup cols="4" colsep="0" rowsep="0">
35439 <colspec colwidth="8*" align="left"/>
35440 <colspec colwidth="6*" align="center"/>
35441 <colspec colwidth="6*" align="center"/>
35442 <colspec colwidth="6*" align="right"/>
35443 <tbody>
35444 <row>
35445 <entry><option>debug_print</option></entry>
35446 <entry>Use: <emphasis>transports</emphasis></entry>
35447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35448 <entry>Default: <emphasis>unset</emphasis></entry>
35449 </row>
35450 </tbody>
35451 </tgroup>
35452 </informaltable>
35453 <para>
35454 <indexterm role="concept">
35455 <primary>testing</primary>
35456 <secondary>variables in drivers</secondary>
35457 </indexterm>
35458 If this option is set and debugging is enabled (see the <option>-d</option> command line
35459 option), the string is expanded and included in the debugging output when the
35460 transport is run.
35461 If expansion of the string fails, the error message is written to the debugging
35462 output, and Exim carries on processing.
35463 This facility is provided to help with checking out the values of variables and
35464 so on when debugging driver configurations. For example, if a <option>headers_add</option>
35465 option is not working properly, <option>debug_print</option> could be used to output the
35466 variables it references. A newline is added to the text if it does not end with
35467 one.
35468 </para>
35469 <para>
35470 <indexterm role="option">
35471 <primary><option>delivery_date_add</option></primary>
35472 </indexterm>
35473 </para>
35474 <informaltable frame="all">
35475 <tgroup cols="4" colsep="0" rowsep="0">
35476 <colspec colwidth="8*" align="left"/>
35477 <colspec colwidth="6*" align="center"/>
35478 <colspec colwidth="6*" align="center"/>
35479 <colspec colwidth="6*" align="right"/>
35480 <tbody>
35481 <row>
35482 <entry><option>delivery_date_add</option></entry>
35483 <entry>Use: <emphasis>transports</emphasis></entry>
35484 <entry>Type: <emphasis>boolean</emphasis></entry>
35485 <entry>Default: <emphasis>false</emphasis></entry>
35486 </row>
35487 </tbody>
35488 </tgroup>
35489 </informaltable>
35490 <para>
35491 <indexterm role="concept">
35492 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
35493 </indexterm>
35494 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
35495 This gives the actual time the delivery was made. As this is not a standard
35496 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
35497 requests its removal from incoming messages, so that delivered messages can
35498 safely be resent to other recipients.
35499 </para>
35500 <para>
35501 <indexterm role="option">
35502 <primary><option>driver</option></primary>
35503 </indexterm>
35504 </para>
35505 <informaltable frame="all">
35506 <tgroup cols="4" colsep="0" rowsep="0">
35507 <colspec colwidth="8*" align="left"/>
35508 <colspec colwidth="6*" align="center"/>
35509 <colspec colwidth="6*" align="center"/>
35510 <colspec colwidth="6*" align="right"/>
35511 <tbody>
35512 <row>
35513 <entry><option>driver</option></entry>
35514 <entry>Use: <emphasis>transports</emphasis></entry>
35515 <entry>Type: <emphasis>string</emphasis></entry>
35516 <entry>Default: <emphasis>unset</emphasis></entry>
35517 </row>
35518 </tbody>
35519 </tgroup>
35520 </informaltable>
35521 <para>
35522 This specifies which of the available transport drivers is to be used.
35523 There is no default, and this option must be set for every transport.
35524 </para>
35525 <para>
35526 <indexterm role="option">
35527 <primary><option>envelope_to_add</option></primary>
35528 </indexterm>
35529 </para>
35530 <informaltable frame="all">
35531 <tgroup cols="4" colsep="0" rowsep="0">
35532 <colspec colwidth="8*" align="left"/>
35533 <colspec colwidth="6*" align="center"/>
35534 <colspec colwidth="6*" align="center"/>
35535 <colspec colwidth="6*" align="right"/>
35536 <tbody>
35537 <row>
35538 <entry><option>envelope_to_add</option></entry>
35539 <entry>Use: <emphasis>transports</emphasis></entry>
35540 <entry>Type: <emphasis>boolean</emphasis></entry>
35541 <entry>Default: <emphasis>false</emphasis></entry>
35542 </row>
35543 </tbody>
35544 </tgroup>
35545 </informaltable>
35546 <para>
35547 <indexterm role="concept">
35548 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35549 </indexterm>
35550 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
35551 This gives the original address(es) in the incoming envelope that caused this
35552 delivery to happen. More than one address may be present if the transport is
35553 configured to handle several addresses at once, or if more than one original
35554 address was redirected to the same final address. As this is not a standard
35555 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
35556 its removal from incoming messages, so that delivered messages can safely be
35557 resent to other recipients.
35558 </para>
35559 <para>
35560 <indexterm role="option">
35561 <primary><option>group</option></primary>
35562 </indexterm>
35563 </para>
35564 <informaltable frame="all">
35565 <tgroup cols="4" colsep="0" rowsep="0">
35566 <colspec colwidth="8*" align="left"/>
35567 <colspec colwidth="6*" align="center"/>
35568 <colspec colwidth="6*" align="center"/>
35569 <colspec colwidth="6*" align="right"/>
35570 <tbody>
35571 <row>
35572 <entry><option>group</option></entry>
35573 <entry>Use: <emphasis>transports</emphasis></entry>
35574 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35575 <entry>Default: <emphasis>Exim group</emphasis></entry>
35576 </row>
35577 </tbody>
35578 </tgroup>
35579 </informaltable>
35580 <para>
35581 <indexterm role="concept">
35582 <primary>transport</primary>
35583 <secondary>group; specifying</secondary>
35584 </indexterm>
35585 This option specifies a gid for running the transport process, overriding any
35586 value that the router supplies, and also overriding any value associated with
35587 <option>user</option> (see below).
35588 </para>
35589 <para>
35590 <indexterm role="option">
35591 <primary><option>headers_add</option></primary>
35592 </indexterm>
35593 </para>
35594 <informaltable frame="all">
35595 <tgroup cols="4" colsep="0" rowsep="0">
35596 <colspec colwidth="8*" align="left"/>
35597 <colspec colwidth="6*" align="center"/>
35598 <colspec colwidth="6*" align="center"/>
35599 <colspec colwidth="6*" align="right"/>
35600 <tbody>
35601 <row>
35602 <entry><option>headers_add</option></entry>
35603 <entry>Use: <emphasis>transports</emphasis></entry>
35604 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35605 <entry>Default: <emphasis>unset</emphasis></entry>
35606 </row>
35607 </tbody>
35608 </tgroup>
35609 </informaltable>
35610 <para>
35611 <indexterm role="concept">
35612 <primary>header lines</primary>
35613 <secondary>adding in transport</secondary>
35614 </indexterm>
35615 <indexterm role="concept">
35616 <primary>transport</primary>
35617 <secondary>header lines; adding</secondary>
35618 </indexterm>
35619 This option specifies a string of text that is expanded and added to the header
35620 portion of a message as it is transported, as described in section
35621 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
35622 routers. If the result of the expansion is an empty string, or if the expansion
35623 is forced to fail, no action is taken. Other expansion failures are treated as
35624 errors and cause the delivery to be deferred.
35625 </para>
35626 <para>
35627 <indexterm role="option">
35628 <primary><option>headers_only</option></primary>
35629 </indexterm>
35630 </para>
35631 <informaltable frame="all">
35632 <tgroup cols="4" colsep="0" rowsep="0">
35633 <colspec colwidth="8*" align="left"/>
35634 <colspec colwidth="6*" align="center"/>
35635 <colspec colwidth="6*" align="center"/>
35636 <colspec colwidth="6*" align="right"/>
35637 <tbody>
35638 <row>
35639 <entry><option>headers_only</option></entry>
35640 <entry>Use: <emphasis>transports</emphasis></entry>
35641 <entry>Type: <emphasis>boolean</emphasis></entry>
35642 <entry>Default: <emphasis>false</emphasis></entry>
35643 </row>
35644 </tbody>
35645 </tgroup>
35646 </informaltable>
35647 <para>
35648 <indexterm role="concept">
35649 <primary>transport</primary>
35650 <secondary>header lines only</secondary>
35651 </indexterm>
35652 <indexterm role="concept">
35653 <primary>message</primary>
35654 <secondary>transporting headers only</secondary>
35655 </indexterm>
35656 <indexterm role="concept">
35657 <primary>header lines</primary>
35658 <secondary>transporting</secondary>
35659 </indexterm>
35660 If this option is set, the message&#x2019;s body is not transported. It is mutually
35661 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
35662 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
35663 checked, since this option does not automatically suppress them.
35664 </para>
35665 <para>
35666 <indexterm role="option">
35667 <primary><option>headers_remove</option></primary>
35668 </indexterm>
35669 </para>
35670 <informaltable frame="all">
35671 <tgroup cols="4" colsep="0" rowsep="0">
35672 <colspec colwidth="8*" align="left"/>
35673 <colspec colwidth="6*" align="center"/>
35674 <colspec colwidth="6*" align="center"/>
35675 <colspec colwidth="6*" align="right"/>
35676 <tbody>
35677 <row>
35678 <entry><option>headers_remove</option></entry>
35679 <entry>Use: <emphasis>transports</emphasis></entry>
35680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35681 <entry>Default: <emphasis>unset</emphasis></entry>
35682 </row>
35683 </tbody>
35684 </tgroup>
35685 </informaltable>
35686 <para>
35687 <indexterm role="concept">
35688 <primary>header lines</primary>
35689 <secondary>removing</secondary>
35690 </indexterm>
35691 <indexterm role="concept">
35692 <primary>transport</primary>
35693 <secondary>header lines; removing</secondary>
35694 </indexterm>
35695 This option specifies a string that is expanded into a list of header names;
35696 these headers are omitted from the message as it is transported, as described
35697 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
35698 routers. If the result of the expansion is an empty string, or if the expansion
35699 is forced to fail, no action is taken. Other expansion failures are treated as
35700 errors and cause the delivery to be deferred.
35701 </para>
35702 <para>
35703 <indexterm role="option">
35704 <primary><option>headers_rewrite</option></primary>
35705 </indexterm>
35706 </para>
35707 <informaltable frame="all">
35708 <tgroup cols="4" colsep="0" rowsep="0">
35709 <colspec colwidth="8*" align="left"/>
35710 <colspec colwidth="6*" align="center"/>
35711 <colspec colwidth="6*" align="center"/>
35712 <colspec colwidth="6*" align="right"/>
35713 <tbody>
35714 <row>
35715 <entry><option>headers_rewrite</option></entry>
35716 <entry>Use: <emphasis>transports</emphasis></entry>
35717 <entry>Type: <emphasis>string</emphasis></entry>
35718 <entry>Default: <emphasis>unset</emphasis></entry>
35719 </row>
35720 </tbody>
35721 </tgroup>
35722 </informaltable>
35723 <para>
35724 <indexterm role="concept">
35725 <primary>transport</primary>
35726 <secondary>header lines; rewriting</secondary>
35727 </indexterm>
35728 <indexterm role="concept">
35729 <primary>rewriting</primary>
35730 <secondary>at transport time</secondary>
35731 </indexterm>
35732 This option allows addresses in header lines to be rewritten at transport time,
35733 that is, as the message is being copied to its destination. The contents of the
35734 option are a colon-separated list of rewriting rules. Each rule is in exactly
35735 the same form as one of the general rewriting rules that are applied when a
35736 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
35737 example,
35738 </para>
35739 <literallayout class="monospaced">
35740 headers_rewrite = a@b c@d f : \
35741                   x@y w@z
35742 </literallayout>
35743 <para>
35744 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
35745 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
35746 header lines just before they are written out at transport time, so they affect
35747 only those copies of the message that pass through the transport. However, only
35748 the message&#x2019;s original header lines, and any that were added by a system
35749 filter, are rewritten. If a router or transport adds header lines, they are not
35750 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
35751 envelope. You can change the return path using <option>return_path</option>, but you cannot
35752 change envelope recipients at this time.
35753 </para>
35754 <para>
35755 <indexterm role="option">
35756 <primary><option>home_directory</option></primary>
35757 </indexterm>
35758 </para>
35759 <informaltable frame="all">
35760 <tgroup cols="4" colsep="0" rowsep="0">
35761 <colspec colwidth="8*" align="left"/>
35762 <colspec colwidth="6*" align="center"/>
35763 <colspec colwidth="6*" align="center"/>
35764 <colspec colwidth="6*" align="right"/>
35765 <tbody>
35766 <row>
35767 <entry><option>home_directory</option></entry>
35768 <entry>Use: <emphasis>transports</emphasis></entry>
35769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35770 <entry>Default: <emphasis>unset</emphasis></entry>
35771 </row>
35772 </tbody>
35773 </tgroup>
35774 </informaltable>
35775 <para>
35776 <indexterm role="concept">
35777 <primary>transport</primary>
35778 <secondary>home directory for</secondary>
35779 </indexterm>
35780 <indexterm role="variable">
35781 <primary><varname>$home</varname></primary>
35782 </indexterm>
35783 This option specifies a home directory setting for a local transport,
35784 overriding any value that may be set by the router. The home directory is
35785 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
35786 used as the current directory if no current directory is set by the
35787 <option>current_directory</option> option on the transport or the
35788 <option>transport_current_directory</option> option on the router. If the expansion fails
35789 for any reason, including forced failure, an error is logged, and delivery is
35790 deferred.
35791 </para>
35792 <para>
35793 <indexterm role="option">
35794 <primary><option>initgroups</option></primary>
35795 </indexterm>
35796 </para>
35797 <informaltable frame="all">
35798 <tgroup cols="4" colsep="0" rowsep="0">
35799 <colspec colwidth="8*" align="left"/>
35800 <colspec colwidth="6*" align="center"/>
35801 <colspec colwidth="6*" align="center"/>
35802 <colspec colwidth="6*" align="right"/>
35803 <tbody>
35804 <row>
35805 <entry><option>initgroups</option></entry>
35806 <entry>Use: <emphasis>transports</emphasis></entry>
35807 <entry>Type: <emphasis>boolean</emphasis></entry>
35808 <entry>Default: <emphasis>false</emphasis></entry>
35809 </row>
35810 </tbody>
35811 </tgroup>
35812 </informaltable>
35813 <para>
35814 <indexterm role="concept">
35815 <primary>additional groups</primary>
35816 </indexterm>
35817 <indexterm role="concept">
35818 <primary>groups</primary>
35819 <secondary>additional</secondary>
35820 </indexterm>
35821 <indexterm role="concept">
35822 <primary>transport</primary>
35823 <secondary>group; additional</secondary>
35824 </indexterm>
35825 If this option is true and the uid for the delivery process is provided by the
35826 transport, the <function>initgroups()</function> function is called when running the transport
35827 to ensure that any additional groups associated with the uid are set up.
35828 </para>
35829 <para>
35830 <indexterm role="option">
35831 <primary><option>message_size_limit</option></primary>
35832 </indexterm>
35833 </para>
35834 <informaltable frame="all">
35835 <tgroup cols="4" colsep="0" rowsep="0">
35836 <colspec colwidth="8*" align="left"/>
35837 <colspec colwidth="6*" align="center"/>
35838 <colspec colwidth="6*" align="center"/>
35839 <colspec colwidth="6*" align="right"/>
35840 <tbody>
35841 <row>
35842 <entry><option>message_size_limit</option></entry>
35843 <entry>Use: <emphasis>transports</emphasis></entry>
35844 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35845 <entry>Default: <emphasis>0</emphasis></entry>
35846 </row>
35847 </tbody>
35848 </tgroup>
35849 </informaltable>
35850 <para>
35851 <indexterm role="concept">
35852 <primary>limit</primary>
35853 <secondary>message size per transport</secondary>
35854 </indexterm>
35855 <indexterm role="concept">
35856 <primary>size</primary>
35857 <secondary>of message, limit</secondary>
35858 </indexterm>
35859 <indexterm role="concept">
35860 <primary>transport</primary>
35861 <secondary>message size; limiting</secondary>
35862 </indexterm>
35863 This option controls the size of messages passed through the transport. It is
35864 expanded before use; the result of the expansion must be a sequence of decimal
35865 digits, optionally followed by K or M. If the expansion fails for any reason,
35866 including forced failure, or if the result is not of the required form,
35867 delivery is deferred. If the value is greater than zero and the size of a
35868 message exceeds this limit, the address is failed. If there is any chance that
35869 the resulting bounce message could be routed to the same transport, you should
35870 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
35871 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
35872 delivered.
35873 </para>
35874 <para>
35875 <indexterm role="option">
35876 <primary><option>rcpt_include_affixes</option></primary>
35877 </indexterm>
35878 </para>
35879 <informaltable frame="all">
35880 <tgroup cols="4" colsep="0" rowsep="0">
35881 <colspec colwidth="8*" align="left"/>
35882 <colspec colwidth="6*" align="center"/>
35883 <colspec colwidth="6*" align="center"/>
35884 <colspec colwidth="6*" align="right"/>
35885 <tbody>
35886 <row>
35887 <entry><option>rcpt_include_affixes</option></entry>
35888 <entry>Use: <emphasis>transports</emphasis></entry>
35889 <entry>Type: <emphasis>boolean</emphasis></entry>
35890 <entry>Default: <emphasis>false</emphasis></entry>
35891 </row>
35892 </tbody>
35893 </tgroup>
35894 </informaltable>
35895 <para>
35896 <indexterm role="concept">
35897 <primary>prefix</primary>
35898 <secondary>for local part, including in envelope</secondary>
35899 </indexterm>
35900 <indexterm role="concept">
35901 <primary>suffix for local part</primary>
35902 <secondary>including in envelope</secondary>
35903 </indexterm>
35904 <indexterm role="concept">
35905 <primary>local part</primary>
35906 <secondary>prefix</secondary>
35907 </indexterm>
35908 <indexterm role="concept">
35909 <primary>local part</primary>
35910 <secondary>suffix</secondary>
35911 </indexterm>
35912 When this option is false (the default), and an address that has had any
35913 affixes (prefixes or suffixes) removed from the local part is delivered by any
35914 form of SMTP or LMTP, the affixes are not included. For example, if a router
35915 that contains
35916 </para>
35917 <literallayout class="monospaced">
35918 local_part_prefix = *-
35919 </literallayout>
35920 <para>
35921 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
35922 is delivered with
35923 </para>
35924 <literallayout class="monospaced">
35925 RCPT TO:&lt;xyz@some.domain&gt;
35926 </literallayout>
35927 <para>
35928 This is also the case when an ACL-time callout is being used to verify a
35929 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
35930 whole local part is included in the RCPT command. This option applies to BSMTP
35931 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
35932 <command>lmtp</command> and <command>smtp</command> transports.
35933 </para>
35934 <para>
35935 <indexterm role="option">
35936 <primary><option>retry_use_local_part</option></primary>
35937 </indexterm>
35938 </para>
35939 <informaltable frame="all">
35940 <tgroup cols="4" colsep="0" rowsep="0">
35941 <colspec colwidth="8*" align="left"/>
35942 <colspec colwidth="6*" align="center"/>
35943 <colspec colwidth="6*" align="center"/>
35944 <colspec colwidth="6*" align="right"/>
35945 <tbody>
35946 <row>
35947 <entry><option>retry_use_local_part</option></entry>
35948 <entry>Use: <emphasis>transports</emphasis></entry>
35949 <entry>Type: <emphasis>boolean</emphasis></entry>
35950 <entry>Default: <emphasis>see below</emphasis></entry>
35951 </row>
35952 </tbody>
35953 </tgroup>
35954 </informaltable>
35955 <para>
35956 <indexterm role="concept">
35957 <primary>hints database</primary>
35958 <secondary>retry keys</secondary>
35959 </indexterm>
35960 When a delivery suffers a temporary failure, a retry record is created
35961 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
35962 is based on the name and/or IP address of the failing remote host. For local
35963 deliveries, the key is normally the entire address, including both the local
35964 part and the domain. This is suitable for most common cases of local delivery
35965 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
35966 deliveries to that mailbox, not to the whole domain.
35967 </para>
35968 <para>
35969 However, in some special cases you may want to treat a temporary local delivery
35970 as a failure associated with the domain, and not with a particular local part.
35971 (For example, if you are storing all mail for some domain in files.) You can do
35972 this by setting <option>retry_use_local_part</option> false.
35973 </para>
35974 <para>
35975 For all the local transports, its default value is true. For remote transports,
35976 the default value is false for tidiness, but changing the value has no effect
35977 on a remote transport in the current implementation.
35978 </para>
35979 <para>
35980 <indexterm role="option">
35981 <primary><option>return_path</option></primary>
35982 </indexterm>
35983 </para>
35984 <informaltable frame="all">
35985 <tgroup cols="4" colsep="0" rowsep="0">
35986 <colspec colwidth="8*" align="left"/>
35987 <colspec colwidth="6*" align="center"/>
35988 <colspec colwidth="6*" align="center"/>
35989 <colspec colwidth="6*" align="right"/>
35990 <tbody>
35991 <row>
35992 <entry><option>return_path</option></entry>
35993 <entry>Use: <emphasis>transports</emphasis></entry>
35994 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35995 <entry>Default: <emphasis>unset</emphasis></entry>
35996 </row>
35997 </tbody>
35998 </tgroup>
35999 </informaltable>
36000 <para>
36001 <indexterm role="concept">
36002 <primary>envelope sender</primary>
36003 </indexterm>
36004 <indexterm role="concept">
36005 <primary>transport</primary>
36006 <secondary>return path; changing</secondary>
36007 </indexterm>
36008 <indexterm role="concept">
36009 <primary>return path</primary>
36010 <secondary>changing in transport</secondary>
36011 </indexterm>
36012 If this option is set, the string is expanded at transport time and replaces
36013 the existing return path (envelope sender) value in the copy of the message
36014 that is being delivered. An empty return path is permitted. This feature is
36015 designed for remote deliveries, where the value of this option is used in the
36016 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
36017 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
36018 header line, if one is added to the message (see the next option).
36019 </para>
36020 <para>
36021 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
36022 <option>return_path_on_delivery</option> to the log selector.
36023 </para>
36024 <para>
36025 <indexterm role="variable">
36026 <primary><varname>$return_path</varname></primary>
36027 </indexterm>
36028 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
36029 either the message&#x2019;s envelope sender, or an address set by the
36030 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
36031 replacement occurs; if it fails for another reason, delivery is deferred. This
36032 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
36033 section <xref linkend="SECTverp"/>.
36034 </para>
36035 <para>
36036 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
36037 remote server rejects a message at SMTP time, the bounce message is not sent to
36038 the value of this option. It is sent to the previously set errors address.
36039 This defaults to the incoming sender address, but can be changed by setting
36040 <option>errors_to</option> in a router.
36041 </para>
36042 <para>
36043 <indexterm role="option">
36044 <primary><option>return_path_add</option></primary>
36045 </indexterm>
36046 </para>
36047 <informaltable frame="all">
36048 <tgroup cols="4" colsep="0" rowsep="0">
36049 <colspec colwidth="8*" align="left"/>
36050 <colspec colwidth="6*" align="center"/>
36051 <colspec colwidth="6*" align="center"/>
36052 <colspec colwidth="6*" align="right"/>
36053 <tbody>
36054 <row>
36055 <entry><option>return_path_add</option></entry>
36056 <entry>Use: <emphasis>transports</emphasis></entry>
36057 <entry>Type: <emphasis>boolean</emphasis></entry>
36058 <entry>Default: <emphasis>false</emphasis></entry>
36059 </row>
36060 </tbody>
36061 </tgroup>
36062 </informaltable>
36063 <para>
36064 <indexterm role="concept">
36065 <primary><emphasis>Return-path:</emphasis> header line</primary>
36066 </indexterm>
36067 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
36068 Although the return path is normally available in the prefix line of BSD
36069 mailboxes, this is commonly not displayed by MUAs, and so the user does not
36070 have easy access to it.
36071 </para>
36072 <para>
36073 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
36074 the delivery SMTP server makes the final delivery</quote>. This implies that this
36075 header should not be present in incoming messages. Exim has a configuration
36076 option, <option>return_path_remove</option>, which requests removal of this header from
36077 incoming messages, so that delivered messages can safely be resent to other
36078 recipients.
36079 </para>
36080 <para>
36081 <indexterm role="option">
36082 <primary><option>shadow_condition</option></primary>
36083 </indexterm>
36084 </para>
36085 <informaltable frame="all">
36086 <tgroup cols="4" colsep="0" rowsep="0">
36087 <colspec colwidth="8*" align="left"/>
36088 <colspec colwidth="6*" align="center"/>
36089 <colspec colwidth="6*" align="center"/>
36090 <colspec colwidth="6*" align="right"/>
36091 <tbody>
36092 <row>
36093 <entry><option>shadow_condition</option></entry>
36094 <entry>Use: <emphasis>transports</emphasis></entry>
36095 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36096 <entry>Default: <emphasis>unset</emphasis></entry>
36097 </row>
36098 </tbody>
36099 </tgroup>
36100 </informaltable>
36101 <para>
36102 See <option>shadow_transport</option> below.
36103 </para>
36104 <para>
36105 <indexterm role="option">
36106 <primary><option>shadow_transport</option></primary>
36107 </indexterm>
36108 </para>
36109 <informaltable frame="all">
36110 <tgroup cols="4" colsep="0" rowsep="0">
36111 <colspec colwidth="8*" align="left"/>
36112 <colspec colwidth="6*" align="center"/>
36113 <colspec colwidth="6*" align="center"/>
36114 <colspec colwidth="6*" align="right"/>
36115 <tbody>
36116 <row>
36117 <entry><option>shadow_transport</option></entry>
36118 <entry>Use: <emphasis>transports</emphasis></entry>
36119 <entry>Type: <emphasis>string</emphasis></entry>
36120 <entry>Default: <emphasis>unset</emphasis></entry>
36121 </row>
36122 </tbody>
36123 </tgroup>
36124 </informaltable>
36125 <para>
36126 <indexterm role="concept">
36127 <primary>shadow transport</primary>
36128 </indexterm>
36129 <indexterm role="concept">
36130 <primary>transport</primary>
36131 <secondary>shadow</secondary>
36132 </indexterm>
36133 A local transport may set the <option>shadow_transport</option> option to the name of
36134 another local transport. Shadow remote transports are not supported.
36135 </para>
36136 <para>
36137 Whenever a delivery to the main transport succeeds, and either
36138 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
36139 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
36140 passed to the shadow transport, with the same delivery address or addresses. If
36141 expansion fails, no action is taken except that non-forced expansion failures
36142 cause a log line to be written.
36143 </para>
36144 <para>
36145 The result of the shadow transport is discarded and does not affect the
36146 subsequent processing of the message. Only a single level of shadowing is
36147 provided; the <option>shadow_transport</option> option is ignored on any transport when it
36148 is running as a shadow. Options concerned with output from pipes are also
36149 ignored. The log line for the successful delivery has an item added on the end,
36150 of the form
36151 </para>
36152 <literallayout class="monospaced">
36153 ST=&lt;shadow transport name&gt;
36154 </literallayout>
36155 <para>
36156 If the shadow transport did not succeed, the error message is put in
36157 parentheses afterwards. Shadow transports can be used for a number of different
36158 purposes, including keeping more detailed log information than Exim normally
36159 provides, and implementing automatic acknowledgment policies based on message
36160 headers that some sites insist on.
36161 </para>
36162 <para>
36163 <indexterm role="option">
36164 <primary><option>transport_filter</option></primary>
36165 </indexterm>
36166 </para>
36167 <informaltable frame="all">
36168 <tgroup cols="4" colsep="0" rowsep="0">
36169 <colspec colwidth="8*" align="left"/>
36170 <colspec colwidth="6*" align="center"/>
36171 <colspec colwidth="6*" align="center"/>
36172 <colspec colwidth="6*" align="right"/>
36173 <tbody>
36174 <row>
36175 <entry><option>transport_filter</option></entry>
36176 <entry>Use: <emphasis>transports</emphasis></entry>
36177 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36178 <entry>Default: <emphasis>unset</emphasis></entry>
36179 </row>
36180 </tbody>
36181 </tgroup>
36182 </informaltable>
36183 <para>
36184 <indexterm role="concept">
36185 <primary>transport</primary>
36186 <secondary>filter</secondary>
36187 </indexterm>
36188 <indexterm role="concept">
36189 <primary>filter</primary>
36190 <secondary>transport filter</secondary>
36191 </indexterm>
36192 This option sets up a filtering (in the Unix shell sense) process for messages
36193 at transport time. It should not be confused with mail filtering as set up by
36194 individual users or via a system filter.
36195 </para>
36196 <para>
36197 When the message is about to be written out, the command specified by
36198 <option>transport_filter</option> is started up in a separate, parallel process, and
36199 the entire message, including the header lines, is passed to it on its standard
36200 input (this in fact is done from a third process, to avoid deadlock). The
36201 command must be specified as an absolute path.
36202 </para>
36203 <para>
36204 The lines of the message that are written to the transport filter are
36205 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
36206 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
36207 lines beginning with a dot, and also before any processing implied by the
36208 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
36209 <command>pipe</command> transports.
36210 </para>
36211 <para>
36212 The standard error for the filter process is set to the same destination as its
36213 standard output; this is read and written to the message&#x2019;s ultimate
36214 destination. The process that writes the message to the filter, the
36215 filter itself, and the original process that reads the result and delivers it
36216 are all run in parallel, like a shell pipeline.
36217 </para>
36218 <para>
36219 The filter can perform any transformations it likes, but of course should take
36220 care not to break RFC 2822 syntax. A demonstration Perl script is provided in
36221 <filename>util/transport-filter.pl</filename>; this makes a few arbitrary modifications just to
36222 show the possibilities. Exim does not check the result, except to test for a
36223 final newline when SMTP is in use. All messages transmitted over SMTP must end
36224 with a newline, so Exim supplies one if it is missing.
36225 </para>
36226 <para>
36227 <indexterm role="concept">
36228 <primary>content scanning</primary>
36229 <secondary>per user</secondary>
36230 </indexterm>
36231 A transport filter can be used to provide content-scanning on a per-user basis
36232 at delivery time if the only required effect of the scan is to modify the
36233 message. For example, a content scan could insert a new header line containing
36234 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
36235 not possible to discard a message at this stage.
36236 </para>
36237 <para>
36238 <indexterm role="concept">
36239 <primary>SMTP</primary>
36240 <secondary>SIZE</secondary>
36241 </indexterm>
36242 A problem might arise if the filter increases the size of a message that is
36243 being sent down an SMTP connection. If the receiving SMTP server has indicated
36244 support for the SIZE parameter, Exim will have sent the size of the message
36245 at the start of the SMTP session. If what is actually sent is substantially
36246 more, the server might reject the message. This can be worked round by setting
36247 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
36248 additions to the message, or to disable the use of SIZE altogether.
36249 </para>
36250 <para>
36251 <indexterm role="variable">
36252 <primary><varname>$pipe_addresses</varname></primary>
36253 </indexterm>
36254 The value of the <option>transport_filter</option> option is the command string for starting
36255 the filter, which is run directly from Exim, not under a shell. The string is
36256 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
36257 Exim breaks it up into arguments and then expands each argument separately (see
36258 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
36259 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
36260 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
36261 an ideal name for this feature here, but as it was already implemented for the
36262 <command>pipe</command> transport, it seemed sensible not to change it.)
36263 </para>
36264 <para>
36265 <indexterm role="variable">
36266 <primary><varname>$host</varname></primary>
36267 </indexterm>
36268 <indexterm role="variable">
36269 <primary><varname>$host_address</varname></primary>
36270 </indexterm>
36271 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
36272 transport is a remote one. They contain the name and IP address of the host to
36273 which the message is being sent. For example:
36274 </para>
36275 <literallayout class="monospaced">
36276 transport_filter = /some/directory/transport-filter.pl \
36277   $host $host_address $sender_address $pipe_addresses
36278 </literallayout>
36279 <para>
36280 Two problems arise if you want to use more complicated expansion items to
36281 generate transport filter commands, both of which due to the fact that the
36282 command is split up <emphasis>before</emphasis> expansion.
36283 </para>
36284 <itemizedlist>
36285 <listitem>
36286 <para>
36287 If an expansion item contains white space, you must quote it, so that it is all
36288 part of the same command item. If the entire option setting is one such
36289 expansion item, you have to take care what kind of quoting you use. For
36290 example:
36291 </para>
36292 <literallayout class="monospaced">
36293 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
36294 </literallayout>
36295 <para>
36296 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
36297 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
36298 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
36299 the single quotes were missing, the line would be split into two items,
36300 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
36301 Exim tried to expand the first one.
36302 </para>
36303 </listitem>
36304 <listitem>
36305 <para>
36306 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
36307 expansion cannot generate multiple arguments, or a command name followed by
36308 arguments. Consider this example:
36309 </para>
36310 <literallayout class="monospaced">
36311 transport_filter = ${lookup{$host}lsearch{/a/file}\
36312                     {$value}{/bin/cat}}
36313 </literallayout>
36314 <para>
36315 The result of the lookup is interpreted as the name of the command, even
36316 if it contains white space. The simplest way round this is to use a shell:
36317 </para>
36318 <literallayout class="monospaced">
36319 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
36320                                {$value}{/bin/cat}}
36321 </literallayout>
36322 </listitem>
36323 </itemizedlist>
36324 <para>
36325 The filter process is run under the same uid and gid as the normal delivery.
36326 For remote deliveries this is the Exim uid/gid by default. The command should
36327 normally yield a zero return code. Transport filters are not supposed to fail.
36328 A non-zero code is taken to mean that the transport filter encountered some
36329 serious problem. Delivery of the message is deferred; the message remains on
36330 the queue and is tried again later. It is not possible to cause a message to be
36331 bounced from a transport filter.
36332 </para>
36333 <para>
36334 If a transport filter is set on an autoreply transport, the original message is
36335 passed through the filter as it is being copied into the newly generated
36336 message, which happens if the <option>return_message</option> option is set.
36337 </para>
36338 <para>
36339 <indexterm role="option">
36340 <primary><option>transport_filter_timeout</option></primary>
36341 </indexterm>
36342 </para>
36343 <informaltable frame="all">
36344 <tgroup cols="4" colsep="0" rowsep="0">
36345 <colspec colwidth="8*" align="left"/>
36346 <colspec colwidth="6*" align="center"/>
36347 <colspec colwidth="6*" align="center"/>
36348 <colspec colwidth="6*" align="right"/>
36349 <tbody>
36350 <row>
36351 <entry><option>transport_filter_timeout</option></entry>
36352 <entry>Use: <emphasis>transports</emphasis></entry>
36353 <entry>Type: <emphasis>time</emphasis></entry>
36354 <entry>Default: <emphasis>5m</emphasis></entry>
36355 </row>
36356 </tbody>
36357 </tgroup>
36358 </informaltable>
36359 <para>
36360 <indexterm role="concept">
36361 <primary>transport</primary>
36362 <secondary>filter, timeout</secondary>
36363 </indexterm>
36364 When Exim is reading the output of a transport filter, it a applies a timeout
36365 that can be set by this option. Exceeding the timeout is normally treated as a
36366 temporary delivery failure. However, if a transport filter is used with a
36367 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
36368 way as a timeout in the pipe command itself. By default, a timeout is a hard
36369 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
36370 becomes a temporary error.
36371 </para>
36372 <para>
36373 <indexterm role="option">
36374 <primary><option>user</option></primary>
36375 </indexterm>
36376 </para>
36377 <informaltable frame="all">
36378 <tgroup cols="4" colsep="0" rowsep="0">
36379 <colspec colwidth="8*" align="left"/>
36380 <colspec colwidth="6*" align="center"/>
36381 <colspec colwidth="6*" align="center"/>
36382 <colspec colwidth="6*" align="right"/>
36383 <tbody>
36384 <row>
36385 <entry><option>user</option></entry>
36386 <entry>Use: <emphasis>transports</emphasis></entry>
36387 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36388 <entry>Default: <emphasis>Exim user</emphasis></entry>
36389 </row>
36390 </tbody>
36391 </tgroup>
36392 </informaltable>
36393 <para>
36394 <indexterm role="concept">
36395 <primary>uid (user id)</primary>
36396 <secondary>local delivery</secondary>
36397 </indexterm>
36398 <indexterm role="concept">
36399 <primary>transport</primary>
36400 <secondary>user, specifying</secondary>
36401 </indexterm>
36402 This option specifies the user under whose uid the delivery process is to be
36403 run, overriding any uid that may have been set by the router. If the user is
36404 given as a name, the uid is looked up from the password data, and the
36405 associated group is taken as the value of the gid to be used if the <option>group</option>
36406 option is not set.
36407 </para>
36408 <para>
36409 For deliveries that use local transports, a user and group are normally
36410 specified explicitly or implicitly (for example, as a result of
36411 <option>check_local_user</option>) by the router or transport.
36412 </para>
36413 <para>
36414 <indexterm role="concept">
36415 <primary>hints database</primary>
36416 <secondary>access by remote transport</secondary>
36417 </indexterm>
36418 For remote transports, you should leave this option unset unless you really are
36419 sure you know what you are doing. When a remote transport is running, it needs
36420 to be able to access Exim&#x2019;s hints databases, because each host may have its own
36421 retry data.
36422 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
36423 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
36424 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
36425 </para>
36426 </chapter>
36427
36428 <chapter id="CHAPbatching">
36429 <title>Address batching in local transports</title>
36430 <titleabbrev>Address batching</titleabbrev>
36431 <para>
36432 <indexterm role="concept">
36433 <primary>transport</primary>
36434 <secondary>local; address batching in</secondary>
36435 </indexterm>
36436 The only remote transport (<command>smtp</command>) is normally configured to handle more than
36437 one address at a time, so that when several addresses are routed to the same
36438 remote host, just one copy of the message is sent. Local transports, however,
36439 normally handle one address at a time. That is, a separate instance of the
36440 transport is run for each address that is routed to the transport. A separate
36441 copy of the message is delivered each time.
36442 </para>
36443 <para>
36444 <indexterm role="concept">
36445 <primary>batched local delivery</primary>
36446 </indexterm>
36447 <indexterm role="option">
36448 <primary><option>batch_max</option></primary>
36449 </indexterm>
36450 <indexterm role="option">
36451 <primary><option>batch_id</option></primary>
36452 </indexterm>
36453 In special cases, it may be desirable to handle several addresses at once in a
36454 local transport, for example:
36455 </para>
36456 <itemizedlist>
36457 <listitem>
36458 <para>
36459 In an <command>appendfile</command> transport, when storing messages in files for later
36460 delivery by some other means, a single copy of the message with multiple
36461 recipients saves space.
36462 </para>
36463 </listitem>
36464 <listitem>
36465 <para>
36466 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
36467 a single copy saves time, and is the normal way LMTP is expected to work.
36468 </para>
36469 </listitem>
36470 <listitem>
36471 <para>
36472 In a <command>pipe</command> transport, when passing the message
36473 to a scanner program or
36474 to some other delivery mechanism such as UUCP, multiple recipients may be
36475 acceptable.
36476 </para>
36477 </listitem>
36478 </itemizedlist>
36479 <para>
36480 These three local transports all have the same options for controlling multiple
36481 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
36482 repeating the information for each transport, these options are described here.
36483 </para>
36484 <para>
36485 The <option>batch_max</option> option specifies the maximum number of addresses that can be
36486 delivered together in a single run of the transport. Its default value is one
36487 (no batching). When more than one address is routed to a transport that has a
36488 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
36489 (that is, in a single run of the transport with multiple recipients), subject
36490 to certain conditions:
36491 </para>
36492 <itemizedlist>
36493 <listitem>
36494 <para>
36495 <indexterm role="variable">
36496 <primary><varname>$local_part</varname></primary>
36497 </indexterm>
36498 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
36499 batching is possible.
36500 </para>
36501 </listitem>
36502 <listitem>
36503 <para>
36504 <indexterm role="variable">
36505 <primary><varname>$domain</varname></primary>
36506 </indexterm>
36507 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
36508 addresses with the same domain are batched.
36509 </para>
36510 </listitem>
36511 <listitem>
36512 <para>
36513 <indexterm role="concept">
36514 <primary>customizing</primary>
36515 <secondary>batching condition</secondary>
36516 </indexterm>
36517 If <option>batch_id</option> is set, it is expanded for each address, and only those
36518 addresses with the same expanded value are batched. This allows you to specify
36519 customized batching conditions. Failure of the expansion for any reason,
36520 including forced failure, disables batching, but it does not stop the delivery
36521 from taking place.
36522 </para>
36523 </listitem>
36524 <listitem>
36525 <para>
36526 Batched addresses must also have the same errors address (where to send
36527 delivery errors), the same header additions and removals, the same user and
36528 group for the transport, and if a host list is present, the first host must
36529 be the same.
36530 </para>
36531 </listitem>
36532 </itemizedlist>
36533 <para>
36534 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
36535 both when the file or pipe command is specified in the transport, and when it
36536 is specified by a <command>redirect</command> router, but all the batched addresses must of
36537 course be routed to the same file or pipe command. These two transports have an
36538 option called <option>use_bsmtp</option>, which causes them to deliver the message in
36539 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
36540 <option>check_string</option> and <option>escape_string</option> options are forced to the values
36541 </para>
36542 <literallayout class="monospaced">
36543 check_string = "."
36544 escape_string = ".."
36545 </literallayout>
36546 <para>
36547 when batched SMTP is in use. A full description of the batch SMTP mechanism is
36548 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
36549 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
36550 </para>
36551 <para>
36552 <indexterm role="concept">
36553 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36554 </indexterm>
36555 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
36556 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
36557 that are being processed together. If you are using a batching <command>appendfile</command>
36558 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
36559 addresses is to set the <option>envelope_to_add</option> option.
36560 </para>
36561 <para>
36562 <indexterm role="concept">
36563 <primary><command>pipe</command> transport</primary>
36564 <secondary>with multiple addresses</secondary>
36565 </indexterm>
36566 <indexterm role="variable">
36567 <primary><varname>$pipe_addresses</varname></primary>
36568 </indexterm>
36569 If you are using a <command>pipe</command> transport without BSMTP, and setting the
36570 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
36571 the command. This is not a true variable; it is a bit of magic that causes each
36572 of the recipient addresses to be inserted into the command as a separate
36573 argument. This provides a way of accessing all the addresses that are being
36574 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
36575 are specified by a <command>redirect</command> router.
36576 </para>
36577 </chapter>
36578
36579 <chapter id="CHAPappendfile">
36580 <title>The appendfile transport</title>
36581 <para>
36582 <indexterm role="concept" id="IIDapptra1" class="startofrange">
36583 <primary><command>appendfile</command> transport</primary>
36584 </indexterm>
36585 <indexterm role="concept" id="IIDapptra2" class="startofrange">
36586 <primary>transports</primary>
36587 <secondary><command>appendfile</command></secondary>
36588 </indexterm>
36589 <indexterm role="concept">
36590 <primary>directory creation</primary>
36591 </indexterm>
36592 <indexterm role="concept">
36593 <primary>creating directories</primary>
36594 </indexterm>
36595 The <command>appendfile</command> transport delivers a message by appending it to an existing
36596 file, or by creating an entirely new file in a specified directory. Single
36597 files to which messages are appended can be in the traditional Unix mailbox
36598 format, or optionally in the MBX format supported by the Pine MUA and
36599 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
36600 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
36601 to give added protection against failures that happen part-way through the
36602 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
36603 supported. For all file formats, Exim attempts to create as many levels of
36604 directory as necessary, provided that <option>create_directory</option> is set.
36605 </para>
36606 <para>
36607 The code for the optional formats is not included in the Exim binary by
36608 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
36609 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
36610 included.
36611 </para>
36612 <para>
36613 <indexterm role="concept">
36614 <primary>quota</primary>
36615 <secondary>system</secondary>
36616 </indexterm>
36617 Exim recognizes system quota errors, and generates an appropriate message. Exim
36618 also supports its own quota control within the transport, for use when the
36619 system facility is unavailable or cannot be used for some reason.
36620 </para>
36621 <para>
36622 If there is an error while appending to a file (for example, quota exceeded or
36623 partition filled), Exim attempts to reset the file&#x2019;s length and last
36624 modification time back to what they were before. If there is an error while
36625 creating an entirely new file, the new file is removed.
36626 </para>
36627 <para>
36628 Before appending to a file, a number of security checks are made, and the
36629 file is locked. A detailed description is given below, after the list of
36630 private options.
36631 </para>
36632 <para>
36633 The <command>appendfile</command> transport is most commonly used for local deliveries to
36634 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
36635 putting messages into files for remote delivery by some means other than Exim.
36636 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
36637 option).
36638 </para>
36639 <section id="SECTfildiropt">
36640 <title>The file and directory options</title>
36641 <para>
36642 The <option>file</option> option specifies a single file, to which the message is appended;
36643 the <option>directory</option> option specifies a directory, in which a new file containing
36644 the message is created. Only one of these two options can be set, and for
36645 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
36646 </para>
36647 <para>
36648 <indexterm role="variable">
36649 <primary><varname>$address_file</varname></primary>
36650 </indexterm>
36651 <indexterm role="variable">
36652 <primary><varname>$local_part</varname></primary>
36653 </indexterm>
36654 However, <command>appendfile</command> is also used for delivering messages to files or
36655 directories whose names (or parts of names) are obtained from alias,
36656 forwarding, or filtering operations (for example, a <option>save</option> command in a
36657 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
36658 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
36659 name (or partial name) of the file or directory generated by the redirection
36660 operation. There are two cases:
36661 </para>
36662 <itemizedlist>
36663 <listitem>
36664 <para>
36665 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
36666 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
36667 common case when users with local accounts use filtering to sort mail into
36668 different folders. See for example, the <command>address_file</command> transport in the
36669 default configuration. If the path ends with a slash, it is assumed to be the
36670 name of a directory. A delivery to a directory can also be forced by setting
36671 <option>maildir_format</option> or <option>mailstore_format</option>.
36672 </para>
36673 </listitem>
36674 <listitem>
36675 <para>
36676 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
36677 used to determine the file or directory name for the delivery. Normally, the
36678 contents of <varname>$address_file</varname> are used in some way in the string expansion.
36679 </para>
36680 </listitem>
36681 </itemizedlist>
36682 <para>
36683 <indexterm role="concept">
36684 <primary>Sieve filter</primary>
36685 <secondary>configuring <command>appendfile</command></secondary>
36686 </indexterm>
36687 <indexterm role="concept">
36688 <primary>Sieve filter</primary>
36689 <secondary>relative mailbox path handling</secondary>
36690 </indexterm>
36691 As an example of the second case, consider an environment where users do not
36692 have home directories. They may be permitted to use Exim filter commands of the
36693 form:
36694 </para>
36695 <literallayout class="monospaced">
36696 save folder23
36697 </literallayout>
36698 <para>
36699 or Sieve filter commands of the form:
36700 </para>
36701 <literallayout class="monospaced">
36702 require "fileinto";
36703 fileinto "folder23";
36704 </literallayout>
36705 <para>
36706 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
36707 must transform the relative path into an appropriate absolute file name. In the
36708 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
36709 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
36710 way of handling this requirement:
36711 </para>
36712 <literallayout class="monospaced">
36713 file = ${if eq{$address_file}{inbox} \
36714             {/var/mail/$local_part} \
36715             {${if eq{${substr_0_1:$address_file}}{/} \
36716                   {$address_file} \
36717                   {$home/mail/$address_file} \
36718             }} \
36719        }
36720 </literallayout>
36721 <para>
36722 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
36723 location, absolute paths are used without change, and other folders are in the
36724 <filename>mail</filename> directory within the home directory.
36725 </para>
36726 <para>
36727 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
36728 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
36729 the router. In particular, this is the case if <option>check_local_user</option> is set. If
36730 you want to prevent this happening at routing time, you can set
36731 <option>router_home_directory</option> empty. This forces the router to pass the relative
36732 path to the transport.
36733 </para>
36734 <para>
36735 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
36736 the <option>file</option> or <option>directory</option> option is still used if it is set.
36737 </para>
36738 </section>
36739 <section id="SECID134">
36740 <title>Private options for appendfile</title>
36741 <para>
36742 <indexterm role="concept">
36743 <primary>options</primary>
36744 <secondary><command>appendfile</command> transport</secondary>
36745 </indexterm>
36746 </para>
36747 <para>
36748 <indexterm role="option">
36749 <primary><option>allow_fifo</option></primary>
36750 </indexterm>
36751 </para>
36752 <informaltable frame="all">
36753 <tgroup cols="4" colsep="0" rowsep="0">
36754 <colspec colwidth="8*" align="left"/>
36755 <colspec colwidth="6*" align="center"/>
36756 <colspec colwidth="6*" align="center"/>
36757 <colspec colwidth="6*" align="right"/>
36758 <tbody>
36759 <row>
36760 <entry><option>allow_fifo</option></entry>
36761 <entry>Use: <emphasis>appendfile</emphasis></entry>
36762 <entry>Type: <emphasis>boolean</emphasis></entry>
36763 <entry>Default: <emphasis>false</emphasis></entry>
36764 </row>
36765 </tbody>
36766 </tgroup>
36767 </informaltable>
36768 <para>
36769 <indexterm role="concept">
36770 <primary>fifo (named pipe)</primary>
36771 </indexterm>
36772 <indexterm role="concept">
36773 <primary>named pipe (fifo)</primary>
36774 </indexterm>
36775 <indexterm role="concept">
36776 <primary>pipe</primary>
36777 <secondary>named (fifo)</secondary>
36778 </indexterm>
36779 Setting this option permits delivery to named pipes (FIFOs) as well as to
36780 regular files. If no process is reading the named pipe at delivery time, the
36781 delivery is deferred.
36782 </para>
36783 <para>
36784 <indexterm role="option">
36785 <primary><option>allow_symlink</option></primary>
36786 </indexterm>
36787 </para>
36788 <informaltable frame="all">
36789 <tgroup cols="4" colsep="0" rowsep="0">
36790 <colspec colwidth="8*" align="left"/>
36791 <colspec colwidth="6*" align="center"/>
36792 <colspec colwidth="6*" align="center"/>
36793 <colspec colwidth="6*" align="right"/>
36794 <tbody>
36795 <row>
36796 <entry><option>allow_symlink</option></entry>
36797 <entry>Use: <emphasis>appendfile</emphasis></entry>
36798 <entry>Type: <emphasis>boolean</emphasis></entry>
36799 <entry>Default: <emphasis>false</emphasis></entry>
36800 </row>
36801 </tbody>
36802 </tgroup>
36803 </informaltable>
36804 <para>
36805 <indexterm role="concept">
36806 <primary>symbolic link</primary>
36807 <secondary>to mailbox</secondary>
36808 </indexterm>
36809 <indexterm role="concept">
36810 <primary>mailbox</primary>
36811 <secondary>symbolic link</secondary>
36812 </indexterm>
36813 By default, <command>appendfile</command> will not deliver if the path name for the file is
36814 that of a symbolic link. Setting this option relaxes that constraint, but there
36815 are security issues involved in the use of symbolic links. Be sure you know
36816 what you are doing if you set this. Details of exactly what this option affects
36817 are included in the discussion which follows this list of options.
36818 </para>
36819 <para>
36820 <indexterm role="option">
36821 <primary><option>batch_id</option></primary>
36822 </indexterm>
36823 </para>
36824 <informaltable frame="all">
36825 <tgroup cols="4" colsep="0" rowsep="0">
36826 <colspec colwidth="8*" align="left"/>
36827 <colspec colwidth="6*" align="center"/>
36828 <colspec colwidth="6*" align="center"/>
36829 <colspec colwidth="6*" align="right"/>
36830 <tbody>
36831 <row>
36832 <entry><option>batch_id</option></entry>
36833 <entry>Use: <emphasis>appendfile</emphasis></entry>
36834 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36835 <entry>Default: <emphasis>unset</emphasis></entry>
36836 </row>
36837 </tbody>
36838 </tgroup>
36839 </informaltable>
36840 <para>
36841 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36842 However, batching is automatically disabled for <command>appendfile</command> deliveries that
36843 happen as a result of forwarding or aliasing or other redirection directly to a
36844 file.
36845 </para>
36846 <para>
36847 <indexterm role="option">
36848 <primary><option>batch_max</option></primary>
36849 </indexterm>
36850 </para>
36851 <informaltable frame="all">
36852 <tgroup cols="4" colsep="0" rowsep="0">
36853 <colspec colwidth="8*" align="left"/>
36854 <colspec colwidth="6*" align="center"/>
36855 <colspec colwidth="6*" align="center"/>
36856 <colspec colwidth="6*" align="right"/>
36857 <tbody>
36858 <row>
36859 <entry><option>batch_max</option></entry>
36860 <entry>Use: <emphasis>appendfile</emphasis></entry>
36861 <entry>Type: <emphasis>integer</emphasis></entry>
36862 <entry>Default: <emphasis>1</emphasis></entry>
36863 </row>
36864 </tbody>
36865 </tgroup>
36866 </informaltable>
36867 <para>
36868 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36869 </para>
36870 <para>
36871 <indexterm role="option">
36872 <primary><option>check_group</option></primary>
36873 </indexterm>
36874 </para>
36875 <informaltable frame="all">
36876 <tgroup cols="4" colsep="0" rowsep="0">
36877 <colspec colwidth="8*" align="left"/>
36878 <colspec colwidth="6*" align="center"/>
36879 <colspec colwidth="6*" align="center"/>
36880 <colspec colwidth="6*" align="right"/>
36881 <tbody>
36882 <row>
36883 <entry><option>check_group</option></entry>
36884 <entry>Use: <emphasis>appendfile</emphasis></entry>
36885 <entry>Type: <emphasis>boolean</emphasis></entry>
36886 <entry>Default: <emphasis>false</emphasis></entry>
36887 </row>
36888 </tbody>
36889 </tgroup>
36890 </informaltable>
36891 <para>
36892 When this option is set, the group owner of the file defined by the <option>file</option>
36893 option is checked to see that it is the same as the group under which the
36894 delivery process is running. The default setting is false because the default
36895 file mode is 0600, which means that the group is irrelevant.
36896 </para>
36897 <para>
36898 <indexterm role="option">
36899 <primary><option>check_owner</option></primary>
36900 </indexterm>
36901 </para>
36902 <informaltable frame="all">
36903 <tgroup cols="4" colsep="0" rowsep="0">
36904 <colspec colwidth="8*" align="left"/>
36905 <colspec colwidth="6*" align="center"/>
36906 <colspec colwidth="6*" align="center"/>
36907 <colspec colwidth="6*" align="right"/>
36908 <tbody>
36909 <row>
36910 <entry><option>check_owner</option></entry>
36911 <entry>Use: <emphasis>appendfile</emphasis></entry>
36912 <entry>Type: <emphasis>boolean</emphasis></entry>
36913 <entry>Default: <emphasis>true</emphasis></entry>
36914 </row>
36915 </tbody>
36916 </tgroup>
36917 </informaltable>
36918 <para>
36919 When this option is set, the owner of the file defined by the <option>file</option> option
36920 is checked to ensure that it is the same as the user under which the delivery
36921 process is running.
36922 </para>
36923 <para>
36924 <indexterm role="option">
36925 <primary><option>check_string</option></primary>
36926 </indexterm>
36927 </para>
36928 <informaltable frame="all">
36929 <tgroup cols="4" colsep="0" rowsep="0">
36930 <colspec colwidth="8*" align="left"/>
36931 <colspec colwidth="6*" align="center"/>
36932 <colspec colwidth="6*" align="center"/>
36933 <colspec colwidth="6*" align="right"/>
36934 <tbody>
36935 <row>
36936 <entry><option>check_string</option></entry>
36937 <entry>Use: <emphasis>appendfile</emphasis></entry>
36938 <entry>Type: <emphasis>string</emphasis></entry>
36939 <entry>Default: <emphasis>see below</emphasis></entry>
36940 </row>
36941 </tbody>
36942 </tgroup>
36943 </informaltable>
36944 <para>
36945 <indexterm role="concept">
36946 <primary><quote>From</quote> line</primary>
36947 </indexterm>
36948 As <command>appendfile</command> writes the message, the start of each line is tested for
36949 matching <option>check_string</option>, and if it does, the initial matching characters are
36950 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
36951 a literal string, not a regular expression, and the case of any letters it
36952 contains is significant.
36953 </para>
36954 <para>
36955 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
36956 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
36957 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
36958 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
36959 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
36960 </para>
36961 <para>
36962 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
36963 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
36964 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
36965 if another format is used. For example, to deliver to mailboxes in MMDF format:
36966 <indexterm role="concept">
36967 <primary>MMDF format mailbox</primary>
36968 </indexterm>
36969 <indexterm role="concept">
36970 <primary>mailbox</primary>
36971 <secondary>MMDF format</secondary>
36972 </indexterm>
36973 </para>
36974 <literallayout class="monospaced">
36975 check_string = "\1\1\1\1\n"
36976 escape_string = "\1\1\1\1 \n"
36977 message_prefix = "\1\1\1\1\n"
36978 message_suffix = "\1\1\1\1\n"
36979 </literallayout>
36980 <para>
36981 <indexterm role="option">
36982 <primary><option>create_directory</option></primary>
36983 </indexterm>
36984 </para>
36985 <informaltable frame="all">
36986 <tgroup cols="4" colsep="0" rowsep="0">
36987 <colspec colwidth="8*" align="left"/>
36988 <colspec colwidth="6*" align="center"/>
36989 <colspec colwidth="6*" align="center"/>
36990 <colspec colwidth="6*" align="right"/>
36991 <tbody>
36992 <row>
36993 <entry><option>create_directory</option></entry>
36994 <entry>Use: <emphasis>appendfile</emphasis></entry>
36995 <entry>Type: <emphasis>boolean</emphasis></entry>
36996 <entry>Default: <emphasis>true</emphasis></entry>
36997 </row>
36998 </tbody>
36999 </tgroup>
37000 </informaltable>
37001 <para>
37002 <indexterm role="concept">
37003 <primary>directory creation</primary>
37004 </indexterm>
37005 When this option is true, Exim attempts to create any missing superior
37006 directories for the file that it is about to write. A created directory&#x2019;s mode
37007 is given by the <option>directory_mode</option> option.
37008 </para>
37009 <para>
37010 The group ownership of a newly created directory is highly dependent on the
37011 operating system (and possibly the file system) that is being used. For
37012 example, in Solaris, if the parent directory has the setgid bit set, its group
37013 is propagated to the child; if not, the currently set group is used. However,
37014 in FreeBSD, the parent&#x2019;s group is always used.
37015 </para>
37016 <para>
37017 <indexterm role="option">
37018 <primary><option>create_file</option></primary>
37019 </indexterm>
37020 </para>
37021 <informaltable frame="all">
37022 <tgroup cols="4" colsep="0" rowsep="0">
37023 <colspec colwidth="8*" align="left"/>
37024 <colspec colwidth="6*" align="center"/>
37025 <colspec colwidth="6*" align="center"/>
37026 <colspec colwidth="6*" align="right"/>
37027 <tbody>
37028 <row>
37029 <entry><option>create_file</option></entry>
37030 <entry>Use: <emphasis>appendfile</emphasis></entry>
37031 <entry>Type: <emphasis>string</emphasis></entry>
37032 <entry>Default: <emphasis>anywhere</emphasis></entry>
37033 </row>
37034 </tbody>
37035 </tgroup>
37036 </informaltable>
37037 <para>
37038 This option constrains the location of files and directories that are created
37039 by this transport. It applies to files defined by the <option>file</option> option and
37040 directories defined by the <option>directory</option> option. In the case of maildir
37041 delivery, it applies to the top level directory, not the maildir directories
37042 beneath.
37043 </para>
37044 <para>
37045 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
37046 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
37047 set for the transport. This option is not useful when an explicit file name is
37048 given for normal mailbox deliveries. It is intended for the case when file
37049 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
37050 by an <command>appendfile</command> transport called <option>address_file</option>. See also
37051 <option>file_must_exist</option>.
37052 </para>
37053 <para>
37054 <indexterm role="option">
37055 <primary><option>directory</option></primary>
37056 </indexterm>
37057 </para>
37058 <informaltable frame="all">
37059 <tgroup cols="4" colsep="0" rowsep="0">
37060 <colspec colwidth="8*" align="left"/>
37061 <colspec colwidth="6*" align="center"/>
37062 <colspec colwidth="6*" align="center"/>
37063 <colspec colwidth="6*" align="right"/>
37064 <tbody>
37065 <row>
37066 <entry><option>directory</option></entry>
37067 <entry>Use: <emphasis>appendfile</emphasis></entry>
37068 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37069 <entry>Default: <emphasis>unset</emphasis></entry>
37070 </row>
37071 </tbody>
37072 </tgroup>
37073 </informaltable>
37074 <para>
37075 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
37076 or <option>directory</option> must be set, unless the delivery is the direct result of a
37077 redirection (see section <xref linkend="SECTfildiropt"/>).
37078 </para>
37079 <para>
37080 When <option>directory</option> is set, the string is expanded, and the message is delivered
37081 into a new file or files in or below the given directory, instead of being
37082 appended to a single mailbox file. A number of different formats are provided
37083 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
37084 <xref linkend="SECTopdir"/> for further details of this form of delivery.
37085 </para>
37086 <para>
37087 <indexterm role="option">
37088 <primary><option>directory_file</option></primary>
37089 </indexterm>
37090 </para>
37091 <informaltable frame="all">
37092 <tgroup cols="4" colsep="0" rowsep="0">
37093 <colspec colwidth="8*" align="left"/>
37094 <colspec colwidth="6*" align="center"/>
37095 <colspec colwidth="6*" align="center"/>
37096 <colspec colwidth="6*" align="right"/>
37097 <tbody>
37098 <row>
37099 <entry><option>directory_file</option></entry>
37100 <entry>Use: <emphasis>appendfile</emphasis></entry>
37101 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37102 <entry>Default: <emphasis>see below</emphasis></entry>
37103 </row>
37104 </tbody>
37105 </tgroup>
37106 </informaltable>
37107 <para>
37108 <indexterm role="concept">
37109 <primary>base62</primary>
37110 </indexterm>
37111 <indexterm role="variable">
37112 <primary><varname>$inode</varname></primary>
37113 </indexterm>
37114 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
37115 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
37116 whose name is obtained by expanding this string. The default value is:
37117 </para>
37118 <literallayout class="monospaced">
37119 q${base62:$tod_epoch}-$inode
37120 </literallayout>
37121 <para>
37122 This generates a unique name from the current time, in base 62 form, and the
37123 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
37124 option.
37125 </para>
37126 <para>
37127 <indexterm role="option">
37128 <primary><option>directory_mode</option></primary>
37129 </indexterm>
37130 </para>
37131 <informaltable frame="all">
37132 <tgroup cols="4" colsep="0" rowsep="0">
37133 <colspec colwidth="8*" align="left"/>
37134 <colspec colwidth="6*" align="center"/>
37135 <colspec colwidth="6*" align="center"/>
37136 <colspec colwidth="6*" align="right"/>
37137 <tbody>
37138 <row>
37139 <entry><option>directory_mode</option></entry>
37140 <entry>Use: <emphasis>appendfile</emphasis></entry>
37141 <entry>Type: <emphasis>octal integer</emphasis></entry>
37142 <entry>Default: <emphasis>0700</emphasis></entry>
37143 </row>
37144 </tbody>
37145 </tgroup>
37146 </informaltable>
37147 <para>
37148 If <command>appendfile</command> creates any directories as a result of the
37149 <option>create_directory</option> option, their mode is specified by this option.
37150 </para>
37151 <para>
37152 <indexterm role="option">
37153 <primary><option>escape_string</option></primary>
37154 </indexterm>
37155 </para>
37156 <informaltable frame="all">
37157 <tgroup cols="4" colsep="0" rowsep="0">
37158 <colspec colwidth="8*" align="left"/>
37159 <colspec colwidth="6*" align="center"/>
37160 <colspec colwidth="6*" align="center"/>
37161 <colspec colwidth="6*" align="right"/>
37162 <tbody>
37163 <row>
37164 <entry><option>escape_string</option></entry>
37165 <entry>Use: <emphasis>appendfile</emphasis></entry>
37166 <entry>Type: <emphasis>string</emphasis></entry>
37167 <entry>Default: <emphasis>see description</emphasis></entry>
37168 </row>
37169 </tbody>
37170 </tgroup>
37171 </informaltable>
37172 <para>
37173 See <option>check_string</option> above.
37174 </para>
37175 <para>
37176 <indexterm role="option">
37177 <primary><option>file</option></primary>
37178 </indexterm>
37179 </para>
37180 <informaltable frame="all">
37181 <tgroup cols="4" colsep="0" rowsep="0">
37182 <colspec colwidth="8*" align="left"/>
37183 <colspec colwidth="6*" align="center"/>
37184 <colspec colwidth="6*" align="center"/>
37185 <colspec colwidth="6*" align="right"/>
37186 <tbody>
37187 <row>
37188 <entry><option>file</option></entry>
37189 <entry>Use: <emphasis>appendfile</emphasis></entry>
37190 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37191 <entry>Default: <emphasis>unset</emphasis></entry>
37192 </row>
37193 </tbody>
37194 </tgroup>
37195 </informaltable>
37196 <para>
37197 This option is mutually exclusive with the <option>directory</option> option, but one of
37198 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
37199 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
37200 specifies a single file, to which the message is appended. One or more of
37201 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
37202 <option>file</option>.
37203 </para>
37204 <para>
37205 <indexterm role="concept">
37206 <primary>NFS</primary>
37207 <secondary>lock file</secondary>
37208 </indexterm>
37209 <indexterm role="concept">
37210 <primary>locking files</primary>
37211 </indexterm>
37212 <indexterm role="concept">
37213 <primary>lock files</primary>
37214 </indexterm>
37215 If you are using more than one host to deliver over NFS into the same
37216 mailboxes, you should always use lock files.
37217 </para>
37218 <para>
37219 The string value is expanded for each delivery, and must yield an absolute
37220 path. The most common settings of this option are variations on one of these
37221 examples:
37222 </para>
37223 <literallayout class="monospaced">
37224 file = /var/spool/mail/$local_part
37225 file = /home/$local_part/inbox
37226 file = $home/inbox
37227 </literallayout>
37228 <para>
37229 <indexterm role="concept">
37230 <primary><quote>sticky</quote> bit</primary>
37231 </indexterm>
37232 In the first example, all deliveries are done into the same directory. If Exim
37233 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
37234 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
37235 deliveries to be possible, or alternatively the <option>group</option> option can be used to
37236 run the delivery under a group id which has write access to the directory.
37237 </para>
37238 <para>
37239 <indexterm role="option">
37240 <primary><option>file_format</option></primary>
37241 </indexterm>
37242 </para>
37243 <informaltable frame="all">
37244 <tgroup cols="4" colsep="0" rowsep="0">
37245 <colspec colwidth="8*" align="left"/>
37246 <colspec colwidth="6*" align="center"/>
37247 <colspec colwidth="6*" align="center"/>
37248 <colspec colwidth="6*" align="right"/>
37249 <tbody>
37250 <row>
37251 <entry><option>file_format</option></entry>
37252 <entry>Use: <emphasis>appendfile</emphasis></entry>
37253 <entry>Type: <emphasis>string</emphasis></entry>
37254 <entry>Default: <emphasis>unset</emphasis></entry>
37255 </row>
37256 </tbody>
37257 </tgroup>
37258 </informaltable>
37259 <para>
37260 <indexterm role="concept">
37261 <primary>file</primary>
37262 <secondary>mailbox; checking existing format</secondary>
37263 </indexterm>
37264 This option requests the transport to check the format of an existing file
37265 before adding to it. The check consists of matching a specific string at the
37266 start of the file. The value of the option consists of an even number of
37267 colon-separated strings. The first of each pair is the test string, and the
37268 second is the name of a transport. If the transport associated with a matched
37269 string is not the current transport, control is passed over to the other
37270 transport. For example, suppose the standard <command>local_delivery</command> transport has
37271 this added to it:
37272 </para>
37273 <literallayout class="monospaced">
37274 file_format = "From       : local_delivery :\
37275                \1\1\1\1\n : local_mmdf_delivery"
37276 </literallayout>
37277 <para>
37278 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
37279 a mailbox begins with four binary ones followed by a newline, control is passed
37280 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
37281 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
37282 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
37283 match any string, or if the transport named for a given string is not defined,
37284 delivery is deferred.
37285 </para>
37286 <para>
37287 <indexterm role="option">
37288 <primary><option>file_must_exist</option></primary>
37289 </indexterm>
37290 </para>
37291 <informaltable frame="all">
37292 <tgroup cols="4" colsep="0" rowsep="0">
37293 <colspec colwidth="8*" align="left"/>
37294 <colspec colwidth="6*" align="center"/>
37295 <colspec colwidth="6*" align="center"/>
37296 <colspec colwidth="6*" align="right"/>
37297 <tbody>
37298 <row>
37299 <entry><option>file_must_exist</option></entry>
37300 <entry>Use: <emphasis>appendfile</emphasis></entry>
37301 <entry>Type: <emphasis>boolean</emphasis></entry>
37302 <entry>Default: <emphasis>false</emphasis></entry>
37303 </row>
37304 </tbody>
37305 </tgroup>
37306 </informaltable>
37307 <para>
37308 If this option is true, the file specified by the <option>file</option> option must exist.
37309 A temporary error occurs if it does not, causing delivery to be deferred.
37310 If this option is false, the file is created if it does not exist.
37311 </para>
37312 <para>
37313 <indexterm role="option">
37314 <primary><option>lock_fcntl_timeout</option></primary>
37315 </indexterm>
37316 </para>
37317 <informaltable frame="all">
37318 <tgroup cols="4" colsep="0" rowsep="0">
37319 <colspec colwidth="8*" align="left"/>
37320 <colspec colwidth="6*" align="center"/>
37321 <colspec colwidth="6*" align="center"/>
37322 <colspec colwidth="6*" align="right"/>
37323 <tbody>
37324 <row>
37325 <entry><option>lock_fcntl_timeout</option></entry>
37326 <entry>Use: <emphasis>appendfile</emphasis></entry>
37327 <entry>Type: <emphasis>time</emphasis></entry>
37328 <entry>Default: <emphasis>0s</emphasis></entry>
37329 </row>
37330 </tbody>
37331 </tgroup>
37332 </informaltable>
37333 <para>
37334 <indexterm role="concept">
37335 <primary>timeout</primary>
37336 <secondary>mailbox locking</secondary>
37337 </indexterm>
37338 <indexterm role="concept">
37339 <primary>mailbox</primary>
37340 <secondary>locking, blocking and non-blocking</secondary>
37341 </indexterm>
37342 <indexterm role="concept">
37343 <primary>locking files</primary>
37344 </indexterm>
37345 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
37346 when locking an open mailbox file. If the call fails, the delivery process
37347 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
37348 Non-blocking calls are used so that the file is not kept open during the wait
37349 for the lock; the reason for this is to make it as safe as possible for
37350 deliveries over NFS in the case when processes might be accessing an NFS
37351 mailbox without using a lock file. This should not be done, but
37352 misunderstandings and hence misconfigurations are not unknown.
37353 </para>
37354 <para>
37355 On a busy system, however, the performance of a non-blocking lock approach is
37356 not as good as using a blocking lock with a timeout. In this case, the waiting
37357 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
37358 and can proceed as soon as the previous lock holder releases it.
37359 </para>
37360 <para>
37361 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
37362 timeout, are used. There may still be some retrying: the maximum number of
37363 retries is
37364 </para>
37365 <literallayout class="monospaced">
37366 (lock_retries * lock_interval) / lock_fcntl_timeout
37367 </literallayout>
37368 <para>
37369 rounded up to the next whole number. In other words, the total time during
37370 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
37371 <option>lock_fcntl_timeout</option> is set very large.
37372 </para>
37373 <para>
37374 You should consider setting this option if you are getting a lot of delayed
37375 local deliveries because of errors of the form
37376 </para>
37377 <literallayout class="monospaced">
37378 failed to lock mailbox /some/file (fcntl)
37379 </literallayout>
37380 <para>
37381 <indexterm role="option">
37382 <primary><option>lock_flock_timeout</option></primary>
37383 </indexterm>
37384 </para>
37385 <informaltable frame="all">
37386 <tgroup cols="4" colsep="0" rowsep="0">
37387 <colspec colwidth="8*" align="left"/>
37388 <colspec colwidth="6*" align="center"/>
37389 <colspec colwidth="6*" align="center"/>
37390 <colspec colwidth="6*" align="right"/>
37391 <tbody>
37392 <row>
37393 <entry><option>lock_flock_timeout</option></entry>
37394 <entry>Use: <emphasis>appendfile</emphasis></entry>
37395 <entry>Type: <emphasis>time</emphasis></entry>
37396 <entry>Default: <emphasis>0s</emphasis></entry>
37397 </row>
37398 </tbody>
37399 </tgroup>
37400 </informaltable>
37401 <para>
37402 This timeout applies to file locking when using <function>flock()</function> (see
37403 <option>use_flock</option>); the timeout operates in a similar manner to
37404 <option>lock_fcntl_timeout</option>.
37405 </para>
37406 <para>
37407 <indexterm role="option">
37408 <primary><option>lock_interval</option></primary>
37409 </indexterm>
37410 </para>
37411 <informaltable frame="all">
37412 <tgroup cols="4" colsep="0" rowsep="0">
37413 <colspec colwidth="8*" align="left"/>
37414 <colspec colwidth="6*" align="center"/>
37415 <colspec colwidth="6*" align="center"/>
37416 <colspec colwidth="6*" align="right"/>
37417 <tbody>
37418 <row>
37419 <entry><option>lock_interval</option></entry>
37420 <entry>Use: <emphasis>appendfile</emphasis></entry>
37421 <entry>Type: <emphasis>time</emphasis></entry>
37422 <entry>Default: <emphasis>3s</emphasis></entry>
37423 </row>
37424 </tbody>
37425 </tgroup>
37426 </informaltable>
37427 <para>
37428 This specifies the time to wait between attempts to lock the file. See below
37429 for details of locking.
37430 </para>
37431 <para>
37432 <indexterm role="option">
37433 <primary><option>lock_retries</option></primary>
37434 </indexterm>
37435 </para>
37436 <informaltable frame="all">
37437 <tgroup cols="4" colsep="0" rowsep="0">
37438 <colspec colwidth="8*" align="left"/>
37439 <colspec colwidth="6*" align="center"/>
37440 <colspec colwidth="6*" align="center"/>
37441 <colspec colwidth="6*" align="right"/>
37442 <tbody>
37443 <row>
37444 <entry><option>lock_retries</option></entry>
37445 <entry>Use: <emphasis>appendfile</emphasis></entry>
37446 <entry>Type: <emphasis>integer</emphasis></entry>
37447 <entry>Default: <emphasis>10</emphasis></entry>
37448 </row>
37449 </tbody>
37450 </tgroup>
37451 </informaltable>
37452 <para>
37453 This specifies the maximum number of attempts to lock the file. A value of zero
37454 is treated as 1. See below for details of locking.
37455 </para>
37456 <para>
37457 <indexterm role="option">
37458 <primary><option>lockfile_mode</option></primary>
37459 </indexterm>
37460 </para>
37461 <informaltable frame="all">
37462 <tgroup cols="4" colsep="0" rowsep="0">
37463 <colspec colwidth="8*" align="left"/>
37464 <colspec colwidth="6*" align="center"/>
37465 <colspec colwidth="6*" align="center"/>
37466 <colspec colwidth="6*" align="right"/>
37467 <tbody>
37468 <row>
37469 <entry><option>lockfile_mode</option></entry>
37470 <entry>Use: <emphasis>appendfile</emphasis></entry>
37471 <entry>Type: <emphasis>octal integer</emphasis></entry>
37472 <entry>Default: <emphasis>0600</emphasis></entry>
37473 </row>
37474 </tbody>
37475 </tgroup>
37476 </informaltable>
37477 <para>
37478 This specifies the mode of the created lock file, when a lock file is being
37479 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
37480 </para>
37481 <para>
37482 <indexterm role="option">
37483 <primary><option>lockfile_timeout</option></primary>
37484 </indexterm>
37485 </para>
37486 <informaltable frame="all">
37487 <tgroup cols="4" colsep="0" rowsep="0">
37488 <colspec colwidth="8*" align="left"/>
37489 <colspec colwidth="6*" align="center"/>
37490 <colspec colwidth="6*" align="center"/>
37491 <colspec colwidth="6*" align="right"/>
37492 <tbody>
37493 <row>
37494 <entry><option>lockfile_timeout</option></entry>
37495 <entry>Use: <emphasis>appendfile</emphasis></entry>
37496 <entry>Type: <emphasis>time</emphasis></entry>
37497 <entry>Default: <emphasis>30m</emphasis></entry>
37498 </row>
37499 </tbody>
37500 </tgroup>
37501 </informaltable>
37502 <para>
37503 <indexterm role="concept">
37504 <primary>timeout</primary>
37505 <secondary>mailbox locking</secondary>
37506 </indexterm>
37507 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
37508 exists and is older than this value, it is assumed to have been left behind by
37509 accident, and Exim attempts to remove it.
37510 </para>
37511 <para>
37512 <indexterm role="option">
37513 <primary><option>mailbox_filecount</option></primary>
37514 </indexterm>
37515 </para>
37516 <informaltable frame="all">
37517 <tgroup cols="4" colsep="0" rowsep="0">
37518 <colspec colwidth="8*" align="left"/>
37519 <colspec colwidth="6*" align="center"/>
37520 <colspec colwidth="6*" align="center"/>
37521 <colspec colwidth="6*" align="right"/>
37522 <tbody>
37523 <row>
37524 <entry><option>mailbox_filecount</option></entry>
37525 <entry>Use: <emphasis>appendfile</emphasis></entry>
37526 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37527 <entry>Default: <emphasis>unset</emphasis></entry>
37528 </row>
37529 </tbody>
37530 </tgroup>
37531 </informaltable>
37532 <para>
37533 <indexterm role="concept">
37534 <primary>mailbox</primary>
37535 <secondary>specifying size of</secondary>
37536 </indexterm>
37537 <indexterm role="concept">
37538 <primary>size</primary>
37539 <secondary>of mailbox</secondary>
37540 </indexterm>
37541 If this option is set, it is expanded, and the result is taken as the current
37542 number of files in the mailbox. It must be a decimal number, optionally
37543 followed by K or M. This provides a way of obtaining this information from an
37544 external source that maintains the data.
37545 </para>
37546 <para>
37547 <indexterm role="option">
37548 <primary><option>mailbox_size</option></primary>
37549 </indexterm>
37550 </para>
37551 <informaltable frame="all">
37552 <tgroup cols="4" colsep="0" rowsep="0">
37553 <colspec colwidth="8*" align="left"/>
37554 <colspec colwidth="6*" align="center"/>
37555 <colspec colwidth="6*" align="center"/>
37556 <colspec colwidth="6*" align="right"/>
37557 <tbody>
37558 <row>
37559 <entry><option>mailbox_size</option></entry>
37560 <entry>Use: <emphasis>appendfile</emphasis></entry>
37561 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37562 <entry>Default: <emphasis>unset</emphasis></entry>
37563 </row>
37564 </tbody>
37565 </tgroup>
37566 </informaltable>
37567 <para>
37568 <indexterm role="concept">
37569 <primary>mailbox</primary>
37570 <secondary>specifying size of</secondary>
37571 </indexterm>
37572 <indexterm role="concept">
37573 <primary>size</primary>
37574 <secondary>of mailbox</secondary>
37575 </indexterm>
37576 If this option is set, it is expanded, and the result is taken as the current
37577 size the mailbox. It must be a decimal number, optionally followed by K or M.
37578 This provides a way of obtaining this information from an external source that
37579 maintains the data. This is likely to be helpful for maildir deliveries where
37580 it is computationally expensive to compute the size of a mailbox.
37581 </para>
37582 <para>
37583 <indexterm role="option">
37584 <primary><option>maildir_format</option></primary>
37585 </indexterm>
37586 </para>
37587 <informaltable frame="all">
37588 <tgroup cols="4" colsep="0" rowsep="0">
37589 <colspec colwidth="8*" align="left"/>
37590 <colspec colwidth="6*" align="center"/>
37591 <colspec colwidth="6*" align="center"/>
37592 <colspec colwidth="6*" align="right"/>
37593 <tbody>
37594 <row>
37595 <entry><option>maildir_format</option></entry>
37596 <entry>Use: <emphasis>appendfile</emphasis></entry>
37597 <entry>Type: <emphasis>boolean</emphasis></entry>
37598 <entry>Default: <emphasis>false</emphasis></entry>
37599 </row>
37600 </tbody>
37601 </tgroup>
37602 </informaltable>
37603 <para>
37604 <indexterm role="concept">
37605 <primary>maildir format</primary>
37606 <secondary>specifying</secondary>
37607 </indexterm>
37608 If this option is set with the <option>directory</option> option, the delivery is into a new
37609 file, in the <quote>maildir</quote> format that is used by other mail software. When the
37610 transport is activated directly from a <command>redirect</command> router (for example, the
37611 <command>address_file</command> transport in the default configuration), setting
37612 <option>maildir_format</option> causes the path received from the router to be treated as a
37613 directory, whether or not it ends with <literal>/</literal>. This option is available only if
37614 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
37615 <xref linkend="SECTmaildirdelivery"/> below for further details.
37616 </para>
37617 <para>
37618 <indexterm role="option">
37619 <primary><option>maildir_quota_directory_regex</option></primary>
37620 </indexterm>
37621 </para>
37622 <informaltable frame="all">
37623 <tgroup cols="4" colsep="0" rowsep="0">
37624 <colspec colwidth="8*" align="left"/>
37625 <colspec colwidth="6*" align="center"/>
37626 <colspec colwidth="6*" align="center"/>
37627 <colspec colwidth="6*" align="right"/>
37628 <tbody>
37629 <row>
37630 <entry><option>maildir_quota_directory_regex</option></entry>
37631 <entry>Use: <emphasis>appendfile</emphasis></entry>
37632 <entry>Type: <emphasis>string</emphasis></entry>
37633 <entry>Default: <emphasis>See below</emphasis></entry>
37634 </row>
37635 </tbody>
37636 </tgroup>
37637 </informaltable>
37638 <para>
37639 <indexterm role="concept">
37640 <primary>maildir format</primary>
37641 <secondary>quota; directories included in</secondary>
37642 </indexterm>
37643 <indexterm role="concept">
37644 <primary>quota</primary>
37645 <secondary>maildir; directories included in</secondary>
37646 </indexterm>
37647 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
37648 a regular expression for specifying directories, relative to the quota
37649 directory (see <option>quota_directory</option>), that should be included in the quota
37650 calculation. The default value is:
37651 </para>
37652 <literallayout class="monospaced">
37653 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
37654 </literallayout>
37655 <para>
37656 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
37657 (directories whose names begin with a dot). If you want to exclude the
37658 <filename>Trash</filename>
37659 folder from the count (as some sites do), you need to change this setting to
37660 </para>
37661 <literallayout class="monospaced">
37662 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
37663 </literallayout>
37664 <para>
37665 This uses a negative lookahead in the regular expression to exclude the
37666 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
37667 calculations, quota processing is bypassed for any messages that are delivered
37668 directly into that directory.
37669 </para>
37670 <para>
37671 <indexterm role="option">
37672 <primary><option>maildir_retries</option></primary>
37673 </indexterm>
37674 </para>
37675 <informaltable frame="all">
37676 <tgroup cols="4" colsep="0" rowsep="0">
37677 <colspec colwidth="8*" align="left"/>
37678 <colspec colwidth="6*" align="center"/>
37679 <colspec colwidth="6*" align="center"/>
37680 <colspec colwidth="6*" align="right"/>
37681 <tbody>
37682 <row>
37683 <entry><option>maildir_retries</option></entry>
37684 <entry>Use: <emphasis>appendfile</emphasis></entry>
37685 <entry>Type: <emphasis>integer</emphasis></entry>
37686 <entry>Default: <emphasis>10</emphasis></entry>
37687 </row>
37688 </tbody>
37689 </tgroup>
37690 </informaltable>
37691 <para>
37692 This option specifies the number of times to retry when writing a file in
37693 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
37694 </para>
37695 <para>
37696 <indexterm role="option">
37697 <primary><option>maildir_tag</option></primary>
37698 </indexterm>
37699 </para>
37700 <informaltable frame="all">
37701 <tgroup cols="4" colsep="0" rowsep="0">
37702 <colspec colwidth="8*" align="left"/>
37703 <colspec colwidth="6*" align="center"/>
37704 <colspec colwidth="6*" align="center"/>
37705 <colspec colwidth="6*" align="right"/>
37706 <tbody>
37707 <row>
37708 <entry><option>maildir_tag</option></entry>
37709 <entry>Use: <emphasis>appendfile</emphasis></entry>
37710 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37711 <entry>Default: <emphasis>unset</emphasis></entry>
37712 </row>
37713 </tbody>
37714 </tgroup>
37715 </informaltable>
37716 <para>
37717 This option applies only to deliveries in maildir format, and is described in
37718 section <xref linkend="SECTmaildirdelivery"/> below.
37719 </para>
37720 <para>
37721 <indexterm role="option">
37722 <primary><option>maildir_use_size_file</option></primary>
37723 </indexterm>
37724 </para>
37725 <informaltable frame="all">
37726 <tgroup cols="4" colsep="0" rowsep="0">
37727 <colspec colwidth="8*" align="left"/>
37728 <colspec colwidth="6*" align="center"/>
37729 <colspec colwidth="6*" align="center"/>
37730 <colspec colwidth="6*" align="right"/>
37731 <tbody>
37732 <row>
37733 <entry><option>maildir_use_size_file</option></entry>
37734 <entry>Use: <emphasis>appendfile</emphasis></entry>
37735 <entry>Type: <emphasis>boolean</emphasis></entry>
37736 <entry>Default: <emphasis>false</emphasis></entry>
37737 </row>
37738 </tbody>
37739 </tgroup>
37740 </informaltable>
37741 <para>
37742 <indexterm role="concept">
37743 <primary>maildir format</primary>
37744 <secondary><filename>maildirsize</filename> file</secondary>
37745 </indexterm>
37746 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
37747 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
37748 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
37749 value is zero. See <option>maildir_quota_directory_regex</option> above and section
37750 <xref linkend="SECTmaildirdelivery"/> below for further details.
37751 </para>
37752 <para>
37753 <indexterm role="option">
37754 <primary><option>maildirfolder_create_regex</option></primary>
37755 </indexterm>
37756 </para>
37757 <informaltable frame="all">
37758 <tgroup cols="4" colsep="0" rowsep="0">
37759 <colspec colwidth="8*" align="left"/>
37760 <colspec colwidth="6*" align="center"/>
37761 <colspec colwidth="6*" align="center"/>
37762 <colspec colwidth="6*" align="right"/>
37763 <tbody>
37764 <row>
37765 <entry><option>maildirfolder_create_regex</option></entry>
37766 <entry>Use: <emphasis>appendfile</emphasis></entry>
37767 <entry>Type: <emphasis>string</emphasis></entry>
37768 <entry>Default: <emphasis>unset</emphasis></entry>
37769 </row>
37770 </tbody>
37771 </tgroup>
37772 </informaltable>
37773 <para>
37774 <indexterm role="concept">
37775 <primary>maildir format</primary>
37776 <secondary><filename>maildirfolder</filename> file</secondary>
37777 </indexterm>
37778 <indexterm role="concept">
37779 <primary><filename>maildirfolder</filename>, creating</primary>
37780 </indexterm>
37781 The value of this option is a regular expression. If it is unset, it has no
37782 effect. Otherwise, before a maildir delivery takes place, the pattern is
37783 matched against the name of the maildir directory, that is, the directory
37784 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
37785 delivery. If there is a match, Exim checks for the existence of a file called
37786 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
37787 See section <xref linkend="SECTmaildirdelivery"/> for more details.
37788 </para>
37789 <para>
37790 <indexterm role="option">
37791 <primary><option>mailstore_format</option></primary>
37792 </indexterm>
37793 </para>
37794 <informaltable frame="all">
37795 <tgroup cols="4" colsep="0" rowsep="0">
37796 <colspec colwidth="8*" align="left"/>
37797 <colspec colwidth="6*" align="center"/>
37798 <colspec colwidth="6*" align="center"/>
37799 <colspec colwidth="6*" align="right"/>
37800 <tbody>
37801 <row>
37802 <entry><option>mailstore_format</option></entry>
37803 <entry>Use: <emphasis>appendfile</emphasis></entry>
37804 <entry>Type: <emphasis>boolean</emphasis></entry>
37805 <entry>Default: <emphasis>false</emphasis></entry>
37806 </row>
37807 </tbody>
37808 </tgroup>
37809 </informaltable>
37810 <para>
37811 <indexterm role="concept">
37812 <primary>mailstore format</primary>
37813 <secondary>specifying</secondary>
37814 </indexterm>
37815 If this option is set with the <option>directory</option> option, the delivery is into two
37816 new files in  <quote>mailstore</quote> format. The option is available only if
37817 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
37818 below for further details.
37819 </para>
37820 <para>
37821 <indexterm role="option">
37822 <primary><option>mailstore_prefix</option></primary>
37823 </indexterm>
37824 </para>
37825 <informaltable frame="all">
37826 <tgroup cols="4" colsep="0" rowsep="0">
37827 <colspec colwidth="8*" align="left"/>
37828 <colspec colwidth="6*" align="center"/>
37829 <colspec colwidth="6*" align="center"/>
37830 <colspec colwidth="6*" align="right"/>
37831 <tbody>
37832 <row>
37833 <entry><option>mailstore_prefix</option></entry>
37834 <entry>Use: <emphasis>appendfile</emphasis></entry>
37835 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37836 <entry>Default: <emphasis>unset</emphasis></entry>
37837 </row>
37838 </tbody>
37839 </tgroup>
37840 </informaltable>
37841 <para>
37842 This option applies only to deliveries in mailstore format, and is described in
37843 section <xref linkend="SECTopdir"/> below.
37844 </para>
37845 <para>
37846 <indexterm role="option">
37847 <primary><option>mailstore_suffix</option></primary>
37848 </indexterm>
37849 </para>
37850 <informaltable frame="all">
37851 <tgroup cols="4" colsep="0" rowsep="0">
37852 <colspec colwidth="8*" align="left"/>
37853 <colspec colwidth="6*" align="center"/>
37854 <colspec colwidth="6*" align="center"/>
37855 <colspec colwidth="6*" align="right"/>
37856 <tbody>
37857 <row>
37858 <entry><option>mailstore_suffix</option></entry>
37859 <entry>Use: <emphasis>appendfile</emphasis></entry>
37860 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37861 <entry>Default: <emphasis>unset</emphasis></entry>
37862 </row>
37863 </tbody>
37864 </tgroup>
37865 </informaltable>
37866 <para>
37867 This option applies only to deliveries in mailstore format, and is described in
37868 section <xref linkend="SECTopdir"/> below.
37869 </para>
37870 <para>
37871 <indexterm role="option">
37872 <primary><option>mbx_format</option></primary>
37873 </indexterm>
37874 </para>
37875 <informaltable frame="all">
37876 <tgroup cols="4" colsep="0" rowsep="0">
37877 <colspec colwidth="8*" align="left"/>
37878 <colspec colwidth="6*" align="center"/>
37879 <colspec colwidth="6*" align="center"/>
37880 <colspec colwidth="6*" align="right"/>
37881 <tbody>
37882 <row>
37883 <entry><option>mbx_format</option></entry>
37884 <entry>Use: <emphasis>appendfile</emphasis></entry>
37885 <entry>Type: <emphasis>boolean</emphasis></entry>
37886 <entry>Default: <emphasis>false</emphasis></entry>
37887 </row>
37888 </tbody>
37889 </tgroup>
37890 </informaltable>
37891 <para>
37892 <indexterm role="concept">
37893 <primary>locking files</primary>
37894 </indexterm>
37895 <indexterm role="concept">
37896 <primary>file</primary>
37897 <secondary>locking</secondary>
37898 </indexterm>
37899 <indexterm role="concept">
37900 <primary>file</primary>
37901 <secondary>MBX format</secondary>
37902 </indexterm>
37903 <indexterm role="concept">
37904 <primary>MBX format, specifying</primary>
37905 </indexterm>
37906 This option is available only if Exim has been compiled with SUPPORT_MBX
37907 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
37908 the message is appended to the mailbox file in MBX format instead of
37909 traditional Unix format. This format is supported by Pine4 and its associated
37910 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
37911 </para>
37912 <para>
37913 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
37914 automatically changed by the use of <option>mbx_format</option>. They should normally be set
37915 empty when using MBX format, so this option almost always appears in this
37916 combination:
37917 </para>
37918 <literallayout class="monospaced">
37919 mbx_format = true
37920 message_prefix =
37921 message_suffix =
37922 </literallayout>
37923 <para>
37924 If none of the locking options are mentioned in the configuration,
37925 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
37926 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
37927 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
37928 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
37929 should not be used if any program that does not use this form of locking is
37930 going to access the mailbox, nor should it be used if the mailbox file is NFS
37931 mounted, because it works only when the mailbox is accessed from a single host.
37932 </para>
37933 <para>
37934 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
37935 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
37936 (this means for the whole of a Pine or IMAP session), Exim will not be able to
37937 append messages to it.
37938 </para>
37939 <para>
37940 <indexterm role="option">
37941 <primary><option>message_prefix</option></primary>
37942 </indexterm>
37943 </para>
37944 <informaltable frame="all">
37945 <tgroup cols="4" colsep="0" rowsep="0">
37946 <colspec colwidth="8*" align="left"/>
37947 <colspec colwidth="6*" align="center"/>
37948 <colspec colwidth="6*" align="center"/>
37949 <colspec colwidth="6*" align="right"/>
37950 <tbody>
37951 <row>
37952 <entry><option>message_prefix</option></entry>
37953 <entry>Use: <emphasis>appendfile</emphasis></entry>
37954 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37955 <entry>Default: <emphasis>see below</emphasis></entry>
37956 </row>
37957 </tbody>
37958 </tgroup>
37959 </informaltable>
37960 <para>
37961 <indexterm role="concept">
37962 <primary><quote>From</quote> line</primary>
37963 </indexterm>
37964 The string specified here is expanded and output at the start of every message.
37965 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
37966 in which case it is:
37967 </para>
37968 <literallayout class="monospaced">
37969 message_prefix = "From ${if def:return_path{$return_path}\
37970   {MAILER-DAEMON}} $tod_bsdinbox\n"
37971 </literallayout>
37972 <para revisionflag="changed">
37973 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
37974 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
37975 </para>
37976 <para>
37977 <indexterm role="option">
37978 <primary><option>message_suffix</option></primary>
37979 </indexterm>
37980 </para>
37981 <informaltable frame="all">
37982 <tgroup cols="4" colsep="0" rowsep="0">
37983 <colspec colwidth="8*" align="left"/>
37984 <colspec colwidth="6*" align="center"/>
37985 <colspec colwidth="6*" align="center"/>
37986 <colspec colwidth="6*" align="right"/>
37987 <tbody>
37988 <row>
37989 <entry><option>message_suffix</option></entry>
37990 <entry>Use: <emphasis>appendfile</emphasis></entry>
37991 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37992 <entry>Default: <emphasis>see below</emphasis></entry>
37993 </row>
37994 </tbody>
37995 </tgroup>
37996 </informaltable>
37997 <para>
37998 The string specified here is expanded and output at the end of every message.
37999 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38000 in which case it is a single newline character. The suffix can be suppressed by
38001 setting
38002 </para>
38003 <literallayout class="monospaced">
38004 message_suffix =
38005 </literallayout>
38006 <para revisionflag="changed">
38007 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38008 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
38009 </para>
38010 <para>
38011 <indexterm role="option">
38012 <primary><option>mode</option></primary>
38013 </indexterm>
38014 </para>
38015 <informaltable frame="all">
38016 <tgroup cols="4" colsep="0" rowsep="0">
38017 <colspec colwidth="8*" align="left"/>
38018 <colspec colwidth="6*" align="center"/>
38019 <colspec colwidth="6*" align="center"/>
38020 <colspec colwidth="6*" align="right"/>
38021 <tbody>
38022 <row>
38023 <entry><option>mode</option></entry>
38024 <entry>Use: <emphasis>appendfile</emphasis></entry>
38025 <entry>Type: <emphasis>octal integer</emphasis></entry>
38026 <entry>Default: <emphasis>0600</emphasis></entry>
38027 </row>
38028 </tbody>
38029 </tgroup>
38030 </informaltable>
38031 <para>
38032 If the output file is created, it is given this mode. If it already exists and
38033 has wider permissions, they are reduced to this mode. If it has narrower
38034 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
38035 if the delivery is the result of a <option>save</option> command in a filter file specifying
38036 a particular mode, the mode of the output file is always forced to take that
38037 value, and this option is ignored.
38038 </para>
38039 <para>
38040 <indexterm role="option">
38041 <primary><option>mode_fail_narrower</option></primary>
38042 </indexterm>
38043 </para>
38044 <informaltable frame="all">
38045 <tgroup cols="4" colsep="0" rowsep="0">
38046 <colspec colwidth="8*" align="left"/>
38047 <colspec colwidth="6*" align="center"/>
38048 <colspec colwidth="6*" align="center"/>
38049 <colspec colwidth="6*" align="right"/>
38050 <tbody>
38051 <row>
38052 <entry><option>mode_fail_narrower</option></entry>
38053 <entry>Use: <emphasis>appendfile</emphasis></entry>
38054 <entry>Type: <emphasis>boolean</emphasis></entry>
38055 <entry>Default: <emphasis>true</emphasis></entry>
38056 </row>
38057 </tbody>
38058 </tgroup>
38059 </informaltable>
38060 <para>
38061 This option applies in the case when an existing mailbox file has a narrower
38062 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
38063 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
38064 continues with the delivery attempt, using the existing mode of the file.
38065 </para>
38066 <para>
38067 <indexterm role="option">
38068 <primary><option>notify_comsat</option></primary>
38069 </indexterm>
38070 </para>
38071 <informaltable frame="all">
38072 <tgroup cols="4" colsep="0" rowsep="0">
38073 <colspec colwidth="8*" align="left"/>
38074 <colspec colwidth="6*" align="center"/>
38075 <colspec colwidth="6*" align="center"/>
38076 <colspec colwidth="6*" align="right"/>
38077 <tbody>
38078 <row>
38079 <entry><option>notify_comsat</option></entry>
38080 <entry>Use: <emphasis>appendfile</emphasis></entry>
38081 <entry>Type: <emphasis>boolean</emphasis></entry>
38082 <entry>Default: <emphasis>false</emphasis></entry>
38083 </row>
38084 </tbody>
38085 </tgroup>
38086 </informaltable>
38087 <para>
38088 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
38089 successful delivery to a user mailbox. This is the daemon that notifies logged
38090 on users about incoming mail.
38091 </para>
38092 <para>
38093 <indexterm role="option">
38094 <primary><option>quota</option></primary>
38095 </indexterm>
38096 </para>
38097 <informaltable frame="all">
38098 <tgroup cols="4" colsep="0" rowsep="0">
38099 <colspec colwidth="8*" align="left"/>
38100 <colspec colwidth="6*" align="center"/>
38101 <colspec colwidth="6*" align="center"/>
38102 <colspec colwidth="6*" align="right"/>
38103 <tbody>
38104 <row>
38105 <entry><option>quota</option></entry>
38106 <entry>Use: <emphasis>appendfile</emphasis></entry>
38107 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38108 <entry>Default: <emphasis>unset</emphasis></entry>
38109 </row>
38110 </tbody>
38111 </tgroup>
38112 </informaltable>
38113 <para>
38114 <indexterm role="concept">
38115 <primary>quota</primary>
38116 <secondary>imposed by Exim</secondary>
38117 </indexterm>
38118 This option imposes a limit on the size of the file to which Exim is appending,
38119 or to the total space used in the directory tree when the <option>directory</option> option
38120 is set. In the latter case, computation of the space used is expensive, because
38121 all the files in the directory (and any sub-directories) have to be
38122 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
38123 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
38124 have no shell access to their mailboxes).
38125 </para>
38126 <para>
38127 As there is no interlock against two simultaneous deliveries into a
38128 multi-file mailbox, it is possible for the quota to be overrun in this case.
38129 For single-file mailboxes, of course, an interlock is a necessity.
38130 </para>
38131 <para>
38132 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
38133 may be a lot less than the actual amount of disk space allocated to the file.
38134 If the sizes of a number of files are being added up, the rounding effect can
38135 become quite noticeable, especially on systems that have large block sizes.
38136 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
38137 the obvious value which users understand most easily.
38138 </para>
38139 <para>
38140 The value of the option is expanded, and must then be a numerical value
38141 (decimal point allowed), optionally followed by one of the letters K, M, or G,
38142 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
38143 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
38144 be handled.
38145 </para>
38146 <para>
38147 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
38148 </para>
38149 <para>
38150 The expansion happens while Exim is running as root, before it changes uid for
38151 the delivery. This means that files that are inaccessible to the end user can
38152 be used to hold quota values that are looked up in the expansion. When delivery
38153 fails because this quota is exceeded, the handling of the error is as for
38154 system quota failures.
38155 </para>
38156 <para>
38157 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
38158 mailbox to the specified maximum size, though the value is not accurate to the
38159 last byte, owing to separator lines and additional headers that may get added
38160 during message delivery. When a mailbox is nearly full, large messages may get
38161 refused even though small ones are accepted, because the size of the current
38162 message is added to the quota when the check is made. This behaviour can be
38163 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
38164 for exceeding the quota does not include the current message. Thus, deliveries
38165 continue until the quota has been exceeded; thereafter, no further messages are
38166 delivered. See also <option>quota_warn_threshold</option>.
38167 </para>
38168 <para>
38169 <indexterm role="option">
38170 <primary><option>quota_directory</option></primary>
38171 </indexterm>
38172 </para>
38173 <informaltable frame="all">
38174 <tgroup cols="4" colsep="0" rowsep="0">
38175 <colspec colwidth="8*" align="left"/>
38176 <colspec colwidth="6*" align="center"/>
38177 <colspec colwidth="6*" align="center"/>
38178 <colspec colwidth="6*" align="right"/>
38179 <tbody>
38180 <row>
38181 <entry><option>quota_directory</option></entry>
38182 <entry>Use: <emphasis>appendfile</emphasis></entry>
38183 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38184 <entry>Default: <emphasis>unset</emphasis></entry>
38185 </row>
38186 </tbody>
38187 </tgroup>
38188 </informaltable>
38189 <para>
38190 This option defines the directory to check for quota purposes when delivering
38191 into individual files. The default is the delivery directory, or, if a file
38192 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
38193 delivery directory.
38194 </para>
38195 <para>
38196 <indexterm role="option">
38197 <primary><option>quota_filecount</option></primary>
38198 </indexterm>
38199 </para>
38200 <informaltable frame="all">
38201 <tgroup cols="4" colsep="0" rowsep="0">
38202 <colspec colwidth="8*" align="left"/>
38203 <colspec colwidth="6*" align="center"/>
38204 <colspec colwidth="6*" align="center"/>
38205 <colspec colwidth="6*" align="right"/>
38206 <tbody>
38207 <row>
38208 <entry><option>quota_filecount</option></entry>
38209 <entry>Use: <emphasis>appendfile</emphasis></entry>
38210 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38211 <entry>Default: <emphasis>0</emphasis></entry>
38212 </row>
38213 </tbody>
38214 </tgroup>
38215 </informaltable>
38216 <para>
38217 This option applies when the <option>directory</option> option is set. It limits the total
38218 number of files in the directory (compare the inode limit in system quotas). It
38219 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
38220 failure causes delivery to be deferred. A value of zero is interpreted as
38221 <quote>no quota</quote>.
38222 </para>
38223 <para>
38224 <indexterm role="option">
38225 <primary><option>quota_is_inclusive</option></primary>
38226 </indexterm>
38227 </para>
38228 <informaltable frame="all">
38229 <tgroup cols="4" colsep="0" rowsep="0">
38230 <colspec colwidth="8*" align="left"/>
38231 <colspec colwidth="6*" align="center"/>
38232 <colspec colwidth="6*" align="center"/>
38233 <colspec colwidth="6*" align="right"/>
38234 <tbody>
38235 <row>
38236 <entry><option>quota_is_inclusive</option></entry>
38237 <entry>Use: <emphasis>appendfile</emphasis></entry>
38238 <entry>Type: <emphasis>boolean</emphasis></entry>
38239 <entry>Default: <emphasis>true</emphasis></entry>
38240 </row>
38241 </tbody>
38242 </tgroup>
38243 </informaltable>
38244 <para>
38245 See <option>quota</option> above.
38246 </para>
38247 <para>
38248 <indexterm role="option">
38249 <primary><option>quota_size_regex</option></primary>
38250 </indexterm>
38251 </para>
38252 <informaltable frame="all">
38253 <tgroup cols="4" colsep="0" rowsep="0">
38254 <colspec colwidth="8*" align="left"/>
38255 <colspec colwidth="6*" align="center"/>
38256 <colspec colwidth="6*" align="center"/>
38257 <colspec colwidth="6*" align="right"/>
38258 <tbody>
38259 <row>
38260 <entry><option>quota_size_regex</option></entry>
38261 <entry>Use: <emphasis>appendfile</emphasis></entry>
38262 <entry>Type: <emphasis>string</emphasis></entry>
38263 <entry>Default: <emphasis>unset</emphasis></entry>
38264 </row>
38265 </tbody>
38266 </tgroup>
38267 </informaltable>
38268 <para>
38269 This option applies when one of the delivery modes that writes a separate file
38270 for each message is being used. When Exim wants to find the size of one of
38271 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
38272 If this is set to a regular expression that matches the file name, and it
38273 captures one string, that string is interpreted as a representation of the
38274 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
38275 </para>
38276 <para>
38277 This feature is useful only when users have no shell access to their mailboxes
38278 &ndash; otherwise they could defeat the quota simply by renaming the files. This
38279 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
38280 the file length to the file name. For example:
38281 </para>
38282 <literallayout class="monospaced">
38283 maildir_tag = ,S=$message_size
38284 quota_size_regex = ,S=(\d+)
38285 </literallayout>
38286 <para>
38287 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
38288 number of lines in the message.
38289 </para>
38290 <para>
38291 The regular expression should not assume that the length is at the end of the
38292 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
38293 sometimes add other information onto the ends of message file names.
38294 </para>
38295 <para>
38296 <indexterm role="option">
38297 <primary><option>quota_warn_message</option></primary>
38298 </indexterm>
38299 </para>
38300 <informaltable frame="all">
38301 <tgroup cols="4" colsep="0" rowsep="0">
38302 <colspec colwidth="8*" align="left"/>
38303 <colspec colwidth="6*" align="center"/>
38304 <colspec colwidth="6*" align="center"/>
38305 <colspec colwidth="6*" align="right"/>
38306 <tbody>
38307 <row>
38308 <entry><option>quota_warn_message</option></entry>
38309 <entry>Use: <emphasis>appendfile</emphasis></entry>
38310 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38311 <entry>Default: <emphasis>see below</emphasis></entry>
38312 </row>
38313 </tbody>
38314 </tgroup>
38315 </informaltable>
38316 <para>
38317 See below for the use of this option. If it is not set when
38318 <option>quota_warn_threshold</option> is set, it defaults to
38319 </para>
38320 <literallayout class="monospaced">
38321 quota_warn_message = "\
38322   To: $local_part@$domain\n\
38323   Subject: Your mailbox\n\n\
38324   This message is automatically created \
38325   by mail delivery software.\n\n\
38326   The size of your mailbox has exceeded \
38327   a warning threshold that is\n\
38328   set by the system administrator.\n"
38329 </literallayout>
38330 <para>
38331 <indexterm role="option">
38332 <primary><option>quota_warn_threshold</option></primary>
38333 </indexterm>
38334 </para>
38335 <informaltable frame="all">
38336 <tgroup cols="4" colsep="0" rowsep="0">
38337 <colspec colwidth="8*" align="left"/>
38338 <colspec colwidth="6*" align="center"/>
38339 <colspec colwidth="6*" align="center"/>
38340 <colspec colwidth="6*" align="right"/>
38341 <tbody>
38342 <row>
38343 <entry><option>quota_warn_threshold</option></entry>
38344 <entry>Use: <emphasis>appendfile</emphasis></entry>
38345 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38346 <entry>Default: <emphasis>0</emphasis></entry>
38347 </row>
38348 </tbody>
38349 </tgroup>
38350 </informaltable>
38351 <para>
38352 <indexterm role="concept">
38353 <primary>quota</primary>
38354 <secondary>warning threshold</secondary>
38355 </indexterm>
38356 <indexterm role="concept">
38357 <primary>mailbox</primary>
38358 <secondary>size warning</secondary>
38359 </indexterm>
38360 <indexterm role="concept">
38361 <primary>size</primary>
38362 <secondary>of mailbox</secondary>
38363 </indexterm>
38364 This option is expanded in the same way as <option>quota</option> (see above). If the
38365 resulting value is greater than zero, and delivery of the message causes the
38366 size of the file or total space in the directory tree to cross the given
38367 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
38368 may be specified as a percentage of it by following the value with a percent
38369 sign. For example:
38370 </para>
38371 <literallayout class="monospaced">
38372 quota = 10M
38373 quota_warn_threshold = 75%
38374 </literallayout>
38375 <para>
38376 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
38377 percent sign is ignored.
38378 </para>
38379 <para>
38380 The warning message itself is specified by the <option>quota_warn_message</option> option,
38381 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
38382 warning message. These do not necessarily have to include the recipient(s) of
38383 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
38384 can include any other header lines that you want. If you do not include a
38385 <emphasis>From:</emphasis> line, the default is:
38386 </para>
38387 <literallayout class="monospaced">
38388 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
38389 </literallayout>
38390 <para>
38391 <indexterm role="option">
38392 <primary><option>errors_reply_to</option></primary>
38393 </indexterm>
38394 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
38395 option.
38396 </para>
38397 <para>
38398 The <option>quota</option> option does not have to be set in order to use this option; they
38399 are independent of one another except when the threshold is specified as a
38400 percentage.
38401 </para>
38402 <para>
38403 <indexterm role="option">
38404 <primary><option>use_bsmtp</option></primary>
38405 </indexterm>
38406 </para>
38407 <informaltable frame="all">
38408 <tgroup cols="4" colsep="0" rowsep="0">
38409 <colspec colwidth="8*" align="left"/>
38410 <colspec colwidth="6*" align="center"/>
38411 <colspec colwidth="6*" align="center"/>
38412 <colspec colwidth="6*" align="right"/>
38413 <tbody>
38414 <row>
38415 <entry><option>use_bsmtp</option></entry>
38416 <entry>Use: <emphasis>appendfile</emphasis></entry>
38417 <entry>Type: <emphasis>boolean</emphasis></entry>
38418 <entry>Default: <emphasis>false</emphasis></entry>
38419 </row>
38420 </tbody>
38421 </tgroup>
38422 </informaltable>
38423 <para>
38424 <indexterm role="concept">
38425 <primary>envelope sender</primary>
38426 </indexterm>
38427 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
38428 format, with the envelope sender and recipient(s) included as SMTP commands. If
38429 you want to include a leading HELO command with such messages, you can do
38430 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
38431 for details of batch SMTP.
38432 </para>
38433 <para>
38434 <indexterm role="option">
38435 <primary><option>use_crlf</option></primary>
38436 </indexterm>
38437 </para>
38438 <informaltable frame="all">
38439 <tgroup cols="4" colsep="0" rowsep="0">
38440 <colspec colwidth="8*" align="left"/>
38441 <colspec colwidth="6*" align="center"/>
38442 <colspec colwidth="6*" align="center"/>
38443 <colspec colwidth="6*" align="right"/>
38444 <tbody>
38445 <row>
38446 <entry><option>use_crlf</option></entry>
38447 <entry>Use: <emphasis>appendfile</emphasis></entry>
38448 <entry>Type: <emphasis>boolean</emphasis></entry>
38449 <entry>Default: <emphasis>false</emphasis></entry>
38450 </row>
38451 </tbody>
38452 </tgroup>
38453 </informaltable>
38454 <para>
38455 <indexterm role="concept">
38456 <primary>carriage return</primary>
38457 </indexterm>
38458 <indexterm role="concept">
38459 <primary>linefeed</primary>
38460 </indexterm>
38461 This option causes lines to be terminated with the two-character CRLF sequence
38462 (carriage return, linefeed) instead of just a linefeed character. In the case
38463 of batched SMTP, the byte sequence written to the file is then an exact image
38464 of what would be sent down a real SMTP connection.
38465 </para>
38466 <para revisionflag="changed">
38467 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
38468 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
38469 in Berkeley-style mailboxes) are written verbatim, so must contain their own
38470 carriage return characters if these are needed. In cases where these options
38471 have non-empty defaults, the values end with a single linefeed, so they must be
38472 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
38473 </para>
38474 <para>
38475 <indexterm role="option">
38476 <primary><option>use_fcntl_lock</option></primary>
38477 </indexterm>
38478 </para>
38479 <informaltable frame="all">
38480 <tgroup cols="4" colsep="0" rowsep="0">
38481 <colspec colwidth="8*" align="left"/>
38482 <colspec colwidth="6*" align="center"/>
38483 <colspec colwidth="6*" align="center"/>
38484 <colspec colwidth="6*" align="right"/>
38485 <tbody>
38486 <row>
38487 <entry><option>use_fcntl_lock</option></entry>
38488 <entry>Use: <emphasis>appendfile</emphasis></entry>
38489 <entry>Type: <emphasis>boolean</emphasis></entry>
38490 <entry>Default: <emphasis>see below</emphasis></entry>
38491 </row>
38492 </tbody>
38493 </tgroup>
38494 </informaltable>
38495 <para>
38496 This option controls the use of the <function>fcntl()</function> function to lock a file for
38497 exclusive use when a message is being appended. It is set by default unless
38498 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
38499 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
38500 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
38501 </para>
38502 <para>
38503 <indexterm role="option">
38504 <primary><option>use_flock_lock</option></primary>
38505 </indexterm>
38506 </para>
38507 <informaltable frame="all">
38508 <tgroup cols="4" colsep="0" rowsep="0">
38509 <colspec colwidth="8*" align="left"/>
38510 <colspec colwidth="6*" align="center"/>
38511 <colspec colwidth="6*" align="center"/>
38512 <colspec colwidth="6*" align="right"/>
38513 <tbody>
38514 <row>
38515 <entry><option>use_flock_lock</option></entry>
38516 <entry>Use: <emphasis>appendfile</emphasis></entry>
38517 <entry>Type: <emphasis>boolean</emphasis></entry>
38518 <entry>Default: <emphasis>false</emphasis></entry>
38519 </row>
38520 </tbody>
38521 </tgroup>
38522 </informaltable>
38523 <para>
38524 This option is provided to support the use of <function>flock()</function> for file locking, for
38525 the few situations where it is needed. Most modern operating systems support
38526 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
38527 each other. Exim uses <function>fcntl()</function> locking by default.
38528 </para>
38529 <para>
38530 This option is required only if you are using an operating system where
38531 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
38532 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
38533 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
38534 </para>
38535 <para>
38536 <indexterm role="concept">
38537 <primary>Solaris</primary>
38538 <secondary><function>flock()</function> support</secondary>
38539 </indexterm>
38540 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
38541 have it (and some, I think, provide a not quite right version built on top of
38542 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
38543 the ability to use it, and any attempt to do so will cause a configuration
38544 error.
38545 </para>
38546 <para>
38547 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
38548 is just being mapped onto <function>fcntl()</function> by the OS).
38549 </para>
38550 <para>
38551 <indexterm role="option">
38552 <primary><option>use_lockfile</option></primary>
38553 </indexterm>
38554 </para>
38555 <informaltable frame="all">
38556 <tgroup cols="4" colsep="0" rowsep="0">
38557 <colspec colwidth="8*" align="left"/>
38558 <colspec colwidth="6*" align="center"/>
38559 <colspec colwidth="6*" align="center"/>
38560 <colspec colwidth="6*" align="right"/>
38561 <tbody>
38562 <row>
38563 <entry><option>use_lockfile</option></entry>
38564 <entry>Use: <emphasis>appendfile</emphasis></entry>
38565 <entry>Type: <emphasis>boolean</emphasis></entry>
38566 <entry>Default: <emphasis>see below</emphasis></entry>
38567 </row>
38568 </tbody>
38569 </tgroup>
38570 </informaltable>
38571 <para>
38572 If this option is turned off, Exim does not attempt to create a lock file when
38573 appending to a mailbox file. In this situation, the only locking is by
38574 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
38575 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
38576 <function>fcntl()</function> rather than a lock file, and even then only when you are not
38577 delivering over NFS from more than one host.
38578 </para>
38579 <para>
38580 <indexterm role="concept">
38581 <primary>NFS</primary>
38582 <secondary>lock file</secondary>
38583 </indexterm>
38584 In order to append to an NFS file safely from more than one host, it is
38585 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
38586 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
38587 file corruption.
38588 </para>
38589 <para>
38590 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
38591 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
38592 except when <option>mbx_format</option> is set.
38593 </para>
38594 <para>
38595 <indexterm role="option">
38596 <primary><option>use_mbx_lock</option></primary>
38597 </indexterm>
38598 </para>
38599 <informaltable frame="all">
38600 <tgroup cols="4" colsep="0" rowsep="0">
38601 <colspec colwidth="8*" align="left"/>
38602 <colspec colwidth="6*" align="center"/>
38603 <colspec colwidth="6*" align="center"/>
38604 <colspec colwidth="6*" align="right"/>
38605 <tbody>
38606 <row>
38607 <entry><option>use_mbx_lock</option></entry>
38608 <entry>Use: <emphasis>appendfile</emphasis></entry>
38609 <entry>Type: <emphasis>boolean</emphasis></entry>
38610 <entry>Default: <emphasis>see below</emphasis></entry>
38611 </row>
38612 </tbody>
38613 </tgroup>
38614 </informaltable>
38615 <para>
38616 This option is available only if Exim has been compiled with SUPPORT_MBX
38617 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
38618 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
38619 of the locking options are mentioned in the configuration. The locking rules
38620 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
38621 the IMAP4 and POP daemons that come with it (see the discussion below). The
38622 rules allow for shared access to the mailbox. However, this kind of locking
38623 does not work when the mailbox is NFS mounted.
38624 </para>
38625 <para>
38626 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
38627 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
38628 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
38629 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
38630 </para>
38631 </section>
38632 <section id="SECTopappend">
38633 <title>Operational details for appending</title>
38634 <para>
38635 <indexterm role="concept">
38636 <primary>appending to a file</primary>
38637 </indexterm>
38638 <indexterm role="concept">
38639 <primary>file</primary>
38640 <secondary>appending</secondary>
38641 </indexterm>
38642 Before appending to a file, the following preparations are made:
38643 </para>
38644 <itemizedlist>
38645 <listitem>
38646 <para>
38647 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
38648 return is given.
38649 </para>
38650 </listitem>
38651 <listitem>
38652 <para>
38653 <indexterm role="concept">
38654 <primary>directory creation</primary>
38655 </indexterm>
38656 If any directories on the file&#x2019;s path are missing, Exim creates them if the
38657 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
38658 <option>directory_mode</option> option.
38659 </para>
38660 </listitem>
38661 <listitem>
38662 <para>
38663 If <option>file_format</option> is set, the format of an existing file is checked. If this
38664 indicates that a different transport should be used, control is passed to that
38665 transport.
38666 </para>
38667 </listitem>
38668 <listitem>
38669 <para>
38670 <indexterm role="concept">
38671 <primary>file</primary>
38672 <secondary>locking</secondary>
38673 </indexterm>
38674 <indexterm role="concept">
38675 <primary>locking files</primary>
38676 </indexterm>
38677 <indexterm role="concept">
38678 <primary>NFS</primary>
38679 <secondary>lock file</secondary>
38680 </indexterm>
38681 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
38682 reliably over NFS, as follows:
38683 </para>
38684 <orderedlist numeration="arabic">
38685 <listitem>
38686 <para>
38687 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
38688 current time, primary host name, and process id added, by opening for writing
38689 as a new file. If this fails with an access error, delivery is deferred.
38690 </para>
38691 </listitem>
38692 <listitem>
38693 <para>
38694 Close the hitching post file, and hard link it to the lock file name.
38695 </para>
38696 </listitem>
38697 <listitem>
38698 <para>
38699 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
38700 Unlink the hitching post name.
38701 </para>
38702 </listitem>
38703 <listitem>
38704 <para>
38705 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
38706 then unlink hitching post name. If the number of links is exactly two, creation
38707 of the lock file succeeded but something (for example, an NFS server crash and
38708 restart) caused this fact not to be communicated to the <function>link()</function> call.
38709 </para>
38710 </listitem>
38711 <listitem>
38712 <para>
38713 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
38714 up to <option>lock_retries</option> times. However, since any program that writes to a
38715 mailbox should complete its task very quickly, it is reasonable to time out old
38716 lock files that are normally the result of user agent and system crashes. If an
38717 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
38718 it before trying again.
38719 </para>
38720 </listitem>
38721 </orderedlist>
38722 </listitem>
38723 <listitem>
38724 <para>
38725 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
38726 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
38727 than non-existence, delivery is deferred.
38728 </para>
38729 </listitem>
38730 <listitem>
38731 <para>
38732 <indexterm role="concept">
38733 <primary>symbolic link</primary>
38734 <secondary>to mailbox</secondary>
38735 </indexterm>
38736 <indexterm role="concept">
38737 <primary>mailbox</primary>
38738 <secondary>symbolic link</secondary>
38739 </indexterm>
38740 If the file does exist and is a symbolic link, delivery is deferred, unless the
38741 <option>allow_symlink</option> option is set, in which case the ownership of the link is
38742 checked, and then <function>stat()</function> is called to find out about the real file, which
38743 is then subjected to the checks below. The check on the top-level link
38744 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
38745 directory, though allowing symbolic links in this case is definitely not a good
38746 idea. If there is a chain of symbolic links, the intermediate ones are not
38747 checked.
38748 </para>
38749 </listitem>
38750 <listitem>
38751 <para>
38752 If the file already exists but is not a regular file, or if the file&#x2019;s owner
38753 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
38754 different from the user and group under which the delivery is running,
38755 delivery is deferred.
38756 </para>
38757 </listitem>
38758 <listitem>
38759 <para>
38760 If the file&#x2019;s permissions are more generous than specified, they are reduced.
38761 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
38762 is set false, in which case the delivery is tried using the existing
38763 permissions.
38764 </para>
38765 </listitem>
38766 <listitem>
38767 <para>
38768 The file&#x2019;s inode number is saved, and the file is then opened for appending.
38769 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
38770 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
38771 </para>
38772 </listitem>
38773 <listitem>
38774 <para>
38775 If the file is opened successfully, check that the inode number hasn&#x2019;t
38776 changed, that it is still a regular file, and that the owner and permissions
38777 have not changed. If anything is wrong, defer delivery and freeze the message.
38778 </para>
38779 </listitem>
38780 <listitem>
38781 <para>
38782 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
38783 option is set. Otherwise, check that the file is being created in a permitted
38784 directory if the <option>create_file</option> option is set (deferring on failure), and then
38785 open for writing as a new file, with the O_EXCL and O_CREAT options,
38786 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
38787 set). In this case, which can happen if the link points to a non-existent file,
38788 the file is opened for writing using O_CREAT but not O_EXCL, because
38789 that prevents link following.
38790 </para>
38791 </listitem>
38792 <listitem>
38793 <para>
38794 <indexterm role="concept">
38795 <primary>loop</primary>
38796 <secondary>while file testing</secondary>
38797 </indexterm>
38798 If opening fails because the file exists, obey the tests given above for
38799 existing files. However, to avoid looping in a situation where the file is
38800 being continuously created and destroyed, the exists/not-exists loop is broken
38801 after 10 repetitions, and the message is then frozen.
38802 </para>
38803 </listitem>
38804 <listitem>
38805 <para>
38806 If opening fails with any other error, defer delivery.
38807 </para>
38808 </listitem>
38809 <listitem>
38810 <para>
38811 <indexterm role="concept">
38812 <primary>file</primary>
38813 <secondary>locking</secondary>
38814 </indexterm>
38815 <indexterm role="concept">
38816 <primary>locking files</primary>
38817 </indexterm>
38818 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
38819 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
38820 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
38821 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
38822 file, and an exclusive lock on the file whose name is
38823 </para>
38824 <literallayout class="monospaced">
38825 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
38826 </literallayout>
38827 <para>
38828 using the device and inode numbers of the open mailbox file, in accordance with
38829 the MBX locking rules. This file is created with a mode that is specified by
38830 the <option>lockfile_mode</option> option.
38831 </para>
38832 <para>
38833 If Exim fails to lock the file, there are two possible courses of action,
38834 depending on the value of the locking timeout. This is obtained from
38835 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
38836 </para>
38837 <para>
38838 If the timeout value is zero, the file is closed, Exim waits for
38839 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
38840 to lock it again. This happens up to <option>lock_retries</option> times, after which the
38841 delivery is deferred.
38842 </para>
38843 <para>
38844 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
38845 <function>flock()</function> are used (with the given timeout), so there has already been some
38846 waiting involved by the time locking fails. Nevertheless, Exim does not give up
38847 immediately. It retries up to
38848 </para>
38849 <literallayout class="monospaced">
38850 (lock_retries * lock_interval) / &lt;timeout&gt;
38851 </literallayout>
38852 <para>
38853 times (rounded up).
38854 </para>
38855 </listitem>
38856 </itemizedlist>
38857 <para>
38858 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
38859 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
38860 </para>
38861 </section>
38862 <section id="SECTopdir">
38863 <title>Operational details for delivery to a new file</title>
38864 <para>
38865 <indexterm role="concept">
38866 <primary>delivery</primary>
38867 <secondary>to single file</secondary>
38868 </indexterm>
38869 <indexterm role="concept">
38870 <primary><quote>From</quote> line</primary>
38871 </indexterm>
38872 When the <option>directory</option> option is set instead of <option>file</option>, each message is
38873 delivered into a newly-created file or set of files. When <command>appendfile</command> is
38874 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
38875 <option>directory</option> is normally set, because the path for delivery is supplied by the
38876 router. (See for example, the <command>address_file</command> transport in the default
38877 configuration.) In this case, delivery is to a new file if either the path name
38878 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
38879 </para>
38880 <para>
38881 No locking is required while writing the message to a new file, so the various
38882 locking options of the transport are ignored. The <quote>From</quote> line that by default
38883 separates messages in a single file is not normally needed, nor is the escaping
38884 of message lines that start with <quote>From</quote>, and there is no need to ensure a
38885 newline at the end of each message. Consequently, the default values for
38886 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
38887 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
38888 </para>
38889 <para>
38890 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
38891 the files in the delivery directory by default. However, you can specify a
38892 different directory by setting <option>quota_directory</option>. Also, for maildir
38893 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
38894 </para>
38895 <para>
38896 <indexterm role="concept">
38897 <primary>maildir format</primary>
38898 </indexterm>
38899 <indexterm role="concept">
38900 <primary>mailstore format</primary>
38901 </indexterm>
38902 There are three different ways in which delivery to individual files can be
38903 done, controlled by the settings of the <option>maildir_format</option> and
38904 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
38905 formats is not included in the binary unless SUPPORT_MAILDIR or
38906 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
38907 </para>
38908 <para>
38909 <indexterm role="concept">
38910 <primary>directory creation</primary>
38911 </indexterm>
38912 In all three cases an attempt is made to create the directory and any necessary
38913 sub-directories if they do not exist, provided that the <option>create_directory</option>
38914 option is set (the default). The location of a created directory can be
38915 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
38916 the <option>directory_mode</option> option. If creation fails, or if the
38917 <option>create_directory</option> option is not set when creation is required, delivery is
38918 deferred.
38919 </para>
38920 </section>
38921 <section id="SECTmaildirdelivery">
38922 <title>Maildir delivery</title>
38923 <para>
38924 <indexterm role="concept">
38925 <primary>maildir format</primary>
38926 <secondary>description of</secondary>
38927 </indexterm>
38928 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
38929 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
38930 directory that is defined by the <option>directory</option> option (the <quote>delivery
38931 directory</quote>). If the delivery is successful, the file is renamed into the
38932 <filename>new</filename> subdirectory.
38933 </para>
38934 <para>
38935 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
38936 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
38937 Exim checks that the time-of-day clock has moved on by at least one microsecond
38938 before terminating the delivery process. This guarantees uniqueness for the
38939 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
38940 opening it. If any response other than ENOENT (does not exist) is given,
38941 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
38942 </para>
38943 <para>
38944 Before Exim carries out a maildir delivery, it ensures that subdirectories
38945 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
38946 do not exist, Exim tries to create them and any superior directories in their
38947 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
38948 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
38949 contains matches the delivery directory, Exim also ensures that a file called
38950 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
38951 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
38952 </para>
38953 <para>
38954 These features make it possible to use Exim to create all the necessary files
38955 and directories in a maildir mailbox, including subdirectories for maildir++
38956 folders. Consider this example:
38957 </para>
38958 <literallayout class="monospaced">
38959 maildir_format = true
38960 directory = /var/mail/$local_part\
38961            ${if eq{$local_part_suffix}{}{}\
38962            {/.${substr_1:$local_part_suffix}}}
38963 maildirfolder_create_regex = /\.[^/]+$
38964 </literallayout>
38965 <para>
38966 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
38967 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
38968 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
38969 not match this name, so Exim will not look for or create the file
38970 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
38971 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
38972 </para>
38973 <para>
38974 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
38975 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
38976 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
38977 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
38978 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
38979 </para>
38980 <para>
38981 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
38982 not inadvertently match the toplevel maildir directory, because a
38983 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
38984 </para>
38985 <para>
38986 <indexterm role="concept">
38987 <primary>quota</primary>
38988 <secondary>in maildir delivery</secondary>
38989 </indexterm>
38990 <indexterm role="concept">
38991 <primary>maildir++</primary>
38992 </indexterm>
38993 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
38994 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
38995 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
38996 Exim assumes the directory is a maildir++ folder directory, which is one level
38997 down from the user&#x2019;s top level mailbox directory. This causes it to start at
38998 the parent directory instead of the current directory when calculating the
38999 amount of space used.
39000 </para>
39001 <para>
39002 One problem with delivering into a multi-file mailbox is that it is
39003 computationally expensive to compute the size of the mailbox for quota
39004 checking. Various approaches have been taken to reduce the amount of work
39005 needed. The next two sections describe two of them. A third alternative is to
39006 use some external process for maintaining the size data, and use the expansion
39007 of the <option>mailbox_size</option> option as a way of importing it into Exim.
39008 </para>
39009 </section>
39010 <section id="SECID135">
39011 <title>Using tags to record message sizes</title>
39012 <para>
39013 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
39014 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
39015 tag is added to its name. However, if adding the tag takes the length of the
39016 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
39017 the tag is dropped and the maildir file is created with no tag.
39018 </para>
39019 <para>
39020 <indexterm role="variable">
39021 <primary><varname>$message_size</varname></primary>
39022 </indexterm>
39023 Tags can be used to encode the size of files in their names; see
39024 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
39025 happens after the message has been written. The value of the <varname>$message_size</varname>
39026 variable is set to the number of bytes actually written. If the expansion is
39027 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
39028 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
39029 Non-printing characters in the string are ignored; if the resulting string is
39030 empty, it is ignored. If it starts with an alphanumeric character, a leading
39031 colon is inserted.
39032 </para>
39033 </section>
39034 <section id="SECID136">
39035 <title>Using a maildirsize file</title>
39036 <para>
39037 <indexterm role="concept">
39038 <primary>quota</primary>
39039 <secondary>in maildir delivery</secondary>
39040 </indexterm>
39041 <indexterm role="concept">
39042 <primary>maildir format</primary>
39043 <secondary><filename>maildirsize</filename> file</secondary>
39044 </indexterm>
39045 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
39046 storing quota and message size information in a file called <filename>maildirsize</filename>
39047 within the toplevel maildir directory. If this file does not exist, Exim
39048 creates it, setting the quota from the <option>quota</option> option of the transport. If
39049 the maildir directory itself does not exist, it is created before any attempt
39050 to write a <filename>maildirsize</filename> file.
39051 </para>
39052 <para>
39053 The <filename>maildirsize</filename> file is used to hold information about the sizes of
39054 messages in the maildir, thus speeding up quota calculations. The quota value
39055 in the file is just a cache; if the quota is changed in the transport, the new
39056 value overrides the cached value when the next message is delivered. The cache
39057 is maintained for the benefit of other programs that access the maildir and
39058 need to know the quota.
39059 </para>
39060 <para>
39061 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
39062 file is maintained (with a zero quota setting), but no quota is imposed.
39063 </para>
39064 <para>
39065 A regular expression is available for controlling which directories in the
39066 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
39067 See the description of the <option>maildir_quota_directory_regex</option> option above for
39068 details.
39069 </para>
39070 </section>
39071 <section id="SECID137">
39072 <title>Mailstore delivery</title>
39073 <para>
39074 <indexterm role="concept">
39075 <primary>mailstore format</primary>
39076 <secondary>description of</secondary>
39077 </indexterm>
39078 If the <option>mailstore_format</option> option is true, each message is written as two
39079 files in the given directory. A unique base name is constructed from the
39080 message id and the current delivery process, and the files that are written use
39081 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
39082 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
39083 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
39084 </para>
39085 <para>
39086 During delivery, the envelope is first written to a file with the suffix
39087 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
39088 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
39089 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
39090 file before accessing either of them. An alternative approach is to wait for
39091 the absence of a <filename>.tmp</filename> file.
39092 </para>
39093 <para>
39094 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
39095 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
39096 the sender address on one line, then all the recipient addresses, one per line.
39097 There can be more than one recipient only if the <option>batch_max</option> option is set
39098 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
39099 appended to the file, followed by a newline if it does not end with one.
39100 </para>
39101 <para>
39102 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
39103 failure, it is ignored. Other expansion errors are treated as serious
39104 configuration errors, and delivery is deferred. The variable
39105 <varname>$mailstore_basename</varname> is available for use during these expansions.
39106 </para>
39107 </section>
39108 <section id="SECID138">
39109 <title>Non-special new file delivery</title>
39110 <para>
39111 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
39112 file is created directly in the named directory. For example, when delivering
39113 messages into files in batched SMTP format for later delivery to some host (see
39114 section <xref linkend="SECTbatchSMTP"/>), a setting such as
39115 </para>
39116 <literallayout class="monospaced">
39117 directory = /var/bsmtp/$host
39118 </literallayout>
39119 <para>
39120 might be used. A message is written to a file with a temporary name, which is
39121 then renamed when the delivery is complete. The final name is obtained by
39122 expanding the contents of the <option>directory_file</option> option.
39123 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
39124 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
39125 </para>
39126 </section>
39127 </chapter>
39128
39129 <chapter id="CHID8">
39130 <title>The autoreply transport</title>
39131 <para>
39132 <indexterm role="concept" id="IIDauttra1" class="startofrange">
39133 <primary>transports</primary>
39134 <secondary><command>autoreply</command></secondary>
39135 </indexterm>
39136 <indexterm role="concept" id="IIDauttra2" class="startofrange">
39137 <primary><command>autoreply</command> transport</primary>
39138 </indexterm>
39139 The <command>autoreply</command> transport is not a true transport in that it does not cause
39140 the message to be transmitted. Instead, it generates a new mail message as an
39141 automatic reply to the incoming message. <emphasis>References:</emphasis> and
39142 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
39143 to the rules in RFCs 2822 and 3834, respectively.
39144 </para>
39145 <para>
39146 If the router that passes the message to this transport does not have the
39147 <option>unseen</option> option set, the original message (for the current recipient) is not
39148 delivered anywhere. However, when the <option>unseen</option> option is set on the router
39149 that passes the message to this transport, routing of the address continues, so
39150 another router can set up a normal message delivery.
39151 </para>
39152 <para>
39153 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
39154 <quote>vacation</quote> message being the standard example. However, it can also be run
39155 directly from a router like any other transport. To reduce the possibility of
39156 message cascades, messages created by the <command>autoreply</command> transport always have
39157 empty envelope sender addresses, like bounce messages.
39158 </para>
39159 <para>
39160 The parameters of the message to be sent can be specified in the configuration
39161 by options described below. However, these are used only when the address
39162 passed to the transport does not contain its own reply information. When the
39163 transport is run as a consequence of a
39164 <option>mail</option>
39165 or <option>vacation</option> command in a filter file, the parameters of the message are
39166 supplied by the filter, and passed with the address. The transport&#x2019;s options
39167 that define the message are then ignored (so they are not usually set in this
39168 case). The message is specified entirely by the filter or by the transport; it
39169 is never built from a mixture of options. However, the <option>file_optional</option>,
39170 <option>mode</option>, and <option>return_message</option> options apply in all cases.
39171 </para>
39172 <para>
39173 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
39174 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
39175 gid of the user, and with appropriate current and home directories (see chapter
39176 <xref linkend="CHAPenvironment"/>).
39177 </para>
39178 <para>
39179 There is a subtle difference between routing a message to a <command>pipe</command> transport
39180 that generates some text to be returned to the sender, and routing it to an
39181 <command>autoreply</command> transport. This difference is noticeable only if more than one
39182 address from the same message is so handled. In the case of a pipe, the
39183 separate outputs from the different addresses are gathered up and returned to
39184 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
39185 message is generated for each address that is passed to it.
39186 </para>
39187 <para>
39188 Non-printing characters are not permitted in the header lines generated for the
39189 message that <command>autoreply</command> creates, with the exception of newlines that are
39190 immediately followed by white space. If any non-printing characters are found,
39191 the transport defers.
39192 Whether characters with the top bit set count as printing characters or not is
39193 controlled by the <option>print_topbitchars</option> global option.
39194 </para>
39195 <para>
39196 If any of the generic options for manipulating headers (for example,
39197 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
39198 of the original message that is included in the generated message when
39199 <option>return_message</option> is set. They do not apply to the generated message itself.
39200 </para>
39201 <para>
39202 <indexterm role="variable">
39203 <primary><varname>$sender_address</varname></primary>
39204 </indexterm>
39205 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
39206 the message, indicating that there were no recipients, it does not treat this
39207 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
39208 is empty (because the incoming message is a bounce message) do not cause
39209 problems. They are just discarded.
39210 </para>
39211 <section id="SECID139">
39212 <title>Private options for autoreply</title>
39213 <para>
39214 <indexterm role="concept">
39215 <primary>options</primary>
39216 <secondary><command>autoreply</command> transport</secondary>
39217 </indexterm>
39218 </para>
39219 <para>
39220 <indexterm role="option">
39221 <primary><option>bcc</option></primary>
39222 </indexterm>
39223 </para>
39224 <informaltable frame="all">
39225 <tgroup cols="4" colsep="0" rowsep="0">
39226 <colspec colwidth="8*" align="left"/>
39227 <colspec colwidth="6*" align="center"/>
39228 <colspec colwidth="6*" align="center"/>
39229 <colspec colwidth="6*" align="right"/>
39230 <tbody>
39231 <row>
39232 <entry><option>bcc</option></entry>
39233 <entry>Use: <emphasis>autoreply</emphasis></entry>
39234 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39235 <entry>Default: <emphasis>unset</emphasis></entry>
39236 </row>
39237 </tbody>
39238 </tgroup>
39239 </informaltable>
39240 <para>
39241 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
39242 message when the message is specified by the transport.
39243 </para>
39244 <para>
39245 <indexterm role="option">
39246 <primary><option>cc</option></primary>
39247 </indexterm>
39248 </para>
39249 <informaltable frame="all">
39250 <tgroup cols="4" colsep="0" rowsep="0">
39251 <colspec colwidth="8*" align="left"/>
39252 <colspec colwidth="6*" align="center"/>
39253 <colspec colwidth="6*" align="center"/>
39254 <colspec colwidth="6*" align="right"/>
39255 <tbody>
39256 <row>
39257 <entry><option>cc</option></entry>
39258 <entry>Use: <emphasis>autoreply</emphasis></entry>
39259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39260 <entry>Default: <emphasis>unset</emphasis></entry>
39261 </row>
39262 </tbody>
39263 </tgroup>
39264 </informaltable>
39265 <para>
39266 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
39267 when the message is specified by the transport.
39268 </para>
39269 <para>
39270 <indexterm role="option">
39271 <primary><option>file</option></primary>
39272 </indexterm>
39273 </para>
39274 <informaltable frame="all">
39275 <tgroup cols="4" colsep="0" rowsep="0">
39276 <colspec colwidth="8*" align="left"/>
39277 <colspec colwidth="6*" align="center"/>
39278 <colspec colwidth="6*" align="center"/>
39279 <colspec colwidth="6*" align="right"/>
39280 <tbody>
39281 <row>
39282 <entry><option>file</option></entry>
39283 <entry>Use: <emphasis>autoreply</emphasis></entry>
39284 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39285 <entry>Default: <emphasis>unset</emphasis></entry>
39286 </row>
39287 </tbody>
39288 </tgroup>
39289 </informaltable>
39290 <para>
39291 The contents of the file are sent as the body of the message when the message
39292 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
39293 string comes first.
39294 </para>
39295 <para>
39296 <indexterm role="option">
39297 <primary><option>file_expand</option></primary>
39298 </indexterm>
39299 </para>
39300 <informaltable frame="all">
39301 <tgroup cols="4" colsep="0" rowsep="0">
39302 <colspec colwidth="8*" align="left"/>
39303 <colspec colwidth="6*" align="center"/>
39304 <colspec colwidth="6*" align="center"/>
39305 <colspec colwidth="6*" align="right"/>
39306 <tbody>
39307 <row>
39308 <entry><option>file_expand</option></entry>
39309 <entry>Use: <emphasis>autoreply</emphasis></entry>
39310 <entry>Type: <emphasis>boolean</emphasis></entry>
39311 <entry>Default: <emphasis>false</emphasis></entry>
39312 </row>
39313 </tbody>
39314 </tgroup>
39315 </informaltable>
39316 <para>
39317 If this is set, the contents of the file named by the <option>file</option> option are
39318 subjected to string expansion as they are added to the message.
39319 </para>
39320 <para>
39321 <indexterm role="option">
39322 <primary><option>file_optional</option></primary>
39323 </indexterm>
39324 </para>
39325 <informaltable frame="all">
39326 <tgroup cols="4" colsep="0" rowsep="0">
39327 <colspec colwidth="8*" align="left"/>
39328 <colspec colwidth="6*" align="center"/>
39329 <colspec colwidth="6*" align="center"/>
39330 <colspec colwidth="6*" align="right"/>
39331 <tbody>
39332 <row>
39333 <entry><option>file_optional</option></entry>
39334 <entry>Use: <emphasis>autoreply</emphasis></entry>
39335 <entry>Type: <emphasis>boolean</emphasis></entry>
39336 <entry>Default: <emphasis>false</emphasis></entry>
39337 </row>
39338 </tbody>
39339 </tgroup>
39340 </informaltable>
39341 <para>
39342 If this option is true, no error is generated if the file named by the <option>file</option>
39343 option or passed with the address does not exist or cannot be read.
39344 </para>
39345 <para>
39346 <indexterm role="option">
39347 <primary><option>from</option></primary>
39348 </indexterm>
39349 </para>
39350 <informaltable frame="all">
39351 <tgroup cols="4" colsep="0" rowsep="0">
39352 <colspec colwidth="8*" align="left"/>
39353 <colspec colwidth="6*" align="center"/>
39354 <colspec colwidth="6*" align="center"/>
39355 <colspec colwidth="6*" align="right"/>
39356 <tbody>
39357 <row>
39358 <entry><option>from</option></entry>
39359 <entry>Use: <emphasis>autoreply</emphasis></entry>
39360 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39361 <entry>Default: <emphasis>unset</emphasis></entry>
39362 </row>
39363 </tbody>
39364 </tgroup>
39365 </informaltable>
39366 <para>
39367 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
39368 specified by the transport.
39369 </para>
39370 <para>
39371 <indexterm role="option">
39372 <primary><option>headers</option></primary>
39373 </indexterm>
39374 </para>
39375 <informaltable frame="all">
39376 <tgroup cols="4" colsep="0" rowsep="0">
39377 <colspec colwidth="8*" align="left"/>
39378 <colspec colwidth="6*" align="center"/>
39379 <colspec colwidth="6*" align="center"/>
39380 <colspec colwidth="6*" align="right"/>
39381 <tbody>
39382 <row>
39383 <entry><option>headers</option></entry>
39384 <entry>Use: <emphasis>autoreply</emphasis></entry>
39385 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39386 <entry>Default: <emphasis>unset</emphasis></entry>
39387 </row>
39388 </tbody>
39389 </tgroup>
39390 </informaltable>
39391 <para>
39392 This specifies additional RFC 2822 headers that are to be added to the message
39393 when the message is specified by the transport. Several can be given by using
39394 <quote>\n</quote> to separate them. There is no check on the format.
39395 </para>
39396 <para>
39397 <indexterm role="option">
39398 <primary><option>log</option></primary>
39399 </indexterm>
39400 </para>
39401 <informaltable frame="all">
39402 <tgroup cols="4" colsep="0" rowsep="0">
39403 <colspec colwidth="8*" align="left"/>
39404 <colspec colwidth="6*" align="center"/>
39405 <colspec colwidth="6*" align="center"/>
39406 <colspec colwidth="6*" align="right"/>
39407 <tbody>
39408 <row>
39409 <entry><option>log</option></entry>
39410 <entry>Use: <emphasis>autoreply</emphasis></entry>
39411 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39412 <entry>Default: <emphasis>unset</emphasis></entry>
39413 </row>
39414 </tbody>
39415 </tgroup>
39416 </informaltable>
39417 <para>
39418 This option names a file in which a record of every message sent is logged when
39419 the message is specified by the transport.
39420 </para>
39421 <para>
39422 <indexterm role="option">
39423 <primary><option>mode</option></primary>
39424 </indexterm>
39425 </para>
39426 <informaltable frame="all">
39427 <tgroup cols="4" colsep="0" rowsep="0">
39428 <colspec colwidth="8*" align="left"/>
39429 <colspec colwidth="6*" align="center"/>
39430 <colspec colwidth="6*" align="center"/>
39431 <colspec colwidth="6*" align="right"/>
39432 <tbody>
39433 <row>
39434 <entry><option>mode</option></entry>
39435 <entry>Use: <emphasis>autoreply</emphasis></entry>
39436 <entry>Type: <emphasis>octal integer</emphasis></entry>
39437 <entry>Default: <emphasis>0600</emphasis></entry>
39438 </row>
39439 </tbody>
39440 </tgroup>
39441 </informaltable>
39442 <para>
39443 If either the log file or the <quote>once</quote> file has to be created, this mode is
39444 used.
39445 </para>
39446 <para>
39447 <indexterm role="option">
39448 <primary><option>never_mail</option></primary>
39449 </indexterm>
39450 </para>
39451 <informaltable frame="all">
39452 <tgroup cols="4" colsep="0" rowsep="0">
39453 <colspec colwidth="8*" align="left"/>
39454 <colspec colwidth="6*" align="center"/>
39455 <colspec colwidth="6*" align="center"/>
39456 <colspec colwidth="6*" align="right"/>
39457 <tbody>
39458 <row>
39459 <entry><option>never_mail</option></entry>
39460 <entry>Use: <emphasis>autoreply</emphasis></entry>
39461 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
39462 <entry>Default: <emphasis>unset</emphasis></entry>
39463 </row>
39464 </tbody>
39465 </tgroup>
39466 </informaltable>
39467 <para>
39468 If any run of the transport creates a message with a recipient that matches any
39469 item in the list, that recipient is quietly discarded. If all recipients are
39470 discarded, no message is created. This applies both when the recipients are
39471 generated by a filter and when they are specified in the transport.
39472 </para>
39473 <para>
39474 <indexterm role="option">
39475 <primary><option>once</option></primary>
39476 </indexterm>
39477 </para>
39478 <informaltable frame="all">
39479 <tgroup cols="4" colsep="0" rowsep="0">
39480 <colspec colwidth="8*" align="left"/>
39481 <colspec colwidth="6*" align="center"/>
39482 <colspec colwidth="6*" align="center"/>
39483 <colspec colwidth="6*" align="right"/>
39484 <tbody>
39485 <row>
39486 <entry><option>once</option></entry>
39487 <entry>Use: <emphasis>autoreply</emphasis></entry>
39488 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39489 <entry>Default: <emphasis>unset</emphasis></entry>
39490 </row>
39491 </tbody>
39492 </tgroup>
39493 </informaltable>
39494 <para>
39495 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
39496 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
39497 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
39498 </para>
39499 <para>
39500 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
39501 By default, if <option>once</option> is set to a non-empty file name, the message
39502 is not sent if a potential recipient is already listed in the database.
39503 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
39504 message is sent if that much time has elapsed since a message was last sent to
39505 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
39506 prevents a message from being sent a second time &ndash; in this case, zero means
39507 infinity.
39508 </para>
39509 <para>
39510 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
39511 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
39512 greater than zero, it changes the way Exim implements the <option>once</option> option.
39513 Instead of using a DBM file to record every recipient it sends to, it uses a
39514 regular file, whose size will never get larger than the given value.
39515 </para>
39516 <para>
39517 In the file, Exim keeps a linear list of recipient addresses and the times at
39518 which they were sent messages. If the file is full when a new address needs to
39519 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
39520 means that a given recipient may receive multiple messages, but at
39521 unpredictable intervals that depend on the rate of turnover of addresses in the
39522 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
39523 </para>
39524 <para>
39525 <indexterm role="option">
39526 <primary><option>once_file_size</option></primary>
39527 </indexterm>
39528 </para>
39529 <informaltable frame="all">
39530 <tgroup cols="4" colsep="0" rowsep="0">
39531 <colspec colwidth="8*" align="left"/>
39532 <colspec colwidth="6*" align="center"/>
39533 <colspec colwidth="6*" align="center"/>
39534 <colspec colwidth="6*" align="right"/>
39535 <tbody>
39536 <row>
39537 <entry><option>once_file_size</option></entry>
39538 <entry>Use: <emphasis>autoreply</emphasis></entry>
39539 <entry>Type: <emphasis>integer</emphasis></entry>
39540 <entry>Default: <emphasis>0</emphasis></entry>
39541 </row>
39542 </tbody>
39543 </tgroup>
39544 </informaltable>
39545 <para>
39546 See <option>once</option> above.
39547 </para>
39548 <para>
39549 <indexterm role="option">
39550 <primary><option>once_repeat</option></primary>
39551 </indexterm>
39552 </para>
39553 <informaltable frame="all">
39554 <tgroup cols="4" colsep="0" rowsep="0">
39555 <colspec colwidth="8*" align="left"/>
39556 <colspec colwidth="6*" align="center"/>
39557 <colspec colwidth="6*" align="center"/>
39558 <colspec colwidth="6*" align="right"/>
39559 <tbody>
39560 <row>
39561 <entry><option>once_repeat</option></entry>
39562 <entry>Use: <emphasis>autoreply</emphasis></entry>
39563 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
39564 <entry>Default: <emphasis>0s</emphasis></entry>
39565 </row>
39566 </tbody>
39567 </tgroup>
39568 </informaltable>
39569 <para>
39570 See <option>once</option> above.
39571 After expansion, the value of this option must be a valid time value.
39572 </para>
39573 <para>
39574 <indexterm role="option">
39575 <primary><option>reply_to</option></primary>
39576 </indexterm>
39577 </para>
39578 <informaltable frame="all">
39579 <tgroup cols="4" colsep="0" rowsep="0">
39580 <colspec colwidth="8*" align="left"/>
39581 <colspec colwidth="6*" align="center"/>
39582 <colspec colwidth="6*" align="center"/>
39583 <colspec colwidth="6*" align="right"/>
39584 <tbody>
39585 <row>
39586 <entry><option>reply_to</option></entry>
39587 <entry>Use: <emphasis>autoreply</emphasis></entry>
39588 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39589 <entry>Default: <emphasis>unset</emphasis></entry>
39590 </row>
39591 </tbody>
39592 </tgroup>
39593 </informaltable>
39594 <para>
39595 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
39596 specified by the transport.
39597 </para>
39598 <para>
39599 <indexterm role="option">
39600 <primary><option>return_message</option></primary>
39601 </indexterm>
39602 </para>
39603 <informaltable frame="all">
39604 <tgroup cols="4" colsep="0" rowsep="0">
39605 <colspec colwidth="8*" align="left"/>
39606 <colspec colwidth="6*" align="center"/>
39607 <colspec colwidth="6*" align="center"/>
39608 <colspec colwidth="6*" align="right"/>
39609 <tbody>
39610 <row>
39611 <entry><option>return_message</option></entry>
39612 <entry>Use: <emphasis>autoreply</emphasis></entry>
39613 <entry>Type: <emphasis>boolean</emphasis></entry>
39614 <entry>Default: <emphasis>false</emphasis></entry>
39615 </row>
39616 </tbody>
39617 </tgroup>
39618 </informaltable>
39619 <para>
39620 If this is set, a copy of the original message is returned with the new
39621 message, subject to the maximum size set in the <option>return_size_limit</option> global
39622 configuration option.
39623 </para>
39624 <para>
39625 <indexterm role="option">
39626 <primary><option>subject</option></primary>
39627 </indexterm>
39628 </para>
39629 <informaltable frame="all">
39630 <tgroup cols="4" colsep="0" rowsep="0">
39631 <colspec colwidth="8*" align="left"/>
39632 <colspec colwidth="6*" align="center"/>
39633 <colspec colwidth="6*" align="center"/>
39634 <colspec colwidth="6*" align="right"/>
39635 <tbody>
39636 <row>
39637 <entry><option>subject</option></entry>
39638 <entry>Use: <emphasis>autoreply</emphasis></entry>
39639 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39640 <entry>Default: <emphasis>unset</emphasis></entry>
39641 </row>
39642 </tbody>
39643 </tgroup>
39644 </informaltable>
39645 <para>
39646 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
39647 specified by the transport. It is tempting to quote the original subject in
39648 automatic responses. For example:
39649 </para>
39650 <literallayout class="monospaced">
39651 subject = Re: $h_subject:
39652 </literallayout>
39653 <para>
39654 There is a danger in doing this, however. It may allow a third party to
39655 subscribe your users to an opt-in mailing list, provided that the list accepts
39656 bounce messages as subscription confirmations. Well-managed lists require a
39657 non-bounce message to confirm a subscription, so the danger is relatively
39658 small.
39659 </para>
39660 <para>
39661 <indexterm role="option">
39662 <primary><option>text</option></primary>
39663 </indexterm>
39664 </para>
39665 <informaltable frame="all">
39666 <tgroup cols="4" colsep="0" rowsep="0">
39667 <colspec colwidth="8*" align="left"/>
39668 <colspec colwidth="6*" align="center"/>
39669 <colspec colwidth="6*" align="center"/>
39670 <colspec colwidth="6*" align="right"/>
39671 <tbody>
39672 <row>
39673 <entry><option>text</option></entry>
39674 <entry>Use: <emphasis>autoreply</emphasis></entry>
39675 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39676 <entry>Default: <emphasis>unset</emphasis></entry>
39677 </row>
39678 </tbody>
39679 </tgroup>
39680 </informaltable>
39681 <para>
39682 This specifies a single string to be used as the body of the message when the
39683 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
39684 the text comes first.
39685 </para>
39686 <para>
39687 <indexterm role="option">
39688 <primary><option>to</option></primary>
39689 </indexterm>
39690 </para>
39691 <informaltable frame="all">
39692 <tgroup cols="4" colsep="0" rowsep="0">
39693 <colspec colwidth="8*" align="left"/>
39694 <colspec colwidth="6*" align="center"/>
39695 <colspec colwidth="6*" align="center"/>
39696 <colspec colwidth="6*" align="right"/>
39697 <tbody>
39698 <row>
39699 <entry><option>to</option></entry>
39700 <entry>Use: <emphasis>autoreply</emphasis></entry>
39701 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39702 <entry>Default: <emphasis>unset</emphasis></entry>
39703 </row>
39704 </tbody>
39705 </tgroup>
39706 </informaltable>
39707 <para>
39708 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
39709 when the message is specified by the transport.
39710 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
39711 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
39712 </para>
39713 </section>
39714 </chapter>
39715
39716 <chapter id="CHAPLMTP">
39717 <title>The lmtp transport</title>
39718 <para>
39719 <indexterm role="concept">
39720 <primary>transports</primary>
39721 <secondary><command>lmtp</command></secondary>
39722 </indexterm>
39723 <indexterm role="concept">
39724 <primary><command>lmtp</command> transport</primary>
39725 </indexterm>
39726 <indexterm role="concept">
39727 <primary>LMTP</primary>
39728 <secondary>over a pipe</secondary>
39729 </indexterm>
39730 <indexterm role="concept">
39731 <primary>LMTP</primary>
39732 <secondary>over a socket</secondary>
39733 </indexterm>
39734 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
39735 specified command
39736 or by interacting with a Unix domain socket.
39737 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
39738 transports. Exim also has support for using LMTP over TCP/IP; this is
39739 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
39740 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
39741 has it commented out. You need to ensure that
39742 </para>
39743 <literallayout class="monospaced">
39744 TRANSPORT_LMTP=yes
39745 </literallayout>
39746 <para>
39747 <indexterm role="concept">
39748 <primary>options</primary>
39749 <secondary><command>lmtp</command> transport</secondary>
39750 </indexterm>
39751 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
39752 included in the Exim binary. The private options of the <command>lmtp</command> transport are
39753 as follows:
39754 </para>
39755 <para>
39756 <indexterm role="option">
39757 <primary><option>batch_id</option></primary>
39758 </indexterm>
39759 </para>
39760 <informaltable frame="all">
39761 <tgroup cols="4" colsep="0" rowsep="0">
39762 <colspec colwidth="8*" align="left"/>
39763 <colspec colwidth="6*" align="center"/>
39764 <colspec colwidth="6*" align="center"/>
39765 <colspec colwidth="6*" align="right"/>
39766 <tbody>
39767 <row>
39768 <entry><option>batch_id</option></entry>
39769 <entry>Use: <emphasis>lmtp</emphasis></entry>
39770 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39771 <entry>Default: <emphasis>unset</emphasis></entry>
39772 </row>
39773 </tbody>
39774 </tgroup>
39775 </informaltable>
39776 <para>
39777 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39778 </para>
39779 <para>
39780 <indexterm role="option">
39781 <primary><option>batch_max</option></primary>
39782 </indexterm>
39783 </para>
39784 <informaltable frame="all">
39785 <tgroup cols="4" colsep="0" rowsep="0">
39786 <colspec colwidth="8*" align="left"/>
39787 <colspec colwidth="6*" align="center"/>
39788 <colspec colwidth="6*" align="center"/>
39789 <colspec colwidth="6*" align="right"/>
39790 <tbody>
39791 <row>
39792 <entry><option>batch_max</option></entry>
39793 <entry>Use: <emphasis>lmtp</emphasis></entry>
39794 <entry>Type: <emphasis>integer</emphasis></entry>
39795 <entry>Default: <emphasis>1</emphasis></entry>
39796 </row>
39797 </tbody>
39798 </tgroup>
39799 </informaltable>
39800 <para>
39801 This limits the number of addresses that can be handled in a single delivery.
39802 Most LMTP servers can handle several addresses at once, so it is normally a
39803 good idea to increase this value. See the description of local delivery
39804 batching in chapter <xref linkend="CHAPbatching"/>.
39805 </para>
39806 <para>
39807 <indexterm role="option">
39808 <primary><option>command</option></primary>
39809 </indexterm>
39810 </para>
39811 <informaltable frame="all">
39812 <tgroup cols="4" colsep="0" rowsep="0">
39813 <colspec colwidth="8*" align="left"/>
39814 <colspec colwidth="6*" align="center"/>
39815 <colspec colwidth="6*" align="center"/>
39816 <colspec colwidth="6*" align="right"/>
39817 <tbody>
39818 <row>
39819 <entry><option>command</option></entry>
39820 <entry>Use: <emphasis>lmtp</emphasis></entry>
39821 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39822 <entry>Default: <emphasis>unset</emphasis></entry>
39823 </row>
39824 </tbody>
39825 </tgroup>
39826 </informaltable>
39827 <para>
39828 This option must be set if <option>socket</option> is not set. The string is a command which
39829 is run in a separate process. It is split up into a command name and list of
39830 arguments, each of which is separately expanded (so expansion cannot change the
39831 number of arguments). The command is run directly, not via a shell. The message
39832 is passed to the new process using the standard input and output to operate the
39833 LMTP protocol.
39834 </para>
39835 <para>
39836 <indexterm role="option">
39837 <primary><option>ignore_quota</option></primary>
39838 </indexterm>
39839 </para>
39840 <informaltable frame="all">
39841 <tgroup cols="4" colsep="0" rowsep="0">
39842 <colspec colwidth="8*" align="left"/>
39843 <colspec colwidth="6*" align="center"/>
39844 <colspec colwidth="6*" align="center"/>
39845 <colspec colwidth="6*" align="right"/>
39846 <tbody>
39847 <row>
39848 <entry><option>ignore_quota</option></entry>
39849 <entry>Use: <emphasis>lmtp</emphasis></entry>
39850 <entry>Type: <emphasis>boolean</emphasis></entry>
39851 <entry>Default: <emphasis>false</emphasis></entry>
39852 </row>
39853 </tbody>
39854 </tgroup>
39855 </informaltable>
39856 <para>
39857 <indexterm role="concept">
39858 <primary>LMTP</primary>
39859 <secondary>ignoring quota errors</secondary>
39860 </indexterm>
39861 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
39862 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
39863 in its response to the LHLO command.
39864 </para>
39865 <para>
39866 <indexterm role="option">
39867 <primary><option>socket</option></primary>
39868 </indexterm>
39869 </para>
39870 <informaltable frame="all">
39871 <tgroup cols="4" colsep="0" rowsep="0">
39872 <colspec colwidth="8*" align="left"/>
39873 <colspec colwidth="6*" align="center"/>
39874 <colspec colwidth="6*" align="center"/>
39875 <colspec colwidth="6*" align="right"/>
39876 <tbody>
39877 <row>
39878 <entry><option>socket</option></entry>
39879 <entry>Use: <emphasis>lmtp</emphasis></entry>
39880 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39881 <entry>Default: <emphasis>unset</emphasis></entry>
39882 </row>
39883 </tbody>
39884 </tgroup>
39885 </informaltable>
39886 <para>
39887 This option must be set if <option>command</option> is not set. The result of expansion must
39888 be the name of a Unix domain socket. The transport connects to the socket and
39889 delivers the message to it using the LMTP protocol.
39890 </para>
39891 <para>
39892 <indexterm role="option">
39893 <primary><option>timeout</option></primary>
39894 </indexterm>
39895 </para>
39896 <informaltable frame="all">
39897 <tgroup cols="4" colsep="0" rowsep="0">
39898 <colspec colwidth="8*" align="left"/>
39899 <colspec colwidth="6*" align="center"/>
39900 <colspec colwidth="6*" align="center"/>
39901 <colspec colwidth="6*" align="right"/>
39902 <tbody>
39903 <row>
39904 <entry><option>timeout</option></entry>
39905 <entry>Use: <emphasis>lmtp</emphasis></entry>
39906 <entry>Type: <emphasis>time</emphasis></entry>
39907 <entry>Default: <emphasis>5m</emphasis></entry>
39908 </row>
39909 </tbody>
39910 </tgroup>
39911 </informaltable>
39912 <para>
39913 The transport is aborted if the created process or Unix domain socket does not
39914 respond to LMTP commands or message input within this timeout. <phrase revisionflag="changed">Delivery
39915 is deferred, and will be tried again later.</phrase> Here is an example of a typical
39916 LMTP transport:
39917 </para>
39918 <literallayout class="monospaced">
39919 lmtp:
39920   driver = lmtp
39921   command = /some/local/lmtp/delivery/program
39922   batch_max = 20
39923   user = exim
39924 </literallayout>
39925 <para>
39926 This delivers up to 20 addresses at a time, in a mixture of domains if
39927 necessary, running as the user <emphasis>exim</emphasis>.
39928 </para>
39929 </chapter>
39930
39931 <chapter id="CHAPpipetransport">
39932 <title>The pipe transport</title>
39933 <para>
39934 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
39935 <primary>transports</primary>
39936 <secondary><command>pipe</command></secondary>
39937 </indexterm>
39938 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
39939 <primary><command>pipe</command> transport</primary>
39940 </indexterm>
39941 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
39942 running in another process. One example is the use of <command>pipe</command> as a
39943 pseudo-remote transport for passing messages to some other delivery mechanism
39944 (such as UUCP). Another is the use by individual users to automatically process
39945 their incoming messages. The <command>pipe</command> transport can be used in one of the
39946 following ways:
39947 </para>
39948 <itemizedlist>
39949 <listitem>
39950 <para>
39951 <indexterm role="variable">
39952 <primary><varname>$local_part</varname></primary>
39953 </indexterm>
39954 A router routes one address to a transport in the normal way, and the
39955 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
39956 contains the local part of the address (as usual), and the command that is run
39957 is specified by the <option>command</option> option on the transport.
39958 </para>
39959 </listitem>
39960 <listitem>
39961 <para>
39962 <indexterm role="variable">
39963 <primary><varname>$pipe_addresses</varname></primary>
39964 </indexterm>
39965 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
39966 transport can handle more than one address in a single run. In this case, when
39967 more than one address is routed to the transport, <varname>$local_part</varname> is not set
39968 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
39969 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
39970 that are routed to the transport.
39971 </para>
39972 </listitem>
39973 <listitem>
39974 <para>
39975 <indexterm role="variable">
39976 <primary><varname>$address_pipe</varname></primary>
39977 </indexterm>
39978 A router redirects an address directly to a pipe command (for example, from an
39979 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
39980 pipe command, and the <option>command</option> option on the transport is ignored. If only
39981 one address is being transported (<option>batch_max</option> is not greater than one, or
39982 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
39983 the local part that was redirected.
39984 </para>
39985 </listitem>
39986 </itemizedlist>
39987 <para>
39988 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
39989 deliver messages over pipes using the LMTP interactive protocol. This is
39990 implemented by the <command>lmtp</command> transport.
39991 </para>
39992 <para>
39993 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
39994 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
39995 other cases, the uid and gid have to be specified explicitly, either on the
39996 transport or on the router that handles the address. Current and <quote>home</quote>
39997 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
39998 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
39999 for a discussion of local delivery batching.
40000 </para>
40001 <section id="SECID140">
40002 <title>Concurrent delivery</title>
40003 <para>
40004 If two messages arrive at almost the same time, and both are routed to a pipe
40005 delivery, the two pipe transports may be run concurrently. You must ensure that
40006 any pipe commands you set up are robust against this happening. If the commands
40007 write to a file, the <option>exim_lock</option> utility might be of use.
40008 </para>
40009 </section>
40010 <section id="SECID141">
40011 <title>Returned status and data</title>
40012 <para>
40013 <indexterm role="concept">
40014 <primary><command>pipe</command> transport</primary>
40015 <secondary>returned data</secondary>
40016 </indexterm>
40017 If the command exits with a non-zero return code, the delivery is deemed to
40018 have failed, unless either the <option>ignore_status</option> option is set (in which case
40019 the return code is treated as zero), or the return code is one of those listed
40020 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
40021 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
40022 logged, but are not included in the bounce message, which merely contains
40023 <quote>local delivery failed</quote>.
40024 </para>
40025 <para>
40026 If the return code is greater than 128 and the command being run is a shell
40027 script, it normally means that the script was terminated by a signal whose
40028 value is the return code minus 128.
40029 </para>
40030 <para>
40031 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
40032 return code is set to 127. This is the value that a shell returns if it is
40033 asked to run a non-existent command. The wording for the log line suggests that
40034 a non-existent command may be the problem.
40035 </para>
40036 <para>
40037 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
40038 set and the command produces any output on its standard output or standard
40039 error streams, the command is considered to have failed, even if it gave a zero
40040 return code or if <option>ignore_status</option> is set. The output from the command is
40041 included as part of the bounce message. The <option>return_fail_output</option> option is
40042 similar, except that output is returned only when the command exits with a
40043 failure return code, that is, a value other than zero or a code that matches
40044 <option>temp_errors</option>.
40045 </para>
40046 </section>
40047 <section id="SECThowcommandrun">
40048 <title>How the command is run</title>
40049 <para>
40050 <indexterm role="concept">
40051 <primary><command>pipe</command> transport</primary>
40052 <secondary>path for command</secondary>
40053 </indexterm>
40054 The command line is (by default) broken down into a command name and arguments
40055 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
40056 <option>restrict_to_path</option> options can be used to restrict the commands that may be
40057 run.
40058 </para>
40059 <para>
40060 <indexterm role="concept">
40061 <primary>quoting</primary>
40062 <secondary>in pipe command</secondary>
40063 </indexterm>
40064 Unquoted arguments are delimited by white space. If an argument appears in
40065 double quotes, backslash is interpreted as an escape character in the usual
40066 way. If an argument appears in single quotes, no escaping is done.
40067 </para>
40068 <para>
40069 String expansion is applied to the command line except when it comes from a
40070 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
40071 expansion is applied to each argument in turn rather than to the whole line.
40072 For this reason, any string expansion item that contains white space must be
40073 quoted so as to be contained within a single argument. A setting such as
40074 </para>
40075 <literallayout class="monospaced">
40076 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
40077 </literallayout>
40078 <para>
40079 will not work, because the expansion item gets split between several
40080 arguments. You have to write
40081 </para>
40082 <literallayout class="monospaced">
40083 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
40084 </literallayout>
40085 <para>
40086 to ensure that it is all in one argument. The expansion is done in this way,
40087 argument by argument, so that the number of arguments cannot be changed as a
40088 result of expansion, and quotes or backslashes in inserted variables do not
40089 interact with external quoting. However, this leads to problems if you want to
40090 generate multiple arguments (or the command name plus arguments) from a single
40091 expansion. In this situation, the simplest solution is to use a shell. For
40092 example:
40093 </para>
40094 <literallayout class="monospaced">
40095 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
40096 </literallayout>
40097 <para>
40098 <indexterm role="concept">
40099 <primary>transport</primary>
40100 <secondary>filter</secondary>
40101 </indexterm>
40102 <indexterm role="concept">
40103 <primary>filter</primary>
40104 <secondary>transport filter</secondary>
40105 </indexterm>
40106 <indexterm role="variable">
40107 <primary><varname>$pipe_addresses</varname></primary>
40108 </indexterm>
40109 Special handling takes place when an argument consists of precisely the text
40110 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
40111 place this string is recognized is when it appears as an argument for a pipe or
40112 transport filter command. It causes each address that is being handled to be
40113 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
40114 avoids any problems with spaces or shell metacharacters, and is of use when a
40115 <command>pipe</command> transport is handling groups of addresses in a batch.
40116 </para>
40117 <para>
40118 After splitting up into arguments and expansion, the resulting command is run
40119 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
40120 message that is being delivered is supplied on the standard input, and the
40121 standard output and standard error are both connected to a single pipe that is
40122 read by Exim. The <option>max_output</option> option controls how much output the command
40123 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
40124 control what is done with it.
40125 </para>
40126 <para>
40127 Not running the command under a shell (by default) lessens the security risks
40128 in cases when a command from a user&#x2019;s filter file is built out of data that was
40129 taken from an incoming message. If a shell is required, it can of course be
40130 explicitly specified as the command to be run. However, there are circumstances
40131 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
40132 under a shell and cannot easily be modified. To allow for these cases, there is
40133 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
40134 works. Instead of breaking up the command line as just described, it expands it
40135 as a single string and passes the result to <filename>/bin/sh</filename>. The
40136 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
40137 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
40138 </para>
40139 </section>
40140 <section id="SECTpipeenv">
40141 <title>Environment variables</title>
40142 <para>
40143 <indexterm role="concept">
40144 <primary><command>pipe</command> transport</primary>
40145 <secondary>environment for command</secondary>
40146 </indexterm>
40147 <indexterm role="concept">
40148 <primary>environment for pipe transport</primary>
40149 </indexterm>
40150 The environment variables listed below are set up when the command is invoked.
40151 This list is a compromise for maximum compatibility with other MTAs. Note that
40152 the <option>environment</option> option can be used to add additional variables to this
40153 environment.
40154 </para>
40155 <literallayout>
40156 <literal>DOMAIN            </literal>   the domain of the address
40157 <literal>HOME              </literal>   the home directory, if set
40158 <literal>HOST              </literal>   the host name when called from a router (see below)
40159 <literal>LOCAL_PART        </literal>   see below
40160 <literal>LOCAL_PART_PREFIX </literal>   see below
40161 <literal>LOCAL_PART_SUFFIX </literal>   see below
40162 <literal>LOGNAME           </literal>   see below
40163 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
40164 <literal>PATH              </literal>   as specified by the <option>path</option> option below
40165 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
40166 <literal>RECIPIENT         </literal>   the complete recipient address
40167 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
40168 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
40169 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
40170 <literal>USER              </literal>   see below
40171 </literallayout>
40172 <para>
40173 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
40174 router, LOCAL_PART is set to the local part of the address. When it is
40175 called as a result of a forward or alias expansion, LOCAL_PART is set to
40176 the local part of the address that was expanded. In both cases, any affixes are
40177 removed from the local part, and made available in LOCAL_PART_PREFIX and
40178 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
40179 same value as LOCAL_PART for compatibility with other MTAs.
40180 </para>
40181 <para>
40182 <indexterm role="concept">
40183 <primary>HOST</primary>
40184 </indexterm>
40185 HOST is set only when a <command>pipe</command> transport is called from a router that
40186 associates hosts with an address, typically when using <command>pipe</command> as a
40187 pseudo-remote transport. HOST is set to the first host name specified by
40188 the router.
40189 </para>
40190 <para>
40191 <indexterm role="concept">
40192 <primary>HOME</primary>
40193 </indexterm>
40194 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
40195 for the HOME environment variable. Otherwise, a home directory may be set
40196 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
40197 user&#x2019;s home directory if <option>check_local_user</option> is set.
40198 </para>
40199 </section>
40200 <section id="SECID142">
40201 <title>Private options for pipe</title>
40202 <para>
40203 <indexterm role="concept">
40204 <primary>options</primary>
40205 <secondary><command>pipe</command> transport</secondary>
40206 </indexterm>
40207 </para>
40208 <para>
40209 <indexterm role="option">
40210 <primary><option>allow_commands</option></primary>
40211 </indexterm>
40212 </para>
40213 <informaltable frame="all">
40214 <tgroup cols="4" colsep="0" rowsep="0">
40215 <colspec colwidth="8*" align="left"/>
40216 <colspec colwidth="6*" align="center"/>
40217 <colspec colwidth="6*" align="center"/>
40218 <colspec colwidth="6*" align="right"/>
40219 <tbody>
40220 <row>
40221 <entry><option>allow_commands</option></entry>
40222 <entry>Use: <emphasis>pipe</emphasis></entry>
40223 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
40224 <entry>Default: <emphasis>unset</emphasis></entry>
40225 </row>
40226 </tbody>
40227 </tgroup>
40228 </informaltable>
40229 <para>
40230 <indexterm role="concept">
40231 <primary><command>pipe</command> transport</primary>
40232 <secondary>permitted commands</secondary>
40233 </indexterm>
40234 The string is expanded, and is then interpreted as a colon-separated list of
40235 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
40236 permitted are those in the <option>allow_commands</option> list. They need not be absolute
40237 paths; the <option>path</option> option is still used for relative paths. If
40238 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
40239 in the <option>allow_commands</option> list, or a name without any slashes that is found on
40240 the path. In other words, if neither <option>allow_commands</option> nor
40241 <option>restrict_to_path</option> is set, there is no restriction on the command, but
40242 otherwise only commands that are permitted by one or the other are allowed. For
40243 example, if
40244 </para>
40245 <literallayout class="monospaced">
40246 allow_commands = /usr/bin/vacation
40247 </literallayout>
40248 <para>
40249 and <option>restrict_to_path</option> is not set, the only permitted command is
40250 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
40251 <option>use_shell</option> is set.
40252 </para>
40253 <para>
40254 <indexterm role="option">
40255 <primary><option>batch_id</option></primary>
40256 </indexterm>
40257 </para>
40258 <informaltable frame="all">
40259 <tgroup cols="4" colsep="0" rowsep="0">
40260 <colspec colwidth="8*" align="left"/>
40261 <colspec colwidth="6*" align="center"/>
40262 <colspec colwidth="6*" align="center"/>
40263 <colspec colwidth="6*" align="right"/>
40264 <tbody>
40265 <row>
40266 <entry><option>batch_id</option></entry>
40267 <entry>Use: <emphasis>pipe</emphasis></entry>
40268 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40269 <entry>Default: <emphasis>unset</emphasis></entry>
40270 </row>
40271 </tbody>
40272 </tgroup>
40273 </informaltable>
40274 <para>
40275 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40276 </para>
40277 <para>
40278 <indexterm role="option">
40279 <primary><option>batch_max</option></primary>
40280 </indexterm>
40281 </para>
40282 <informaltable frame="all">
40283 <tgroup cols="4" colsep="0" rowsep="0">
40284 <colspec colwidth="8*" align="left"/>
40285 <colspec colwidth="6*" align="center"/>
40286 <colspec colwidth="6*" align="center"/>
40287 <colspec colwidth="6*" align="right"/>
40288 <tbody>
40289 <row>
40290 <entry><option>batch_max</option></entry>
40291 <entry>Use: <emphasis>pipe</emphasis></entry>
40292 <entry>Type: <emphasis>integer</emphasis></entry>
40293 <entry>Default: <emphasis>1</emphasis></entry>
40294 </row>
40295 </tbody>
40296 </tgroup>
40297 </informaltable>
40298 <para>
40299 This limits the number of addresses that can be handled in a single delivery.
40300 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40301 </para>
40302 <para>
40303 <indexterm role="option">
40304 <primary><option>check_string</option></primary>
40305 </indexterm>
40306 </para>
40307 <informaltable frame="all">
40308 <tgroup cols="4" colsep="0" rowsep="0">
40309 <colspec colwidth="8*" align="left"/>
40310 <colspec colwidth="6*" align="center"/>
40311 <colspec colwidth="6*" align="center"/>
40312 <colspec colwidth="6*" align="right"/>
40313 <tbody>
40314 <row>
40315 <entry><option>check_string</option></entry>
40316 <entry>Use: <emphasis>pipe</emphasis></entry>
40317 <entry>Type: <emphasis>string</emphasis></entry>
40318 <entry>Default: <emphasis>unset</emphasis></entry>
40319 </row>
40320 </tbody>
40321 </tgroup>
40322 </informaltable>
40323 <para>
40324 As <command>pipe</command> writes the message, the start of each line is tested for matching
40325 <option>check_string</option>, and if it does, the initial matching characters are replaced
40326 by the contents of <option>escape_string</option>, provided both are set. The value of
40327 <option>check_string</option> is a literal string, not a regular expression, and the case of
40328 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
40329 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
40330 the SMTP escaping protocol. Any settings made in the configuration file are
40331 ignored.
40332 </para>
40333 <para>
40334 <indexterm role="option">
40335 <primary><option>command</option></primary>
40336 </indexterm>
40337 </para>
40338 <informaltable frame="all">
40339 <tgroup cols="4" colsep="0" rowsep="0">
40340 <colspec colwidth="8*" align="left"/>
40341 <colspec colwidth="6*" align="center"/>
40342 <colspec colwidth="6*" align="center"/>
40343 <colspec colwidth="6*" align="right"/>
40344 <tbody>
40345 <row>
40346 <entry><option>command</option></entry>
40347 <entry>Use: <emphasis>pipe</emphasis></entry>
40348 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40349 <entry>Default: <emphasis>unset</emphasis></entry>
40350 </row>
40351 </tbody>
40352 </tgroup>
40353 </informaltable>
40354 <para>
40355 This option need not be set when <command>pipe</command> is being used to deliver to pipes
40356 obtained directly from address redirections. In other cases, the option must be
40357 set, to provide a command to be run. It need not yield an absolute path (see
40358 the <option>path</option> option below). The command is split up into separate arguments by
40359 Exim, and each argument is separately expanded, as described in section
40360 <xref linkend="SECThowcommandrun"/> above.
40361 </para>
40362 <para>
40363 <indexterm role="option">
40364 <primary><option>environment</option></primary>
40365 </indexterm>
40366 </para>
40367 <informaltable frame="all">
40368 <tgroup cols="4" colsep="0" rowsep="0">
40369 <colspec colwidth="8*" align="left"/>
40370 <colspec colwidth="6*" align="center"/>
40371 <colspec colwidth="6*" align="center"/>
40372 <colspec colwidth="6*" align="right"/>
40373 <tbody>
40374 <row>
40375 <entry><option>environment</option></entry>
40376 <entry>Use: <emphasis>pipe</emphasis></entry>
40377 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40378 <entry>Default: <emphasis>unset</emphasis></entry>
40379 </row>
40380 </tbody>
40381 </tgroup>
40382 </informaltable>
40383 <para>
40384 <indexterm role="concept">
40385 <primary><command>pipe</command> transport</primary>
40386 <secondary>environment for command</secondary>
40387 </indexterm>
40388 <indexterm role="concept">
40389 <primary>environment for <command>pipe</command> transport</primary>
40390 </indexterm>
40391 This option is used to add additional variables to the environment in which the
40392 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
40393 a string which is expanded, and then interpreted as a colon-separated list of
40394 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
40395 </para>
40396 <para>
40397 <indexterm role="option">
40398 <primary><option>escape_string</option></primary>
40399 </indexterm>
40400 </para>
40401 <informaltable frame="all">
40402 <tgroup cols="4" colsep="0" rowsep="0">
40403 <colspec colwidth="8*" align="left"/>
40404 <colspec colwidth="6*" align="center"/>
40405 <colspec colwidth="6*" align="center"/>
40406 <colspec colwidth="6*" align="right"/>
40407 <tbody>
40408 <row>
40409 <entry><option>escape_string</option></entry>
40410 <entry>Use: <emphasis>pipe</emphasis></entry>
40411 <entry>Type: <emphasis>string</emphasis></entry>
40412 <entry>Default: <emphasis>unset</emphasis></entry>
40413 </row>
40414 </tbody>
40415 </tgroup>
40416 </informaltable>
40417 <para>
40418 See <option>check_string</option> above.
40419 </para>
40420 <para>
40421 <indexterm role="option">
40422 <primary><option>freeze_exec_fail</option></primary>
40423 </indexterm>
40424 </para>
40425 <informaltable frame="all">
40426 <tgroup cols="4" colsep="0" rowsep="0">
40427 <colspec colwidth="8*" align="left"/>
40428 <colspec colwidth="6*" align="center"/>
40429 <colspec colwidth="6*" align="center"/>
40430 <colspec colwidth="6*" align="right"/>
40431 <tbody>
40432 <row>
40433 <entry><option>freeze_exec_fail</option></entry>
40434 <entry>Use: <emphasis>pipe</emphasis></entry>
40435 <entry>Type: <emphasis>boolean</emphasis></entry>
40436 <entry>Default: <emphasis>false</emphasis></entry>
40437 </row>
40438 </tbody>
40439 </tgroup>
40440 </informaltable>
40441 <para>
40442 <indexterm role="concept">
40443 <primary>exec failure</primary>
40444 </indexterm>
40445 <indexterm role="concept">
40446 <primary>failure of exec</primary>
40447 </indexterm>
40448 <indexterm role="concept">
40449 <primary><command>pipe</command> transport</primary>
40450 <secondary>failure of exec</secondary>
40451 </indexterm>
40452 Failure to exec the command in a pipe transport is by default treated like
40453 any other failure while running the command. However, if <option>freeze_exec_fail</option>
40454 is set, failure to exec is treated specially, and causes the message to be
40455 frozen, whatever the setting of <option>ignore_status</option>.
40456 </para>
40457 <para>
40458 <indexterm role="option">
40459 <primary><option>ignore_status</option></primary>
40460 </indexterm>
40461 </para>
40462 <informaltable frame="all">
40463 <tgroup cols="4" colsep="0" rowsep="0">
40464 <colspec colwidth="8*" align="left"/>
40465 <colspec colwidth="6*" align="center"/>
40466 <colspec colwidth="6*" align="center"/>
40467 <colspec colwidth="6*" align="right"/>
40468 <tbody>
40469 <row>
40470 <entry><option>ignore_status</option></entry>
40471 <entry>Use: <emphasis>pipe</emphasis></entry>
40472 <entry>Type: <emphasis>boolean</emphasis></entry>
40473 <entry>Default: <emphasis>false</emphasis></entry>
40474 </row>
40475 </tbody>
40476 </tgroup>
40477 </informaltable>
40478 <para>
40479 If this option is true, the status returned by the subprocess that is set up to
40480 run the command is ignored, and Exim behaves as if zero had been returned.
40481 Otherwise, a non-zero status or termination by signal causes an error return
40482 from the transport unless the status value is one of those listed in
40483 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
40484 </para>
40485 <para>
40486 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
40487 See the <option>timeout_defer</option> option for how timeouts are handled.
40488 </para>
40489 <para>
40490 <indexterm role="option">
40491 <primary><option>log_defer_output</option></primary>
40492 </indexterm>
40493 </para>
40494 <informaltable frame="all">
40495 <tgroup cols="4" colsep="0" rowsep="0">
40496 <colspec colwidth="8*" align="left"/>
40497 <colspec colwidth="6*" align="center"/>
40498 <colspec colwidth="6*" align="center"/>
40499 <colspec colwidth="6*" align="right"/>
40500 <tbody>
40501 <row>
40502 <entry><option>log_defer_output</option></entry>
40503 <entry>Use: <emphasis>pipe</emphasis></entry>
40504 <entry>Type: <emphasis>boolean</emphasis></entry>
40505 <entry>Default: <emphasis>false</emphasis></entry>
40506 </row>
40507 </tbody>
40508 </tgroup>
40509 </informaltable>
40510 <para>
40511 <indexterm role="concept">
40512 <primary><command>pipe</command> transport</primary>
40513 <secondary>logging output</secondary>
40514 </indexterm>
40515 If this option is set, and the status returned by the command is
40516 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
40517 and any output was produced, the first line of it is written to the main log.
40518 </para>
40519 <para>
40520 <indexterm role="option">
40521 <primary><option>log_fail_output</option></primary>
40522 </indexterm>
40523 </para>
40524 <informaltable frame="all">
40525 <tgroup cols="4" colsep="0" rowsep="0">
40526 <colspec colwidth="8*" align="left"/>
40527 <colspec colwidth="6*" align="center"/>
40528 <colspec colwidth="6*" align="center"/>
40529 <colspec colwidth="6*" align="right"/>
40530 <tbody>
40531 <row>
40532 <entry><option>log_fail_output</option></entry>
40533 <entry>Use: <emphasis>pipe</emphasis></entry>
40534 <entry>Type: <emphasis>boolean</emphasis></entry>
40535 <entry>Default: <emphasis>false</emphasis></entry>
40536 </row>
40537 </tbody>
40538 </tgroup>
40539 </informaltable>
40540 <para>
40541 If this option is set, and the command returns any output, and also ends with a
40542 return code that is neither zero nor one of the return codes listed in
40543 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
40544 written to the main log. This option and <option>log_output</option> are mutually exclusive.
40545 Only one of them may be set.
40546 </para>
40547 <para>
40548 <indexterm role="option">
40549 <primary><option>log_output</option></primary>
40550 </indexterm>
40551 </para>
40552 <informaltable frame="all">
40553 <tgroup cols="4" colsep="0" rowsep="0">
40554 <colspec colwidth="8*" align="left"/>
40555 <colspec colwidth="6*" align="center"/>
40556 <colspec colwidth="6*" align="center"/>
40557 <colspec colwidth="6*" align="right"/>
40558 <tbody>
40559 <row>
40560 <entry><option>log_output</option></entry>
40561 <entry>Use: <emphasis>pipe</emphasis></entry>
40562 <entry>Type: <emphasis>boolean</emphasis></entry>
40563 <entry>Default: <emphasis>false</emphasis></entry>
40564 </row>
40565 </tbody>
40566 </tgroup>
40567 </informaltable>
40568 <para>
40569 If this option is set and the command returns any output, the first line of
40570 output is written to the main log, whatever the return code. This option and
40571 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
40572 </para>
40573 <para>
40574 <indexterm role="option">
40575 <primary><option>max_output</option></primary>
40576 </indexterm>
40577 </para>
40578 <informaltable frame="all">
40579 <tgroup cols="4" colsep="0" rowsep="0">
40580 <colspec colwidth="8*" align="left"/>
40581 <colspec colwidth="6*" align="center"/>
40582 <colspec colwidth="6*" align="center"/>
40583 <colspec colwidth="6*" align="right"/>
40584 <tbody>
40585 <row>
40586 <entry><option>max_output</option></entry>
40587 <entry>Use: <emphasis>pipe</emphasis></entry>
40588 <entry>Type: <emphasis>integer</emphasis></entry>
40589 <entry>Default: <emphasis>20K</emphasis></entry>
40590 </row>
40591 </tbody>
40592 </tgroup>
40593 </informaltable>
40594 <para>
40595 This specifies the maximum amount of output that the command may produce on its
40596 standard output and standard error file combined. If the limit is exceeded, the
40597 process running the command is killed. This is intended as a safety measure to
40598 catch runaway processes. The limit is applied independently of the settings of
40599 the options that control what is done with such output (for example,
40600 <option>return_output</option>). Because of buffering effects, the amount of output may
40601 exceed the limit by a small amount before Exim notices.
40602 </para>
40603 <para>
40604 <indexterm role="option">
40605 <primary><option>message_prefix</option></primary>
40606 </indexterm>
40607 </para>
40608 <informaltable frame="all">
40609 <tgroup cols="4" colsep="0" rowsep="0">
40610 <colspec colwidth="8*" align="left"/>
40611 <colspec colwidth="6*" align="center"/>
40612 <colspec colwidth="6*" align="center"/>
40613 <colspec colwidth="6*" align="right"/>
40614 <tbody>
40615 <row>
40616 <entry><option>message_prefix</option></entry>
40617 <entry>Use: <emphasis>pipe</emphasis></entry>
40618 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40619 <entry>Default: <emphasis>see below</emphasis></entry>
40620 </row>
40621 </tbody>
40622 </tgroup>
40623 </informaltable>
40624 <para>
40625 The string specified here is expanded and output at the start of every message.
40626 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
40627 </para>
40628 <literallayout class="monospaced">
40629 message_prefix = \
40630   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
40631   ${tod_bsdinbox}\n
40632 </literallayout>
40633 <para>
40634 <indexterm role="concept">
40635 <primary>Cyrus</primary>
40636 </indexterm>
40637 <indexterm role="concept">
40638 <primary><option>tmail</option></primary>
40639 </indexterm>
40640 <indexterm role="concept">
40641 <primary><quote>From</quote> line</primary>
40642 </indexterm>
40643 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
40644 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
40645 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
40646 setting
40647 </para>
40648 <literallayout class="monospaced">
40649 message_prefix =
40650 </literallayout>
40651 <para revisionflag="changed">
40652 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40653 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40654 </para>
40655 <para>
40656 <indexterm role="option">
40657 <primary><option>message_suffix</option></primary>
40658 </indexterm>
40659 </para>
40660 <informaltable frame="all">
40661 <tgroup cols="4" colsep="0" rowsep="0">
40662 <colspec colwidth="8*" align="left"/>
40663 <colspec colwidth="6*" align="center"/>
40664 <colspec colwidth="6*" align="center"/>
40665 <colspec colwidth="6*" align="right"/>
40666 <tbody>
40667 <row>
40668 <entry><option>message_suffix</option></entry>
40669 <entry>Use: <emphasis>pipe</emphasis></entry>
40670 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40671 <entry>Default: <emphasis>see below</emphasis></entry>
40672 </row>
40673 </tbody>
40674 </tgroup>
40675 </informaltable>
40676 <para>
40677 The string specified here is expanded and output at the end of every message.
40678 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
40679 The suffix can be suppressed by setting
40680 </para>
40681 <literallayout class="monospaced">
40682 message_suffix =
40683 </literallayout>
40684 <para revisionflag="changed">
40685 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40686 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40687 </para>
40688 <para>
40689 <indexterm role="option">
40690 <primary><option>path</option></primary>
40691 </indexterm>
40692 </para>
40693 <informaltable frame="all">
40694 <tgroup cols="4" colsep="0" rowsep="0">
40695 <colspec colwidth="8*" align="left"/>
40696 <colspec colwidth="6*" align="center"/>
40697 <colspec colwidth="6*" align="center"/>
40698 <colspec colwidth="6*" align="right"/>
40699 <tbody>
40700 <row>
40701 <entry><option>path</option></entry>
40702 <entry>Use: <emphasis>pipe</emphasis></entry>
40703 <entry>Type: <emphasis>string</emphasis></entry>
40704 <entry>Default: <emphasis>see below</emphasis></entry>
40705 </row>
40706 </tbody>
40707 </tgroup>
40708 </informaltable>
40709 <para>
40710 This option specifies the string that is set up in the PATH environment
40711 variable of the subprocess. The default is:
40712 </para>
40713 <literallayout class="monospaced">
40714 /bin:/usr/bin
40715 </literallayout>
40716 <para>
40717 If the <option>command</option> option does not yield an absolute path name, the command is
40718 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
40719 apply to a command specified as a transport filter.
40720 </para>
40721 <para>
40722 <indexterm role="option">
40723 <primary><option>pipe_as_creator</option></primary>
40724 </indexterm>
40725 </para>
40726 <informaltable frame="all">
40727 <tgroup cols="4" colsep="0" rowsep="0">
40728 <colspec colwidth="8*" align="left"/>
40729 <colspec colwidth="6*" align="center"/>
40730 <colspec colwidth="6*" align="center"/>
40731 <colspec colwidth="6*" align="right"/>
40732 <tbody>
40733 <row>
40734 <entry><option>pipe_as_creator</option></entry>
40735 <entry>Use: <emphasis>pipe</emphasis></entry>
40736 <entry>Type: <emphasis>boolean</emphasis></entry>
40737 <entry>Default: <emphasis>false</emphasis></entry>
40738 </row>
40739 </tbody>
40740 </tgroup>
40741 </informaltable>
40742 <para>
40743 <indexterm role="concept">
40744 <primary>uid (user id)</primary>
40745 <secondary>local delivery</secondary>
40746 </indexterm>
40747 If the generic <option>user</option> option is not set and this option is true, the delivery
40748 process is run under the uid that was in force when Exim was originally called
40749 to accept the message. If the group id is not otherwise set (via the generic
40750 <option>group</option> option), the gid that was in force when Exim was originally called to
40751 accept the message is used.
40752 </para>
40753 <para>
40754 <indexterm role="option">
40755 <primary><option>restrict_to_path</option></primary>
40756 </indexterm>
40757 </para>
40758 <informaltable frame="all">
40759 <tgroup cols="4" colsep="0" rowsep="0">
40760 <colspec colwidth="8*" align="left"/>
40761 <colspec colwidth="6*" align="center"/>
40762 <colspec colwidth="6*" align="center"/>
40763 <colspec colwidth="6*" align="right"/>
40764 <tbody>
40765 <row>
40766 <entry><option>restrict_to_path</option></entry>
40767 <entry>Use: <emphasis>pipe</emphasis></entry>
40768 <entry>Type: <emphasis>boolean</emphasis></entry>
40769 <entry>Default: <emphasis>false</emphasis></entry>
40770 </row>
40771 </tbody>
40772 </tgroup>
40773 </informaltable>
40774 <para>
40775 When this option is set, any command name not listed in <option>allow_commands</option> must
40776 contain no slashes. The command is searched for only in the directories listed
40777 in the <option>path</option> option. This option is intended for use in the case when a pipe
40778 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
40779 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
40780 </para>
40781 <para>
40782 <indexterm role="option">
40783 <primary><option>return_fail_output</option></primary>
40784 </indexterm>
40785 </para>
40786 <informaltable frame="all">
40787 <tgroup cols="4" colsep="0" rowsep="0">
40788 <colspec colwidth="8*" align="left"/>
40789 <colspec colwidth="6*" align="center"/>
40790 <colspec colwidth="6*" align="center"/>
40791 <colspec colwidth="6*" align="right"/>
40792 <tbody>
40793 <row>
40794 <entry><option>return_fail_output</option></entry>
40795 <entry>Use: <emphasis>pipe</emphasis></entry>
40796 <entry>Type: <emphasis>boolean</emphasis></entry>
40797 <entry>Default: <emphasis>false</emphasis></entry>
40798 </row>
40799 </tbody>
40800 </tgroup>
40801 </informaltable>
40802 <para>
40803 If this option is true, and the command produced any output and ended with a
40804 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
40805 is, the delivery failed), the output is returned in the bounce message.
40806 However, if the message has a null sender (that is, it is itself a bounce
40807 message), output from the command is discarded. This option and
40808 <option>return_output</option> are mutually exclusive. Only one of them may be set.
40809 </para>
40810 <para>
40811 <indexterm role="option">
40812 <primary><option>return_output</option></primary>
40813 </indexterm>
40814 </para>
40815 <informaltable frame="all">
40816 <tgroup cols="4" colsep="0" rowsep="0">
40817 <colspec colwidth="8*" align="left"/>
40818 <colspec colwidth="6*" align="center"/>
40819 <colspec colwidth="6*" align="center"/>
40820 <colspec colwidth="6*" align="right"/>
40821 <tbody>
40822 <row>
40823 <entry><option>return_output</option></entry>
40824 <entry>Use: <emphasis>pipe</emphasis></entry>
40825 <entry>Type: <emphasis>boolean</emphasis></entry>
40826 <entry>Default: <emphasis>false</emphasis></entry>
40827 </row>
40828 </tbody>
40829 </tgroup>
40830 </informaltable>
40831 <para>
40832 If this option is true, and the command produced any output, the delivery is
40833 deemed to have failed whatever the return code from the command, and the output
40834 is returned in the bounce message. Otherwise, the output is just discarded.
40835 However, if the message has a null sender (that is, it is a bounce message),
40836 output from the command is always discarded, whatever the setting of this
40837 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
40838 of them may be set.
40839 </para>
40840 <para>
40841 <indexterm role="option">
40842 <primary><option>temp_errors</option></primary>
40843 </indexterm>
40844 </para>
40845 <informaltable frame="all">
40846 <tgroup cols="4" colsep="0" rowsep="0">
40847 <colspec colwidth="8*" align="left"/>
40848 <colspec colwidth="6*" align="center"/>
40849 <colspec colwidth="6*" align="center"/>
40850 <colspec colwidth="6*" align="right"/>
40851 <tbody>
40852 <row>
40853 <entry><option>temp_errors</option></entry>
40854 <entry>Use: <emphasis>pipe</emphasis></entry>
40855 <entry>Type: <emphasis>string list</emphasis></entry>
40856 <entry>Default: <emphasis>see below</emphasis></entry>
40857 </row>
40858 </tbody>
40859 </tgroup>
40860 </informaltable>
40861 <para>
40862 <indexterm role="concept">
40863 <primary><command>pipe</command> transport</primary>
40864 <secondary>temporary failure</secondary>
40865 </indexterm>
40866 This option contains either a colon-separated list of numbers, or a single
40867 asterisk. If <option>ignore_status</option> is false
40868 and <option>return_output</option> is not set,
40869 and the command exits with a non-zero return code, the failure is treated as
40870 temporary and the delivery is deferred if the return code matches one of the
40871 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
40872 codes are treated as permanent errors. The default setting contains the codes
40873 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
40874 compiled on a system that does not define these macros, it assumes values of 75
40875 and 73, respectively.
40876 </para>
40877 <para>
40878 <indexterm role="option">
40879 <primary><option>timeout</option></primary>
40880 </indexterm>
40881 </para>
40882 <informaltable frame="all">
40883 <tgroup cols="4" colsep="0" rowsep="0">
40884 <colspec colwidth="8*" align="left"/>
40885 <colspec colwidth="6*" align="center"/>
40886 <colspec colwidth="6*" align="center"/>
40887 <colspec colwidth="6*" align="right"/>
40888 <tbody>
40889 <row>
40890 <entry><option>timeout</option></entry>
40891 <entry>Use: <emphasis>pipe</emphasis></entry>
40892 <entry>Type: <emphasis>time</emphasis></entry>
40893 <entry>Default: <emphasis>1h</emphasis></entry>
40894 </row>
40895 </tbody>
40896 </tgroup>
40897 </informaltable>
40898 <para>
40899 If the command fails to complete within this time, it is killed. This normally
40900 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
40901 specifies no timeout. In order to ensure that any subprocesses created by the
40902 command are also killed, Exim makes the initial process a process group leader,
40903 and kills the whole process group on a timeout. However, this can be defeated
40904 if one of the processes starts a new process group.
40905 </para>
40906 <para>
40907 <indexterm role="option">
40908 <primary><option>timeout_defer</option></primary>
40909 </indexterm>
40910 </para>
40911 <informaltable frame="all">
40912 <tgroup cols="4" colsep="0" rowsep="0">
40913 <colspec colwidth="8*" align="left"/>
40914 <colspec colwidth="6*" align="center"/>
40915 <colspec colwidth="6*" align="center"/>
40916 <colspec colwidth="6*" align="right"/>
40917 <tbody>
40918 <row>
40919 <entry><option>timeout_defer</option></entry>
40920 <entry>Use: <emphasis>pipe</emphasis></entry>
40921 <entry>Type: <emphasis>boolean</emphasis></entry>
40922 <entry>Default: <emphasis>false</emphasis></entry>
40923 </row>
40924 </tbody>
40925 </tgroup>
40926 </informaltable>
40927 <para>
40928 A timeout in a <command>pipe</command> transport, either in the command that the transport
40929 runs, or in a transport filter that is associated with it, is by default
40930 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
40931 is set true, both kinds of timeout become temporary errors, causing the
40932 delivery to be deferred.
40933 </para>
40934 <para>
40935 <indexterm role="option">
40936 <primary><option>umask</option></primary>
40937 </indexterm>
40938 </para>
40939 <informaltable frame="all">
40940 <tgroup cols="4" colsep="0" rowsep="0">
40941 <colspec colwidth="8*" align="left"/>
40942 <colspec colwidth="6*" align="center"/>
40943 <colspec colwidth="6*" align="center"/>
40944 <colspec colwidth="6*" align="right"/>
40945 <tbody>
40946 <row>
40947 <entry><option>umask</option></entry>
40948 <entry>Use: <emphasis>pipe</emphasis></entry>
40949 <entry>Type: <emphasis>octal integer</emphasis></entry>
40950 <entry>Default: <emphasis>022</emphasis></entry>
40951 </row>
40952 </tbody>
40953 </tgroup>
40954 </informaltable>
40955 <para>
40956 This specifies the umask setting for the subprocess that runs the command.
40957 </para>
40958 <para>
40959 <indexterm role="option">
40960 <primary><option>use_bsmtp</option></primary>
40961 </indexterm>
40962 </para>
40963 <informaltable frame="all">
40964 <tgroup cols="4" colsep="0" rowsep="0">
40965 <colspec colwidth="8*" align="left"/>
40966 <colspec colwidth="6*" align="center"/>
40967 <colspec colwidth="6*" align="center"/>
40968 <colspec colwidth="6*" align="right"/>
40969 <tbody>
40970 <row>
40971 <entry><option>use_bsmtp</option></entry>
40972 <entry>Use: <emphasis>pipe</emphasis></entry>
40973 <entry>Type: <emphasis>boolean</emphasis></entry>
40974 <entry>Default: <emphasis>false</emphasis></entry>
40975 </row>
40976 </tbody>
40977 </tgroup>
40978 </informaltable>
40979 <para>
40980 <indexterm role="concept">
40981 <primary>envelope sender</primary>
40982 </indexterm>
40983 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
40984 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
40985 commands. If you want to include a leading HELO command with such messages,
40986 you can do so by setting the <option>message_prefix</option> option. See section
40987 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
40988 </para>
40989 <para>
40990 <indexterm role="option">
40991 <primary><option>use_classresources</option></primary>
40992 </indexterm>
40993 </para>
40994 <informaltable frame="all">
40995 <tgroup cols="4" colsep="0" rowsep="0">
40996 <colspec colwidth="8*" align="left"/>
40997 <colspec colwidth="6*" align="center"/>
40998 <colspec colwidth="6*" align="center"/>
40999 <colspec colwidth="6*" align="right"/>
41000 <tbody>
41001 <row>
41002 <entry><option>use_classresources</option></entry>
41003 <entry>Use: <emphasis>pipe</emphasis></entry>
41004 <entry>Type: <emphasis>boolean</emphasis></entry>
41005 <entry>Default: <emphasis>false</emphasis></entry>
41006 </row>
41007 </tbody>
41008 </tgroup>
41009 </informaltable>
41010 <para>
41011 <indexterm role="concept">
41012 <primary>class resources (BSD)</primary>
41013 </indexterm>
41014 This option is available only when Exim is running on FreeBSD, NetBSD, or
41015 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
41016 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
41017 limits for the uid under which the pipe is to run are obtained from the login
41018 class database.
41019 </para>
41020 <para>
41021 <indexterm role="option">
41022 <primary><option>use_crlf</option></primary>
41023 </indexterm>
41024 </para>
41025 <informaltable frame="all">
41026 <tgroup cols="4" colsep="0" rowsep="0">
41027 <colspec colwidth="8*" align="left"/>
41028 <colspec colwidth="6*" align="center"/>
41029 <colspec colwidth="6*" align="center"/>
41030 <colspec colwidth="6*" align="right"/>
41031 <tbody>
41032 <row>
41033 <entry><option>use_crlf</option></entry>
41034 <entry>Use: <emphasis>pipe</emphasis></entry>
41035 <entry>Type: <emphasis>boolean</emphasis></entry>
41036 <entry>Default: <emphasis>false</emphasis></entry>
41037 </row>
41038 </tbody>
41039 </tgroup>
41040 </informaltable>
41041 <para>
41042 <indexterm role="concept">
41043 <primary>carriage return</primary>
41044 </indexterm>
41045 <indexterm role="concept">
41046 <primary>linefeed</primary>
41047 </indexterm>
41048 This option causes lines to be terminated with the two-character CRLF sequence
41049 (carriage return, linefeed) instead of just a linefeed character. In the case
41050 of batched SMTP, the byte sequence written to the pipe is then an exact image
41051 of what would be sent down a real SMTP connection.
41052 </para>
41053 <para revisionflag="changed">
41054 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
41055 written verbatim, so must contain their own carriage return characters if these
41056 are needed. When <option>use_bsmtp</option> is not set, the default values for both
41057 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
41058 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41059 </para>
41060 <para>
41061 <indexterm role="option">
41062 <primary><option>use_shell</option></primary>
41063 </indexterm>
41064 </para>
41065 <informaltable frame="all">
41066 <tgroup cols="4" colsep="0" rowsep="0">
41067 <colspec colwidth="8*" align="left"/>
41068 <colspec colwidth="6*" align="center"/>
41069 <colspec colwidth="6*" align="center"/>
41070 <colspec colwidth="6*" align="right"/>
41071 <tbody>
41072 <row>
41073 <entry><option>use_shell</option></entry>
41074 <entry>Use: <emphasis>pipe</emphasis></entry>
41075 <entry>Type: <emphasis>boolean</emphasis></entry>
41076 <entry>Default: <emphasis>false</emphasis></entry>
41077 </row>
41078 </tbody>
41079 </tgroup>
41080 </informaltable>
41081 <para>
41082 <indexterm role="variable">
41083 <primary><varname>$pipe_addresses</varname></primary>
41084 </indexterm>
41085 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
41086 instead of being run directly from the transport, as described in section
41087 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
41088 where the command is expected to be run under a shell and cannot easily be
41089 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
41090 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
41091 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
41092 its <option>-c</option> option.
41093 </para>
41094 </section>
41095 <section id="SECID143">
41096 <title>Using an external local delivery agent</title>
41097 <para>
41098 <indexterm role="concept">
41099 <primary>local delivery</primary>
41100 <secondary>using an external agent</secondary>
41101 </indexterm>
41102 <indexterm role="concept">
41103 <primary><emphasis>procmail</emphasis></primary>
41104 </indexterm>
41105 <indexterm role="concept">
41106 <primary>external local delivery</primary>
41107 </indexterm>
41108 <indexterm role="concept">
41109 <primary>delivery</primary>
41110 <secondary><emphasis>procmail</emphasis></secondary>
41111 </indexterm>
41112 <indexterm role="concept">
41113 <primary>delivery</primary>
41114 <secondary>by external agent</secondary>
41115 </indexterm>
41116 The <command>pipe</command> transport can be used to pass all messages that require local
41117 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
41118 this, care must be taken to ensure that the pipe is run under an appropriate
41119 uid and gid. In some configurations one wants this to be a uid that is trusted
41120 by the delivery agent to supply the correct sender of the message. It may be
41121 necessary to recompile or reconfigure the delivery agent so that it trusts an
41122 appropriate user. The following is an example transport and router
41123 configuration for <option>procmail</option>:
41124 </para>
41125 <literallayout class="monospaced">
41126 # transport
41127 procmail_pipe:
41128   driver = pipe
41129   command = /usr/local/bin/procmail -d $local_part
41130   return_path_add
41131   delivery_date_add
41132   envelope_to_add
41133   check_string = "From "
41134   escape_string = "&gt;From "
41135   user = $local_part
41136   group = mail
41137
41138 # router
41139 procmail:
41140   driver = accept
41141   check_local_user
41142   transport = procmail_pipe
41143 </literallayout>
41144 <para>
41145 In this example, the pipe is run as the local user, but with the group set to
41146 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
41147 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
41148 user to supply a correct sender address. If you do not specify either a
41149 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
41150 home directory is the user&#x2019;s home directory by default.
41151 </para>
41152 <para>
41153 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
41154 </para>
41155 <literallayout class="monospaced">
41156 IFS=" "
41157 </literallayout>
41158 <para>
41159 as shown in some <option>procmail</option> documentation, because Exim does not by default
41160 use a shell to run pipe commands.
41161 </para>
41162 <para>
41163 <indexterm role="concept">
41164 <primary>Cyrus</primary>
41165 </indexterm>
41166 The next example shows a transport and a router for a system where local
41167 deliveries are handled by the Cyrus IMAP server.
41168 </para>
41169 <literallayout class="monospaced">
41170 # transport
41171 local_delivery_cyrus:
41172   driver = pipe
41173   command = /usr/cyrus/bin/deliver \
41174             -m ${substr_1:$local_part_suffix} -- $local_part
41175   user = cyrus
41176   group = mail
41177   return_output
41178   log_output
41179   message_prefix =
41180   message_suffix =
41181
41182 # router
41183 local_user_cyrus:
41184   driver = accept
41185   check_local_user
41186   local_part_suffix = .*
41187   transport = local_delivery_cyrus
41188 </literallayout>
41189 <para>
41190 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
41191 <option>return_output</option> to cause any text written by Cyrus to be returned to the
41192 sender.
41193 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
41194 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
41195 </para>
41196 </section>
41197 </chapter>
41198
41199 <chapter id="CHAPsmtptrans">
41200 <title>The smtp transport</title>
41201 <para>
41202 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
41203 <primary>transports</primary>
41204 <secondary><command>smtp</command></secondary>
41205 </indexterm>
41206 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
41207 <primary><command>smtp</command> transport</primary>
41208 </indexterm>
41209 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
41210 or LMTP protocol. The list of hosts to try can either be taken from the address
41211 that is being processed (having been set up by the router), or specified
41212 explicitly for the transport. Timeout and retry processing (see chapter
41213 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
41214 </para>
41215 <section id="SECID144">
41216 <title>Multiple messages on a single connection</title>
41217 <para>
41218 The sending of multiple messages over a single TCP/IP connection can arise in
41219 two ways:
41220 </para>
41221 <itemizedlist>
41222 <listitem>
41223 <para>
41224 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
41225 routed to the same host, more than one copy of the message has to be sent to
41226 that host. In this situation, multiple copies may be sent in a single run of
41227 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
41228 does when it has too many addresses to send in one message also depends on the
41229 value of the global <option>remote_max_parallel</option> option. Details are given in
41230 section <xref linkend="SECToutSMTPTCP"/>.)
41231 </para>
41232 </listitem>
41233 <listitem>
41234 <para>
41235 <indexterm role="concept">
41236 <primary>hints database</primary>
41237 <secondary>remembering routing</secondary>
41238 </indexterm>
41239 When a message has been successfully delivered over a TCP/IP connection, Exim
41240 looks in its hints database to see if there are any other messages awaiting a
41241 connection to the same host. If there are, a new delivery process is started
41242 for one of them, and the current TCP/IP connection is passed on to it. The new
41243 process may in turn send multiple copies and possibly create yet another
41244 process.
41245 </para>
41246 </listitem>
41247 </itemizedlist>
41248 <para>
41249 For each copy sent over the same TCP/IP connection, a sequence counter is
41250 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
41251 no further messages are sent over that connection.
41252 </para>
41253 </section>
41254 <section id="SECID145">
41255 <title>Use of the $host and $host_address variables</title>
41256 <para>
41257 <indexterm role="variable">
41258 <primary><varname>$host</varname></primary>
41259 </indexterm>
41260 <indexterm role="variable">
41261 <primary><varname>$host_address</varname></primary>
41262 </indexterm>
41263 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
41264 <varname>$host_address</varname> are the name and IP address of the first host on the host list
41265 passed by the router. However, when the transport is about to connect to a
41266 specific host, and while it is connected to that host, <varname>$host</varname> and
41267 <varname>$host_address</varname> are set to the values for that host. These are the values
41268 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
41269 <option>serialize_hosts</option>, and the various TLS options are expanded.
41270 </para>
41271 </section>
41272 <section id="usecippeer" revisionflag="changed">
41273 <title>Use of $tls_cipher and $tls_peerdn</title>
41274 <para revisionflag="changed">
41275 <indexterm role="variable">
41276 <primary><varname>$tls_cipher</varname></primary>
41277 </indexterm>
41278 <indexterm role="variable">
41279 <primary><varname>$tls_peerdn</varname></primary>
41280 </indexterm>
41281 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_cipher</varname>
41282 and <varname>$tls_peerdn</varname> are the values that were set when the message was received.
41283 These are the values that are used for options that are expanded before any
41284 SMTP connections are made. Just before each connection is made, these two
41285 variables are emptied. If TLS is subsequently started, they are set to the
41286 appropriate values for the outgoing connection, and these are the values that
41287 are in force when any authenticators are run and when the
41288 <option>authenticated_sender</option> option is expanded.
41289 </para>
41290 </section>
41291 <section id="SECID146">
41292 <title>Private options for smtp</title>
41293 <para>
41294 <indexterm role="concept">
41295 <primary>options</primary>
41296 <secondary><command>smtp</command> transport</secondary>
41297 </indexterm>
41298 The private options of the <command>smtp</command> transport are as follows:
41299 </para>
41300 <para>
41301 <indexterm role="option">
41302 <primary><option>address_retry_include_sender</option></primary>
41303 </indexterm>
41304 </para>
41305 <informaltable frame="all">
41306 <tgroup cols="4" colsep="0" rowsep="0">
41307 <colspec colwidth="8*" align="left"/>
41308 <colspec colwidth="6*" align="center"/>
41309 <colspec colwidth="6*" align="center"/>
41310 <colspec colwidth="6*" align="right"/>
41311 <tbody>
41312 <row>
41313 <entry><option>address_retry_include_sender</option></entry>
41314 <entry>Use: <emphasis>smtp</emphasis></entry>
41315 <entry>Type: <emphasis>boolean</emphasis></entry>
41316 <entry>Default: <emphasis>true</emphasis></entry>
41317 </row>
41318 </tbody>
41319 </tgroup>
41320 </informaltable>
41321 <para>
41322 <indexterm role="concept">
41323 <primary>4<emphasis>xx</emphasis> responses</primary>
41324 <secondary>retrying after</secondary>
41325 </indexterm>
41326 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
41327 is the combination of sender and recipient that is delayed in subsequent queue
41328 runs until the retry time is reached. You can delay the recipient without
41329 reference to the sender (which is what earlier versions of Exim did), by
41330 setting <option>address_retry_include_sender</option> false. However, this can lead to
41331 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
41332 </para>
41333 <para>
41334 <indexterm role="option">
41335 <primary><option>allow_localhost</option></primary>
41336 </indexterm>
41337 </para>
41338 <informaltable frame="all">
41339 <tgroup cols="4" colsep="0" rowsep="0">
41340 <colspec colwidth="8*" align="left"/>
41341 <colspec colwidth="6*" align="center"/>
41342 <colspec colwidth="6*" align="center"/>
41343 <colspec colwidth="6*" align="right"/>
41344 <tbody>
41345 <row>
41346 <entry><option>allow_localhost</option></entry>
41347 <entry>Use: <emphasis>smtp</emphasis></entry>
41348 <entry>Type: <emphasis>boolean</emphasis></entry>
41349 <entry>Default: <emphasis>false</emphasis></entry>
41350 </row>
41351 </tbody>
41352 </tgroup>
41353 </informaltable>
41354 <para>
41355 <indexterm role="concept">
41356 <primary>local host</primary>
41357 <secondary>sending to</secondary>
41358 </indexterm>
41359 <indexterm role="concept">
41360 <primary>fallback</primary>
41361 <secondary>hosts specified on transport</secondary>
41362 </indexterm>
41363 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
41364 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
41365 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
41366 the delivery anyway. This should be used only in special cases when the
41367 configuration ensures that no looping will result (for example, a differently
41368 configured Exim is listening on the port to which the message is sent).
41369 </para>
41370 <para>
41371 <indexterm role="option">
41372 <primary><option>authenticated_sender</option></primary>
41373 </indexterm>
41374 </para>
41375 <informaltable frame="all">
41376 <tgroup cols="4" colsep="0" rowsep="0">
41377 <colspec colwidth="8*" align="left"/>
41378 <colspec colwidth="6*" align="center"/>
41379 <colspec colwidth="6*" align="center"/>
41380 <colspec colwidth="6*" align="right"/>
41381 <tbody>
41382 <row>
41383 <entry><option>authenticated_sender</option></entry>
41384 <entry>Use: <emphasis>smtp</emphasis></entry>
41385 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41386 <entry>Default: <emphasis>unset</emphasis></entry>
41387 </row>
41388 </tbody>
41389 </tgroup>
41390 </informaltable>
41391 <para>
41392 <indexterm role="concept">
41393 <primary>Cyrus</primary>
41394 </indexterm>
41395 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
41396 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
41397 overriding any existing authenticated sender value. If the string expansion is
41398 forced to fail, the option is ignored. Other expansion failures cause delivery
41399 to be deferred. If the result of expansion is an empty string, that is also
41400 ignored.
41401 </para>
41402 <para revisionflag="changed">
41403 The expansion happens after the outgoing connection has been made and TLS
41404 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
41405 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
41406 particular connection.
41407 </para>
41408 <para>
41409 If the SMTP session is not authenticated, the expansion of
41410 <option>authenticated_sender</option> still happens (and can cause the delivery to be
41411 deferred if it fails), but no AUTH= item is added to MAIL commands
41412 unless <option>authenticated_sender_force</option> is true.
41413 </para>
41414 <para>
41415 This option allows you to use the <command>smtp</command> transport in LMTP mode to
41416 deliver mail to Cyrus IMAP and provide the proper local part as the
41417 <quote>authenticated sender</quote>, via a setting such as:
41418 </para>
41419 <literallayout class="monospaced">
41420 authenticated_sender = $local_part
41421 </literallayout>
41422 <para>
41423 This removes the need for IMAP subfolders to be assigned special ACLs to
41424 allow direct delivery to those subfolders.
41425 </para>
41426 <para>
41427 Because of expected uses such as that just described for Cyrus (when no
41428 domain is involved), there is no checking on the syntax of the provided
41429 value.
41430 </para>
41431 <para>
41432 <indexterm role="option">
41433 <primary><option>authenticated_sender_force</option></primary>
41434 </indexterm>
41435 </para>
41436 <informaltable frame="all">
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>authenticated_sender_force</option></entry>
41445 <entry>Use: <emphasis>smtp</emphasis></entry>
41446 <entry>Type: <emphasis>boolean</emphasis></entry>
41447 <entry>Default: <emphasis>false</emphasis></entry>
41448 </row>
41449 </tbody>
41450 </tgroup>
41451 </informaltable>
41452 <para>
41453 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
41454 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
41455 authenticated as a client.
41456 </para>
41457 <para>
41458 <indexterm role="option">
41459 <primary><option>command_timeout</option></primary>
41460 </indexterm>
41461 </para>
41462 <informaltable frame="all">
41463 <tgroup cols="4" colsep="0" rowsep="0">
41464 <colspec colwidth="8*" align="left"/>
41465 <colspec colwidth="6*" align="center"/>
41466 <colspec colwidth="6*" align="center"/>
41467 <colspec colwidth="6*" align="right"/>
41468 <tbody>
41469 <row>
41470 <entry><option>command_timeout</option></entry>
41471 <entry>Use: <emphasis>smtp</emphasis></entry>
41472 <entry>Type: <emphasis>time</emphasis></entry>
41473 <entry>Default: <emphasis>5m</emphasis></entry>
41474 </row>
41475 </tbody>
41476 </tgroup>
41477 </informaltable>
41478 <para>
41479 This sets a timeout for receiving a response to an SMTP command that has been
41480 sent out. It is also used when waiting for the initial banner line from the
41481 remote host. Its value must not be zero.
41482 </para>
41483 <para>
41484 <indexterm role="option">
41485 <primary><option>connect_timeout</option></primary>
41486 </indexterm>
41487 </para>
41488 <informaltable frame="all">
41489 <tgroup cols="4" colsep="0" rowsep="0">
41490 <colspec colwidth="8*" align="left"/>
41491 <colspec colwidth="6*" align="center"/>
41492 <colspec colwidth="6*" align="center"/>
41493 <colspec colwidth="6*" align="right"/>
41494 <tbody>
41495 <row>
41496 <entry><option>connect_timeout</option></entry>
41497 <entry>Use: <emphasis>smtp</emphasis></entry>
41498 <entry>Type: <emphasis>time</emphasis></entry>
41499 <entry>Default: <emphasis>5m</emphasis></entry>
41500 </row>
41501 </tbody>
41502 </tgroup>
41503 </informaltable>
41504 <para>
41505 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
41506 to a remote host. A setting of zero allows the system timeout (typically
41507 several minutes) to act. To have any effect, the value of this option must be
41508 less than the system timeout. However, it has been observed that on some
41509 systems there is no system timeout, which is why the default value for this
41510 option is 5 minutes, a value recommended by RFC 1123.
41511 </para>
41512 <para>
41513 <indexterm role="option">
41514 <primary><option>connection_max_messages</option></primary>
41515 </indexterm>
41516 </para>
41517 <informaltable frame="all">
41518 <tgroup cols="4" colsep="0" rowsep="0">
41519 <colspec colwidth="8*" align="left"/>
41520 <colspec colwidth="6*" align="center"/>
41521 <colspec colwidth="6*" align="center"/>
41522 <colspec colwidth="6*" align="right"/>
41523 <tbody>
41524 <row>
41525 <entry><option>connection_max_messages</option></entry>
41526 <entry>Use: <emphasis>smtp</emphasis></entry>
41527 <entry>Type: <emphasis>integer</emphasis></entry>
41528 <entry>Default: <emphasis>500</emphasis></entry>
41529 </row>
41530 </tbody>
41531 </tgroup>
41532 </informaltable>
41533 <para>
41534 <indexterm role="concept">
41535 <primary>SMTP</primary>
41536 <secondary>passed connection</secondary>
41537 </indexterm>
41538 <indexterm role="concept">
41539 <primary>SMTP</primary>
41540 <secondary>multiple deliveries</secondary>
41541 </indexterm>
41542 <indexterm role="concept">
41543 <primary>multiple SMTP deliveries</primary>
41544 </indexterm>
41545 This controls the maximum number of separate message deliveries that are sent
41546 over a single TCP/IP connection. If the value is zero, there is no limit.
41547 For testing purposes, this value can be overridden by the <option>-oB</option> command line
41548 option.
41549 </para>
41550 <para>
41551 <indexterm role="option">
41552 <primary><option>data_timeout</option></primary>
41553 </indexterm>
41554 </para>
41555 <informaltable frame="all">
41556 <tgroup cols="4" colsep="0" rowsep="0">
41557 <colspec colwidth="8*" align="left"/>
41558 <colspec colwidth="6*" align="center"/>
41559 <colspec colwidth="6*" align="center"/>
41560 <colspec colwidth="6*" align="right"/>
41561 <tbody>
41562 <row>
41563 <entry><option>data_timeout</option></entry>
41564 <entry>Use: <emphasis>smtp</emphasis></entry>
41565 <entry>Type: <emphasis>time</emphasis></entry>
41566 <entry>Default: <emphasis>5m</emphasis></entry>
41567 </row>
41568 </tbody>
41569 </tgroup>
41570 </informaltable>
41571 <para>
41572 This sets a timeout for the transmission of each block in the data portion of
41573 the message. As a result, the overall timeout for a message depends on the size
41574 of the message. Its value must not be zero. See also <option>final_timeout</option>.
41575 </para>
41576 <para>
41577 <indexterm role="option">
41578 <primary><option>delay_after_cutoff</option></primary>
41579 </indexterm>
41580 </para>
41581 <informaltable frame="all">
41582 <tgroup cols="4" colsep="0" rowsep="0">
41583 <colspec colwidth="8*" align="left"/>
41584 <colspec colwidth="6*" align="center"/>
41585 <colspec colwidth="6*" align="center"/>
41586 <colspec colwidth="6*" align="right"/>
41587 <tbody>
41588 <row>
41589 <entry><option>delay_after_cutoff</option></entry>
41590 <entry>Use: <emphasis>smtp</emphasis></entry>
41591 <entry>Type: <emphasis>boolean</emphasis></entry>
41592 <entry>Default: <emphasis>true</emphasis></entry>
41593 </row>
41594 </tbody>
41595 </tgroup>
41596 </informaltable>
41597 <para>
41598 This option controls what happens when all remote IP addresses for a given
41599 domain have been inaccessible for so long that they have passed their retry
41600 cutoff times.
41601 </para>
41602 <para>
41603 In the default state, if the next retry time has not been reached for any of
41604 them, the address is bounced without trying any deliveries. In other words,
41605 Exim delays retrying an IP address after the final cutoff time until a new
41606 retry time is reached, and can therefore bounce an address without ever trying
41607 a delivery, when machines have been down for a long time. Some people are
41608 unhappy at this prospect, so...
41609 </para>
41610 <para>
41611 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
41612 addresses are past their final cutoff time, Exim tries to deliver to those
41613 IP addresses that have not been tried since the message arrived. If there are
41614 none, of if they all fail, the address is bounced. In other words, it does not
41615 delay when a new message arrives, but immediately tries those expired IP
41616 addresses that haven&#x2019;t been tried since the message arrived. If there is a
41617 continuous stream of messages for the dead hosts, unsetting
41618 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
41619 to them.
41620 </para>
41621 <para>
41622 <indexterm role="option">
41623 <primary><option>dns_qualify_single</option></primary>
41624 </indexterm>
41625 </para>
41626 <informaltable frame="all">
41627 <tgroup cols="4" colsep="0" rowsep="0">
41628 <colspec colwidth="8*" align="left"/>
41629 <colspec colwidth="6*" align="center"/>
41630 <colspec colwidth="6*" align="center"/>
41631 <colspec colwidth="6*" align="right"/>
41632 <tbody>
41633 <row>
41634 <entry><option>dns_qualify_single</option></entry>
41635 <entry>Use: <emphasis>smtp</emphasis></entry>
41636 <entry>Type: <emphasis>boolean</emphasis></entry>
41637 <entry>Default: <emphasis>true</emphasis></entry>
41638 </row>
41639 </tbody>
41640 </tgroup>
41641 </informaltable>
41642 <para>
41643 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
41644 and the <option>gethostbyname</option> option is false,
41645 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
41646 in chapter <xref linkend="CHAPdnslookup"/> for more details.
41647 </para>
41648 <para>
41649 <indexterm role="option">
41650 <primary><option>dns_search_parents</option></primary>
41651 </indexterm>
41652 </para>
41653 <informaltable frame="all">
41654 <tgroup cols="4" colsep="0" rowsep="0">
41655 <colspec colwidth="8*" align="left"/>
41656 <colspec colwidth="6*" align="center"/>
41657 <colspec colwidth="6*" align="center"/>
41658 <colspec colwidth="6*" align="right"/>
41659 <tbody>
41660 <row>
41661 <entry><option>dns_search_parents</option></entry>
41662 <entry>Use: <emphasis>smtp</emphasis></entry>
41663 <entry>Type: <emphasis>boolean</emphasis></entry>
41664 <entry>Default: <emphasis>false</emphasis></entry>
41665 </row>
41666 </tbody>
41667 </tgroup>
41668 </informaltable>
41669 <para>
41670 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
41671 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
41672 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
41673 details.
41674 </para>
41675 <para>
41676 <indexterm role="option">
41677 <primary><option>fallback_hosts</option></primary>
41678 </indexterm>
41679 </para>
41680 <informaltable frame="all">
41681 <tgroup cols="4" colsep="0" rowsep="0">
41682 <colspec colwidth="8*" align="left"/>
41683 <colspec colwidth="6*" align="center"/>
41684 <colspec colwidth="6*" align="center"/>
41685 <colspec colwidth="6*" align="right"/>
41686 <tbody>
41687 <row>
41688 <entry><option>fallback_hosts</option></entry>
41689 <entry>Use: <emphasis>smtp</emphasis></entry>
41690 <entry>Type: <emphasis>string list</emphasis></entry>
41691 <entry>Default: <emphasis>unset</emphasis></entry>
41692 </row>
41693 </tbody>
41694 </tgroup>
41695 </informaltable>
41696 <para>
41697 <indexterm role="concept">
41698 <primary>fallback</primary>
41699 <secondary>hosts specified on transport</secondary>
41700 </indexterm>
41701 String expansion is not applied to this option. The argument must be a
41702 colon-separated list of host names or IP addresses, optionally also including
41703 port numbers, though the separator can be changed, as described in section
41704 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
41705 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
41706 in section <xref linkend="SECTformatonehostitem"/>.
41707 </para>
41708 <para>
41709 Fallback hosts can also be specified on routers, which associate them with the
41710 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
41711 <option>fallback_hosts</option> specified on the transport is used only if the address does
41712 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
41713 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
41714 However, <option>hosts_randomize</option> does apply to fallback host lists.
41715 </para>
41716 <para>
41717 If Exim is unable to deliver to any of the hosts for a particular address, and
41718 the errors are not permanent rejections, the address is put on a separate
41719 transport queue with its host list replaced by the fallback hosts, unless the
41720 address was routed via MX records and the current host was in the original MX
41721 list. In that situation, the fallback host list is not used.
41722 </para>
41723 <para>
41724 Once normal deliveries are complete, the fallback queue is delivered by
41725 re-running the same transports with the new host lists. If several failing
41726 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
41727 copy of the message is sent.
41728 </para>
41729 <para>
41730 The resolution of the host names on the fallback list is controlled by the
41731 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
41732 both to cases when the host list comes with the address and when it is taken
41733 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
41734 fails</quote> facility.
41735 </para>
41736 <para>
41737 <indexterm role="option">
41738 <primary><option>final_timeout</option></primary>
41739 </indexterm>
41740 </para>
41741 <informaltable frame="all">
41742 <tgroup cols="4" colsep="0" rowsep="0">
41743 <colspec colwidth="8*" align="left"/>
41744 <colspec colwidth="6*" align="center"/>
41745 <colspec colwidth="6*" align="center"/>
41746 <colspec colwidth="6*" align="right"/>
41747 <tbody>
41748 <row>
41749 <entry><option>final_timeout</option></entry>
41750 <entry>Use: <emphasis>smtp</emphasis></entry>
41751 <entry>Type: <emphasis>time</emphasis></entry>
41752 <entry>Default: <emphasis>10m</emphasis></entry>
41753 </row>
41754 </tbody>
41755 </tgroup>
41756 </informaltable>
41757 <para>
41758 This is the timeout that applies while waiting for the response to the final
41759 line containing just <quote>.</quote> that terminates a message. Its value must not be
41760 zero.
41761 </para>
41762 <para>
41763 <indexterm role="option">
41764 <primary><option>gethostbyname</option></primary>
41765 </indexterm>
41766 </para>
41767 <informaltable frame="all">
41768 <tgroup cols="4" colsep="0" rowsep="0">
41769 <colspec colwidth="8*" align="left"/>
41770 <colspec colwidth="6*" align="center"/>
41771 <colspec colwidth="6*" align="center"/>
41772 <colspec colwidth="6*" align="right"/>
41773 <tbody>
41774 <row>
41775 <entry><option>gethostbyname</option></entry>
41776 <entry>Use: <emphasis>smtp</emphasis></entry>
41777 <entry>Type: <emphasis>boolean</emphasis></entry>
41778 <entry>Default: <emphasis>false</emphasis></entry>
41779 </row>
41780 </tbody>
41781 </tgroup>
41782 </informaltable>
41783 <para>
41784 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
41785 being used, names are looked up using <function>gethostbyname()</function>
41786 (or <function>getipnodebyname()</function> when available)
41787 instead of using the DNS. Of course, that function may in fact use the DNS, but
41788 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
41789 </para>
41790 <para>
41791 <indexterm role="option">
41792 <primary><option>gnutls_require_kx</option></primary>
41793 </indexterm>
41794 </para>
41795 <informaltable frame="all">
41796 <tgroup cols="4" colsep="0" rowsep="0">
41797 <colspec colwidth="8*" align="left"/>
41798 <colspec colwidth="6*" align="center"/>
41799 <colspec colwidth="6*" align="center"/>
41800 <colspec colwidth="6*" align="right"/>
41801 <tbody>
41802 <row>
41803 <entry><option>gnutls_require_kx</option></entry>
41804 <entry>Use: <emphasis>main</emphasis></entry>
41805 <entry>Type: <emphasis>string</emphasis></entry>
41806 <entry>Default: <emphasis>unset</emphasis></entry>
41807 </row>
41808 </tbody>
41809 </tgroup>
41810 </informaltable>
41811 <para>
41812 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
41813 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41814 </para>
41815 <para>
41816 <indexterm role="option">
41817 <primary><option>gnutls_require_mac</option></primary>
41818 </indexterm>
41819 </para>
41820 <informaltable frame="all">
41821 <tgroup cols="4" colsep="0" rowsep="0">
41822 <colspec colwidth="8*" align="left"/>
41823 <colspec colwidth="6*" align="center"/>
41824 <colspec colwidth="6*" align="center"/>
41825 <colspec colwidth="6*" align="right"/>
41826 <tbody>
41827 <row>
41828 <entry><option>gnutls_require_mac</option></entry>
41829 <entry>Use: <emphasis>main</emphasis></entry>
41830 <entry>Type: <emphasis>string</emphasis></entry>
41831 <entry>Default: <emphasis>unset</emphasis></entry>
41832 </row>
41833 </tbody>
41834 </tgroup>
41835 </informaltable>
41836 <para>
41837 This option controls the MAC algorithms when GnuTLS is used in an Exim
41838 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41839 </para>
41840 <para>
41841 <indexterm role="option">
41842 <primary><option>gnutls_require_protocols</option></primary>
41843 </indexterm>
41844 </para>
41845 <informaltable frame="all">
41846 <tgroup cols="4" colsep="0" rowsep="0">
41847 <colspec colwidth="8*" align="left"/>
41848 <colspec colwidth="6*" align="center"/>
41849 <colspec colwidth="6*" align="center"/>
41850 <colspec colwidth="6*" align="right"/>
41851 <tbody>
41852 <row>
41853 <entry><option>gnutls_require_protocols</option></entry>
41854 <entry>Use: <emphasis>main</emphasis></entry>
41855 <entry>Type: <emphasis>string</emphasis></entry>
41856 <entry>Default: <emphasis>unset</emphasis></entry>
41857 </row>
41858 </tbody>
41859 </tgroup>
41860 </informaltable>
41861 <para>
41862 This option controls the protocols when GnuTLS is used in an Exim
41863 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41864 </para>
41865 <para>
41866 <indexterm role="option">
41867 <primary><option>helo_data</option></primary>
41868 </indexterm>
41869 </para>
41870 <informaltable frame="all">
41871 <tgroup cols="4" colsep="0" rowsep="0">
41872 <colspec colwidth="8*" align="left"/>
41873 <colspec colwidth="6*" align="center"/>
41874 <colspec colwidth="6*" align="center"/>
41875 <colspec colwidth="6*" align="right"/>
41876 <tbody>
41877 <row>
41878 <entry><option>helo_data</option></entry>
41879 <entry>Use: <emphasis>smtp</emphasis></entry>
41880 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41881 <entry>Default: <emphasis>see below</emphasis></entry>
41882 </row>
41883 </tbody>
41884 </tgroup>
41885 </informaltable>
41886 <para>
41887 <indexterm role="concept">
41888 <primary>HELO</primary>
41889 <secondary>argument, setting</secondary>
41890 </indexterm>
41891 <indexterm role="concept">
41892 <primary>EHLO</primary>
41893 <secondary>argument, setting</secondary>
41894 </indexterm>
41895 <indexterm role="concept">
41896 <primary>LHLO argument setting</primary>
41897 </indexterm>
41898 The value of this option is expanded after a connection to a another host has
41899 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
41900 command that starts the outgoing SMTP or LMTP session. The default value of the
41901 option is:
41902 </para>
41903 <literallayout class="monospaced">
41904 $primary_hostname
41905 </literallayout>
41906 <para>
41907 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
41908 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
41909 <varname>$sending_port</varname> are set to the local IP address and port number that are being
41910 used. These variables can be used to generate different values for different
41911 servers or different local IP addresses. For example, if you want the string
41912 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
41913 interface address, you could use this:
41914 </para>
41915 <literallayout class="monospaced">
41916 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
41917   {$primary_hostname}}
41918 </literallayout>
41919 <para>
41920 The use of <option>helo_data</option> applies both to sending messages and when doing
41921 callouts.
41922 </para>
41923 <para>
41924 <indexterm role="option">
41925 <primary><option>hosts</option></primary>
41926 </indexterm>
41927 </para>
41928 <informaltable frame="all">
41929 <tgroup cols="4" colsep="0" rowsep="0">
41930 <colspec colwidth="8*" align="left"/>
41931 <colspec colwidth="6*" align="center"/>
41932 <colspec colwidth="6*" align="center"/>
41933 <colspec colwidth="6*" align="right"/>
41934 <tbody>
41935 <row>
41936 <entry><option>hosts</option></entry>
41937 <entry>Use: <emphasis>smtp</emphasis></entry>
41938 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
41939 <entry>Default: <emphasis>unset</emphasis></entry>
41940 </row>
41941 </tbody>
41942 </tgroup>
41943 </informaltable>
41944 <para>
41945 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
41946 finds the hosts by looking up the address domain in the DNS, or by
41947 <command>manualroute</command>, which has lists of hosts in its configuration. However,
41948 email addresses can be passed to the <command>smtp</command> transport by any router, and not
41949 all of them can provide an associated list of hosts.
41950 </para>
41951 <para>
41952 The <option>hosts</option> option specifies a list of hosts to be used if the address being
41953 processed does not have any hosts associated with it. The hosts specified by
41954 <option>hosts</option> are also used, whether or not the address has its own hosts, if
41955 <option>hosts_override</option> is set.
41956 </para>
41957 <para>
41958 The string is first expanded, before being interpreted as a colon-separated
41959 list of host names or IP addresses, possibly including port numbers. The
41960 separator may be changed to something other than colon, as described in section
41961 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
41962 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
41963 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
41964 of the <command>manualroute</command> router is not available here.
41965 </para>
41966 <para>
41967 If the expansion fails, delivery is deferred. Unless the failure was caused by
41968 the inability to complete a lookup, the error is logged to the panic log as
41969 well as the main log. Host names are looked up either by searching directly for
41970 address records in the DNS or by calling <function>gethostbyname()</function> (or
41971 <function>getipnodebyname()</function> when available), depending on the setting of the
41972 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
41973 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
41974 address are used.
41975 </para>
41976 <para>
41977 During delivery, the hosts are tried in order, subject to their retry status,
41978 unless <option>hosts_randomize</option> is set.
41979 </para>
41980 <para>
41981 <indexterm role="option">
41982 <primary><option>hosts_avoid_esmtp</option></primary>
41983 </indexterm>
41984 </para>
41985 <informaltable frame="all">
41986 <tgroup cols="4" colsep="0" rowsep="0">
41987 <colspec colwidth="8*" align="left"/>
41988 <colspec colwidth="6*" align="center"/>
41989 <colspec colwidth="6*" align="center"/>
41990 <colspec colwidth="6*" align="right"/>
41991 <tbody>
41992 <row>
41993 <entry><option>hosts_avoid_esmtp</option></entry>
41994 <entry>Use: <emphasis>smtp</emphasis></entry>
41995 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41996 <entry>Default: <emphasis>unset</emphasis></entry>
41997 </row>
41998 </tbody>
41999 </tgroup>
42000 </informaltable>
42001 <para>
42002 <indexterm role="concept">
42003 <primary>ESMTP, avoiding use of</primary>
42004 </indexterm>
42005 <indexterm role="concept">
42006 <primary>HELO</primary>
42007 <secondary>forcing use of</secondary>
42008 </indexterm>
42009 <indexterm role="concept">
42010 <primary>EHLO</primary>
42011 <secondary>avoiding use of</secondary>
42012 </indexterm>
42013 <indexterm role="concept">
42014 <primary>PIPELINING</primary>
42015 <secondary>avoiding the use of</secondary>
42016 </indexterm>
42017 This option is for use with broken hosts that announce ESMTP facilities (for
42018 example, PIPELINING) and then fail to implement them properly. When a host
42019 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
42020 start of the SMTP session. This means that it cannot use any of the ESMTP
42021 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
42022 </para>
42023 <para>
42024 <indexterm role="option">
42025 <primary><option>hosts_avoid_pipelining</option></primary>
42026 </indexterm>
42027 </para>
42028 <informaltable frame="all">
42029 <tgroup cols="4" colsep="0" rowsep="0">
42030 <colspec colwidth="8*" align="left"/>
42031 <colspec colwidth="6*" align="center"/>
42032 <colspec colwidth="6*" align="center"/>
42033 <colspec colwidth="6*" align="right"/>
42034 <tbody>
42035 <row>
42036 <entry><option>hosts_avoid_pipelining</option></entry>
42037 <entry>Use: <emphasis>smtp</emphasis></entry>
42038 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42039 <entry>Default: <emphasis>unset</emphasis></entry>
42040 </row>
42041 </tbody>
42042 </tgroup>
42043 </informaltable>
42044 <para>
42045 <indexterm role="concept">
42046 <primary>PIPELINING</primary>
42047 <secondary>avoiding the use of</secondary>
42048 </indexterm>
42049 Exim will not use the SMTP PIPELINING extension when delivering to any host
42050 that matches this list, even if the server host advertises PIPELINING support.
42051 </para>
42052 <para>
42053 <indexterm role="option">
42054 <primary><option>hosts_avoid_tls</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>hosts_avoid_tls</option></entry>
42066 <entry>Use: <emphasis>smtp</emphasis></entry>
42067 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42068 <entry>Default: <emphasis>unset</emphasis></entry>
42069 </row>
42070 </tbody>
42071 </tgroup>
42072 </informaltable>
42073 <para>
42074 <indexterm role="concept">
42075 <primary>TLS</primary>
42076 <secondary>avoiding for certain hosts</secondary>
42077 </indexterm>
42078 Exim will not try to start a TLS session when delivering to any host that
42079 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42080 </para>
42081 <para>
42082 <indexterm role="option">
42083 <primary><option>hosts_max_try</option></primary>
42084 </indexterm>
42085 </para>
42086 <informaltable frame="all">
42087 <tgroup cols="4" colsep="0" rowsep="0">
42088 <colspec colwidth="8*" align="left"/>
42089 <colspec colwidth="6*" align="center"/>
42090 <colspec colwidth="6*" align="center"/>
42091 <colspec colwidth="6*" align="right"/>
42092 <tbody>
42093 <row>
42094 <entry><option>hosts_max_try</option></entry>
42095 <entry>Use: <emphasis>smtp</emphasis></entry>
42096 <entry>Type: <emphasis>integer</emphasis></entry>
42097 <entry>Default: <emphasis>5</emphasis></entry>
42098 </row>
42099 </tbody>
42100 </tgroup>
42101 </informaltable>
42102 <para>
42103 <indexterm role="concept">
42104 <primary>host</primary>
42105 <secondary>maximum number to try</secondary>
42106 </indexterm>
42107 <indexterm role="concept">
42108 <primary>limit</primary>
42109 <secondary>number of hosts tried</secondary>
42110 </indexterm>
42111 <indexterm role="concept">
42112 <primary>limit</primary>
42113 <secondary>number of MX tried</secondary>
42114 </indexterm>
42115 <indexterm role="concept">
42116 <primary>MX record</primary>
42117 <secondary>maximum tried</secondary>
42118 </indexterm>
42119 This option limits the number of IP addresses that are tried for any one
42120 delivery in cases where there are temporary delivery errors. Section
42121 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
42122 </para>
42123 <para>
42124 <indexterm role="option">
42125 <primary><option>hosts_max_try_hardlimit</option></primary>
42126 </indexterm>
42127 </para>
42128 <informaltable frame="all">
42129 <tgroup cols="4" colsep="0" rowsep="0">
42130 <colspec colwidth="8*" align="left"/>
42131 <colspec colwidth="6*" align="center"/>
42132 <colspec colwidth="6*" align="center"/>
42133 <colspec colwidth="6*" align="right"/>
42134 <tbody>
42135 <row>
42136 <entry><option>hosts_max_try_hardlimit</option></entry>
42137 <entry>Use: <emphasis>smtp</emphasis></entry>
42138 <entry>Type: <emphasis>integer</emphasis></entry>
42139 <entry>Default: <emphasis>50</emphasis></entry>
42140 </row>
42141 </tbody>
42142 </tgroup>
42143 </informaltable>
42144 <para>
42145 This is an additional check on the maximum number of IP addresses that Exim
42146 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
42147 why it exists.
42148 </para>
42149 <para>
42150 <indexterm role="option">
42151 <primary><option>hosts_nopass_tls</option></primary>
42152 </indexterm>
42153 </para>
42154 <informaltable frame="all">
42155 <tgroup cols="4" colsep="0" rowsep="0">
42156 <colspec colwidth="8*" align="left"/>
42157 <colspec colwidth="6*" align="center"/>
42158 <colspec colwidth="6*" align="center"/>
42159 <colspec colwidth="6*" align="right"/>
42160 <tbody>
42161 <row>
42162 <entry><option>hosts_nopass_tls</option></entry>
42163 <entry>Use: <emphasis>smtp</emphasis></entry>
42164 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42165 <entry>Default: <emphasis>unset</emphasis></entry>
42166 </row>
42167 </tbody>
42168 </tgroup>
42169 </informaltable>
42170 <para>
42171 <indexterm role="concept">
42172 <primary>TLS</primary>
42173 <secondary>passing connection</secondary>
42174 </indexterm>
42175 <indexterm role="concept">
42176 <primary>multiple SMTP deliveries</primary>
42177 </indexterm>
42178 <indexterm role="concept">
42179 <primary>TLS</primary>
42180 <secondary>multiple message deliveries</secondary>
42181 </indexterm>
42182 For any host that matches this list, a connection on which a TLS session has
42183 been started will not be passed to a new delivery process for sending another
42184 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
42185 explanation of when this might be needed.
42186 </para>
42187 <para>
42188 <indexterm role="option">
42189 <primary><option>hosts_override</option></primary>
42190 </indexterm>
42191 </para>
42192 <informaltable frame="all">
42193 <tgroup cols="4" colsep="0" rowsep="0">
42194 <colspec colwidth="8*" align="left"/>
42195 <colspec colwidth="6*" align="center"/>
42196 <colspec colwidth="6*" align="center"/>
42197 <colspec colwidth="6*" align="right"/>
42198 <tbody>
42199 <row>
42200 <entry><option>hosts_override</option></entry>
42201 <entry>Use: <emphasis>smtp</emphasis></entry>
42202 <entry>Type: <emphasis>boolean</emphasis></entry>
42203 <entry>Default: <emphasis>false</emphasis></entry>
42204 </row>
42205 </tbody>
42206 </tgroup>
42207 </informaltable>
42208 <para>
42209 If this option is set and the <option>hosts</option> option is also set, any hosts that are
42210 attached to the address are ignored, and instead the hosts specified by the
42211 <option>hosts</option> option are always used. This option does not apply to
42212 <option>fallback_hosts</option>.
42213 </para>
42214 <para>
42215 <indexterm role="option">
42216 <primary><option>hosts_randomize</option></primary>
42217 </indexterm>
42218 </para>
42219 <informaltable frame="all">
42220 <tgroup cols="4" colsep="0" rowsep="0">
42221 <colspec colwidth="8*" align="left"/>
42222 <colspec colwidth="6*" align="center"/>
42223 <colspec colwidth="6*" align="center"/>
42224 <colspec colwidth="6*" align="right"/>
42225 <tbody>
42226 <row>
42227 <entry><option>hosts_randomize</option></entry>
42228 <entry>Use: <emphasis>smtp</emphasis></entry>
42229 <entry>Type: <emphasis>boolean</emphasis></entry>
42230 <entry>Default: <emphasis>false</emphasis></entry>
42231 </row>
42232 </tbody>
42233 </tgroup>
42234 </informaltable>
42235 <para>
42236 <indexterm role="concept">
42237 <primary>randomized host list</primary>
42238 </indexterm>
42239 <indexterm role="concept">
42240 <primary>host</primary>
42241 <secondary>list of; randomized</secondary>
42242 </indexterm>
42243 <indexterm role="concept">
42244 <primary>fallback</primary>
42245 <secondary>randomized hosts</secondary>
42246 </indexterm>
42247 If this option is set, and either the list of hosts is taken from the
42248 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
42249 were not obtained from MX records (this includes fallback hosts from the
42250 router), and were not randomized by the router, the order of trying the hosts
42251 is randomized each time the transport runs. Randomizing the order of a host
42252 list can be used to do crude load sharing.
42253 </para>
42254 <para>
42255 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
42256 order is separately randomized. This makes it possible to set up MX-like
42257 behaviour. The boundaries between groups are indicated by an item that is just
42258 <literal>+</literal> in the host list. For example:
42259 </para>
42260 <literallayout class="monospaced">
42261 hosts = host1:host2:host3:+:host4:host5
42262 </literallayout>
42263 <para>
42264 The order of the first three hosts and the order of the last two hosts is
42265 randomized for each use, but the first three always end up before the last two.
42266 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
42267 </para>
42268 <para>
42269 <indexterm role="option">
42270 <primary><option>hosts_require_auth</option></primary>
42271 </indexterm>
42272 </para>
42273 <informaltable frame="all">
42274 <tgroup cols="4" colsep="0" rowsep="0">
42275 <colspec colwidth="8*" align="left"/>
42276 <colspec colwidth="6*" align="center"/>
42277 <colspec colwidth="6*" align="center"/>
42278 <colspec colwidth="6*" align="right"/>
42279 <tbody>
42280 <row>
42281 <entry><option>hosts_require_auth</option></entry>
42282 <entry>Use: <emphasis>smtp</emphasis></entry>
42283 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42284 <entry>Default: <emphasis>unset</emphasis></entry>
42285 </row>
42286 </tbody>
42287 </tgroup>
42288 </informaltable>
42289 <para>
42290 <indexterm role="concept">
42291 <primary>authentication</primary>
42292 <secondary>required by client</secondary>
42293 </indexterm>
42294 This option provides a list of servers for which authentication must succeed
42295 before Exim will try to transfer a message. If authentication fails for
42296 servers which are not in this list, Exim tries to send unauthenticated. If
42297 authentication fails for one of these servers, delivery is deferred. This
42298 temporary error is detectable in the retry rules, so it can be turned into a
42299 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
42300 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42301 </para>
42302 <para>
42303 <indexterm role="option">
42304 <primary><option>hosts_require_tls</option></primary>
42305 </indexterm>
42306 </para>
42307 <informaltable frame="all">
42308 <tgroup cols="4" colsep="0" rowsep="0">
42309 <colspec colwidth="8*" align="left"/>
42310 <colspec colwidth="6*" align="center"/>
42311 <colspec colwidth="6*" align="center"/>
42312 <colspec colwidth="6*" align="right"/>
42313 <tbody>
42314 <row>
42315 <entry><option>hosts_require_tls</option></entry>
42316 <entry>Use: <emphasis>smtp</emphasis></entry>
42317 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42318 <entry>Default: <emphasis>unset</emphasis></entry>
42319 </row>
42320 </tbody>
42321 </tgroup>
42322 </informaltable>
42323 <para>
42324 <indexterm role="concept">
42325 <primary>TLS</primary>
42326 <secondary>requiring for certain servers</secondary>
42327 </indexterm>
42328 Exim will insist on using a TLS session when delivering to any host that
42329 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42330 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
42331 incoming messages, use an appropriate ACL.
42332 </para>
42333 <para>
42334 <indexterm role="option">
42335 <primary><option>hosts_try_auth</option></primary>
42336 </indexterm>
42337 </para>
42338 <informaltable frame="all">
42339 <tgroup cols="4" colsep="0" rowsep="0">
42340 <colspec colwidth="8*" align="left"/>
42341 <colspec colwidth="6*" align="center"/>
42342 <colspec colwidth="6*" align="center"/>
42343 <colspec colwidth="6*" align="right"/>
42344 <tbody>
42345 <row>
42346 <entry><option>hosts_try_auth</option></entry>
42347 <entry>Use: <emphasis>smtp</emphasis></entry>
42348 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42349 <entry>Default: <emphasis>unset</emphasis></entry>
42350 </row>
42351 </tbody>
42352 </tgroup>
42353 </informaltable>
42354 <para>
42355 <indexterm role="concept">
42356 <primary>authentication</primary>
42357 <secondary>optional in client</secondary>
42358 </indexterm>
42359 This option provides a list of servers to which, provided they announce
42360 authentication support, Exim will attempt to authenticate as a client when it
42361 connects. If authentication fails, Exim will try to transfer the message
42362 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
42363 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42364 </para>
42365 <para>
42366 <indexterm role="option">
42367 <primary><option>interface</option></primary>
42368 </indexterm>
42369 </para>
42370 <informaltable frame="all">
42371 <tgroup cols="4" colsep="0" rowsep="0">
42372 <colspec colwidth="8*" align="left"/>
42373 <colspec colwidth="6*" align="center"/>
42374 <colspec colwidth="6*" align="center"/>
42375 <colspec colwidth="6*" align="right"/>
42376 <tbody>
42377 <row>
42378 <entry><option>interface</option></entry>
42379 <entry>Use: <emphasis>smtp</emphasis></entry>
42380 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42381 <entry>Default: <emphasis>unset</emphasis></entry>
42382 </row>
42383 </tbody>
42384 </tgroup>
42385 </informaltable>
42386 <para>
42387 <indexterm role="concept">
42388 <primary>bind IP address</primary>
42389 </indexterm>
42390 <indexterm role="concept">
42391 <primary>IP address</primary>
42392 <secondary>binding</secondary>
42393 </indexterm>
42394 <indexterm role="variable">
42395 <primary><varname>$host</varname></primary>
42396 </indexterm>
42397 <indexterm role="variable">
42398 <primary><varname>$host_address</varname></primary>
42399 </indexterm>
42400 This option specifies which interface to bind to when making an outgoing SMTP
42401 call. <phrase revisionflag="changed">The value is an IP address, not an interface name such as
42402 <literal>eth0</literal>.</phrase> Do not confuse this with the interface address that was used when a
42403 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
42404 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
42405 outgoing interface address. There is no variable that contains an outgoing
42406 interface address because, unless it is set by this option, its value is
42407 unknown.
42408 </para>
42409 <para>
42410 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
42411 <varname>$host_address</varname> refer to the host to which a connection is about to be made
42412 during the expansion of the string. Forced expansion failure, or an empty
42413 string result causes the option to be ignored. Otherwise, after expansion, the
42414 string must be a list of IP addresses, colon-separated by default, but the
42415 separator can be changed in the usual way. For example:
42416 </para>
42417 <literallayout class="monospaced">
42418 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
42419 </literallayout>
42420 <para>
42421 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
42422 connection. If none of them are the correct type, the option is ignored. If
42423 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
42424 interface to use if the host has more than one.
42425 </para>
42426 <para>
42427 <indexterm role="option">
42428 <primary><option>keepalive</option></primary>
42429 </indexterm>
42430 </para>
42431 <informaltable frame="all">
42432 <tgroup cols="4" colsep="0" rowsep="0">
42433 <colspec colwidth="8*" align="left"/>
42434 <colspec colwidth="6*" align="center"/>
42435 <colspec colwidth="6*" align="center"/>
42436 <colspec colwidth="6*" align="right"/>
42437 <tbody>
42438 <row>
42439 <entry><option>keepalive</option></entry>
42440 <entry>Use: <emphasis>smtp</emphasis></entry>
42441 <entry>Type: <emphasis>boolean</emphasis></entry>
42442 <entry>Default: <emphasis>true</emphasis></entry>
42443 </row>
42444 </tbody>
42445 </tgroup>
42446 </informaltable>
42447 <para>
42448 <indexterm role="concept">
42449 <primary>keepalive</primary>
42450 <secondary>on outgoing connection</secondary>
42451 </indexterm>
42452 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
42453 connections. When set, it causes the kernel to probe idle connections
42454 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
42455 of the connection should send a acknowledgment if the connection is still okay
42456 or a reset if the connection has been aborted. The reason for doing this is
42457 that it has the beneficial effect of freeing up certain types of connection
42458 that can get stuck when the remote host is disconnected without tidying up the
42459 TCP/IP call properly. The keepalive mechanism takes several hours to detect
42460 unreachable hosts.
42461 </para>
42462 <para>
42463 <indexterm role="option">
42464 <primary><option>lmtp_ignore_quota</option></primary>
42465 </indexterm>
42466 </para>
42467 <informaltable frame="all">
42468 <tgroup cols="4" colsep="0" rowsep="0">
42469 <colspec colwidth="8*" align="left"/>
42470 <colspec colwidth="6*" align="center"/>
42471 <colspec colwidth="6*" align="center"/>
42472 <colspec colwidth="6*" align="right"/>
42473 <tbody>
42474 <row>
42475 <entry><option>lmtp_ignore_quota</option></entry>
42476 <entry>Use: <emphasis>smtp</emphasis></entry>
42477 <entry>Type: <emphasis>boolean</emphasis></entry>
42478 <entry>Default: <emphasis>false</emphasis></entry>
42479 </row>
42480 </tbody>
42481 </tgroup>
42482 </informaltable>
42483 <para>
42484 <indexterm role="concept">
42485 <primary>LMTP</primary>
42486 <secondary>ignoring quota errors</secondary>
42487 </indexterm>
42488 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
42489 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
42490 has advertised support for IGNOREQUOTA in its response to the LHLO command.
42491 </para>
42492 <para>
42493 <indexterm role="option">
42494 <primary><option>max_rcpt</option></primary>
42495 </indexterm>
42496 </para>
42497 <informaltable frame="all">
42498 <tgroup cols="4" colsep="0" rowsep="0">
42499 <colspec colwidth="8*" align="left"/>
42500 <colspec colwidth="6*" align="center"/>
42501 <colspec colwidth="6*" align="center"/>
42502 <colspec colwidth="6*" align="right"/>
42503 <tbody>
42504 <row>
42505 <entry><option>max_rcpt</option></entry>
42506 <entry>Use: <emphasis>smtp</emphasis></entry>
42507 <entry>Type: <emphasis>integer</emphasis></entry>
42508 <entry>Default: <emphasis>100</emphasis></entry>
42509 </row>
42510 </tbody>
42511 </tgroup>
42512 </informaltable>
42513 <para>
42514 <indexterm role="concept">
42515 <primary>RCPT</primary>
42516 <secondary>maximum number of outgoing</secondary>
42517 </indexterm>
42518 This option limits the number of RCPT commands that are sent in a single
42519 SMTP message transaction. Each set of addresses is treated independently, and
42520 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
42521 permits this.
42522 </para>
42523 <para>
42524 <indexterm role="option">
42525 <primary><option>multi_domain</option></primary>
42526 </indexterm>
42527 </para>
42528 <informaltable frame="all">
42529 <tgroup cols="4" colsep="0" rowsep="0">
42530 <colspec colwidth="8*" align="left"/>
42531 <colspec colwidth="6*" align="center"/>
42532 <colspec colwidth="6*" align="center"/>
42533 <colspec colwidth="6*" align="right"/>
42534 <tbody>
42535 <row>
42536 <entry><option>multi_domain</option></entry>
42537 <entry>Use: <emphasis>smtp</emphasis></entry>
42538 <entry>Type: <emphasis>boolean</emphasis></entry>
42539 <entry>Default: <emphasis>true</emphasis></entry>
42540 </row>
42541 </tbody>
42542 </tgroup>
42543 </informaltable>
42544 <para>
42545 <indexterm role="variable">
42546 <primary><varname>$domain</varname></primary>
42547 </indexterm>
42548 When this option is set, the <command>smtp</command> transport can handle a number of
42549 addresses containing a mixture of different domains provided they all resolve
42550 to the same list of hosts. Turning the option off restricts the transport to
42551 handling only one domain at a time. This is useful if you want to use
42552 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
42553 is a single domain involved in a remote delivery.
42554 </para>
42555 <para>
42556 <indexterm role="option">
42557 <primary><option>port</option></primary>
42558 </indexterm>
42559 </para>
42560 <informaltable frame="all">
42561 <tgroup cols="4" colsep="0" rowsep="0">
42562 <colspec colwidth="8*" align="left"/>
42563 <colspec colwidth="6*" align="center"/>
42564 <colspec colwidth="6*" align="center"/>
42565 <colspec colwidth="6*" align="right"/>
42566 <tbody>
42567 <row>
42568 <entry><option>port</option></entry>
42569 <entry>Use: <emphasis>smtp</emphasis></entry>
42570 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42571 <entry>Default: <emphasis>see below</emphasis></entry>
42572 </row>
42573 </tbody>
42574 </tgroup>
42575 </informaltable>
42576 <para>
42577 <indexterm role="concept">
42578 <primary>port</primary>
42579 <secondary>sending TCP/IP</secondary>
42580 </indexterm>
42581 <indexterm role="concept">
42582 <primary>TCP/IP</primary>
42583 <secondary>setting outgoing port</secondary>
42584 </indexterm>
42585 This option specifies the TCP/IP port on the server to which Exim connects.
42586 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
42587 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
42588 The name was changed to minimize confusion with the outgoing port. There is no
42589 variable that contains an outgoing port.
42590 </para>
42591 <para>
42592 If the value of this option begins with a digit it is taken as a port number;
42593 otherwise it is looked up using <function>getservbyname()</function>. The default value is
42594 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
42595 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
42596 is deferred.
42597 </para>
42598 <para>
42599 <indexterm role="option">
42600 <primary><option>protocol</option></primary>
42601 </indexterm>
42602 </para>
42603 <informaltable frame="all">
42604 <tgroup cols="4" colsep="0" rowsep="0">
42605 <colspec colwidth="8*" align="left"/>
42606 <colspec colwidth="6*" align="center"/>
42607 <colspec colwidth="6*" align="center"/>
42608 <colspec colwidth="6*" align="right"/>
42609 <tbody>
42610 <row>
42611 <entry><option>protocol</option></entry>
42612 <entry>Use: <emphasis>smtp</emphasis></entry>
42613 <entry>Type: <emphasis>string</emphasis></entry>
42614 <entry>Default: <emphasis>smtp</emphasis></entry>
42615 </row>
42616 </tbody>
42617 </tgroup>
42618 </informaltable>
42619 <para>
42620 <indexterm role="concept">
42621 <primary>LMTP</primary>
42622 <secondary>over TCP/IP</secondary>
42623 </indexterm>
42624 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
42625 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
42626 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
42627 deliveries into closed message stores. Exim also has support for running LMTP
42628 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
42629 </para>
42630 <para>
42631 <indexterm role="option">
42632 <primary><option>retry_include_ip_address</option></primary>
42633 </indexterm>
42634 </para>
42635 <informaltable frame="all">
42636 <tgroup cols="4" colsep="0" rowsep="0">
42637 <colspec colwidth="8*" align="left"/>
42638 <colspec colwidth="6*" align="center"/>
42639 <colspec colwidth="6*" align="center"/>
42640 <colspec colwidth="6*" align="right"/>
42641 <tbody>
42642 <row>
42643 <entry><option>retry_include_ip_address</option></entry>
42644 <entry>Use: <emphasis>smtp</emphasis></entry>
42645 <entry>Type: <emphasis>boolean</emphasis></entry>
42646 <entry>Default: <emphasis>true</emphasis></entry>
42647 </row>
42648 </tbody>
42649 </tgroup>
42650 </informaltable>
42651 <para>
42652 Exim normally includes both the host name and the IP address in the key it
42653 constructs for indexing retry data after a temporary delivery failure. This
42654 means that when one of several IP addresses for a host is failing, it gets
42655 tried periodically (controlled by the retry rules), but use of the other IP
42656 addresses is not affected.
42657 </para>
42658 <para>
42659 However, in some dialup environments hosts are assigned a different IP address
42660 each time they connect. In this situation the use of the IP address as part of
42661 the retry key leads to undesirable behaviour. Setting this option false causes
42662 Exim to use only the host name. This should normally be done on a separate
42663 instance of the <command>smtp</command> transport, set up specially to handle the dialup
42664 hosts.
42665 </para>
42666 <para>
42667 <indexterm role="option">
42668 <primary><option>serialize_hosts</option></primary>
42669 </indexterm>
42670 </para>
42671 <informaltable frame="all">
42672 <tgroup cols="4" colsep="0" rowsep="0">
42673 <colspec colwidth="8*" align="left"/>
42674 <colspec colwidth="6*" align="center"/>
42675 <colspec colwidth="6*" align="center"/>
42676 <colspec colwidth="6*" align="right"/>
42677 <tbody>
42678 <row>
42679 <entry><option>serialize_hosts</option></entry>
42680 <entry>Use: <emphasis>smtp</emphasis></entry>
42681 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42682 <entry>Default: <emphasis>unset</emphasis></entry>
42683 </row>
42684 </tbody>
42685 </tgroup>
42686 </informaltable>
42687 <para>
42688 <indexterm role="concept">
42689 <primary>serializing connections</primary>
42690 </indexterm>
42691 <indexterm role="concept">
42692 <primary>host</primary>
42693 <secondary>serializing connections</secondary>
42694 </indexterm>
42695 Because Exim operates in a distributed manner, if several messages for the same
42696 host arrive at around the same time, more than one simultaneous connection to
42697 the remote host can occur. This is not usually a problem except when there is a
42698 slow link between the hosts. In that situation it may be helpful to restrict
42699 Exim to one connection at a time. This can be done by setting
42700 <option>serialize_hosts</option> to match the relevant hosts.
42701 </para>
42702 <para>
42703 <indexterm role="concept">
42704 <primary>hints database</primary>
42705 <secondary>serializing deliveries to a host</secondary>
42706 </indexterm>
42707 Exim implements serialization by means of a hints database in which a record is
42708 written whenever a process connects to one of the restricted hosts. The record
42709 is deleted when the connection is completed. Obviously there is scope for
42710 records to get left lying around if there is a system or program crash. To
42711 guard against this, Exim ignores any records that are more than six hours old.
42712 </para>
42713 <para>
42714 If you set up this kind of serialization, you should also arrange to delete the
42715 relevant hints database whenever your system reboots. The names of the files
42716 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
42717 may be one or two files, depending on the type of DBM in use. The same files
42718 are used for ETRN serialization.
42719 </para>
42720 <para>
42721 <indexterm role="option">
42722 <primary><option>size_addition</option></primary>
42723 </indexterm>
42724 </para>
42725 <informaltable frame="all">
42726 <tgroup cols="4" colsep="0" rowsep="0">
42727 <colspec colwidth="8*" align="left"/>
42728 <colspec colwidth="6*" align="center"/>
42729 <colspec colwidth="6*" align="center"/>
42730 <colspec colwidth="6*" align="right"/>
42731 <tbody>
42732 <row>
42733 <entry><option>size_addition</option></entry>
42734 <entry>Use: <emphasis>smtp</emphasis></entry>
42735 <entry>Type: <emphasis>integer</emphasis></entry>
42736 <entry>Default: <emphasis>1024</emphasis></entry>
42737 </row>
42738 </tbody>
42739 </tgroup>
42740 </informaltable>
42741 <para>
42742 <indexterm role="concept">
42743 <primary>SMTP</primary>
42744 <secondary>SIZE</secondary>
42745 </indexterm>
42746 <indexterm role="concept">
42747 <primary>message</primary>
42748 <secondary>size issue for transport filter</secondary>
42749 </indexterm>
42750 <indexterm role="concept">
42751 <primary>size</primary>
42752 <secondary>of message</secondary>
42753 </indexterm>
42754 <indexterm role="concept">
42755 <primary>transport</primary>
42756 <secondary>filter</secondary>
42757 </indexterm>
42758 <indexterm role="concept">
42759 <primary>filter</primary>
42760 <secondary>transport filter</secondary>
42761 </indexterm>
42762 If a remote SMTP server indicates that it supports the SIZE option of the
42763 MAIL command, Exim uses this to pass over the message size at the start of
42764 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
42765 sends, to allow for headers and other text that may be added during delivery by
42766 configuration options or in a transport filter. It may be necessary to increase
42767 this if a lot of text is added to messages.
42768 </para>
42769 <para>
42770 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
42771 the use of the SIZE option altogether.
42772 </para>
42773 <para>
42774 <indexterm role="option">
42775 <primary><option>tls_certificate</option></primary>
42776 </indexterm>
42777 </para>
42778 <informaltable frame="all">
42779 <tgroup cols="4" colsep="0" rowsep="0">
42780 <colspec colwidth="8*" align="left"/>
42781 <colspec colwidth="6*" align="center"/>
42782 <colspec colwidth="6*" align="center"/>
42783 <colspec colwidth="6*" align="right"/>
42784 <tbody>
42785 <row>
42786 <entry><option>tls_certificate</option></entry>
42787 <entry>Use: <emphasis>smtp</emphasis></entry>
42788 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42789 <entry>Default: <emphasis>unset</emphasis></entry>
42790 </row>
42791 </tbody>
42792 </tgroup>
42793 </informaltable>
42794 <para>
42795 <indexterm role="concept">
42796 <primary>TLS</primary>
42797 <secondary>client certificate, location of</secondary>
42798 </indexterm>
42799 <indexterm role="concept">
42800 <primary>certificate</primary>
42801 <secondary>client, location of</secondary>
42802 </indexterm>
42803 <indexterm role="variable">
42804 <primary><varname>$host</varname></primary>
42805 </indexterm>
42806 <indexterm role="variable">
42807 <primary><varname>$host_address</varname></primary>
42808 </indexterm>
42809 The value of this option must be the absolute path to a file which contains the
42810 client&#x2019;s certificate, for possible use when sending a message over an encrypted
42811 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
42812 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
42813 details of TLS.
42814 </para>
42815 <para>
42816 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
42817 certificate when sending messages as a client. The global option of the same
42818 name specifies the certificate for Exim as a server; it is not automatically
42819 assumed that the same certificate should be used when Exim is operating as a
42820 client.
42821 </para>
42822 <para>
42823 <indexterm role="option">
42824 <primary><option>tls_crl</option></primary>
42825 </indexterm>
42826 </para>
42827 <informaltable frame="all">
42828 <tgroup cols="4" colsep="0" rowsep="0">
42829 <colspec colwidth="8*" align="left"/>
42830 <colspec colwidth="6*" align="center"/>
42831 <colspec colwidth="6*" align="center"/>
42832 <colspec colwidth="6*" align="right"/>
42833 <tbody>
42834 <row>
42835 <entry><option>tls_crl</option></entry>
42836 <entry>Use: <emphasis>smtp</emphasis></entry>
42837 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42838 <entry>Default: <emphasis>unset</emphasis></entry>
42839 </row>
42840 </tbody>
42841 </tgroup>
42842 </informaltable>
42843 <para>
42844 <indexterm role="concept">
42845 <primary>TLS</primary>
42846 <secondary>client certificate revocation list</secondary>
42847 </indexterm>
42848 <indexterm role="concept">
42849 <primary>certificate</primary>
42850 <secondary>revocation list for client</secondary>
42851 </indexterm>
42852 This option specifies a certificate revocation list. The expanded value must
42853 be the name of a file that contains a CRL in PEM format.
42854 </para>
42855 <para>
42856 <indexterm role="option">
42857 <primary><option>tls_privatekey</option></primary>
42858 </indexterm>
42859 </para>
42860 <informaltable frame="all">
42861 <tgroup cols="4" colsep="0" rowsep="0">
42862 <colspec colwidth="8*" align="left"/>
42863 <colspec colwidth="6*" align="center"/>
42864 <colspec colwidth="6*" align="center"/>
42865 <colspec colwidth="6*" align="right"/>
42866 <tbody>
42867 <row>
42868 <entry><option>tls_privatekey</option></entry>
42869 <entry>Use: <emphasis>smtp</emphasis></entry>
42870 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42871 <entry>Default: <emphasis>unset</emphasis></entry>
42872 </row>
42873 </tbody>
42874 </tgroup>
42875 </informaltable>
42876 <para>
42877 <indexterm role="concept">
42878 <primary>TLS</primary>
42879 <secondary>client private key, location of</secondary>
42880 </indexterm>
42881 <indexterm role="variable">
42882 <primary><varname>$host</varname></primary>
42883 </indexterm>
42884 <indexterm role="variable">
42885 <primary><varname>$host_address</varname></primary>
42886 </indexterm>
42887 The value of this option must be the absolute path to a file which contains the
42888 client&#x2019;s private key. This is used when sending a message over an encrypted
42889 connection using a client certificate. The values of <varname>$host</varname> and
42890 <varname>$host_address</varname> are set to the name and address of the server during the
42891 expansion. If this option is unset, or the expansion is forced to fail, or the
42892 result is an empty string, the private key is assumed to be in the same file as
42893 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42894 </para>
42895 <para>
42896 <indexterm role="option">
42897 <primary><option>tls_require_ciphers</option></primary>
42898 </indexterm>
42899 </para>
42900 <informaltable frame="all">
42901 <tgroup cols="4" colsep="0" rowsep="0">
42902 <colspec colwidth="8*" align="left"/>
42903 <colspec colwidth="6*" align="center"/>
42904 <colspec colwidth="6*" align="center"/>
42905 <colspec colwidth="6*" align="right"/>
42906 <tbody>
42907 <row>
42908 <entry><option>tls_require_ciphers</option></entry>
42909 <entry>Use: <emphasis>smtp</emphasis></entry>
42910 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42911 <entry>Default: <emphasis>unset</emphasis></entry>
42912 </row>
42913 </tbody>
42914 </tgroup>
42915 </informaltable>
42916 <para>
42917 <indexterm role="concept">
42918 <primary>TLS</primary>
42919 <secondary>requiring specific ciphers</secondary>
42920 </indexterm>
42921 <indexterm role="concept">
42922 <primary>cipher</primary>
42923 <secondary>requiring specific</secondary>
42924 </indexterm>
42925 <indexterm role="variable">
42926 <primary><varname>$host</varname></primary>
42927 </indexterm>
42928 <indexterm role="variable">
42929 <primary><varname>$host_address</varname></primary>
42930 </indexterm>
42931 The value of this option must be a list of permitted cipher suites, for use
42932 when setting up an outgoing encrypted connection. (There is a global option of
42933 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
42934 <varname>$host_address</varname> are set to the name and address of the server during the
42935 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
42936 is used in different ways by OpenSSL and GnuTLS (see sections
42937 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
42938 ciphers is a preference order.
42939 </para>
42940 <para>
42941 <indexterm role="option">
42942 <primary><option>tls_tempfail_tryclear</option></primary>
42943 </indexterm>
42944 </para>
42945 <informaltable frame="all">
42946 <tgroup cols="4" colsep="0" rowsep="0">
42947 <colspec colwidth="8*" align="left"/>
42948 <colspec colwidth="6*" align="center"/>
42949 <colspec colwidth="6*" align="center"/>
42950 <colspec colwidth="6*" align="right"/>
42951 <tbody>
42952 <row>
42953 <entry><option>tls_tempfail_tryclear</option></entry>
42954 <entry>Use: <emphasis>smtp</emphasis></entry>
42955 <entry>Type: <emphasis>boolean</emphasis></entry>
42956 <entry>Default: <emphasis>true</emphasis></entry>
42957 </row>
42958 </tbody>
42959 </tgroup>
42960 </informaltable>
42961 <para>
42962 <indexterm role="concept">
42963 <primary>4<emphasis>xx</emphasis> responses</primary>
42964 <secondary>to STARTTLS</secondary>
42965 </indexterm>
42966 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
42967 setting up a TLS session, this option determines whether or not Exim should try
42968 to deliver the message unencrypted. If it is set false, delivery to the
42969 current host is deferred; if there are other hosts, they are tried. If this
42970 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
42971 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
42972 TLS negotiation fails, Exim closes the current connection (because it is in an
42973 unknown state), opens a new one to the same host, and then tries the delivery
42974 in clear.
42975 </para>
42976 <para>
42977 <indexterm role="option">
42978 <primary><option>tls_verify_certificates</option></primary>
42979 </indexterm>
42980 </para>
42981 <informaltable frame="all">
42982 <tgroup cols="4" colsep="0" rowsep="0">
42983 <colspec colwidth="8*" align="left"/>
42984 <colspec colwidth="6*" align="center"/>
42985 <colspec colwidth="6*" align="center"/>
42986 <colspec colwidth="6*" align="right"/>
42987 <tbody>
42988 <row>
42989 <entry><option>tls_verify_certificates</option></entry>
42990 <entry>Use: <emphasis>smtp</emphasis></entry>
42991 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42992 <entry>Default: <emphasis>unset</emphasis></entry>
42993 </row>
42994 </tbody>
42995 </tgroup>
42996 </informaltable>
42997 <para>
42998 <indexterm role="concept">
42999 <primary>TLS</primary>
43000 <secondary>server certificate verification</secondary>
43001 </indexterm>
43002 <indexterm role="concept">
43003 <primary>certificate</primary>
43004 <secondary>verification of server</secondary>
43005 </indexterm>
43006 <indexterm role="variable">
43007 <primary><varname>$host</varname></primary>
43008 </indexterm>
43009 <indexterm role="variable">
43010 <primary><varname>$host_address</varname></primary>
43011 </indexterm>
43012 The value of this option must be the absolute path to a file containing
43013 permitted server certificates, for use when setting up an encrypted connection.
43014 Alternatively, if you are using OpenSSL, you can set
43015 <option>tls_verify_certificates</option> to the name of a directory containing certificate
43016 files. This does not work with GnuTLS; the option must be set to the name of a
43017 single file if you are using GnuTLS. The values of <varname>$host</varname> and
43018 <varname>$host_address</varname> are set to the name and address of the server during the
43019 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43020 </para>
43021 </section>
43022 <section id="SECTvalhosmax">
43023 <title>How the limits for the number of hosts to try are used</title>
43024 <para>
43025 <indexterm role="concept">
43026 <primary>host</primary>
43027 <secondary>maximum number to try</secondary>
43028 </indexterm>
43029 <indexterm role="concept">
43030 <primary>limit</primary>
43031 <secondary>hosts; maximum number tried</secondary>
43032 </indexterm>
43033 There are two options that are concerned with the number of hosts that are
43034 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
43035 <option>hosts_max_try_hardlimit</option>.
43036 </para>
43037 <para>
43038 The <option>hosts_max_try</option> option limits the number of hosts that are tried
43039 for a single delivery. However, despite the term <quote>host</quote> in its name, the
43040 option actually applies to each IP address independently. In other words, a
43041 multihomed host is treated as several independent hosts, just as it is for
43042 retrying.
43043 </para>
43044 <para>
43045 Many of the larger ISPs have multiple MX records which often point to
43046 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
43047 created as a result of routing one of these domains.
43048 </para>
43049 <para>
43050 Trying every single IP address on such a long list does not seem sensible; if
43051 several at the top of the list fail, it is reasonable to assume there is some
43052 problem that is likely to affect all of them. Roughly speaking, the value of
43053 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
43054 delivery. However, the logic cannot be quite that simple.
43055 </para>
43056 <para>
43057 Firstly, IP addresses that are skipped because their retry times have not
43058 arrived do not count, and in addition, addresses that are past their retry
43059 limits are also not counted, even when they are tried. This means that when
43060 some IP addresses are past their retry limits, more than the value of
43061 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
43062 that all IP addresses are considered before timing out an email address (but
43063 see below for an exception).
43064 </para>
43065 <para>
43066 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
43067 list to see if there is a subsequent host with a different (higher valued) MX.
43068 If there is, that host is considered next, and the current IP address is used
43069 but not counted. This behaviour helps in the case of a domain with a retry rule
43070 that hardly ever delays any hosts, as is now explained:
43071 </para>
43072 <para>
43073 Consider the case of a long list of hosts with one MX value, and a few with a
43074 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
43075 hosts at the top of the list are tried at first. With the default retry rule,
43076 which specifies increasing retry times, the higher MX hosts are eventually
43077 tried when those at the top of the list are skipped because they have not
43078 reached their retry times.
43079 </para>
43080 <para>
43081 However, it is common practice to put a fixed short retry time on domains for
43082 large ISPs, on the grounds that their servers are rarely down for very long.
43083 Unfortunately, these are exactly the domains that tend to resolve to long lists
43084 of hosts. The short retry time means that the lowest MX hosts are tried every
43085 time. The attempts may be in a different order because of random sorting, but
43086 without the special MX check, the higher MX hosts would never be tried until
43087 all the lower MX hosts had timed out (which might be several days), because
43088 there are always some lower MX hosts that have reached their retry times. With
43089 the special check, Exim considers at least one IP address from each MX value at
43090 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
43091 reached.
43092 </para>
43093 <para>
43094 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
43095 particular, Exim normally eventually tries all the IP addresses before timing
43096 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
43097 reasonable thing to do. Recently, however, some lunatic DNS configurations have
43098 been set up with hundreds of IP addresses for some domains. It can
43099 take a very long time indeed for an address to time out in these cases.
43100 </para>
43101 <para>
43102 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
43103 Exim never tries more than this number of IP addresses; if it hits this limit
43104 and they are all timed out, the email address is bounced, even though not all
43105 possible IP addresses have been tried.
43106 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
43107 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
43108 </para>
43109 </section>
43110 </chapter>
43111
43112 <chapter id="CHAPrewrite">
43113 <title>Address rewriting</title>
43114 <para>
43115 <indexterm role="concept" id="IIDaddrew" class="startofrange">
43116 <primary>rewriting</primary>
43117 <secondary>addresses</secondary>
43118 </indexterm>
43119 There are some circumstances in which Exim automatically rewrites domains in
43120 addresses. The two most common are when an address is given without a domain
43121 (referred to as an <quote>unqualified address</quote>) or when an address contains an
43122 abbreviated domain that is expanded by DNS lookup.
43123 </para>
43124 <para>
43125 Unqualified envelope addresses are accepted only for locally submitted
43126 messages, or for messages that are received from hosts matching
43127 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
43128 appropriate. Unqualified addresses in header lines are qualified if they are in
43129 locally submitted messages, or messages from hosts that are permitted to send
43130 unqualified envelope addresses. Otherwise, unqualified addresses in header
43131 lines are neither qualified nor rewritten.
43132 </para>
43133 <para>
43134 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
43135 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
43136 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
43137 do this. The new RFCs do not contain this suggestion.
43138 </para>
43139 <section id="SECID147">
43140 <title>Explicitly configured address rewriting</title>
43141 <para>
43142 This chapter describes the rewriting rules that can be used in the
43143 main rewrite section of the configuration file, and also in the generic
43144 <option>headers_rewrite</option> option that can be set on any transport.
43145 </para>
43146 <para>
43147 Some people believe that configured address rewriting is a Mortal Sin.
43148 Others believe that life is not possible without it. Exim provides the
43149 facility; you do not have to use it.
43150 </para>
43151 <para>
43152 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
43153 configuration file are applied to addresses in incoming messages, both envelope
43154 addresses and addresses in header lines. Each rule specifies the types of
43155 address to which it applies.
43156 </para>
43157 <para>
43158 Whether or not addresses in header lines are rewritten depends on the origin of
43159 the headers and the type of rewriting. Global rewriting, that is, rewriting
43160 rules from the rewrite section of the configuration file, is applied only to
43161 those headers that were received with the message. Header lines that are added
43162 by ACLs or by a system filter or by individual routers or transports (which
43163 are specific to individual recipient addresses) are not rewritten by the global
43164 rules.
43165 </para>
43166 <para>
43167 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
43168 applies all headers except those added by routers and transports. That is, as
43169 well as the headers that were received with the message, it also applies to
43170 headers that were added by an ACL or a system filter.
43171 </para>
43172 <para>
43173 In general, rewriting addresses from your own system or domain has some
43174 legitimacy. Rewriting other addresses should be done only with great care and
43175 in special circumstances. The author of Exim believes that rewriting should be
43176 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
43177 Although it can sometimes be used as a routing tool, this is very strongly
43178 discouraged.
43179 </para>
43180 <para>
43181 There are two commonly encountered circumstances where rewriting is used, as
43182 illustrated by these examples:
43183 </para>
43184 <itemizedlist>
43185 <listitem>
43186 <para>
43187 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
43188 exchange mail with each other behind a firewall, but there is only a single
43189 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
43190 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
43191 </para>
43192 </listitem>
43193 <listitem>
43194 <para>
43195 A host rewrites the local parts of its own users so that, for example,
43196 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
43197 </para>
43198 </listitem>
43199 </itemizedlist>
43200 </section>
43201 <section id="SECID148">
43202 <title>When does rewriting happen?</title>
43203 <para>
43204 <indexterm role="concept">
43205 <primary>rewriting</primary>
43206 <secondary>timing of</secondary>
43207 </indexterm>
43208 <indexterm role="concept">
43209 <primary>access control lists (ACLs)</primary>
43210 <secondary>rewriting addresses in</secondary>
43211 </indexterm>
43212 Configured address rewriting can take place at several different stages of a
43213 message&#x2019;s processing.
43214 </para>
43215 <para>
43216 <indexterm role="variable">
43217 <primary><varname>$sender_address</varname></primary>
43218 </indexterm>
43219 At the start of an ACL for MAIL, the sender address may have been rewritten
43220 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
43221 ordinary rewrite rules have yet been applied. If, however, the sender address
43222 is verified in the ACL, it is rewritten before verification, and remains
43223 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
43224 rewritten address. This also applies if sender verification happens in a
43225 RCPT ACL. Otherwise, when the sender address is not verified, it is
43226 rewritten as soon as a message&#x2019;s header lines have been received.
43227 </para>
43228 <para>
43229 <indexterm role="variable">
43230 <primary><varname>$domain</varname></primary>
43231 </indexterm>
43232 <indexterm role="variable">
43233 <primary><varname>$local_part</varname></primary>
43234 </indexterm>
43235 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
43236 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
43237 rewrite rules have yet been applied to it. However, the behaviour is different
43238 from the sender address when a recipient is verified. The address is rewritten
43239 for the verification, but the rewriting is not remembered at this stage. The
43240 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
43241 as they were before (that is, they contain the unrewritten &ndash; except for
43242 SMTP-time rewriting &ndash; address).
43243 </para>
43244 <para>
43245 As soon as a message&#x2019;s header lines have been received, all the envelope
43246 recipient addresses are permanently rewritten, and rewriting is also applied to
43247 the addresses in the header lines (if configured). This happens before adding
43248 any header lines that were specified in MAIL or RCPT ACLs, and
43249 <indexterm role="concept">
43250 <primary><function>local_scan()</function> function</primary>
43251 <secondary>address rewriting; timing of</secondary>
43252 </indexterm>
43253 before the DATA ACL and <function>local_scan()</function> functions are run.
43254 </para>
43255 <para>
43256 When an address is being routed, either for delivery or for verification,
43257 rewriting is applied immediately to child addresses that are generated by
43258 redirection, unless <option>no_rewrite</option> is set on the router.
43259 </para>
43260 <para>
43261 <indexterm role="concept">
43262 <primary>envelope sender</primary>
43263 <secondary>rewriting at transport time</secondary>
43264 </indexterm>
43265 <indexterm role="concept">
43266 <primary>rewriting</primary>
43267 <secondary>at transport time</secondary>
43268 </indexterm>
43269 <indexterm role="concept">
43270 <primary>header lines</primary>
43271 <secondary>rewriting at transport time</secondary>
43272 </indexterm>
43273 At transport time, additional rewriting of addresses in header lines can be
43274 specified by setting the generic <option>headers_rewrite</option> option on a transport.
43275 This option contains rules that are identical in form to those in the rewrite
43276 section of the configuration file. They are applied to the original message
43277 header lines and any that were added by ACLs or a system filter. They are not
43278 applied to header lines that are added by routers or the transport.
43279 </para>
43280 <para>
43281 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
43282 transport option. However, it is not possible to rewrite envelope recipients at
43283 transport time.
43284 </para>
43285 </section>
43286 <section id="SECID149">
43287 <title>Testing the rewriting rules that apply on input</title>
43288 <para>
43289 <indexterm role="concept">
43290 <primary>rewriting</primary>
43291 <secondary>testing</secondary>
43292 </indexterm>
43293 <indexterm role="concept">
43294 <primary>testing</primary>
43295 <secondary>rewriting</secondary>
43296 </indexterm>
43297 Exim&#x2019;s input rewriting configuration appears in a part of the run time
43298 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
43299 <option>-brw</option> command line option. This takes an address (which can be a full RFC
43300 2822 address) as its argument. The output is a list of how the address would be
43301 transformed by the rewriting rules for each of the different places it might
43302 appear in an incoming message, that is, for each different header and for the
43303 envelope sender and recipient fields. For example,
43304 </para>
43305 <literallayout class="monospaced">
43306 exim -brw ph10@exim.workshop.example
43307 </literallayout>
43308 <para>
43309 might produce the output
43310 </para>
43311 <literallayout class="monospaced">
43312 sender: Philip.Hazel@exim.workshop.example
43313 from: Philip.Hazel@exim.workshop.example
43314 to: ph10@exim.workshop.example
43315 cc: ph10@exim.workshop.example
43316 bcc: ph10@exim.workshop.example
43317 reply-to: Philip.Hazel@exim.workshop.example
43318 env-from: Philip.Hazel@exim.workshop.example
43319 env-to: ph10@exim.workshop.example
43320 </literallayout>
43321 <para>
43322 which shows that rewriting has been set up for that address when used in any of
43323 the source fields, but not when it appears as a recipient address. At the
43324 present time, there is no equivalent way of testing rewriting rules that are
43325 set for a particular transport.
43326 </para>
43327 </section>
43328 <section id="SECID150">
43329 <title>Rewriting rules</title>
43330 <para>
43331 <indexterm role="concept">
43332 <primary>rewriting</primary>
43333 <secondary>rules</secondary>
43334 </indexterm>
43335 The rewrite section of the configuration file consists of lines of rewriting
43336 rules in the form
43337 </para>
43338 <literallayout>
43339 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
43340 </literallayout>
43341 <para>
43342 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
43343 transport option are given as a colon-separated list. Each item in the list
43344 takes the same form as a line in the main rewriting configuration (except that
43345 any colons must be doubled, of course).
43346 </para>
43347 <para>
43348 The formats of source patterns and replacement strings are described below.
43349 Each is terminated by white space, unless enclosed in double quotes, in which
43350 case normal quoting conventions apply inside the quotes. The flags are single
43351 characters which may appear in any order. Spaces and tabs between them are
43352 ignored.
43353 </para>
43354 <para>
43355 For each address that could potentially be rewritten, the rules are scanned in
43356 order, and replacements for the address from earlier rules can themselves be
43357 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
43358 </para>
43359 <para>
43360 The order in which addresses are rewritten is undefined, may change between
43361 releases, and must not be relied on, with one exception: when a message is
43362 received, the envelope sender is always rewritten first, before any header
43363 lines are rewritten. For example, the replacement string for a rewrite of an
43364 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
43365 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
43366 that the envelope sender has already been rewritten.
43367 </para>
43368 <para>
43369 <indexterm role="variable">
43370 <primary><varname>$domain</varname></primary>
43371 </indexterm>
43372 <indexterm role="variable">
43373 <primary><varname>$local_part</varname></primary>
43374 </indexterm>
43375 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
43376 string to refer to the address that is being rewritten. Note that lookup-driven
43377 rewriting can be done by a rule of the form
43378 </para>
43379 <literallayout class="monospaced">
43380 *@*   ${lookup ...
43381 </literallayout>
43382 <para>
43383 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
43384 refer to the address that is being rewritten.
43385 </para>
43386 </section>
43387 <section id="SECID151">
43388 <title>Rewriting patterns</title>
43389 <para>
43390 <indexterm role="concept">
43391 <primary>rewriting</primary>
43392 <secondary>patterns</secondary>
43393 </indexterm>
43394 <indexterm role="concept">
43395 <primary>address list</primary>
43396 <secondary>in a rewriting pattern</secondary>
43397 </indexterm>
43398 The source pattern in a rewriting rule is any item which may appear in an
43399 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
43400 single-item address list, which means that it is expanded before being tested
43401 against the address. As always, if you use a regular expression as a pattern,
43402 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
43403 facility to suppress string expansion within the regular expression.
43404 </para>
43405 <para>
43406 Domains in patterns should be given in lower case. Local parts in patterns are
43407 case-sensitive. If you want to do case-insensitive matching of local parts, you
43408 can use a regular expression that starts with <literal>^(?i)</literal>.
43409 </para>
43410 <para>
43411 <indexterm role="concept">
43412 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43413 <secondary>in rewriting rules</secondary>
43414 </indexterm>
43415 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
43416 depending on the type of match which occurred. These can be used in the
43417 replacement string to insert portions of the incoming address. <varname>$0</varname> always
43418 refers to the complete incoming address. When a regular expression is used, the
43419 numerical variables are set from its capturing subexpressions. For other types
43420 of pattern they are set as follows:
43421 </para>
43422 <itemizedlist>
43423 <listitem>
43424 <para>
43425 If a local part or domain starts with an asterisk, the numerical variables
43426 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
43427 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
43428 pattern
43429 </para>
43430 <literallayout class="monospaced">
43431 *queen@*.fict.example
43432 </literallayout>
43433 <para>
43434 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
43435 </para>
43436 <literallayout class="monospaced">
43437 $0 = hearts-queen@wonderland.fict.example
43438 $1 = hearts-
43439 $2 = wonderland
43440 </literallayout>
43441 <para>
43442 Note that if the local part does not start with an asterisk, but the domain
43443 does, it is <varname>$1</varname> that contains the wild part of the domain.
43444 </para>
43445 </listitem>
43446 <listitem>
43447 <para>
43448 If the domain part of the pattern is a partial lookup, the wild and fixed parts
43449 of the domain are placed in the next available numerical variables. Suppose,
43450 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
43451 rewriting rule of the form
43452 </para>
43453 <literallayout>
43454 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
43455 </literallayout>
43456 <para>
43457 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
43458 </para>
43459 <literallayout class="monospaced">
43460 $1 = foo
43461 $2 = bar
43462 $3 = baz.example
43463 </literallayout>
43464 <para>
43465 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
43466 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
43467 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
43468 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
43469 whole domain. For non-partial domain lookups, no numerical variables are set.
43470 </para>
43471 </listitem>
43472 </itemizedlist>
43473 </section>
43474 <section id="SECID152">
43475 <title>Rewriting replacements</title>
43476 <para>
43477 <indexterm role="concept">
43478 <primary>rewriting</primary>
43479 <secondary>replacements</secondary>
43480 </indexterm>
43481 If the replacement string for a rule is a single asterisk, addresses that
43482 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
43483 rewriting rules are scanned. For example,
43484 </para>
43485 <literallayout class="monospaced">
43486 hatta@lookingglass.fict.example  *  f
43487 </literallayout>
43488 <para>
43489 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
43490 <emphasis>From:</emphasis> headers.
43491 </para>
43492 <para>
43493 <indexterm role="variable">
43494 <primary><varname>$domain</varname></primary>
43495 </indexterm>
43496 <indexterm role="variable">
43497 <primary><varname>$local_part</varname></primary>
43498 </indexterm>
43499 If the replacement string is not a single asterisk, it is expanded, and must
43500 yield a fully qualified address. Within the expansion, the variables
43501 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
43502 Any letters they contain retain their original case &ndash; they are not lower
43503 cased. The numerical variables are set up according to the type of pattern that
43504 matched the address, as described above. If the expansion is forced to fail by
43505 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
43506 current rule is abandoned, but subsequent rules may take effect. Any other
43507 expansion failure causes the entire rewriting operation to be abandoned, and an
43508 entry written to the panic log.
43509 </para>
43510 </section>
43511 <section id="SECID153">
43512 <title>Rewriting flags</title>
43513 <para>
43514 There are three different kinds of flag that may appear on rewriting rules:
43515 </para>
43516 <itemizedlist>
43517 <listitem>
43518 <para>
43519 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
43520 c, f, h, r, s, t.
43521 </para>
43522 </listitem>
43523 <listitem>
43524 <para>
43525 A flag that specifies rewriting at SMTP time: S.
43526 </para>
43527 </listitem>
43528 <listitem>
43529 <para>
43530 Flags that control the rewriting process: Q, q, R, w.
43531 </para>
43532 </listitem>
43533 </itemizedlist>
43534 <para>
43535 For rules that are part of the <option>headers_rewrite</option> generic transport option,
43536 E, F, T, and S are not permitted.
43537 </para>
43538 </section>
43539 <section id="SECID154">
43540 <title>Flags specifying which headers and envelope addresses to rewrite</title>
43541 <para>
43542 <indexterm role="concept">
43543 <primary>rewriting</primary>
43544 <secondary>flags</secondary>
43545 </indexterm>
43546 If none of the following flag letters, nor the <quote>S</quote> flag (see section
43547 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
43548 and to both the sender and recipient fields of the envelope, whereas a
43549 transport-time rewriting rule just applies to all headers. Otherwise, the
43550 rewriting rule is skipped unless the relevant addresses are being processed.
43551 </para>
43552 <literallayout>
43553 <literal>E</literal>       rewrite all envelope fields
43554 <literal>F</literal>       rewrite the envelope From field
43555 <literal>T</literal>       rewrite the envelope To field
43556 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
43557 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
43558 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
43559 <literal>h</literal>       rewrite all headers
43560 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
43561 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
43562 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
43563 </literallayout>
43564 <para>
43565 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
43566 restrict this to special known cases in your own domains.
43567 </para>
43568 </section>
43569 <section id="SECTrewriteS">
43570 <title>The SMTP-time rewriting flag</title>
43571 <para>
43572 <indexterm role="concept">
43573 <primary>SMTP</primary>
43574 <secondary>rewriting malformed addresses</secondary>
43575 </indexterm>
43576 <indexterm role="concept">
43577 <primary>RCPT</primary>
43578 <secondary>rewriting argument of</secondary>
43579 </indexterm>
43580 <indexterm role="concept">
43581 <primary>MAIL</primary>
43582 <secondary>rewriting argument of</secondary>
43583 </indexterm>
43584 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
43585 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
43586 before any other processing; even before syntax checking. The pattern is
43587 required to be a regular expression, and it is matched against the whole of the
43588 data for the command, including any surrounding angle brackets.
43589 </para>
43590 <para>
43591 <indexterm role="variable">
43592 <primary><varname>$domain</varname></primary>
43593 </indexterm>
43594 <indexterm role="variable">
43595 <primary><varname>$local_part</varname></primary>
43596 </indexterm>
43597 This form of rewrite rule allows for the handling of addresses that are not
43598 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
43599 input). Because the input is not required to be a syntactically valid address,
43600 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
43601 expansion of the replacement string. The result of rewriting replaces the
43602 original address in the MAIL or RCPT command.
43603 </para>
43604 </section>
43605 <section id="SECID155">
43606 <title>Flags controlling the rewriting process</title>
43607 <para>
43608 There are four flags which control the way the rewriting process works. These
43609 take effect only when a rule is invoked, that is, when the address is of the
43610 correct type (matches the flags) and matches the pattern:
43611 </para>
43612 <itemizedlist>
43613 <listitem>
43614 <para>
43615 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
43616 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
43617 absence of <quote>Q</quote> the rewritten address must always include a domain.
43618 </para>
43619 </listitem>
43620 <listitem>
43621 <para>
43622 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
43623 even if no rewriting actually takes place because of a <quote>fail</quote> in the
43624 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
43625 (does not match the flags) or does not match the pattern.
43626 </para>
43627 </listitem>
43628 <listitem>
43629 <para>
43630 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
43631 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
43632 rewriting once it fails to match (after at least one successful rewrite).
43633 </para>
43634 </listitem>
43635 <listitem>
43636 <para>
43637 <indexterm role="concept">
43638 <primary>rewriting</primary>
43639 <secondary>whole addresses</secondary>
43640 </indexterm>
43641 When an address in a header is rewritten, the rewriting normally applies only
43642 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
43643 left unchanged. For example, rewriting might change
43644 </para>
43645 <literallayout class="monospaced">
43646 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
43647 </literallayout>
43648 <para>
43649 into
43650 </para>
43651 <literallayout class="monospaced">
43652 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
43653 </literallayout>
43654 <para>
43655 <indexterm role="concept">
43656 <primary>RFC 2047</primary>
43657 </indexterm>
43658 Sometimes there is a need to replace the whole address item, and this can be
43659 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
43660 causes an address in a header line to be rewritten, the entire address is
43661 replaced, not just the working part. The replacement must be a complete RFC
43662 2822 address, including the angle brackets if necessary. If text outside angle
43663 brackets contains a character whose value is greater than 126 or less than 32
43664 (except for tab), the text is encoded according to RFC 2047. The character set
43665 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
43666 </para>
43667 <para>
43668 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
43669 rewritten, all but the working part of the replacement address is discarded.
43670 </para>
43671 </listitem>
43672 </itemizedlist>
43673 </section>
43674 <section id="SECID156">
43675 <title>Rewriting examples</title>
43676 <para>
43677 Here is an example of the two common rewriting paradigms:
43678 </para>
43679 <literallayout class="monospaced">
43680 *@*.hitch.fict.example  $1@hitch.fict.example
43681 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
43682                      {$value}fail}@hitch.fict.example bctfrF
43683 </literallayout>
43684 <para>
43685 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
43686 the string expansion to fail if the lookup does not succeed. In this context it
43687 has the effect of leaving the original address unchanged, but Exim goes on to
43688 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
43689 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
43690 explicitly, which would cause the rewritten address to be the same as before,
43691 at the cost of a small bit of processing. Not supplying either of these is an
43692 error, since the rewritten address would then contain no local part.
43693 </para>
43694 <para>
43695 The first example above replaces the domain with a superior, more general
43696 domain. This may not be desirable for certain local parts. If the rule
43697 </para>
43698 <literallayout class="monospaced">
43699 root@*.hitch.fict.example  *
43700 </literallayout>
43701 <para>
43702 were inserted before the first rule, rewriting would be suppressed for the
43703 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
43704 </para>
43705 <para>
43706 Rewriting can be made conditional on a number of tests, by making use of
43707 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
43708 messages that originate outside the local host:
43709 </para>
43710 <literallayout class="monospaced">
43711 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
43712                          {$1@hitch.fict.example}fail}"
43713 </literallayout>
43714 <para>
43715 The replacement string is quoted in this example because it contains white
43716 space.
43717 </para>
43718 <para>
43719 <indexterm role="concept">
43720 <primary>rewriting</primary>
43721 <secondary>bang paths</secondary>
43722 </indexterm>
43723 <indexterm role="concept">
43724 <primary>bang paths</primary>
43725 <secondary>rewriting</secondary>
43726 </indexterm>
43727 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
43728 an address it treats it as an unqualified local part which it qualifies with
43729 the local qualification domain (if the source of the message is local or if the
43730 remote host is permitted to send unqualified addresses). Rewriting can
43731 sometimes be used to handle simple bang paths with a fixed number of
43732 components. For example, the rule
43733 </para>
43734 <literallayout class="monospaced">
43735 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
43736 </literallayout>
43737 <para>
43738 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
43739 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
43740 a global rewriting rule for envelope addresses. It can provide a backdoor
43741 method for using your system as a relay, because the incoming addresses appear
43742 to be local. If the bang path addresses are received via SMTP, it is safer to
43743 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
43744 can be done on the rewritten addresses.
43745 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
43746 </para>
43747 </section>
43748 </chapter>
43749
43750 <chapter id="CHAPretry">
43751 <title>Retry configuration</title>
43752 <para>
43753 <indexterm role="concept" id="IIDretconf1" class="startofrange">
43754 <primary>retry</primary>
43755 <secondary>configuration, description of</secondary>
43756 </indexterm>
43757 <indexterm role="concept" id="IIDregconf2" class="startofrange">
43758 <primary>configuration file</primary>
43759 <secondary>retry section</secondary>
43760 </indexterm>
43761 </para>
43762 <para revisionflag="changed">
43763 The <quote>retry</quote> section of the runtime configuration file contains a list of
43764 retry rules that control how often Exim tries to deliver messages that cannot
43765 be delivered at the first attempt. If there are no retry rules (the section is
43766 empty or not present), there are no retries. In this situation, temporary
43767 errors are treated as permanent. The default configuration contains a single,
43768 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
43769 line option can be used to test which retry rule will be used for a given
43770 address, domain and error.
43771 </para>
43772 <para>
43773 The most common cause of retries is temporary failure to deliver to a remote
43774 host because the host is down, or inaccessible because of a network problem.
43775 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
43776 address) basis, not on a per-message basis. Thus, if one message has recently
43777 been delayed, delivery of a new message to the same host is not immediately
43778 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
43779 log selector is set, the message
43780 <indexterm role="concept">
43781 <primary>retry</primary>
43782 <secondary>time not reached</secondary>
43783 </indexterm>
43784 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
43785 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
43786 the handling of errors during remote deliveries.
43787 </para>
43788 <para>
43789 Retry processing applies to routing as well as to delivering, except as covered
43790 in the next paragraph. The retry rules do not distinguish between these
43791 actions. It is not possible, for example, to specify different behaviour for
43792 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
43793 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
43794 added complication, so did not implement it. However, although they share the
43795 same retry rule, the actual retry times for routing and transporting a given
43796 domain are maintained independently.
43797 </para>
43798 <para>
43799 When a delivery is not part of a queue run (typically an immediate delivery on
43800 receipt of a message), the routers are always run, and local deliveries are
43801 always attempted, even if retry times are set for them. This makes for better
43802 behaviour if one particular message is causing problems (for example, causing
43803 quota overflow, or provoking an error in a filter file). If such a delivery
43804 suffers a temporary failure, the retry data is updated as normal, and
43805 subsequent delivery attempts from queue runs occur only when the retry time for
43806 the local address is reached.
43807 </para>
43808 <section id="SECID157">
43809 <title>Changing retry rules</title>
43810 <para>
43811 If you change the retry rules in your configuration, you should consider
43812 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
43813 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
43814 always safe; that is why they are called <quote>hints</quote>.
43815 </para>
43816 <para>
43817 The hints retry data contains suggested retry times based on the previous
43818 rules. In the case of a long-running problem with a remote host, it might
43819 record the fact that the host has timed out. If your new rules increase the
43820 timeout time for such a host, you should definitely remove the old retry data
43821 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
43822 messages that it should now be retaining.
43823 </para>
43824 </section>
43825 <section id="SECID158">
43826 <title>Format of retry rules</title>
43827 <para>
43828 <indexterm role="concept">
43829 <primary>retry</primary>
43830 <secondary>rules</secondary>
43831 </indexterm>
43832 Each retry rule occupies one line and consists of three or four parts,
43833 separated by white space: a pattern, an error name, an optional list of sender
43834 addresses, and a list of retry parameters. The pattern and sender lists must be
43835 enclosed in double quotes if they contain white space. The rules are searched
43836 in order until one is found where the pattern, error name, and sender list (if
43837 present) match the failing host or address, the error that occurred, and the
43838 message&#x2019;s sender, respectively.
43839 </para>
43840 <para>
43841 The pattern is any single item that may appear in an address list (see section
43842 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
43843 which means that it is expanded before being tested against the address that
43844 has been delayed. A negated address list item is permitted. Address
43845 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
43846 which makes it possible for many retry rules to start with just a domain. For
43847 example,
43848 </para>
43849 <literallayout class="monospaced">
43850 lookingglass.fict.example        *  F,24h,30m;
43851 </literallayout>
43852 <para>
43853 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
43854 whereas
43855 </para>
43856 <literallayout class="monospaced">
43857 alice@lookingglass.fict.example  *  F,24h,30m;
43858 </literallayout>
43859 <para>
43860 applies only to temporary failures involving the local part <option>alice</option>.
43861 In practice, almost all rules start with a domain name pattern without a local
43862 part.
43863 </para>
43864 <para>
43865 <indexterm role="concept">
43866 <primary>regular expressions</primary>
43867 <secondary>in retry rules</secondary>
43868 </indexterm>
43869 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
43870 must match a complete address, not just a domain, because that is how regular
43871 expressions work in address lists.
43872 </para>
43873 <literallayout>
43874 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
43875 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
43876 </literallayout>
43877 </section>
43878 <section id="SECID159">
43879 <title>Choosing which retry rule to use for address errors</title>
43880 <para>
43881 When Exim is looking for a retry rule after a routing attempt has failed (for
43882 example, after a DNS timeout), each line in the retry configuration is tested
43883 against the complete address only if <option>retry_use_local_part</option> is set for the
43884 router. Otherwise, only the domain is used, except when matching against a
43885 regular expression, when the local part of the address is replaced with <quote>*</quote>.
43886 A domain on its own can match a domain pattern, or a pattern that starts with
43887 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
43888 <option>check_local_user</option> is true, and false for other routers.
43889 </para>
43890 <para>
43891 Similarly, when Exim is looking for a retry rule after a local delivery has
43892 failed (for example, after a mailbox full error), each line in the retry
43893 configuration is tested against the complete address only if
43894 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
43895 local transports).
43896 </para>
43897 <para>
43898 <indexterm role="concept">
43899 <primary>4<emphasis>xx</emphasis> responses</primary>
43900 <secondary>retry rules for</secondary>
43901 </indexterm>
43902 However, when Exim is looking for a retry rule after a remote delivery attempt
43903 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
43904 whole address is always used as the key when searching the retry rules. The
43905 rule that is found is used to create a retry time for the combination of the
43906 failing address and the message&#x2019;s sender. It is the combination of sender and
43907 recipient that is delayed in subsequent queue runs until its retry time is
43908 reached. You can delay the recipient without regard to the sender by setting
43909 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
43910 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
43911 commands.
43912 </para>
43913 </section>
43914 <section id="SECID160">
43915 <title>Choosing which retry rule to use for host and message errors</title>
43916 <para>
43917 For a temporary error that is not related to an individual address (for
43918 example, a connection timeout), each line in the retry configuration is checked
43919 twice. First, the name of the remote host is used as a domain name (preceded by
43920 <quote>*@</quote> when matching a regular expression). If this does not match the line,
43921 the domain from the email address is tried in a similar fashion. For example,
43922 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
43923 </para>
43924 <literallayout class="monospaced">
43925 a.b.c.example  MX  5  x.y.z.example
43926                MX  6  p.q.r.example
43927                MX  7  m.n.o.example
43928 </literallayout>
43929 <para>
43930 and the retry rules are
43931 </para>
43932 <literallayout class="monospaced">
43933 p.q.r.example    *      F,24h,30m;
43934 a.b.c.example    *      F,4d,45m;
43935 </literallayout>
43936 <para>
43937 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
43938 first rule matches neither the host nor the domain, so Exim looks at the second
43939 rule. This does not match the host, but it does match the domain, so it is used
43940 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
43941 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
43942 first retry rule is used, because it matches the host.
43943 </para>
43944 <para>
43945 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
43946 first rule to determine retry times, but for all the other hosts for the domain
43947 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
43948 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
43949 </para>
43950 <para>
43951 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
43952 However, if a message is routed directly to an IP address without the use of a
43953 host name, for example, if a <command>manualroute</command> router contains a setting such as:
43954 </para>
43955 <literallayout class="monospaced">
43956 route_list = *.a.example  192.168.34.23
43957 </literallayout>
43958 <para>
43959 then the <quote>host name</quote> that is used when searching for a retry rule is the
43960 textual form of the IP address.
43961 </para>
43962 </section>
43963 <section id="SECID161">
43964 <title>Retry rules for specific errors</title>
43965 <para>
43966 <indexterm role="concept">
43967 <primary>retry</primary>
43968 <secondary>specific errors; specifying</secondary>
43969 </indexterm>
43970 The second field in a retry rule is the name of a particular error, or an
43971 asterisk, which matches any error. The errors that can be tested for are:
43972 </para>
43973 <variablelist>
43974 <varlistentry>
43975 <term><option>auth_failed</option></term>
43976 <listitem>
43977 <para>
43978 Authentication failed when trying to send to a host in the
43979 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
43980 </para>
43981 </listitem></varlistentry>
43982 <varlistentry>
43983 <term><option>data_4xx</option></term>
43984 <listitem>
43985 <para>
43986 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
43987 after the command, or after sending the message&#x2019;s data.
43988 </para>
43989 </listitem></varlistentry>
43990 <varlistentry>
43991 <term><option>mail_4xx</option></term>
43992 <listitem>
43993 <para>
43994 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
43995 </para>
43996 </listitem></varlistentry>
43997 <varlistentry>
43998 <term><option>rcpt_4xx</option></term>
43999 <listitem>
44000 <para>
44001 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
44002 </para>
44003 </listitem></varlistentry>
44004 </variablelist>
44005 <para>
44006 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
44007 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
44008 recognize 452 errors given to RCPT commands for addresses in a certain domain,
44009 and have retries every ten minutes with a one-hour timeout, you could set up a
44010 retry rule of this form:
44011 </para>
44012 <literallayout class="monospaced">
44013 the.domain.name  rcpt_452   F,1h,10m
44014 </literallayout>
44015 <para>
44016 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
44017 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
44018 </para>
44019 <variablelist>
44020 <varlistentry>
44021 <term><option>lost_connection</option></term>
44022 <listitem>
44023 <para>
44024 A server unexpectedly closed the SMTP connection. There may, of course,
44025 legitimate reasons for this (host died, network died), but if it repeats a lot
44026 for the same host, it indicates something odd.
44027 </para>
44028 </listitem></varlistentry>
44029 <varlistentry>
44030 <term><option>refused_MX</option></term>
44031 <listitem>
44032 <para>
44033 A connection to a host obtained from an MX record was refused.
44034 </para>
44035 </listitem></varlistentry>
44036 <varlistentry>
44037 <term><option>refused_A</option></term>
44038 <listitem>
44039 <para>
44040 A connection to a host not obtained from an MX record was refused.
44041 </para>
44042 </listitem></varlistentry>
44043 <varlistentry>
44044 <term><option>refused</option></term>
44045 <listitem>
44046 <para>
44047 A connection was refused.
44048 </para>
44049 </listitem></varlistentry>
44050 <varlistentry>
44051 <term><option>timeout_connect_MX</option></term>
44052 <listitem>
44053 <para>
44054 A connection attempt to a host obtained from an MX record timed out.
44055 </para>
44056 </listitem></varlistentry>
44057 <varlistentry>
44058 <term><option>timeout_connect_A</option></term>
44059 <listitem>
44060 <para>
44061 A connection attempt to a host not obtained from an MX record timed out.
44062 </para>
44063 </listitem></varlistentry>
44064 <varlistentry>
44065 <term><option>timeout_connect</option></term>
44066 <listitem>
44067 <para>
44068 A connection attempt timed out.
44069 </para>
44070 </listitem></varlistentry>
44071 <varlistentry>
44072 <term><option>timeout_MX</option></term>
44073 <listitem>
44074 <para>
44075 There was a timeout while connecting or during an SMTP session with a host
44076 obtained from an MX record.
44077 </para>
44078 </listitem></varlistentry>
44079 <varlistentry>
44080 <term><option>timeout_A</option></term>
44081 <listitem>
44082 <para>
44083 There was a timeout while connecting or during an SMTP session with a host not
44084 obtained from an MX record.
44085 </para>
44086 </listitem></varlistentry>
44087 <varlistentry>
44088 <term><option>timeout</option></term>
44089 <listitem>
44090 <para>
44091 There was a timeout while connecting or during an SMTP session.
44092 </para>
44093 </listitem></varlistentry>
44094 <varlistentry>
44095 <term><option>tls_required</option></term>
44096 <listitem>
44097 <para>
44098 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
44099 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
44100 to STARTTLS, or there was a problem setting up the TLS connection.
44101 </para>
44102 </listitem></varlistentry>
44103 <varlistentry>
44104 <term><option>quota</option></term>
44105 <listitem>
44106 <para>
44107 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44108 transport.
44109 </para>
44110 </listitem></varlistentry>
44111 <varlistentry>
44112 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
44113 <listitem>
44114 <para>
44115 <indexterm role="concept">
44116 <primary>quota</primary>
44117 <secondary>error testing in retry rule</secondary>
44118 </indexterm>
44119 <indexterm role="concept">
44120 <primary>retry</primary>
44121 <secondary>quota error testing</secondary>
44122 </indexterm>
44123 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44124 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
44125 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
44126 for four days.
44127 </para>
44128 </listitem></varlistentry>
44129 </variablelist>
44130 <para>
44131 <indexterm role="concept">
44132 <primary>mailbox</primary>
44133 <secondary>time of last read</secondary>
44134 </indexterm>
44135 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
44136 timeouts when the mailbox is full and is not being read by its owner. Ideally,
44137 it should be based on the last time that the user accessed the mailbox.
44138 However, it is not always possible to determine this. Exim uses the following
44139 heuristic rules:
44140 </para>
44141 <itemizedlist>
44142 <listitem>
44143 <para>
44144 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
44145 used. As no new messages are being delivered (because the mailbox is over
44146 quota), Exim does not access the file, so this is the time of last user access.
44147 </para>
44148 </listitem>
44149 <listitem>
44150 <para>
44151 <indexterm role="concept">
44152 <primary>maildir format</primary>
44153 <secondary>time of last read</secondary>
44154 </indexterm>
44155 For a maildir delivery, the time of last modification of the <filename>new</filename>
44156 subdirectory is used. As the mailbox is over quota, no new files are created in
44157 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
44158 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
44159 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
44160 time that is used is therefore the last time that the user read a new message.
44161 </para>
44162 </listitem>
44163 <listitem>
44164 <para>
44165 For other kinds of multi-file mailbox, the time of last access cannot be
44166 obtained, so a retry rule that uses this type of error field is never matched.
44167 </para>
44168 </listitem>
44169 </itemizedlist>
44170 <para>
44171 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
44172 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
44173 when a local delivery is deferred because a partition is full (the ENOSPC
44174 error).
44175 </para>
44176 </section>
44177 <section id="SECID162">
44178 <title>Retry rules for specified senders</title>
44179 <para>
44180 <indexterm role="concept">
44181 <primary>retry</primary>
44182 <secondary>rules; sender-specific</secondary>
44183 </indexterm>
44184 You can specify retry rules that apply only when the failing message has a
44185 specific sender. In particular, this can be used to define retry rules that
44186 apply only to bounce messages. The third item in a retry rule can be of this
44187 form:
44188 </para>
44189 <literallayout>
44190 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
44191 </literallayout>
44192 <para>
44193 The retry timings themselves are then the fourth item. For example:
44194 </para>
44195 <literallayout class="monospaced">
44196 *   rcpt_4xx   senders=:   F,1h,30m
44197 </literallayout>
44198 <para>
44199 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
44200 host. If the address list contains white space, it must be enclosed in quotes.
44201 For example:
44202 </para>
44203 <literallayout class="monospaced">
44204 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
44205 </literallayout>
44206 <para>
44207 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
44208 (which do not depend on the recipient). The reason is that the sender is used
44209 only to match the retry rule. Once the rule has been found for a host error,
44210 its contents are used to set a retry time for the host, and this will apply to
44211 all messages, not just those with specific senders.
44212 </para>
44213 <para>
44214 When testing retry rules using <option>-brt</option>, you can supply a sender using the
44215 <option>-f</option> command line option, like this:
44216 </para>
44217 <literallayout class="monospaced">
44218 exim -f "" -brt user@dom.ain
44219 </literallayout>
44220 <para>
44221 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
44222 list is never matched.
44223 </para>
44224 </section>
44225 <section id="SECID163">
44226 <title>Retry parameters</title>
44227 <para>
44228 <indexterm role="concept">
44229 <primary>retry</primary>
44230 <secondary>parameters in rules</secondary>
44231 </indexterm>
44232 The third (or fourth, if a senders list is present) field in a retry rule is a
44233 sequence of retry parameter sets, separated by semicolons. Each set consists of
44234 </para>
44235 <literallayout>
44236 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
44237 </literallayout>
44238 <para>
44239 The letter identifies the algorithm for computing a new retry time; the cutoff
44240 time is the time beyond which this algorithm no longer applies, and the
44241 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
44242 time that the first failure for the domain (combined with the local part if
44243 relevant) was detected, not from the time the message was received.
44244 </para>
44245 <para>
44246 <indexterm role="concept">
44247 <primary>retry</primary>
44248 <secondary>algorithms</secondary>
44249 </indexterm>
44250 <indexterm role="concept">
44251 <primary>retry</primary>
44252 <secondary>fixed intervals</secondary>
44253 </indexterm>
44254 <indexterm role="concept">
44255 <primary>retry</primary>
44256 <secondary>increasing intervals</secondary>
44257 </indexterm>
44258 <indexterm role="concept">
44259 <primary>retry</primary>
44260 <secondary>random intervals</secondary>
44261 </indexterm>
44262 The available algorithms are:
44263 </para>
44264 <itemizedlist>
44265 <listitem>
44266 <para>
44267 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
44268 the interval.
44269 </para>
44270 </listitem>
44271 <listitem>
44272 <para>
44273 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
44274 specifies a starting value for the interval, and the second a multiplier, which
44275 is used to increase the size of the interval at each retry.
44276 </para>
44277 </listitem>
44278 <listitem>
44279 <para>
44280 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
44281 retry, the previous interval is multiplied by the factor in order to get a
44282 maximum for the next interval. The minimum interval is the first argument of
44283 the parameter, and an actual interval is chosen randomly between them. Such a
44284 rule has been found to be helpful in cluster configurations when all the
44285 members of the cluster restart at once, and may therefore synchronize their
44286 queue processing times.
44287 </para>
44288 </listitem>
44289 </itemizedlist>
44290 <para>
44291 When computing the next retry time, the algorithm definitions are scanned in
44292 order until one whose cutoff time has not yet passed is reached. This is then
44293 used to compute a new retry time that is later than the current time. In the
44294 case of fixed interval retries, this simply means adding the interval to the
44295 current time. For geometrically increasing intervals, retry intervals are
44296 computed from the rule&#x2019;s parameters until one that is greater than the previous
44297 interval is found. The main configuration variable
44298 <indexterm role="concept">
44299 <primary>limit</primary>
44300 <secondary>retry interval</secondary>
44301 </indexterm>
44302 <indexterm role="concept">
44303 <primary>retry</primary>
44304 <secondary>interval, maximum</secondary>
44305 </indexterm>
44306 <indexterm role="option">
44307 <primary><option>retry_interval_max</option></primary>
44308 </indexterm>
44309 <option>retry_interval_max</option> limits the maximum interval between retries. It
44310 cannot be set greater than <literal>24h</literal>, which is its default value.
44311 </para>
44312 <para>
44313 A single remote domain may have a number of hosts associated with it, and each
44314 host may have more than one IP address. Retry algorithms are selected on the
44315 basis of the domain name, but are applied to each IP address independently. If,
44316 for example, a host has two IP addresses and one is unusable, Exim will
44317 generate retry times for it and will not try to use it until its next retry
44318 time comes. Thus the good IP address is likely to be tried first most of the
44319 time.
44320 </para>
44321 <para>
44322 <indexterm role="concept">
44323 <primary>hints database</primary>
44324 <secondary>use for retrying</secondary>
44325 </indexterm>
44326 Retry times are hints rather than promises. Exim does not make any attempt to
44327 run deliveries exactly at the computed times. Instead, a queue runner process
44328 starts delivery processes for delayed messages periodically, and these attempt
44329 new deliveries only for those addresses that have passed their next retry time.
44330 If a new message arrives for a deferred address, an immediate delivery attempt
44331 occurs only if the address has passed its retry time. In the absence of new
44332 messages, the minimum time between retries is the interval between queue runner
44333 processes. There is not much point in setting retry times of five minutes if
44334 your queue runners happen only once an hour, unless there are a significant
44335 number of incoming messages (which might be the case on a system that is
44336 sending everything to a smart host, for example).
44337 </para>
44338 <para>
44339 The data in the retry hints database can be inspected by using the
44340 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
44341 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
44342 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
44343 are for the hosts associated with a particular mail domain, and also for local
44344 deliveries that have been deferred.
44345 </para>
44346 </section>
44347 <section id="SECID164">
44348 <title>Retry rule examples</title>
44349 <para>
44350 Here are some example retry rules:
44351 </para>
44352 <literallayout class="monospaced">
44353 alice@wonderland.fict.example quota_5d  F,7d,3h
44354 wonderland.fict.example       quota_5d
44355 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
44356 lookingglass.fict.example     *         F,24h,30m;
44357 *                 refused_A   F,2h,20m;
44358 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
44359 </literallayout>
44360 <para>
44361 The first rule sets up special handling for mail to
44362 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
44363 mailbox has not been read for at least 5 days. Retries continue every three
44364 hours for 7 days. The second rule handles over-quota errors for all other local
44365 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
44366 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
44367 fail are bounced immediately if the mailbox has not been read for at least 5
44368 days.
44369 </para>
44370 <para>
44371 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
44372 happen every 15 minutes for an hour, then with geometrically increasing
44373 intervals until two days have passed since a delivery first failed. After the
44374 first hour there is a delay of one hour, then two hours, then four hours, and
44375 so on (this is a rather extreme example).
44376 </para>
44377 <para>
44378 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
44379 They happen every 30 minutes for 24 hours only. The remaining two rules handle
44380 all other domains, with special action for connection refusal from hosts that
44381 were not obtained from an MX record.
44382 </para>
44383 <para>
44384 The final rule in a retry configuration should always have asterisks in the
44385 first two fields so as to provide a general catch-all for any addresses that do
44386 not have their own special handling. This example tries every 15 minutes for 2
44387 hours, then with intervals starting at one hour and increasing by a factor of
44388 1.5 up to 16 hours, then every 8 hours up to 5 days.
44389 </para>
44390 </section>
44391 <section id="SECID165">
44392 <title>Timeout of retry data</title>
44393 <para>
44394 <indexterm role="concept">
44395 <primary>timeout</primary>
44396 <secondary>of retry data</secondary>
44397 </indexterm>
44398 <indexterm role="option">
44399 <primary><option>retry_data_expire</option></primary>
44400 </indexterm>
44401 <indexterm role="concept">
44402 <primary>hints database</primary>
44403 <secondary>data expiry</secondary>
44404 </indexterm>
44405 <indexterm role="concept">
44406 <primary>retry</primary>
44407 <secondary>timeout of data</secondary>
44408 </indexterm>
44409 Exim timestamps the data that it writes to its retry hints database. When it
44410 consults the data during a delivery it ignores any that is older than the value
44411 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
44412 been tried for 7 days, Exim will try to deliver to it immediately a message
44413 arrives, and if that fails, it will calculate a retry time as if it were
44414 failing for the first time.
44415 </para>
44416 <para>
44417 This improves the behaviour for messages routed to rarely-used hosts such as MX
44418 backups. If such a host was down at one time, and happens to be down again when
44419 Exim tries a month later, using the old retry data would imply that it had been
44420 down all the time, which is not a justified assumption.
44421 </para>
44422 <para>
44423 If a host really is permanently dead, this behaviour causes a burst of retries
44424 every now and again, but only if messages routed to it are rare. If there is a
44425 message at least once every 7 days the retry data never expires.
44426 </para>
44427 </section>
44428 <section id="SECID166">
44429 <title>Long-term failures</title>
44430 <para>
44431 <indexterm role="concept">
44432 <primary>delivery failure, long-term</primary>
44433 </indexterm>
44434 <indexterm role="concept">
44435 <primary>retry</primary>
44436 <secondary>after long-term failure</secondary>
44437 </indexterm>
44438 Special processing happens when an email address has been failing for so long
44439 that the cutoff time for the last algorithm is reached. For example, using the
44440 default retry rule:
44441 </para>
44442 <literallayout class="monospaced">
44443 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
44444 </literallayout>
44445 <para>
44446 the cutoff time is four days. Reaching the retry cutoff is independent of how
44447 long any specific message has been failing; it is the length of continuous
44448 failure for the recipient address that counts.
44449 </para>
44450 <para>
44451 When the cutoff time is reached for a local delivery, or for all the IP
44452 addresses associated with a remote delivery, a subsequent delivery failure
44453 causes Exim to give up on the address, and a bounce message is generated.
44454 In order to cater for new messages that use the failing address, a next retry
44455 time is still computed from the final algorithm, and is used as follows:
44456 </para>
44457 <para>
44458 For local deliveries, one delivery attempt is always made for any subsequent
44459 messages. If this delivery fails, the address fails immediately. The
44460 post-cutoff retry time is not used.
44461 </para>
44462 <para>
44463 If the delivery is remote, there are two possibilities, controlled by the
44464 <indexterm role="option">
44465 <primary><option>delay_after_cutoff</option></primary>
44466 </indexterm>
44467 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
44468 default. Until the post-cutoff retry time for one of the IP addresses is
44469 reached, the failing email address is bounced immediately, without a delivery
44470 attempt taking place. After that time, one new delivery attempt is made to
44471 those IP addresses that are past their retry times, and if that still fails,
44472 the address is bounced and new retry times are computed.
44473 </para>
44474 <para>
44475 In other words, when all the hosts for a given email address have been failing
44476 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
44477 times is reached. Then it tries once, and bounces if that attempt fails. This
44478 behaviour ensures that few resources are wasted in repeatedly trying to deliver
44479 to a broken destination, but if the host does recover, Exim will eventually
44480 notice.
44481 </para>
44482 <para>
44483 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44484 addresses are past their final cutoff time, Exim tries to deliver to those IP
44485 addresses that have not been tried since the message arrived. If there are
44486 no suitable IP addresses, or if they all fail, the address is bounced. In other
44487 words, it does not delay when a new message arrives, but tries the expired
44488 addresses immediately, unless they have been tried since the message arrived.
44489 If there is a continuous stream of messages for the failing domains, setting
44490 <option>delay_after_cutoff</option> false means that there will be many more attempts to
44491 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
44492 true.
44493 </para>
44494 </section>
44495 <section id="SECID167">
44496 <title>Deliveries that work intermittently</title>
44497 <para>
44498 <indexterm role="concept">
44499 <primary>retry</primary>
44500 <secondary>intermittently working deliveries</secondary>
44501 </indexterm>
44502 Some additional logic is needed to cope with cases where a host is
44503 intermittently available, or when a message has some attribute that prevents
44504 its delivery when others to the same address get through. In this situation,
44505 because some messages are successfully delivered, the <quote>retry clock</quote> for the
44506 host or address keeps getting reset by the successful deliveries, and so
44507 failing messages remain on the queue for ever because the cutoff time is never
44508 reached.
44509 </para>
44510 <para>
44511 Two exceptional actions are applied to prevent this happening. The first
44512 applies to errors that are related to a message rather than a remote host.
44513 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
44514 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
44515 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
44516 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
44517 is used when scanning the retry rules to decide when to try next and when to
44518 time out the address.
44519 </para>
44520 <para>
44521 The exceptional second action applies in all cases. If a message has been on
44522 the queue for longer than the cutoff time of any applicable retry rule for a
44523 given address, a delivery is attempted for that address, even if it is not yet
44524 time, and if this delivery fails, the address is timed out. A new retry time is
44525 not computed in this case, so that other messages for the same address are
44526 considered immediately.
44527 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
44528 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
44529 </para>
44530 </section>
44531 </chapter>
44532
44533 <chapter id="CHAPSMTPAUTH">
44534 <title>SMTP authentication</title>
44535 <para>
44536 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
44537 <primary>SMTP</primary>
44538 <secondary>authentication configuration</secondary>
44539 </indexterm>
44540 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
44541 <primary>authentication</primary>
44542 </indexterm>
44543 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
44544 with SMTP authentication. This facility is an extension to the SMTP protocol,
44545 described in RFC 2554, which allows a client SMTP host to authenticate itself
44546 to a server. This is a common way for a server to recognize clients that are
44547 permitted to use it as a relay. SMTP authentication is not of relevance to the
44548 transfer of mail between servers that have no managerial connection with each
44549 other.
44550 </para>
44551 <para>
44552 <indexterm role="concept">
44553 <primary>AUTH</primary>
44554 <secondary>description of</secondary>
44555 </indexterm>
44556 Very briefly, the way SMTP authentication works is as follows:
44557 </para>
44558 <itemizedlist>
44559 <listitem>
44560 <para>
44561 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
44562 the client&#x2019;s EHLO command.
44563 </para>
44564 </listitem>
44565 <listitem>
44566 <para>
44567 The client issues an AUTH command, naming a specific mechanism. The command
44568 may, optionally, contain some authentication data.
44569 </para>
44570 </listitem>
44571 <listitem>
44572 <para>
44573 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
44574 appropriate responses. In simple authentication mechanisms, the challenges are
44575 just prompts for user names and passwords. The server does not have to issue
44576 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
44577 with the AUTH command.
44578 </para>
44579 </listitem>
44580 <listitem>
44581 <para>
44582 The server either accepts or denies authentication.
44583 </para>
44584 </listitem>
44585 <listitem>
44586 <para>
44587 If authentication succeeds, the client may optionally make use of the AUTH
44588 option on the MAIL command to pass an authenticated sender in subsequent
44589 mail transactions. Authentication lasts for the remainder of the SMTP
44590 connection.
44591 </para>
44592 </listitem>
44593 <listitem>
44594 <para>
44595 If authentication fails, the client may give up, or it may try a different
44596 authentication mechanism, or it may try transferring mail over the
44597 unauthenticated connection.
44598 </para>
44599 </listitem>
44600 </itemizedlist>
44601 <para>
44602 If you are setting up a client, and want to know which authentication
44603 mechanisms the server supports, you can use Telnet to connect to port 25 (the
44604 SMTP port) on the server, and issue an EHLO command. The response to this
44605 includes the list of supported mechanisms. For example:
44606 </para>
44607 <literallayout>
44608 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
44609 <literal>Trying 192.168.34.25...</literal>
44610 <literal>Connected to server.example.</literal>
44611 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
44612 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
44613 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
44614 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
44615 <literal>250-SIZE 52428800</literal>
44616 <literal>250-PIPELINING</literal>
44617 <literal>250-AUTH PLAIN</literal>
44618 <literal>250 HELP</literal>
44619 </literallayout>
44620 <para>
44621 The second-last line of this example output shows that the server supports
44622 authentication using the PLAIN mechanism. In Exim, the different authentication
44623 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
44624 routers and transports, which authenticators are included in the binary is
44625 controlled by build-time definitions. The following are currently available,
44626 included by setting
44627 </para>
44628 <literallayout class="monospaced">
44629 AUTH_CRAM_MD5=yes
44630 AUTH_CYRUS_SASL=yes
44631 AUTH_PLAINTEXT=yes
44632 AUTH_SPA=yes
44633 </literallayout>
44634 <para>
44635 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
44636 authentication mechanism (RFC 2195), and the second provides an interface to
44637 the Cyrus SASL authentication library. The third can be configured to support
44638 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
44639 not formally documented, but used by several MUAs. The fourth authenticator
44640 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
44641 </para>
44642 <para>
44643 The authenticators are configured using the same syntax as other drivers (see
44644 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
44645 authentication section need be present in the configuration file. Each
44646 authenticator can in principle have both server and client functions. When Exim
44647 is receiving SMTP mail, it is acting as a server; when it is sending out
44648 messages over SMTP, it is acting as a client. Authenticator configuration
44649 options are provided for use in both these circumstances.
44650 </para>
44651 <para>
44652 To make it clear which options apply to which situation, the prefixes
44653 <option>server_</option> and <option>client_</option> are used on option names that are specific to
44654 either the server or the client function, respectively. Server and client
44655 functions are disabled if none of their options are set. If an authenticator is
44656 to be used for both server and client functions, a single definition, using
44657 both sets of options, is required. For example:
44658 </para>
44659 <literallayout class="monospaced">
44660 cram:
44661   driver = cram_md5
44662   public_name = CRAM-MD5
44663   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
44664   client_name = ph10
44665   client_secret = secret2
44666 </literallayout>
44667 <para>
44668 The <option>server_</option> option is used when Exim is acting as a server, and the
44669 <option>client_</option> options when it is acting as a client.
44670 </para>
44671 <para>
44672 Descriptions of the individual authenticators are given in subsequent chapters.
44673 The remainder of this chapter covers the generic options for the
44674 authenticators, followed by general discussion of the way authentication works
44675 in Exim.
44676 </para>
44677 <section id="SECID168">
44678 <title>Generic options for authenticators</title>
44679 <para>
44680 <indexterm role="concept">
44681 <primary>authentication</primary>
44682 <secondary>generic options</secondary>
44683 </indexterm>
44684 <indexterm role="concept">
44685 <primary>options</primary>
44686 <secondary>generic; for authenticators</secondary>
44687 </indexterm>
44688 </para>
44689 <para revisionflag="changed">
44690 <indexterm role="option">
44691 <primary><option>client_condition</option></primary>
44692 </indexterm>
44693 </para>
44694 <informaltable frame="all" revisionflag="changed">
44695 <tgroup cols="4" colsep="0" rowsep="0">
44696 <colspec colwidth="8*" align="left"/>
44697 <colspec colwidth="6*" align="center"/>
44698 <colspec colwidth="6*" align="center"/>
44699 <colspec colwidth="6*" align="right"/>
44700 <tbody>
44701 <row>
44702 <entry><option>client_condition</option></entry>
44703 <entry>Use: <emphasis>authenticators</emphasis></entry>
44704 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44705 <entry>Default: <emphasis>unset</emphasis></entry>
44706 </row>
44707 </tbody>
44708 </tgroup>
44709 </informaltable>
44710 <para revisionflag="changed">
44711 When Exim is authenticating as a client, it skips any authenticator whose
44712 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
44713 used, for example, to skip plain text authenticators when the connection is not
44714 encrypted by a setting such as:
44715 </para>
44716 <literallayout class="monospaced" revisionflag="changed">
44717 client_condition = ${if !eq{$tls_cipher}{}}
44718 </literallayout>
44719 <para revisionflag="changed">
44720 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
44721 used for incoming messages. In fact, during SMTP delivery, it contains the
44722 cipher used for the delivery.)
44723 </para>
44724 <para>
44725 <indexterm role="option">
44726 <primary><option>driver</option></primary>
44727 </indexterm>
44728 </para>
44729 <informaltable frame="all">
44730 <tgroup cols="4" colsep="0" rowsep="0">
44731 <colspec colwidth="8*" align="left"/>
44732 <colspec colwidth="6*" align="center"/>
44733 <colspec colwidth="6*" align="center"/>
44734 <colspec colwidth="6*" align="right"/>
44735 <tbody>
44736 <row>
44737 <entry><option>driver</option></entry>
44738 <entry>Use: <emphasis>authenticators</emphasis></entry>
44739 <entry>Type: <emphasis>string</emphasis></entry>
44740 <entry>Default: <emphasis>unset</emphasis></entry>
44741 </row>
44742 </tbody>
44743 </tgroup>
44744 </informaltable>
44745 <para>
44746 This option must always be set. It specifies which of the available
44747 authenticators is to be used.
44748 </para>
44749 <para>
44750 <indexterm role="option">
44751 <primary><option>public_name</option></primary>
44752 </indexterm>
44753 </para>
44754 <informaltable frame="all">
44755 <tgroup cols="4" colsep="0" rowsep="0">
44756 <colspec colwidth="8*" align="left"/>
44757 <colspec colwidth="6*" align="center"/>
44758 <colspec colwidth="6*" align="center"/>
44759 <colspec colwidth="6*" align="right"/>
44760 <tbody>
44761 <row>
44762 <entry><option>public_name</option></entry>
44763 <entry>Use: <emphasis>authenticators</emphasis></entry>
44764 <entry>Type: <emphasis>string</emphasis></entry>
44765 <entry>Default: <emphasis>unset</emphasis></entry>
44766 </row>
44767 </tbody>
44768 </tgroup>
44769 </informaltable>
44770 <para>
44771 This option specifies the name of the authentication mechanism that the driver
44772 implements, and by which it is known to the outside world. These names should
44773 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
44774 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
44775 defaults to the driver&#x2019;s instance name.
44776 </para>
44777 <para>
44778 <indexterm role="option">
44779 <primary><option>server_advertise_condition</option></primary>
44780 </indexterm>
44781 </para>
44782 <informaltable frame="all">
44783 <tgroup cols="4" colsep="0" rowsep="0">
44784 <colspec colwidth="8*" align="left"/>
44785 <colspec colwidth="6*" align="center"/>
44786 <colspec colwidth="6*" align="center"/>
44787 <colspec colwidth="6*" align="right"/>
44788 <tbody>
44789 <row>
44790 <entry><option>server_advertise_condition</option></entry>
44791 <entry>Use: <emphasis>authenticators</emphasis></entry>
44792 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44793 <entry>Default: <emphasis>unset</emphasis></entry>
44794 </row>
44795 </tbody>
44796 </tgroup>
44797 </informaltable>
44798 <para>
44799 When a server is about to advertise an authentication mechanism, the condition
44800 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
44801 mechanism is not advertised.
44802 If the expansion fails, the mechanism is not advertised. If the failure was not
44803 forced, and was not caused by a lookup defer, the incident is logged.
44804 See section <xref linkend="SECTauthexiser"/> below for further discussion.
44805 </para>
44806 <para>
44807 <indexterm role="option">
44808 <primary><option>server_condition</option></primary>
44809 </indexterm>
44810 </para>
44811 <informaltable frame="all">
44812 <tgroup cols="4" colsep="0" rowsep="0">
44813 <colspec colwidth="8*" align="left"/>
44814 <colspec colwidth="6*" align="center"/>
44815 <colspec colwidth="6*" align="center"/>
44816 <colspec colwidth="6*" align="right"/>
44817 <tbody>
44818 <row>
44819 <entry><option>server_condition</option></entry>
44820 <entry>Use: <emphasis>authenticators</emphasis></entry>
44821 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44822 <entry>Default: <emphasis>unset</emphasis></entry>
44823 </row>
44824 </tbody>
44825 </tgroup>
44826 </informaltable>
44827 <para>
44828 This option must be set for a <option>plaintext</option> server authenticator, where it
44829 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
44830 for details.
44831 </para>
44832 <para>
44833 For the other authenticators, <option>server_condition</option> can be used as an additional
44834 authentication or authorization mechanism that is applied after the other
44835 authenticator conditions succeed. If it is set, it is expanded when the
44836 authenticator would otherwise return a success code. If the expansion is forced
44837 to fail, authentication fails. Any other expansion failure causes a temporary
44838 error code to be returned. If the result of a successful expansion is an empty
44839 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
44840 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
44841 other result, a temporary error code is returned, with the expanded string as
44842 the error text.
44843 </para>
44844 <para>
44845 <indexterm role="option">
44846 <primary><option>server_debug_print</option></primary>
44847 </indexterm>
44848 </para>
44849 <informaltable frame="all">
44850 <tgroup cols="4" colsep="0" rowsep="0">
44851 <colspec colwidth="8*" align="left"/>
44852 <colspec colwidth="6*" align="center"/>
44853 <colspec colwidth="6*" align="center"/>
44854 <colspec colwidth="6*" align="right"/>
44855 <tbody>
44856 <row>
44857 <entry><option>server_debug_print</option></entry>
44858 <entry>Use: <emphasis>authenticators</emphasis></entry>
44859 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44860 <entry>Default: <emphasis>unset</emphasis></entry>
44861 </row>
44862 </tbody>
44863 </tgroup>
44864 </informaltable>
44865 <para>
44866 If this option is set and authentication debugging is enabled (see the <option>-d</option>
44867 command line option), the string is expanded and included in the debugging
44868 output when the authenticator is run as a server. This can help with checking
44869 out the values of variables.
44870 If expansion of the string fails, the error message is written to the debugging
44871 output, and Exim carries on processing.
44872 </para>
44873 <para>
44874 <indexterm role="option">
44875 <primary><option>server_set_id</option></primary>
44876 </indexterm>
44877 </para>
44878 <informaltable frame="all">
44879 <tgroup cols="4" colsep="0" rowsep="0">
44880 <colspec colwidth="8*" align="left"/>
44881 <colspec colwidth="6*" align="center"/>
44882 <colspec colwidth="6*" align="center"/>
44883 <colspec colwidth="6*" align="right"/>
44884 <tbody>
44885 <row>
44886 <entry><option>server_set_id</option></entry>
44887 <entry>Use: <emphasis>authenticators</emphasis></entry>
44888 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44889 <entry>Default: <emphasis>unset</emphasis></entry>
44890 </row>
44891 </tbody>
44892 </tgroup>
44893 </informaltable>
44894 <para>
44895 <indexterm role="variable">
44896 <primary><varname>$authenticated_id</varname></primary>
44897 </indexterm>
44898 When an Exim server successfully authenticates a client, this string is
44899 expanded using data from the authentication, and preserved for any incoming
44900 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
44901 lines for incoming messages. For example, a user/password authenticator
44902 configuration might preserve the user name that was used to authenticate, and
44903 refer to it subsequently during delivery of the message.
44904 If expansion fails, the option is ignored.
44905 </para>
44906 <para>
44907 <indexterm role="option">
44908 <primary><option>server_mail_auth_condition</option></primary>
44909 </indexterm>
44910 </para>
44911 <informaltable frame="all">
44912 <tgroup cols="4" colsep="0" rowsep="0">
44913 <colspec colwidth="8*" align="left"/>
44914 <colspec colwidth="6*" align="center"/>
44915 <colspec colwidth="6*" align="center"/>
44916 <colspec colwidth="6*" align="right"/>
44917 <tbody>
44918 <row>
44919 <entry><option>server_mail_auth_condition</option></entry>
44920 <entry>Use: <emphasis>authenticators</emphasis></entry>
44921 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44922 <entry>Default: <emphasis>unset</emphasis></entry>
44923 </row>
44924 </tbody>
44925 </tgroup>
44926 </informaltable>
44927 <para>
44928 This option allows a server to discard authenticated sender addresses supplied
44929 as part of MAIL commands in SMTP connections that are authenticated by the
44930 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
44931 as part of the authentication process; instead its (unexpanded) value is
44932 remembered for later use.
44933 How it is used is described in the following section.
44934 </para>
44935 </section>
44936 <section id="SECTauthparamail">
44937 <title>The AUTH parameter on MAIL commands</title>
44938 <para>
44939 <indexterm role="concept">
44940 <primary>authentication</primary>
44941 <secondary>sender; authenticated</secondary>
44942 </indexterm>
44943 <indexterm role="concept">
44944 <primary>AUTH</primary>
44945 <secondary>on MAIL command</secondary>
44946 </indexterm>
44947 When a client supplied an AUTH= item on a MAIL command, Exim applies
44948 the following checks before accepting it as the authenticated sender of the
44949 message:
44950 </para>
44951 <itemizedlist>
44952 <listitem>
44953 <para>
44954 If the connection is not using extended SMTP (that is, HELO was used rather
44955 than EHLO), the use of AUTH= is a syntax error.
44956 </para>
44957 </listitem>
44958 <listitem>
44959 <para>
44960 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
44961 </para>
44962 </listitem>
44963 <listitem>
44964 <para>
44965 <indexterm role="variable">
44966 <primary><varname>$authenticated_sender</varname></primary>
44967 </indexterm>
44968 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
44969 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
44970 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
44971 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
44972 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
44973 given for the MAIL command.
44974 </para>
44975 </listitem>
44976 <listitem>
44977 <para>
44978 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
44979 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
44980 authenticated.
44981 </para>
44982 </listitem>
44983 <listitem>
44984 <para>
44985 If the AUTH= value was accepted by either of the two previous rules, and
44986 the client has authenticated, and the authenticator has a setting for the
44987 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
44988 valued that was saved from the authenticator is expanded. If the expansion
44989 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
44990 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
44991 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
44992 message.
44993 </para>
44994 </listitem>
44995 </itemizedlist>
44996 <para>
44997 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
44998 hosts to which Exim authenticates as a client. Do not confuse this value with
44999 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
45000 process, and which is not usually a complete email address.
45001 </para>
45002 <para>
45003 <indexterm role="variable">
45004 <primary><varname>$sender_address</varname></primary>
45005 </indexterm>
45006 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
45007 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
45008 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
45009 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
45010 ACL is run.
45011 </para>
45012 </section>
45013 <section id="SECTauthexiser">
45014 <title>Authentication on an Exim server</title>
45015 <para>
45016 <indexterm role="concept">
45017 <primary>authentication</primary>
45018 <secondary>on an Exim server</secondary>
45019 </indexterm>
45020 When Exim receives an EHLO command, it advertises the public names of those
45021 authenticators that are configured as servers, subject to the following
45022 conditions:
45023 </para>
45024 <itemizedlist>
45025 <listitem>
45026 <para>
45027 The client host must match <option>auth_advertise_hosts</option> (default *).
45028 </para>
45029 </listitem>
45030 <listitem>
45031 <para>
45032 It the <option>server_advertise_condition</option> option is set, its expansion must not
45033 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
45034 </para>
45035 </listitem>
45036 </itemizedlist>
45037 <para>
45038 The order in which the authenticators are defined controls the order in which
45039 the mechanisms are advertised.
45040 </para>
45041 <para>
45042 Some mail clients (for example, some versions of Netscape) require the user to
45043 provide a name and password for authentication whenever AUTH is advertised,
45044 even though authentication may not in fact be needed (for example, Exim may be
45045 set up to allow unconditional relaying from the client by an IP address check).
45046 You can make such clients more friendly by not advertising AUTH to them.
45047 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
45048 that runs for RCPT) to relay without authentication, you should set
45049 </para>
45050 <literallayout class="monospaced">
45051 auth_advertise_hosts = ! 10.9.8.0/24
45052 </literallayout>
45053 <para>
45054 so that no authentication mechanisms are advertised to them.
45055 </para>
45056 <para>
45057 The <option>server_advertise_condition</option> controls the advertisement of individual
45058 authentication mechanisms. For example, it can be used to restrict the
45059 advertisement of a particular mechanism to encrypted connections, by a setting
45060 such as:
45061 </para>
45062 <literallayout class="monospaced">
45063 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
45064 </literallayout>
45065 <para>
45066 <indexterm role="variable">
45067 <primary><varname>$tls_cipher</varname></primary>
45068 </indexterm>
45069 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
45070 yields <quote>yes</quote>, which allows the advertisement to happen.
45071 </para>
45072 <para>
45073 When an Exim server receives an AUTH command from a client, it rejects it
45074 immediately if AUTH was not advertised in response to an earlier EHLO
45075 command. This is the case if
45076 </para>
45077 <itemizedlist>
45078 <listitem>
45079 <para>
45080 The client host does not match <option>auth_advertise_hosts</option>; or
45081 </para>
45082 </listitem>
45083 <listitem>
45084 <para>
45085 No authenticators are configured with server options; or
45086 </para>
45087 </listitem>
45088 <listitem>
45089 <para>
45090 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
45091 server authenticators.
45092 </para>
45093 </listitem>
45094 </itemizedlist>
45095 <para>
45096 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
45097 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
45098 AUTH is accepted from any client host.
45099 </para>
45100 <para>
45101 If AUTH is not rejected by the ACL, Exim searches its configuration for a
45102 server authentication mechanism that was advertised in response to EHLO and
45103 that matches the one named in the AUTH command. If it finds one, it runs
45104 the appropriate authentication protocol, and authentication either succeeds or
45105 fails. If there is no matching advertised mechanism, the AUTH command is
45106 rejected with a 504 error.
45107 </para>
45108 <para>
45109 <indexterm role="variable">
45110 <primary><varname>$received_protocol</varname></primary>
45111 </indexterm>
45112 <indexterm role="variable">
45113 <primary><varname>$sender_host_authenticated</varname></primary>
45114 </indexterm>
45115 When a message is received from an authenticated host, the value of
45116 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
45117 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
45118 public name) of the authenticator driver that successfully authenticated the
45119 client from which the message was received. This variable is empty if there was
45120 no successful authentication.
45121 </para>
45122 </section>
45123 <section id="SECID169">
45124 <title>Testing server authentication</title>
45125 <para>
45126 <indexterm role="concept">
45127 <primary>authentication</primary>
45128 <secondary>testing a server</secondary>
45129 </indexterm>
45130 <indexterm role="concept">
45131 <primary>AUTH</primary>
45132 <secondary>testing a server</secondary>
45133 </indexterm>
45134 <indexterm role="concept">
45135 <primary>base64 encoding</primary>
45136 <secondary>creating authentication test data</secondary>
45137 </indexterm>
45138 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
45139 configurations. The data for the AUTH command has to be sent using base64
45140 encoding. A quick way to produce such data for testing is the following Perl
45141 script:
45142 </para>
45143 <literallayout class="monospaced">
45144 use MIME::Base64;
45145 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
45146 </literallayout>
45147 <para>
45148 <indexterm role="concept">
45149 <primary>binary zero</primary>
45150 <secondary>in authentication data</secondary>
45151 </indexterm>
45152 This interprets its argument as a Perl string, and then encodes it. The
45153 interpretation as a Perl string allows binary zeros, which are required for
45154 some kinds of authentication, to be included in the data. For example, a
45155 command line to run this script on such data might be
45156 </para>
45157 <literallayout class="monospaced">
45158 encode '\0user\0password'
45159 </literallayout>
45160 <para>
45161 Note the use of single quotes to prevent the shell interpreting the
45162 backslashes, so that they can be interpreted by Perl to specify characters
45163 whose code value is zero.
45164 </para>
45165 <para>
45166 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
45167 digit, you must use three zeros instead of one after the leading backslash. If
45168 you do not, the octal digit that starts your string will be incorrectly
45169 interpreted as part of the code for the first character.
45170 </para>
45171 <para>
45172 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
45173 specially, you must use a Perl escape to prevent them being misinterpreted. For
45174 example, a command such as
45175 </para>
45176 <literallayout class="monospaced">
45177 encode '\0user@domain.com\0pas$$word'
45178 </literallayout>
45179 <para>
45180 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
45181 </para>
45182 <para>
45183 If you have the <option>mimencode</option> command installed, another way to do produce
45184 base64-encoded strings is to run the command
45185 </para>
45186 <literallayout class="monospaced">
45187 echo -e -n `\0user\0password' | mimencode
45188 </literallayout>
45189 <para>
45190 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
45191 in the argument, and the <option>-n</option> option specifies no newline at the end of its
45192 output. However, not all versions of <option>echo</option> recognize these options, so you
45193 should check your version before relying on this suggestion.
45194 </para>
45195 </section>
45196 <section id="SECID170">
45197 <title>Authentication by an Exim client</title>
45198 <para>
45199 <indexterm role="concept">
45200 <primary>authentication</primary>
45201 <secondary>on an Exim client</secondary>
45202 </indexterm>
45203 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
45204 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
45205 announces support for authentication, and the host matches an entry in either
45206 of these options, Exim (as a client) tries to authenticate as follows:
45207 </para>
45208 <itemizedlist>
45209 <listitem>
45210 <para>
45211 For each authenticator that is configured as a client, in the order in which
45212 they are defined in the configuration, it searches the authentication
45213 mechanisms announced by the server for one whose name matches the public name
45214 of the authenticator.
45215 </para>
45216 </listitem>
45217 <listitem>
45218 <para>
45219 <indexterm role="variable">
45220 <primary><varname>$host</varname></primary>
45221 </indexterm>
45222 <indexterm role="variable">
45223 <primary><varname>$host_address</varname></primary>
45224 </indexterm>
45225 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
45226 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
45227 that the client might do. They are set to the server&#x2019;s name and IP address. If
45228 any expansion is forced to fail, the authentication attempt is abandoned, and
45229 Exim moves on to the next authenticator. Otherwise an expansion failure causes
45230 delivery to be deferred.
45231 </para>
45232 </listitem>
45233 <listitem>
45234 <para>
45235 If the result of the authentication attempt is a temporary error or a timeout,
45236 Exim abandons trying to send the message to the host for the moment. It will
45237 try again later. If there are any backup hosts available, they are tried in the
45238 usual way.
45239 </para>
45240 </listitem>
45241 <listitem>
45242 <para>
45243 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
45244 carries on searching the list of authenticators and tries another one if
45245 possible. If all authentication attempts give permanent errors, or if there are
45246 no attempts because no mechanisms match (or option expansions force failure),
45247 what happens depends on whether the host matches <option>hosts_require_auth</option> or
45248 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
45249 delivery is deferred. The error can be detected in the retry rules, and thereby
45250 turned into a permanent error if you wish. In the second case, Exim tries to
45251 deliver the message unauthenticated.
45252 </para>
45253 </listitem>
45254 </itemizedlist>
45255 <para>
45256 <indexterm role="concept">
45257 <primary>AUTH</primary>
45258 <secondary>on MAIL command</secondary>
45259 </indexterm>
45260 When Exim has authenticated itself to a remote server, it adds the AUTH
45261 parameter to the MAIL commands it sends, if it has an authenticated sender for
45262 the message. If the message came from a remote host, the authenticated sender
45263 is the one that was receiving on an incoming MAIL command, provided that the
45264 incoming connection was authenticated and the <option>server_mail_auth</option> condition
45265 allowed the authenticated sender to be retained. If a local process calls Exim
45266 to send a message, the sender address that is built from the login name and
45267 <option>qualify_domain</option> is treated as authenticated. However, if the
45268 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
45269 the authenticated sender that was received with the message.
45270 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
45271 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
45272 </para>
45273 </section>
45274 </chapter>
45275
45276 <chapter id="CHAPplaintext">
45277 <title>The plaintext authenticator</title>
45278 <para>
45279 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
45280 <primary><command>plaintext</command> authenticator</primary>
45281 </indexterm>
45282 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
45283 <primary>authenticators</primary>
45284 <secondary><command>plaintext</command></secondary>
45285 </indexterm>
45286 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
45287 LOGIN authentication mechanisms, both of which transfer authentication data as
45288 plain (unencrypted) text (though base64 encoded). The use of plain text is a
45289 security risk; you are strongly advised to insist on the use of SMTP encryption
45290 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
45291 use unencrypted plain text, you should not use the same passwords for SMTP
45292 connections as you do for login accounts.
45293 </para>
45294 <section id="SECID171">
45295 <title>Plaintext options</title>
45296 <para>
45297 <indexterm role="concept">
45298 <primary>options</primary>
45299 <secondary><command>plaintext</command> authenticator (server)</secondary>
45300 </indexterm>
45301 When configured as a server, <command>plaintext</command> uses the following options:
45302 </para>
45303 <para>
45304 <indexterm role="option">
45305 <primary><option>server_condition</option></primary>
45306 </indexterm>
45307 </para>
45308 <informaltable frame="all">
45309 <tgroup cols="4" colsep="0" rowsep="0">
45310 <colspec colwidth="8*" align="left"/>
45311 <colspec colwidth="6*" align="center"/>
45312 <colspec colwidth="6*" align="center"/>
45313 <colspec colwidth="6*" align="right"/>
45314 <tbody>
45315 <row>
45316 <entry><option>server_condition</option></entry>
45317 <entry>Use: <emphasis>authenticators</emphasis></entry>
45318 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45319 <entry>Default: <emphasis>unset</emphasis></entry>
45320 </row>
45321 </tbody>
45322 </tgroup>
45323 </informaltable>
45324 <para>
45325 This is actually a global authentication option, but it must be set in order to
45326 configure the <command>plaintext</command> driver as a server. Its use is described below.
45327 </para>
45328 <para>
45329 <indexterm role="option">
45330 <primary><option>server_prompts</option></primary>
45331 </indexterm>
45332 </para>
45333 <informaltable frame="all">
45334 <tgroup cols="4" colsep="0" rowsep="0">
45335 <colspec colwidth="8*" align="left"/>
45336 <colspec colwidth="6*" align="center"/>
45337 <colspec colwidth="6*" align="center"/>
45338 <colspec colwidth="6*" align="right"/>
45339 <tbody>
45340 <row>
45341 <entry><option>server_prompts</option></entry>
45342 <entry>Use: <emphasis>plaintext</emphasis></entry>
45343 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45344 <entry>Default: <emphasis>unset</emphasis></entry>
45345 </row>
45346 </tbody>
45347 </tgroup>
45348 </informaltable>
45349 <para>
45350 The contents of this option, after expansion, must be a colon-separated list of
45351 prompt strings. If expansion fails, a temporary authentication rejection is
45352 given.
45353 </para>
45354 </section>
45355 <section id="SECTplainserver">
45356 <title>Using plaintext in a server</title>
45357 <para>
45358 <indexterm role="concept">
45359 <primary>AUTH</primary>
45360 <secondary>in <command>plaintext</command> authenticator</secondary>
45361 </indexterm>
45362 <indexterm role="concept">
45363 <primary>binary zero</primary>
45364 <secondary>in <command>plaintext</command> authenticator</secondary>
45365 </indexterm>
45366 <indexterm role="concept">
45367 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45368 <secondary>in <command>plaintext</command> authenticator</secondary>
45369 </indexterm>
45370 <indexterm role="variable">
45371 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
45372 </indexterm>
45373 <indexterm role="concept">
45374 <primary>base64 encoding</primary>
45375 <secondary>in <command>plaintext</command> authenticator</secondary>
45376 </indexterm>
45377 </para>
45378 <para>
45379 When running as a server, <command>plaintext</command> performs the authentication test by
45380 expanding a string. The data sent by the client with the AUTH command, or in
45381 response to subsequent prompts, is base64 encoded, and so may contain any byte
45382 values when decoded. If any data is supplied with the command, it is treated as
45383 a list of strings, separated by NULs (binary zeros), the first three of which
45384 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
45385 (neither LOGIN nor PLAIN uses more than three strings).
45386 </para>
45387 <para>
45388 For compatibility with previous releases of Exim, the values are also placed in
45389 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
45390 variables for this purpose is now deprecated, as it can lead to confusion in
45391 string expansions that also use them for other things.
45392 </para>
45393 <para>
45394 If there are more strings in <option>server_prompts</option> than the number of strings
45395 supplied with the AUTH command, the remaining prompts are used to obtain more
45396 data. Each response from the client may be a list of NUL-separated strings.
45397 </para>
45398 <para>
45399 <indexterm role="variable">
45400 <primary><varname>$authenticated_id</varname></primary>
45401 </indexterm>
45402 Once a sufficient number of data strings have been received,
45403 <option>server_condition</option> is expanded. If the expansion is forced to fail,
45404 authentication fails. Any other expansion failure causes a temporary error code
45405 to be returned. If the result of a successful expansion is an empty string,
45406 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45407 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
45408 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
45409 For any other result, a temporary error code is returned, with the expanded
45410 string as the error text.
45411 </para>
45412 <para>
45413 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
45414 password, be sure to make the authentication fail if the user is unknown.
45415 There are good and bad examples at the end of the next section.
45416 </para>
45417 </section>
45418 <section id="SECID172">
45419 <title>The PLAIN authentication mechanism</title>
45420 <para>
45421 <indexterm role="concept">
45422 <primary>PLAIN authentication mechanism</primary>
45423 </indexterm>
45424 <indexterm role="concept">
45425 <primary>authentication</primary>
45426 <secondary>PLAIN mechanism</secondary>
45427 </indexterm>
45428 <indexterm role="concept">
45429 <primary>binary zero</primary>
45430 <secondary>in <command>plaintext</command> authenticator</secondary>
45431 </indexterm>
45432 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
45433 sent as one item of data (that is, one combined string containing two NUL
45434 separators). The data is sent either as part of the AUTH command, or
45435 subsequently in response to an empty prompt from the server.
45436 </para>
45437 <para>
45438 The second and third strings are a user name and a corresponding password.
45439 Using a single fixed user name and password as an example, this could be
45440 configured as follows:
45441 </para>
45442 <literallayout class="monospaced">
45443 fixed_plain:
45444   driver = plaintext
45445   public_name = PLAIN
45446   server_prompts = :
45447   server_condition = \
45448     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
45449   server_set_id = $auth2
45450 </literallayout>
45451 <para>
45452 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
45453 are exactly what we want here, so they need not be specified. Obviously, if the
45454 password contains expansion-significant characters such as dollar, backslash,
45455 or closing brace, they have to be escaped.
45456 </para>
45457 <para>
45458 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
45459 the end of a string list are ignored). If all the data comes as part of the
45460 AUTH command, as is commonly the case, the prompt is not used. This
45461 authenticator is advertised in the response to EHLO as
45462 </para>
45463 <literallayout class="monospaced">
45464 250-AUTH PLAIN
45465 </literallayout>
45466 <para>
45467 and a client host can authenticate itself by sending the command
45468 </para>
45469 <literallayout class="monospaced">
45470 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
45471 </literallayout>
45472 <para>
45473 As this contains three strings (more than the number of prompts), no further
45474 data is required from the client. Alternatively, the client may just send
45475 </para>
45476 <literallayout class="monospaced">
45477 AUTH PLAIN
45478 </literallayout>
45479 <para>
45480 to initiate authentication, in which case the server replies with an empty
45481 prompt. The client must respond with the combined data string.
45482 </para>
45483 <para>
45484 The data string is base64 encoded, as required by the RFC. This example,
45485 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;
45486 represents a zero byte. This is split up into three strings, the first of which
45487 is empty. The <option>server_condition</option> option in the authenticator checks that the
45488 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
45489 </para>
45490 <para>
45491 Having just one fixed user name and password, as in this example, is not very
45492 realistic, though for a small organization with only a handful of
45493 authenticating clients it could make sense.
45494 </para>
45495 <para>
45496 A more sophisticated instance of this authenticator could use the user name in
45497 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
45498 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
45499 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
45500 This is an incorrect example:
45501 </para>
45502 <literallayout class="monospaced">
45503 server_condition = \
45504   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
45505 </literallayout>
45506 <para>
45507 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
45508 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
45509 incorrect? It works fine for existing users, but consider what happens if a
45510 non-existent user name is given. The lookup fails, but as no success/failure
45511 strings are given for the lookup, it yields an empty string. Thus, to defeat
45512 the authentication, all a client has to do is to supply a non-existent user
45513 name and an empty password. The correct way of writing this test is:
45514 </para>
45515 <literallayout class="monospaced">
45516 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
45517   {${if eq{$value}{$auth3}}} {false}}
45518 </literallayout>
45519 <para>
45520 In this case, if the lookup succeeds, the result is checked; if the lookup
45521 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
45522 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
45523 always fails if its second argument is empty. However, the second way of
45524 writing the test makes the logic clearer.
45525 </para>
45526 </section>
45527 <section id="SECID173">
45528 <title>The LOGIN authentication mechanism</title>
45529 <para>
45530 <indexterm role="concept">
45531 <primary>LOGIN authentication mechanism</primary>
45532 </indexterm>
45533 <indexterm role="concept">
45534 <primary>authentication</primary>
45535 <secondary>LOGIN mechanism</secondary>
45536 </indexterm>
45537 The LOGIN authentication mechanism is not documented in any RFC, but is in use
45538 in a number of programs. No data is sent with the AUTH command. Instead, a
45539 user name and password are supplied separately, in response to prompts. The
45540 plaintext authenticator can be configured to support this as in this example:
45541 </para>
45542 <literallayout class="monospaced">
45543 fixed_login:
45544   driver = plaintext
45545   public_name = LOGIN
45546   server_prompts = User Name : Password
45547   server_condition = \
45548     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
45549   server_set_id = $auth1
45550 </literallayout>
45551 <para>
45552 Because of the way plaintext operates, this authenticator accepts data supplied
45553 with the AUTH command (in contravention of the specification of LOGIN), but
45554 if the client does not supply it (as is the case for LOGIN clients), the prompt
45555 strings are used to obtain two data items.
45556 </para>
45557 <para>
45558 Some clients are very particular about the precise text of the prompts. For
45559 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
45560 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
45561 strings. It uses the <option>ldapauth</option> expansion condition to check the user
45562 name and password by binding to an LDAP server:
45563 </para>
45564 <literallayout class="monospaced">
45565 login:
45566   driver = plaintext
45567   public_name = LOGIN
45568   server_prompts = Username:: : Password::
45569   server_condition = ${if ldapauth \
45570     {user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
45571     pass=${quote:$auth2} \
45572     ldap://ldap.example.org/}}
45573   server_set_id = uid=$auth1,ou=people,o=example.org
45574 </literallayout>
45575 <para>
45576 Note the use of the <option>quote_ldap_dn</option> operator to correctly quote the DN for
45577 authentication. However, the basic <option>quote</option> operator, rather than any of the
45578 LDAP quoting operators, is the correct one to use for the password, because
45579 quoting is needed only to make the password conform to the Exim syntax. At the
45580 LDAP level, the password is an uninterpreted string.
45581 </para>
45582 </section>
45583 <section id="SECID174">
45584 <title>Support for different kinds of authentication</title>
45585 <para>
45586 A number of string expansion features are provided for the purpose of
45587 interfacing to different ways of user authentication. These include checking
45588 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
45589 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
45590 <xref linkend="SECTexpcond"/>.
45591 </para>
45592 </section>
45593 <section id="SECID175">
45594 <title>Using plaintext in a client</title>
45595 <para>
45596 <indexterm role="concept">
45597 <primary>options</primary>
45598 <secondary><command>plaintext</command> authenticator (client)</secondary>
45599 </indexterm>
45600 The <command>plaintext</command> authenticator has two client options:
45601 </para>
45602 <para>
45603 <indexterm role="option">
45604 <primary><option>client_ignore_invalid_base64</option></primary>
45605 </indexterm>
45606 </para>
45607 <informaltable frame="all">
45608 <tgroup cols="4" colsep="0" rowsep="0">
45609 <colspec colwidth="8*" align="left"/>
45610 <colspec colwidth="6*" align="center"/>
45611 <colspec colwidth="6*" align="center"/>
45612 <colspec colwidth="6*" align="right"/>
45613 <tbody>
45614 <row>
45615 <entry><option>client_ignore_invalid_base64</option></entry>
45616 <entry>Use: <emphasis>plaintext</emphasis></entry>
45617 <entry>Type: <emphasis>boolean</emphasis></entry>
45618 <entry>Default: <emphasis>false</emphasis></entry>
45619 </row>
45620 </tbody>
45621 </tgroup>
45622 </informaltable>
45623 <para>
45624 If the client receives a server prompt that is not a valid base64 string,
45625 authentication is abandoned by default. However, if this option is set true,
45626 the error in the challenge is ignored and the client sends the response as
45627 usual.
45628 </para>
45629 <para>
45630 <indexterm role="option">
45631 <primary><option>client_send</option></primary>
45632 </indexterm>
45633 </para>
45634 <informaltable frame="all">
45635 <tgroup cols="4" colsep="0" rowsep="0">
45636 <colspec colwidth="8*" align="left"/>
45637 <colspec colwidth="6*" align="center"/>
45638 <colspec colwidth="6*" align="center"/>
45639 <colspec colwidth="6*" align="right"/>
45640 <tbody>
45641 <row>
45642 <entry><option>client_send</option></entry>
45643 <entry>Use: <emphasis>plaintext</emphasis></entry>
45644 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45645 <entry>Default: <emphasis>unset</emphasis></entry>
45646 </row>
45647 </tbody>
45648 </tgroup>
45649 </informaltable>
45650 <para>
45651 The string is a colon-separated list of authentication data strings. Each
45652 string is independently expanded before being sent to the server. The first
45653 string is sent with the AUTH command; any more strings are sent in response
45654 to prompts from the server. Before each string is expanded, the value of the
45655 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
45656 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
45657 way. Thus, the prompt that is received in response to sending the first string
45658 (with the AUTH command) can be used in the expansion of the second string, and
45659 so on. If an invalid base64 string is received when
45660 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
45661 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
45662 </para>
45663 <para>
45664 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
45665 splitting takes priority and happens first.
45666 </para>
45667 <para>
45668 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
45669 the data, further processing is applied to each string before it is sent. If
45670 there are any single circumflex characters in the string, they are converted to
45671 NULs. Should an actual circumflex be required as data, it must be doubled in
45672 the string.
45673 </para>
45674 <para>
45675 This is an example of a client configuration that implements the PLAIN
45676 authentication mechanism with a fixed user name and password:
45677 </para>
45678 <literallayout class="monospaced">
45679 fixed_plain:
45680   driver = plaintext
45681   public_name = PLAIN
45682   client_send = ^username^mysecret
45683 </literallayout>
45684 <para>
45685 The lack of colons means that the entire text is sent with the AUTH
45686 command, with the circumflex characters converted to NULs. A similar example
45687 that uses the LOGIN mechanism is:
45688 </para>
45689 <literallayout class="monospaced">
45690 fixed_login:
45691   driver = plaintext
45692   public_name = LOGIN
45693   client_send = : username : mysecret
45694 </literallayout>
45695 <para>
45696 The initial colon means that the first string is empty, so no data is sent with
45697 the AUTH command itself. The remaining strings are sent in response to
45698 prompts.
45699 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
45700 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
45701 </para>
45702 </section>
45703 </chapter>
45704
45705 <chapter id="CHID9">
45706 <title>The cram_md5 authenticator</title>
45707 <para>
45708 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
45709 <primary><command>cram_md5</command> authenticator</primary>
45710 </indexterm>
45711 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
45712 <primary>authenticators</primary>
45713 <secondary><command>cram_md5</command></secondary>
45714 </indexterm>
45715 <indexterm role="concept">
45716 <primary>CRAM-MD5 authentication mechanism</primary>
45717 </indexterm>
45718 <indexterm role="concept">
45719 <primary>authentication</primary>
45720 <secondary>CRAM-MD5 mechanism</secondary>
45721 </indexterm>
45722 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
45723 sends a challenge string to the client, and the response consists of a user
45724 name and the CRAM-MD5 digest of the challenge string combined with a secret
45725 string (password) which is known to both server and client. Thus, the secret
45726 is not sent over the network as plain text, which makes this authenticator more
45727 secure than <command>plaintext</command>. However, the downside is that the secret has to be
45728 available in plain text at either end.
45729 </para>
45730 <section id="SECID176">
45731 <title>Using cram_md5 as a server</title>
45732 <para>
45733 <indexterm role="concept">
45734 <primary>options</primary>
45735 <secondary><command>cram_md5</command> authenticator (server)</secondary>
45736 </indexterm>
45737 This authenticator has one server option, which must be set to configure the
45738 authenticator as a server:
45739 </para>
45740 <para>
45741 <indexterm role="option">
45742 <primary><option>server_secret</option></primary>
45743 </indexterm>
45744 </para>
45745 <informaltable frame="all">
45746 <tgroup cols="4" colsep="0" rowsep="0">
45747 <colspec colwidth="8*" align="left"/>
45748 <colspec colwidth="6*" align="center"/>
45749 <colspec colwidth="6*" align="center"/>
45750 <colspec colwidth="6*" align="right"/>
45751 <tbody>
45752 <row>
45753 <entry><option>server_secret</option></entry>
45754 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45755 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45756 <entry>Default: <emphasis>unset</emphasis></entry>
45757 </row>
45758 </tbody>
45759 </tgroup>
45760 </informaltable>
45761 <para>
45762 <indexterm role="concept">
45763 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45764 <secondary>in <command>cram_md5</command> authenticator</secondary>
45765 </indexterm>
45766 When the server receives the client&#x2019;s response, the user name is placed in
45767 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
45768 obtain the password for that user. The server then computes the CRAM-MD5 digest
45769 that the client should have sent, and checks that it received the correct
45770 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
45771 fails. If the expansion fails for some other reason, a temporary error code is
45772 returned to the client.
45773 </para>
45774 <para>
45775 For compatibility with previous releases of Exim, the user name is also placed
45776 in <varname>$1</varname>. However, the use of this variables for this purpose is now
45777 deprecated, as it can lead to confusion in string expansions that also use
45778 numeric variables for other things.
45779 </para>
45780 <para>
45781 For example, the following authenticator checks that the user name given by the
45782 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
45783 user name, authentication fails.
45784 </para>
45785 <literallayout class="monospaced">
45786 fixed_cram:
45787   driver = cram_md5
45788   public_name = CRAM-MD5
45789   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
45790   server_set_id = $auth1
45791 </literallayout>
45792 <para>
45793 <indexterm role="variable">
45794 <primary><varname>$authenticated_id</varname></primary>
45795 </indexterm>
45796 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
45797 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
45798 secret string in a file, using the user name as the key. For example:
45799 </para>
45800 <literallayout class="monospaced">
45801 lookup_cram:
45802   driver = cram_md5
45803   public_name = CRAM-MD5
45804   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
45805                   {$value}fail}
45806   server_set_id = $auth1
45807 </literallayout>
45808 <para>
45809 Note that this expansion explicitly forces failure if the lookup fails
45810 because <varname>$auth1</varname> contains an unknown user name.
45811 </para>
45812 </section>
45813 <section id="SECID177">
45814 <title>Using cram_md5 as a client</title>
45815 <para>
45816 <indexterm role="concept">
45817 <primary>options</primary>
45818 <secondary><command>cram_md5</command> authenticator (client)</secondary>
45819 </indexterm>
45820 When used as a client, the <command>cram_md5</command> authenticator has two options:
45821 </para>
45822 <para>
45823 <indexterm role="option">
45824 <primary><option>client_name</option></primary>
45825 </indexterm>
45826 </para>
45827 <informaltable frame="all">
45828 <tgroup cols="4" colsep="0" rowsep="0">
45829 <colspec colwidth="8*" align="left"/>
45830 <colspec colwidth="6*" align="center"/>
45831 <colspec colwidth="6*" align="center"/>
45832 <colspec colwidth="6*" align="right"/>
45833 <tbody>
45834 <row>
45835 <entry><option>client_name</option></entry>
45836 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45837 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45838 <entry>Default: <emphasis>the primary host name</emphasis></entry>
45839 </row>
45840 </tbody>
45841 </tgroup>
45842 </informaltable>
45843 <para>
45844 This string is expanded, and the result used as the user name data when
45845 computing the response to the server&#x2019;s challenge.
45846 </para>
45847 <para>
45848 <indexterm role="option">
45849 <primary><option>client_secret</option></primary>
45850 </indexterm>
45851 </para>
45852 <informaltable frame="all">
45853 <tgroup cols="4" colsep="0" rowsep="0">
45854 <colspec colwidth="8*" align="left"/>
45855 <colspec colwidth="6*" align="center"/>
45856 <colspec colwidth="6*" align="center"/>
45857 <colspec colwidth="6*" align="right"/>
45858 <tbody>
45859 <row>
45860 <entry><option>client_secret</option></entry>
45861 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45862 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45863 <entry>Default: <emphasis>unset</emphasis></entry>
45864 </row>
45865 </tbody>
45866 </tgroup>
45867 </informaltable>
45868 <para>
45869 This option must be set for the authenticator to work as a client. Its value is
45870 expanded and the result used as the secret string when computing the response.
45871 </para>
45872 <para>
45873 <indexterm role="variable">
45874 <primary><varname>$host</varname></primary>
45875 </indexterm>
45876 <indexterm role="variable">
45877 <primary><varname>$host_address</varname></primary>
45878 </indexterm>
45879 Different user names and secrets can be used for different servers by referring
45880 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
45881 expansion string is treated as an indication that this authenticator is not
45882 prepared to handle this case. Exim moves on to the next configured client
45883 authenticator. Any other expansion failure causes Exim to give up trying to
45884 send the message to the current server.
45885 </para>
45886 <para>
45887 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
45888 strings, is:
45889 </para>
45890 <literallayout class="monospaced">
45891 fixed_cram:
45892   driver = cram_md5
45893   public_name = CRAM-MD5
45894   client_name = ph10
45895   client_secret = secret
45896 </literallayout>
45897 <para>
45898 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
45899 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
45900 </para>
45901 </section>
45902 </chapter>
45903
45904 <chapter id="CHID10">
45905 <title>The cyrus_sasl authenticator</title>
45906 <para>
45907 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
45908 <primary><command>cyrus_sasl</command> authenticator</primary>
45909 </indexterm>
45910 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
45911 <primary>authenticators</primary>
45912 <secondary><command>cyrus_sasl</command></secondary>
45913 </indexterm>
45914 <indexterm role="concept">
45915 <primary>Cyrus</primary>
45916 <secondary>SASL library</secondary>
45917 </indexterm>
45918 <indexterm role="concept">
45919 <primary>Kerberos</primary>
45920 </indexterm>
45921 The code for this authenticator was provided by Matthew Byng-Maddick of A L
45922 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
45923 </para>
45924 <para>
45925 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
45926 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
45927 Layer</quote>). This library supports a number of authentication mechanisms,
45928 including PLAIN and LOGIN, but also several others that Exim does not support
45929 directly. In particular, there is support for Kerberos authentication.
45930 </para>
45931 <para>
45932 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
45933 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
45934 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
45935 name of the driver to determine which mechanism to support.
45936 </para>
45937 <para>
45938 Where access to some kind of secret file is required, for example in GSSAPI
45939 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
45940 user, and that the Cyrus SASL library has no way of escalating privileges
45941 by default. You may also find you need to set environment variables,
45942 depending on the driver you are using.
45943 </para>
45944 <para>
45945 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
45946 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
45947 Kerberos, note that because of limitations in the GSSAPI interface,
45948 changing the server keytab might need to be communicated down to the Kerberos
45949 layer independently. The mechanism for doing so is dependent upon the Kerberos
45950 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
45951 may be set to point to an alternative keytab file. Exim will pass this
45952 variable through from its own inherited environment when started as root or the
45953 Exim user. The keytab file needs to be readable by the Exim user.
45954 </para>
45955 <section id="SECID178">
45956 <title>Using cyrus_sasl as a server</title>
45957 <para>
45958 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
45959 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
45960 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
45961 use of this variable for this purpose is now deprecated, as it can lead to
45962 confusion in string expansions that also use numeric variables for other
45963 things.
45964 </para>
45965 <para>
45966 <indexterm role="option">
45967 <primary><option>server_hostname</option></primary>
45968 </indexterm>
45969 </para>
45970 <informaltable frame="all">
45971 <tgroup cols="4" colsep="0" rowsep="0">
45972 <colspec colwidth="8*" align="left"/>
45973 <colspec colwidth="6*" align="center"/>
45974 <colspec colwidth="6*" align="center"/>
45975 <colspec colwidth="6*" align="right"/>
45976 <tbody>
45977 <row>
45978 <entry><option>server_hostname</option></entry>
45979 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45980 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45981 <entry>Default: <emphasis>see below</emphasis></entry>
45982 </row>
45983 </tbody>
45984 </tgroup>
45985 </informaltable>
45986 <para>
45987 This option selects the hostname that is used when communicating with the
45988 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
45989 SASL plug-in what it does with this data.
45990 </para>
45991 <para>
45992 <indexterm role="option">
45993 <primary><option>server_mech</option></primary>
45994 </indexterm>
45995 </para>
45996 <informaltable frame="all">
45997 <tgroup cols="4" colsep="0" rowsep="0">
45998 <colspec colwidth="8*" align="left"/>
45999 <colspec colwidth="6*" align="center"/>
46000 <colspec colwidth="6*" align="center"/>
46001 <colspec colwidth="6*" align="right"/>
46002 <tbody>
46003 <row>
46004 <entry><option>server_mech</option></entry>
46005 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46006 <entry>Type: <emphasis>string</emphasis></entry>
46007 <entry>Default: <emphasis>see below</emphasis></entry>
46008 </row>
46009 </tbody>
46010 </tgroup>
46011 </informaltable>
46012 <para>
46013 This option selects the authentication mechanism this driver should use. The
46014 default is the value of the generic <option>public_name</option> option. This option allows
46015 you to use a different underlying mechanism from the advertised name. For
46016 example:
46017 </para>
46018 <literallayout class="monospaced">
46019 sasl:
46020   driver = cyrus_sasl
46021   public_name = X-ANYTHING
46022   server_mech = CRAM-MD5
46023   server_set_id = $auth1
46024 </literallayout>
46025 <para>
46026 <indexterm role="option">
46027 <primary><option>server_realm</option></primary>
46028 </indexterm>
46029 </para>
46030 <informaltable frame="all">
46031 <tgroup cols="4" colsep="0" rowsep="0">
46032 <colspec colwidth="8*" align="left"/>
46033 <colspec colwidth="6*" align="center"/>
46034 <colspec colwidth="6*" align="center"/>
46035 <colspec colwidth="6*" align="right"/>
46036 <tbody>
46037 <row>
46038 <entry><option>server_realm</option></entry>
46039 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46040 <entry>Type: <emphasis>string</emphasis></entry>
46041 <entry>Default: <emphasis>unset</emphasis></entry>
46042 </row>
46043 </tbody>
46044 </tgroup>
46045 </informaltable>
46046 <para>
46047 This specifies the SASL realm that the server claims to be in.
46048 </para>
46049 <para>
46050 <indexterm role="option">
46051 <primary><option>server_service</option></primary>
46052 </indexterm>
46053 </para>
46054 <informaltable frame="all">
46055 <tgroup cols="4" colsep="0" rowsep="0">
46056 <colspec colwidth="8*" align="left"/>
46057 <colspec colwidth="6*" align="center"/>
46058 <colspec colwidth="6*" align="center"/>
46059 <colspec colwidth="6*" align="right"/>
46060 <tbody>
46061 <row>
46062 <entry><option>server_service</option></entry>
46063 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46064 <entry>Type: <emphasis>string</emphasis></entry>
46065 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
46066 </row>
46067 </tbody>
46068 </tgroup>
46069 </informaltable>
46070 <para>
46071 This is the SASL service that the server claims to implement.
46072 </para>
46073 <para>
46074 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
46075 private options. All you need to do is to specify an appropriate mechanism as
46076 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
46077 PLAIN, you could have two authenticators as follows:
46078 </para>
46079 <literallayout class="monospaced">
46080 sasl_cram_md5:
46081   driver = cyrus_sasl
46082   public_name = CRAM-MD5
46083   server_set_id = $auth1
46084
46085 sasl_plain:
46086   driver = cyrus_sasl
46087   public_name = PLAIN
46088   server_set_id = $auth1
46089 </literallayout>
46090 <para>
46091 Cyrus SASL does implement the LOGIN authentication method, even though it is
46092 not a standard method. It is disabled by default in the source distribution,
46093 but it is present in many binary distributions.
46094 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
46095 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
46096 </para>
46097 </section>
46098 </chapter>
46099
46100 <chapter id="CHAPdovecot">
46101 <title>The dovecot authenticator</title>
46102 <para>
46103 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
46104 <primary><command>dovecot</command> authenticator</primary>
46105 </indexterm>
46106 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
46107 <primary>authenticators</primary>
46108 <secondary><command>dovecot</command></secondary>
46109 </indexterm>
46110 This authenticator is an interface to the authentication facility of the
46111 Dovecot POP/IMAP server, which can support a number of authentication methods.
46112 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
46113 to use the same mechanisms for SMTP authentication. This is a server
46114 authenticator only. There is only one option:
46115 </para>
46116 <para>
46117 <indexterm role="option">
46118 <primary><option>server_socket</option></primary>
46119 </indexterm>
46120 </para>
46121 <informaltable frame="all">
46122 <tgroup cols="4" colsep="0" rowsep="0">
46123 <colspec colwidth="8*" align="left"/>
46124 <colspec colwidth="6*" align="center"/>
46125 <colspec colwidth="6*" align="center"/>
46126 <colspec colwidth="6*" align="right"/>
46127 <tbody>
46128 <row>
46129 <entry><option>server_socket</option></entry>
46130 <entry>Use: <emphasis>dovecot</emphasis></entry>
46131 <entry>Type: <emphasis>string</emphasis></entry>
46132 <entry>Default: <emphasis>unset</emphasis></entry>
46133 </row>
46134 </tbody>
46135 </tgroup>
46136 </informaltable>
46137 <para>
46138 This option must specify the socket that is the interface to Dovecot
46139 authentication. The <option>public_name</option> option must specify an authentication
46140 mechanism that Dovecot is configured to support. You can have several
46141 authenticators for different mechanisms. For example:
46142 </para>
46143 <literallayout class="monospaced">
46144 dovecot_plain:
46145   driver = dovecot
46146   public_name = PLAIN
46147   server_socket = /var/run/dovecot/auth-client
46148   server_set_id = $auth1
46149
46150 dovecot_ntlm:
46151   driver = dovecot
46152   public_name = NTLM
46153   server_socket = /var/run/dovecot/auth-client
46154   server_set_id = $auth1
46155 </literallayout>
46156 <para>
46157 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
46158 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
46159 option is passed in the Dovecot authentication command. If, for a TLS
46160 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
46161 option is passed. When authentication succeeds, the identity of the user
46162 who authenticated is placed in <varname>$auth1</varname>.
46163 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
46164 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
46165 </para>
46166 </chapter>
46167
46168 <chapter id="CHAPspa">
46169 <title>The spa authenticator</title>
46170 <para>
46171 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
46172 <primary><command>spa</command> authenticator</primary>
46173 </indexterm>
46174 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
46175 <primary>authenticators</primary>
46176 <secondary><command>spa</command></secondary>
46177 </indexterm>
46178 <indexterm role="concept">
46179 <primary>authentication</primary>
46180 <secondary>Microsoft Secure Password</secondary>
46181 </indexterm>
46182 <indexterm role="concept">
46183 <primary>authentication</primary>
46184 <secondary>NTLM</secondary>
46185 </indexterm>
46186 <indexterm role="concept">
46187 <primary>Microsoft Secure Password Authentication</primary>
46188 </indexterm>
46189 <indexterm role="concept">
46190 <primary>NTLM authentication</primary>
46191 </indexterm>
46192 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
46193 Password Authentication</emphasis> mechanism,
46194 which is also sometimes known as NTLM (NT LanMan). The code for client side of
46195 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
46196 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
46197 server side was subsequently contributed by Tom Kistner. The mechanism works as
46198 follows:
46199 </para>
46200 <itemizedlist>
46201 <listitem>
46202 <para>
46203 After the AUTH command has been accepted, the client sends an SPA
46204 authentication request based on the user name and optional domain.
46205 </para>
46206 </listitem>
46207 <listitem>
46208 <para>
46209 The server sends back a challenge.
46210 </para>
46211 </listitem>
46212 <listitem>
46213 <para>
46214 The client builds a challenge response which makes use of the user&#x2019;s password
46215 and sends it to the server, which then accepts or rejects it.
46216 </para>
46217 </listitem>
46218 </itemizedlist>
46219 <para>
46220 Encryption is used to protect the password in transit.
46221 </para>
46222 <section id="SECID179">
46223 <title>Using spa as a server</title>
46224 <para>
46225 <indexterm role="concept">
46226 <primary>options</primary>
46227 <secondary><command>spa</command> authenticator (server)</secondary>
46228 </indexterm>
46229 The <command>spa</command> authenticator has just one server option:
46230 </para>
46231 <para>
46232 <indexterm role="option">
46233 <primary><option>server_password</option></primary>
46234 </indexterm>
46235 </para>
46236 <informaltable frame="all">
46237 <tgroup cols="4" colsep="0" rowsep="0">
46238 <colspec colwidth="8*" align="left"/>
46239 <colspec colwidth="6*" align="center"/>
46240 <colspec colwidth="6*" align="center"/>
46241 <colspec colwidth="6*" align="right"/>
46242 <tbody>
46243 <row>
46244 <entry><option>server_password</option></entry>
46245 <entry>Use: <emphasis>spa</emphasis></entry>
46246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46247 <entry>Default: <emphasis>unset</emphasis></entry>
46248 </row>
46249 </tbody>
46250 </tgroup>
46251 </informaltable>
46252 <para>
46253 <indexterm role="concept">
46254 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46255 <secondary>in <command>spa</command> authenticator</secondary>
46256 </indexterm>
46257 This option is expanded, and the result must be the cleartext password for the
46258 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
46259 compatibility with previous releases of Exim, the user name is also placed in
46260 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
46261 it can lead to confusion in string expansions that also use numeric variables
46262 for other things. For example:
46263 </para>
46264 <literallayout class="monospaced">
46265 spa:
46266   driver = spa
46267   public_name = NTLM
46268   server_password = \
46269     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
46270 </literallayout>
46271 <para>
46272 If the expansion is forced to fail, authentication fails. Any other expansion
46273 failure causes a temporary error code to be returned.
46274 </para>
46275 </section>
46276 <section id="SECID180">
46277 <title>Using spa as a client</title>
46278 <para>
46279 <indexterm role="concept">
46280 <primary>options</primary>
46281 <secondary><command>spa</command> authenticator (client)</secondary>
46282 </indexterm>
46283 The <command>spa</command> authenticator has the following client options:
46284 </para>
46285 <para>
46286 <indexterm role="option">
46287 <primary><option>client_domain</option></primary>
46288 </indexterm>
46289 </para>
46290 <informaltable frame="all">
46291 <tgroup cols="4" colsep="0" rowsep="0">
46292 <colspec colwidth="8*" align="left"/>
46293 <colspec colwidth="6*" align="center"/>
46294 <colspec colwidth="6*" align="center"/>
46295 <colspec colwidth="6*" align="right"/>
46296 <tbody>
46297 <row>
46298 <entry><option>client_domain</option></entry>
46299 <entry>Use: <emphasis>spa</emphasis></entry>
46300 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46301 <entry>Default: <emphasis>unset</emphasis></entry>
46302 </row>
46303 </tbody>
46304 </tgroup>
46305 </informaltable>
46306 <para>
46307 This option specifies an optional domain for the authentication.
46308 </para>
46309 <para>
46310 <indexterm role="option">
46311 <primary><option>client_password</option></primary>
46312 </indexterm>
46313 </para>
46314 <informaltable frame="all">
46315 <tgroup cols="4" colsep="0" rowsep="0">
46316 <colspec colwidth="8*" align="left"/>
46317 <colspec colwidth="6*" align="center"/>
46318 <colspec colwidth="6*" align="center"/>
46319 <colspec colwidth="6*" align="right"/>
46320 <tbody>
46321 <row>
46322 <entry><option>client_password</option></entry>
46323 <entry>Use: <emphasis>spa</emphasis></entry>
46324 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46325 <entry>Default: <emphasis>unset</emphasis></entry>
46326 </row>
46327 </tbody>
46328 </tgroup>
46329 </informaltable>
46330 <para>
46331 This option specifies the user&#x2019;s password, and must be set.
46332 </para>
46333 <para>
46334 <indexterm role="option">
46335 <primary><option>client_username</option></primary>
46336 </indexterm>
46337 </para>
46338 <informaltable frame="all">
46339 <tgroup cols="4" colsep="0" rowsep="0">
46340 <colspec colwidth="8*" align="left"/>
46341 <colspec colwidth="6*" align="center"/>
46342 <colspec colwidth="6*" align="center"/>
46343 <colspec colwidth="6*" align="right"/>
46344 <tbody>
46345 <row>
46346 <entry><option>client_username</option></entry>
46347 <entry>Use: <emphasis>spa</emphasis></entry>
46348 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46349 <entry>Default: <emphasis>unset</emphasis></entry>
46350 </row>
46351 </tbody>
46352 </tgroup>
46353 </informaltable>
46354 <para>
46355 This option specifies the user name, and must be set. Here is an example of a
46356 configuration of this authenticator for use with the mail servers at
46357 <emphasis>msn.com</emphasis>:
46358 </para>
46359 <literallayout class="monospaced">
46360 msn:
46361   driver = spa
46362   public_name = MSN
46363   client_username = msn/msn_username
46364   client_password = msn_plaintext_password
46365   client_domain = DOMAIN_OR_UNSET
46366 </literallayout>
46367 <para>
46368 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
46369 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
46370 </para>
46371 </section>
46372 </chapter>
46373
46374 <chapter id="CHAPTLS">
46375 <title>Encrypted SMTP connections using TLS/SSL</title>
46376 <titleabbrev>Encrypted SMTP connections</titleabbrev>
46377 <para>
46378 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
46379 <primary>encryption</primary>
46380 <secondary>on SMTP connection</secondary>
46381 </indexterm>
46382 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
46383 <primary>SMTP</primary>
46384 <secondary>encryption</secondary>
46385 </indexterm>
46386 <indexterm role="concept">
46387 <primary>TLS</primary>
46388 <secondary>on SMTP connection</secondary>
46389 </indexterm>
46390 <indexterm role="concept">
46391 <primary>OpenSSL</primary>
46392 </indexterm>
46393 <indexterm role="concept">
46394 <primary>GnuTLS</primary>
46395 </indexterm>
46396 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
46397 Sockets Layer), is implemented by making use of the OpenSSL library or the
46398 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
46399 cryptographic code in the Exim distribution itself for implementing TLS. In
46400 order to use this feature you must install OpenSSL or GnuTLS, and then build a
46401 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
46402 You also need to understand the basic concepts of encryption at a managerial
46403 level, and in particular, the way that public keys, private keys, and
46404 certificates are used.
46405 </para>
46406 <para>
46407 RFC 3207 defines how SMTP connections can make use of encryption. Once a
46408 connection is established, the client issues a STARTTLS command. If the
46409 server accepts this, the client and the server negotiate an encryption
46410 mechanism. If the negotiation succeeds, the data that subsequently passes
46411 between them is encrypted.
46412 </para>
46413 <para>
46414 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
46415 and if so, what cipher suite is in use, whether the client supplied a
46416 certificate, and whether or not that certificate was verified. This makes it
46417 possible for an Exim server to deny or accept certain commands based on the
46418 encryption state.
46419 </para>
46420 <para>
46421 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
46422 disrupt TLS connections. You need to turn off SMTP scanning for these products
46423 in order to get TLS to work.
46424 </para>
46425 <section id="SECID284">
46426 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
46427 <para>
46428 <indexterm role="concept">
46429 <primary>ssmtp protocol</primary>
46430 </indexterm>
46431 <indexterm role="concept">
46432 <primary>smtps protocol</primary>
46433 </indexterm>
46434 <indexterm role="concept">
46435 <primary>SMTP</primary>
46436 <secondary>ssmtp protocol</secondary>
46437 </indexterm>
46438 <indexterm role="concept">
46439 <primary>SMTP</primary>
46440 <secondary>smtps protocol</secondary>
46441 </indexterm>
46442 Early implementations of encrypted SMTP used a different TCP port from normal
46443 SMTP, and expected an encryption negotiation to start immediately, instead of
46444 waiting for a STARTTLS command from the client using the standard SMTP
46445 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
46446 allocated for this purpose.
46447 </para>
46448 <para>
46449 This approach was abandoned when encrypted SMTP was standardized, but there are
46450 still some legacy clients that use it. Exim supports these clients by means of
46451 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
46452 numbers; the most common use is expected to be:
46453 </para>
46454 <literallayout class="monospaced">
46455 tls_on_connect_ports = 465
46456 </literallayout>
46457 <para>
46458 The port numbers specified by this option apply to all SMTP connections, both
46459 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
46460 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
46461 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
46462 an extra port &ndash; rather, it specifies different behaviour on a port that is
46463 defined elsewhere.
46464 </para>
46465 <para>
46466 There is also a <option>-tls-on-connect</option> command line option. This overrides
46467 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
46468 </para>
46469 </section>
46470 <section id="SECTopenvsgnu">
46471 <title>OpenSSL vs GnuTLS</title>
46472 <para>
46473 <indexterm role="concept">
46474 <primary>TLS</primary>
46475 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
46476 </indexterm>
46477 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
46478 followed later, when the first versions of GnuTLS were released. To build Exim
46479 to use GnuTLS, you need to set
46480 </para>
46481 <literallayout class="monospaced">
46482 USE_GNUTLS=yes
46483 </literallayout>
46484 <para>
46485 in Local/Makefile, in addition to
46486 </para>
46487 <literallayout class="monospaced">
46488 SUPPORT_TLS=yes
46489 </literallayout>
46490 <para>
46491 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
46492 include files and libraries for GnuTLS can be found.
46493 </para>
46494 <para>
46495 There are some differences in usage when using GnuTLS instead of OpenSSL:
46496 </para>
46497 <itemizedlist>
46498 <listitem>
46499 <para>
46500 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
46501 name of a directory (for OpenSSL it can be either).
46502 </para>
46503 </listitem>
46504 <listitem>
46505 <para>
46506 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
46507 facility for varying its Diffie-Hellman parameters. I understand that this has
46508 changed, but Exim has not been updated to provide this facility.
46509 </para>
46510 </listitem>
46511 <listitem>
46512 <para>
46513 <indexterm role="variable">
46514 <primary><varname>$tls_peerdn</varname></primary>
46515 </indexterm>
46516 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
46517 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
46518 affects the value of the <varname>$tls_peerdn</varname> variable.
46519 </para>
46520 </listitem>
46521 <listitem>
46522 <para>
46523 OpenSSL identifies cipher suites using hyphens as separators, for example:
46524 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
46525 more, OpenSSL complains if underscores are present in a cipher list. To make
46526 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
46527 underscores for GnuTLS when processing lists of cipher suites in the
46528 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
46529 option).
46530 </para>
46531 </listitem>
46532 <listitem>
46533 <para>
46534 The <option>tls_require_ciphers</option> options operate differently, as described in the
46535 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
46536 </para>
46537 </listitem>
46538 </itemizedlist>
46539 </section>
46540 <section id="SECID181">
46541 <title>GnuTLS parameter computation</title>
46542 <para>
46543 GnuTLS uses RSA and D-H parameters that may take a substantial amount of time
46544 to compute. It is unreasonable to re-compute them for every TLS session.
46545 Therefore, Exim keeps this data in a file in its spool directory, called
46546 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
46547 its owner. Every Exim process that start up GnuTLS reads the RSA and D-H
46548 parameters from this file. If the file does not exist, the first Exim process
46549 that needs it computes the data and writes it to a temporary file which is
46550 renamed once it is complete. It does not matter if several Exim processes do
46551 this simultaneously (apart from wasting a few resources). Once a file is in
46552 place, new Exim processes immediately start using it.
46553 </para>
46554 <para>
46555 For maximum security, the parameters that are stored in this file should be
46556 recalculated periodically, the frequency depending on your paranoia level.
46557 Arranging this is easy in principle; just delete the file when you want new
46558 values to be computed. However, there may be a problem. The calculation of new
46559 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
46560 If the system is not very active, <filename>/dev/random</filename> may delay returning data
46561 until enough randomness (entropy) is available. This may cause Exim to hang for
46562 a substantial amount of time, causing timeouts on incoming connections.
46563 </para>
46564 <para>
46565 The solution is to generate the parameters externally to Exim. They are stored
46566 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
46567 externally using the <command>certtool</command> command that is part of GnuTLS.
46568 </para>
46569 <para>
46570 To replace the parameters with new ones, instead of deleting the file
46571 and letting Exim re-create it, you can generate new parameters using
46572 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
46573 renaming. The relevant commands are something like this:
46574 </para>
46575 <literallayout class="monospaced">
46576 # rm -f new-params
46577 # touch new-params
46578 # chown exim:exim new-params
46579 # chmod 0400 new-params
46580 # certtool --generate-privkey --bits 512 &gt;new-params
46581 # echo "" &gt;&gt;new-params
46582 # certtool --generate-dh-params --bits 1024 &gt;&gt; new-params
46583 # mv new-params gnutls-params
46584 </literallayout>
46585 <para>
46586 If Exim never has to generate the parameters itself, the possibility of
46587 stalling is removed.
46588 </para>
46589 </section>
46590 <section id="SECTreqciphssl">
46591 <title>Requiring specific ciphers in OpenSSL</title>
46592 <para>
46593 <indexterm role="concept">
46594 <primary>TLS</primary>
46595 <secondary>requiring specific ciphers (OpenSSL)</secondary>
46596 </indexterm>
46597 <indexterm role="option">
46598 <primary><option>tls_require_ciphers</option></primary>
46599 <secondary>OpenSSL</secondary>
46600 </indexterm>
46601 There is a function in the OpenSSL library that can be passed a list of cipher
46602 suites before the cipher negotiation takes place. This specifies which ciphers
46603 are acceptable. The list is colon separated and may contain names like
46604 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
46605 directly to this function call. The following quotation from the OpenSSL
46606 documentation specifies what forms of item are allowed in the cipher string:
46607 </para>
46608 <itemizedlist>
46609 <listitem>
46610 <para>
46611 It can consist of a single cipher suite such as RC4-SHA.
46612 </para>
46613 </listitem>
46614 <listitem>
46615 <para>
46616 It can represent a list of cipher suites containing a certain algorithm,
46617 or cipher suites of a certain type. For example SHA1 represents all
46618 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
46619 SSL v3 algorithms.
46620 </para>
46621 </listitem>
46622 <listitem>
46623 <para>
46624 Lists of cipher suites can be combined in a single cipher string using
46625 the + character. This is used as a logical and operation. For example
46626 SHA1+DES represents all cipher suites containing the SHA1 and the DES
46627 algorithms.
46628 </para>
46629 </listitem>
46630 </itemizedlist>
46631 <para>
46632 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
46633 <literal>-</literal> or <literal>+</literal>.
46634 </para>
46635 <itemizedlist>
46636 <listitem>
46637 <para>
46638 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
46639 ciphers deleted can never reappear in the list even if they are explicitly
46640 stated.
46641 </para>
46642 </listitem>
46643 <listitem>
46644 <para>
46645 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
46646 of the ciphers can be added again by later options.
46647 </para>
46648 </listitem>
46649 <listitem>
46650 <para>
46651 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
46652 option does not add any new ciphers; it just moves matching existing ones.
46653 </para>
46654 </listitem>
46655 </itemizedlist>
46656 <para>
46657 If none of these characters is present, the string is interpreted as
46658 a list of ciphers to be appended to the current preference list. If the list
46659 includes any ciphers already present they will be ignored: that is, they will
46660 not be moved to the end of the list.
46661 </para>
46662 </section>
46663 <section id="SECTreqciphgnu">
46664 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
46665 <para>
46666 <indexterm role="concept">
46667 <primary>GnuTLS</primary>
46668 <secondary>specifying parameters for</secondary>
46669 </indexterm>
46670 <indexterm role="concept">
46671 <primary>TLS</primary>
46672 <secondary>specifying ciphers (GnuTLS)</secondary>
46673 </indexterm>
46674 <indexterm role="concept">
46675 <primary>TLS</primary>
46676 <secondary>specifying key exchange methods (GnuTLS)</secondary>
46677 </indexterm>
46678 <indexterm role="concept">
46679 <primary>TLS</primary>
46680 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
46681 </indexterm>
46682 <indexterm role="concept">
46683 <primary>TLS</primary>
46684 <secondary>specifying protocols (GnuTLS)</secondary>
46685 </indexterm>
46686 <indexterm role="option">
46687 <primary><option>tls_require_ciphers</option></primary>
46688 <secondary>GnuTLS</secondary>
46689 </indexterm>
46690 The GnuTLS library allows the caller to specify separate lists of permitted key
46691 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
46692 Unfortunately, these lists are numerical, and the library does not have a
46693 function for turning names into numbers. Consequently, lists of recognized
46694 names have to be built into the application. The permitted key exchange
46695 methods, ciphers, and MAC algorithms may be used in any combination to form a
46696 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
46697 passed to its control function.
46698 </para>
46699 <para>
46700 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
46701 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
46702 option controls only the cipher algorithms. Exim searches each item in the
46703 list for the name of an available algorithm. For example, if the list
46704 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
46705 the same as if just AES were given.
46706 </para>
46707 <para>
46708 <indexterm role="option">
46709 <primary><option>gnutls_require_kx</option></primary>
46710 </indexterm>
46711 <indexterm role="option">
46712 <primary><option>gnutls_require_mac</option></primary>
46713 </indexterm>
46714 <indexterm role="option">
46715 <primary><option>gnutls_require_protocols</option></primary>
46716 </indexterm>
46717 There are additional options called <option>gnutls_require_kx</option>,
46718 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
46719 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
46720 These options are ignored if OpenSSL is in use.
46721 </para>
46722 <para>
46723 All four options are available as global options, controlling how Exim
46724 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
46725 how Exim behaves as a client. All the values are string expanded. After
46726 expansion, the values must be colon-separated lists, though the separator
46727 can be changed in the usual way.
46728 </para>
46729 <para>
46730 Each of the four lists starts out with a default set of algorithms. If the
46731 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
46732 default items are deleted. In this case, only those that are explicitly
46733 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
46734 exclamation mark, the defaults are left on the list.
46735 </para>
46736 <para>
46737 Then, any item that starts with an exclamation mark causes the relevant
46738 entry to be removed from the list, and any item that does not start with an
46739 exclamation mark causes a new entry to be added to the list. Unrecognized
46740 items in the list are ignored. Thus:
46741 </para>
46742 <literallayout class="monospaced">
46743 tls_require_ciphers = !ARCFOUR
46744 </literallayout>
46745 <para>
46746 allows all the defaults except ARCFOUR, whereas
46747 </para>
46748 <literallayout class="monospaced">
46749 tls_require_ciphers = AES : 3DES
46750 </literallayout>
46751 <para>
46752 allows only cipher suites that use AES or 3DES.
46753 </para>
46754 <para>
46755 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
46756 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
46757 the preceding). The default list does not contain all of these; it just has
46758 AES_256, AES_128, 3DES, and ARCFOUR_128.
46759 </para>
46760 <para>
46761 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
46762 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
46763 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
46764 </para>
46765 <para>
46766 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
46767 MD5. The default list contains SHA, MD5.
46768 </para>
46769 <para>
46770 For <option>gnutls_require_protocols</option>, the recognized names are TLS1 and SSL3.
46771 The default list contains TLS1, SSL3.
46772 </para>
46773 <para>
46774 In a server, the order of items in these lists is unimportant. The server
46775 advertises the availability of all the relevant cipher suites. However, in a
46776 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
46777 order for the cipher algorithms. The first one in the client&#x2019;s list that is
46778 also advertised by the server is tried first. The default order is as listed
46779 above.
46780 </para>
46781 </section>
46782 <section id="SECID182">
46783 <title>Configuring an Exim server to use TLS</title>
46784 <para>
46785 <indexterm role="concept">
46786 <primary>TLS</primary>
46787 <secondary>configuring an Exim server</secondary>
46788 </indexterm>
46789 When Exim has been built with TLS support, it advertises the availability of
46790 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
46791 but not to any others. The default value of this option is unset, which means
46792 that STARTTLS is not advertised at all. This default is chosen because you
46793 need to set some other options in order to make TLS available, and also it is
46794 sensible for systems that want to use TLS only as a client.
46795 </para>
46796 <para>
46797 If a client issues a STARTTLS command and there is some configuration
46798 problem in the server, the command is rejected with a 454 error. If the client
46799 persists in trying to issue SMTP commands, all except QUIT are rejected
46800 with the error
46801 </para>
46802 <literallayout class="monospaced">
46803 554 Security failure
46804 </literallayout>
46805 <para>
46806 If a STARTTLS command is issued within an existing TLS session, it is
46807 rejected with a 554 error code.
46808 </para>
46809 <para>
46810 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
46811 match some hosts. You can, of course, set it to * to match all hosts.
46812 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
46813 without some further configuration at the server end.
46814 </para>
46815 <para>
46816 It is rumoured that all existing clients that support TLS/SSL use RSA
46817 encryption. To make this work you need to set, in the server,
46818 </para>
46819 <literallayout class="monospaced">
46820 tls_certificate = /some/file/name
46821 tls_privatekey = /some/file/name
46822 </literallayout>
46823 <para>
46824 These options are, in fact, expanded strings, so you can make them depend on
46825 the identity of the client that is connected if you wish. The first file
46826 contains the server&#x2019;s X509 certificate, and the second contains the private key
46827 that goes with it. These files need to be readable by the Exim user, and must
46828 always be given as full path names. They can be the same file if both the
46829 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
46830 set, or if its expansion is forced to fail or results in an empty string, this
46831 is assumed to be the case. The certificate file may also contain intermediate
46832 certificates that need to be sent to the client to enable it to authenticate
46833 the server&#x2019;s certificate.
46834 </para>
46835 <para>
46836 If you do not understand about certificates and keys, please try to find a
46837 source of this background information, which is not Exim-specific. (There are a
46838 few comments below in section <xref linkend="SECTcerandall"/>.)
46839 </para>
46840 <para>
46841 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
46842 they apply only in the case of a server. If you need to use a certificate in an
46843 Exim client, you must set the options of the same names in an <command>smtp</command>
46844 transport.
46845 </para>
46846 <para>
46847 With just these options, an Exim server will be able to use TLS. It does not
46848 require the client to have a certificate (but see below for how to insist on
46849 this). There is one other option that may be needed in other situations. If
46850 </para>
46851 <literallayout class="monospaced">
46852 tls_dhparam = /some/file/name
46853 </literallayout>
46854 <para>
46855 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
46856 with the parameters contained in the file. This increases the set of cipher
46857 suites that the server supports. See the command
46858 </para>
46859 <literallayout class="monospaced">
46860 openssl dhparam
46861 </literallayout>
46862 <para>
46863 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
46864 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
46865 </para>
46866 <para>
46867 The strings supplied for these three options are expanded every time a client
46868 host connects. It is therefore possible to use different certificates and keys
46869 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
46870 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
46871 forced to fail, Exim behaves as if the option is not set.
46872 </para>
46873 <para>
46874 <indexterm role="concept">
46875 <primary>cipher</primary>
46876 <secondary>logging</secondary>
46877 </indexterm>
46878 <indexterm role="concept">
46879 <primary>log</primary>
46880 <secondary>TLS cipher</secondary>
46881 </indexterm>
46882 <indexterm role="variable">
46883 <primary><varname>$tls_cipher</varname></primary>
46884 </indexterm>
46885 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
46886 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
46887 incoming message (by default &ndash; you can, of course, change this), and it is
46888 also included in the log line that records a message&#x2019;s arrival, keyed by
46889 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
46890 condition can be used to test for specific cipher suites in ACLs.
46891 <phrase revisionflag="changed">(For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset &ndash; see section
46892 <xref linkend="SECID185"/>.)</phrase>
46893 </para>
46894 <para revisionflag="changed">
46895 Once TLS has been established, the ACLs that run for subsequent SMTP commands
46896 can check the name of the cipher suite and vary their actions accordingly. The
46897 cipher suite names vary, depending on which TLS library is being used. For
46898 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
46899 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
46900 documentation for more details.
46901 </para>
46902 </section>
46903 <section id="SECID183">
46904 <title>Requesting and verifying client certificates</title>
46905 <para>
46906 <indexterm role="concept">
46907 <primary>certificate</primary>
46908 <secondary>verification of client</secondary>
46909 </indexterm>
46910 <indexterm role="concept">
46911 <primary>TLS</primary>
46912 <secondary>client certificate verification</secondary>
46913 </indexterm>
46914 If you want an Exim server to request a certificate when negotiating a TLS
46915 session with a client, you must set either <option>tls_verify_hosts</option> or
46916 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
46917 apply to all TLS connections. For any host that matches one of these options,
46918 Exim requests a certificate as part of the setup of the TLS session. The
46919 contents of the certificate are verified by comparing it with a list of
46920 expected certificates. These must be available in a file or,
46921 for OpenSSL only (not GnuTLS), a directory, identified by
46922 <option>tls_verify_certificates</option>.
46923 </para>
46924 <para>
46925 A file can contain multiple certificates, concatenated end to end. If a
46926 directory is used
46927 (OpenSSL only),
46928 each certificate must be in a separate file, with a name (or a symbolic link)
46929 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
46930 certificate. You can compute the relevant hash by running the command
46931 </para>
46932 <literallayout class="monospaced">
46933 openssl x509 -hash -noout -in /cert/file
46934 </literallayout>
46935 <para>
46936 where <filename>/cert/file</filename> contains a single certificate.
46937 </para>
46938 <para>
46939 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
46940 what happens if the client does not supply a certificate, or if the certificate
46941 does not match any of the certificates in the collection named by
46942 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
46943 attempt to set up a TLS session is aborted, and the incoming connection is
46944 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
46945 session continues. ACLs that run for subsequent SMTP commands can detect the
46946 fact that no certificate was verified, and vary their actions accordingly. For
46947 example, you can insist on a certificate before accepting a message for
46948 relaying, but not when the message is destined for local delivery.
46949 </para>
46950 <para>
46951 <indexterm role="variable">
46952 <primary><varname>$tls_peerdn</varname></primary>
46953 </indexterm>
46954 When a client supplies a certificate (whether it verifies or not), the value of
46955 the Distinguished Name of the certificate is made available in the variable
46956 <varname>$tls_peerdn</varname> during subsequent processing of the message.
46957 </para>
46958 <para>
46959 <indexterm role="concept">
46960 <primary>log</primary>
46961 <secondary>distinguished name</secondary>
46962 </indexterm>
46963 Because it is often a long text string, it is not included in the log line or
46964 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
46965 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
46966 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
46967 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
46968 </para>
46969 </section>
46970 <section id="SECID184">
46971 <title>Revoked certificates</title>
46972 <para>
46973 <indexterm role="concept">
46974 <primary>TLS</primary>
46975 <secondary>revoked certificates</secondary>
46976 </indexterm>
46977 <indexterm role="concept">
46978 <primary>revocation list</primary>
46979 </indexterm>
46980 <indexterm role="concept">
46981 <primary>certificate</primary>
46982 <secondary>revocation list</secondary>
46983 </indexterm>
46984 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
46985 certificates are revoked. If you have such a list, you can pass it to an Exim
46986 server using the global option called <option>tls_crl</option> and to an Exim client using
46987 an identically named option for the <command>smtp</command> transport. In each case, the value
46988 of the option is expanded and must then be the name of a file that contains a
46989 CRL in PEM format.
46990 </para>
46991 </section>
46992 <section id="SECID185">
46993 <title>Configuring an Exim client to use TLS</title>
46994 <para>
46995 <indexterm role="concept">
46996 <primary>cipher</primary>
46997 <secondary>logging</secondary>
46998 </indexterm>
46999 <indexterm role="concept">
47000 <primary>log</primary>
47001 <secondary>TLS cipher</secondary>
47002 </indexterm>
47003 <indexterm role="concept">
47004 <primary>log</primary>
47005 <secondary>distinguished name</secondary>
47006 </indexterm>
47007 <indexterm role="concept">
47008 <primary>TLS</primary>
47009 <secondary>configuring an Exim client</secondary>
47010 </indexterm>
47011 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
47012 deliveries as well as to incoming, the latter one causing logging of the
47013 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
47014 within the <command>smtp</command> transport.
47015 </para>
47016 <para>
47017 It is not necessary to set any options to have TLS work in the <command>smtp</command>
47018 transport. If Exim is built with TLS support, and TLS is advertised by a
47019 server, the <command>smtp</command> transport always tries to start a TLS session. However,
47020 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
47021 transport) to a list of server hosts for which TLS should not be used.
47022 </para>
47023 <para>
47024 If you do not want Exim to attempt to send messages unencrypted when an attempt
47025 to set up an encrypted connection fails in any way, you can set
47026 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
47027 those hosts, delivery is always deferred if an encrypted connection cannot be
47028 set up. If there are any other hosts for the address, they are tried in the
47029 usual way.
47030 </para>
47031 <para>
47032 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
47033 the message unencrypted. It always does this if the response to STARTTLS is
47034 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
47035 session after a success response code, what happens is controlled by the
47036 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
47037 delivery to this host is deferred, and other hosts (if available) are tried. If
47038 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
47039 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
47040 negotiation fails, Exim closes the current connection (because it is in an
47041 unknown state), opens a new one to the same host, and then tries the delivery
47042 unencrypted.
47043 </para>
47044 <para>
47045 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
47046 transport provide the client with a certificate, which is passed to the server
47047 if it requests it. If the server is Exim, it will request a certificate only if
47048 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client. <emphasis role="bold">Note</emphasis>:
47049 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
47050 is operating as a client. Exim does not assume that a server certificate (set
47051 by the global options of the same name) should also be used when operating as a
47052 client.
47053 </para>
47054 <para>
47055 If <option>tls_verify_certificates</option> is set, it must name a file or,
47056 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
47057 expected server certificates. The client verifies the server&#x2019;s certificate
47058 against this collection, taking into account any revoked certificates that are
47059 in the list defined by <option>tls_crl</option>.
47060 </para>
47061 <para>
47062 If
47063 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
47064 list of permitted cipher suites. If either of these checks fails, delivery to
47065 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
47066 alternative hosts, if any.
47067 </para>
47068 <para>
47069 <indexterm role="variable">
47070 <primary><varname>$host</varname></primary>
47071 </indexterm>
47072 <indexterm role="variable">
47073 <primary><varname>$host_address</varname></primary>
47074 </indexterm>
47075 All the TLS options in the <command>smtp</command> transport are expanded before use, with
47076 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
47077 which the client is connected. Forced failure of an expansion causes Exim to
47078 behave as if the relevant option were unset.
47079 </para>
47080 <para revisionflag="changed">
47081 <indexterm role="variable">
47082 <primary><varname>$tls_cipher</varname></primary>
47083 </indexterm>
47084 <indexterm role="variable">
47085 <primary><varname>$tls_peerdn</varname></primary>
47086 </indexterm>
47087 Before an SMTP connection is established, the <varname>$tls_cipher</varname> and <varname>$tls_peerdn</varname>
47088 variables are emptied. (Until the first connection, they contain the values
47089 that were set when the message was received.) If STARTTLS is subsequently
47090 successfully obeyed, these variables are set to the relevant values for the
47091 outgoing connection.
47092 </para>
47093 </section>
47094 <section id="SECTmulmessam">
47095 <title>Multiple messages on the same encrypted TCP/IP connection</title>
47096 <para>
47097 <indexterm role="concept">
47098 <primary>multiple SMTP deliveries with TLS</primary>
47099 </indexterm>
47100 <indexterm role="concept">
47101 <primary>TLS</primary>
47102 <secondary>multiple message deliveries</secondary>
47103 </indexterm>
47104 Exim sends multiple messages down the same TCP/IP connection by starting up
47105 an entirely new delivery process for each message, passing the socket from
47106 one process to the next. This implementation does not fit well with the use
47107 of TLS, because there is quite a lot of state information associated with a TLS
47108 connection, not just a socket identification. Passing all the state information
47109 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
47110 session before passing the socket to a new process. The new process may then
47111 try to start a new TLS session, and if successful, may try to re-authenticate
47112 if AUTH is in use, before sending the next message.
47113 </para>
47114 <para>
47115 The RFC is not clear as to whether or not an SMTP session continues in clear
47116 after TLS has been shut down, or whether TLS may be restarted again later, as
47117 just described. However, if the server is Exim, this shutdown and
47118 reinitialization works. It is not known which (if any) other servers operate
47119 successfully if the client closes a TLS session and continues with unencrypted
47120 SMTP, but there are certainly some that do not work. For such servers, Exim
47121 should not pass the socket to another process, because the failure of the
47122 subsequent attempt to use it would cause Exim to record a temporary host error,
47123 and delay other deliveries to that host.
47124 </para>
47125 <para>
47126 To test for this case, Exim sends an EHLO command to the server after
47127 closing down the TLS session. If this fails in any way, the connection is
47128 closed instead of being passed to a new delivery process, but no retry
47129 information is recorded.
47130 </para>
47131 <para>
47132 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
47133 <command>smtp</command> transport to match those hosts for which Exim should not pass
47134 connections to new processes if TLS has been used.
47135 </para>
47136 </section>
47137 <section id="SECTcerandall">
47138 <title>Certificates and all that</title>
47139 <para>
47140 <indexterm role="concept">
47141 <primary>certificate</primary>
47142 <secondary>references to discussion</secondary>
47143 </indexterm>
47144 In order to understand fully how TLS works, you need to know about
47145 certificates, certificate signing, and certificate authorities. This is not the
47146 place to give a tutorial, especially as I do not know very much about it
47147 myself. Some helpful introduction can be found in the FAQ for the SSL addition
47148 to Apache, currently at
47149 </para>
47150 <literallayout>
47151 <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>
47152 </literallayout>
47153 <para>
47154 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
47155 links to further files.
47156 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
47157 0-201-61598-3), contains both introductory and more in-depth descriptions.
47158 Some sample programs taken from the book are available from
47159 </para>
47160 <literallayout>
47161 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
47162 </literallayout>
47163 </section>
47164 <section id="SECID186">
47165 <title>Certificate chains</title>
47166 <para>
47167 The file named by <option>tls_certificate</option> may contain more than one
47168 certificate. This is useful in the case where the certificate that is being
47169 sent is validated by an intermediate certificate which the other end does
47170 not have. Multiple certificates must be in the correct order in the file.
47171 First the host&#x2019;s certificate itself, then the first intermediate
47172 certificate to validate the issuer of the host certificate, then the next
47173 intermediate certificate to validate the issuer of the first intermediate
47174 certificate, and so on, until finally (optionally) the root certificate.
47175 The root certificate must already be trusted by the recipient for
47176 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
47177 root certificate along with the rest makes it available for the user to
47178 install if the receiving end is a client MUA that can interact with a user.
47179 </para>
47180 </section>
47181 <section id="SECID187">
47182 <title>Self-signed certificates</title>
47183 <para>
47184 <indexterm role="concept">
47185 <primary>certificate</primary>
47186 <secondary>self-signed</secondary>
47187 </indexterm>
47188 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
47189 with OpenSSL, like this:
47190 </para>
47191 <literallayout class="monospaced">
47192 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
47193             -days 9999 -nodes
47194 </literallayout>
47195 <para>
47196 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
47197 delimited and so can be identified independently. The <option>-days</option> option
47198 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
47199 important: if you do not set it, the key is encrypted with a passphrase
47200 that you are prompted for, and any use that is made of the key causes more
47201 prompting for the passphrase. This is not helpful if you are going to use
47202 this certificate and key in an MTA, where prompting is not possible.
47203 </para>
47204 <para>
47205 A self-signed certificate made in this way is sufficient for testing, and
47206 may be adequate for all your requirements if you are mainly interested in
47207 encrypting transfers, and not in secure identification.
47208 </para>
47209 <para>
47210 However, many clients require that the certificate presented by the server be a
47211 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
47212 certificate. In this situation, the self-signed certificate described above
47213 must be installed on the client host as a trusted root <emphasis>certification
47214 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
47215 signed with that self-signed certificate.
47216 </para>
47217 <para>
47218 For information on creating self-signed CA certificates and using them to sign
47219 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
47220 Open-source PKI book, available online at
47221 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
47222 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
47223 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
47224 </para>
47225 </section>
47226 </chapter>
47227
47228 <chapter id="CHAPACL">
47229 <title>Access control lists</title>
47230 <para>
47231 <indexterm role="concept" id="IIDacl" class="startofrange">
47232 <primary>access control lists (ACLs)</primary>
47233 <secondary>description</secondary>
47234 </indexterm>
47235 <indexterm role="concept">
47236 <primary>control of incoming mail</primary>
47237 </indexterm>
47238 <indexterm role="concept">
47239 <primary>message</primary>
47240 <secondary>controlling incoming</secondary>
47241 </indexterm>
47242 <indexterm role="concept">
47243 <primary>policy control</primary>
47244 <secondary>access control lists</secondary>
47245 </indexterm>
47246 Access Control Lists (ACLs) are defined in a separate section of the run time
47247 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
47248 name, terminated by a colon. Here is a complete ACL section that contains just
47249 one very small ACL:
47250 </para>
47251 <literallayout class="monospaced">
47252 begin acl
47253 small_acl:
47254   accept   hosts = one.host.only
47255 </literallayout>
47256 <para>
47257 You can have as many lists as you like in the ACL section, and the order in
47258 which they appear does not matter. The lists are self-terminating.
47259 </para>
47260 <para>
47261 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
47262 certain SMTP commands. This applies both to incoming TCP/IP connections, and
47263 when a local process submits a message using SMTP by specifying the <option>-bs</option>
47264 option. The most common use is for controlling which recipients are accepted
47265 in incoming messages. In addition, you can define an ACL that is used to check
47266 local non-SMTP messages. The default configuration file contains an example of
47267 a realistic ACL for checking RCPT commands. This is discussed in chapter
47268 <xref linkend="CHAPdefconfil"/>.
47269 </para>
47270 <section id="SECID188">
47271 <title>Testing ACLs</title>
47272 <para>
47273 The <option>-bh</option> command line option provides a way of testing your ACL
47274 configuration locally by running a fake SMTP session with which you interact.
47275 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
47276 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
47277 </para>
47278 </section>
47279 <section id="SECID189">
47280 <title>Specifying when ACLs are used</title>
47281 <para>
47282 <indexterm role="concept">
47283 <primary>access control lists (ACLs)</primary>
47284 <secondary>options for specifying</secondary>
47285 </indexterm>
47286 In order to cause an ACL to be used, you have to name it in one of the relevant
47287 options in the main part of the configuration. These options are:
47288 <indexterm role="concept">
47289 <primary>AUTH</primary>
47290 <secondary>ACL for</secondary>
47291 </indexterm>
47292 <indexterm role="concept">
47293 <primary>DATA</primary>
47294 <secondary>ACLs for</secondary>
47295 </indexterm>
47296 <indexterm role="concept">
47297 <primary>ETRN</primary>
47298 <secondary>ACL for</secondary>
47299 </indexterm>
47300 <indexterm role="concept">
47301 <primary>EXPN</primary>
47302 <secondary>ACL for</secondary>
47303 </indexterm>
47304 <indexterm role="concept">
47305 <primary>HELO</primary>
47306 <secondary>ACL for</secondary>
47307 </indexterm>
47308 <indexterm role="concept">
47309 <primary>EHLO</primary>
47310 <secondary>ACL for</secondary>
47311 </indexterm>
47312 <indexterm role="concept">
47313 <primary>MAIL</primary>
47314 <secondary>ACL for</secondary>
47315 </indexterm>
47316 <indexterm role="concept">
47317 <primary>QUIT, ACL for</primary>
47318 </indexterm>
47319 <indexterm role="concept">
47320 <primary>RCPT</primary>
47321 <secondary>ACL for</secondary>
47322 </indexterm>
47323 <indexterm role="concept">
47324 <primary>STARTTLS, ACL for</primary>
47325 </indexterm>
47326 <indexterm role="concept">
47327 <primary>VRFY</primary>
47328 <secondary>ACL for</secondary>
47329 </indexterm>
47330 <indexterm role="concept">
47331 <primary>SMTP</primary>
47332 <secondary>connection, ACL for</secondary>
47333 </indexterm>
47334 <indexterm role="concept">
47335 <primary>non-SMTP messages</primary>
47336 <secondary>ACLs for</secondary>
47337 </indexterm>
47338 <indexterm role="concept">
47339 <primary>MIME content scanning</primary>
47340 <secondary>ACL for</secondary>
47341 </indexterm>
47342 </para>
47343 <informaltable frame="none">
47344 <tgroup cols="2" colsep="0" rowsep="0">
47345 <colspec colwidth="140pt" align="left"/>
47346 <colspec colwidth="254pt" align="left"/>
47347 <tbody>
47348 <row>
47349 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
47350 <entry>ACL for non-SMTP messages</entry>
47351 </row>
47352 <row>
47353 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
47354 <entry>ACL for non-SMTP MIME parts</entry>
47355 </row>
47356 <row>
47357 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
47358 <entry>ACL at start of non-SMTP message</entry>
47359 </row>
47360 <row>
47361 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
47362 <entry>ACL for AUTH</entry>
47363 </row>
47364 <row>
47365 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
47366 <entry>ACL for start of SMTP connection</entry>
47367 </row>
47368 <row>
47369 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
47370 <entry>ACL after DATA is complete</entry>
47371 </row>
47372 <row>
47373 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
47374 <entry>ACL for ETRN</entry>
47375 </row>
47376 <row>
47377 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
47378 <entry>ACL for EXPN</entry>
47379 </row>
47380 <row>
47381 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
47382 <entry>ACL for HELO or EHLO</entry>
47383 </row>
47384 <row>
47385 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
47386 <entry>ACL for MAIL</entry>
47387 </row>
47388 <row>
47389 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
47390 <entry>ACL for the AUTH parameter of MAIL</entry>
47391 </row>
47392 <row>
47393 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
47394 <entry>ACL for content-scanning MIME parts</entry>
47395 </row>
47396 <row>
47397 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<phrase revisionflag="changed"><option>acl_smtp_notquit</option></phrase></entry>
47398 <entry>ACL for non-QUIT terminations</entry>
47399 </row>
47400 <row>
47401 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
47402 <entry>ACL at start of DATA command</entry>
47403 </row>
47404 <row>
47405 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
47406 <entry>ACL for QUIT</entry>
47407 </row>
47408 <row>
47409 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
47410 <entry>ACL for RCPT</entry>
47411 </row>
47412 <row>
47413 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
47414 <entry>ACL for STARTTLS</entry>
47415 </row>
47416 <row>
47417 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
47418 <entry>ACL for VRFY</entry>
47419 </row>
47420 </tbody>
47421 </tgroup>
47422 </informaltable>
47423 <para>
47424 For example, if you set
47425 </para>
47426 <literallayout class="monospaced">
47427 acl_smtp_rcpt = small_acl
47428 </literallayout>
47429 <para>
47430 the little ACL defined above is used whenever Exim receives a RCPT command
47431 in an SMTP dialogue. The majority of policy tests on incoming messages can be
47432 done when RCPT commands arrive. A rejection of RCPT should cause the
47433 sending MTA to give up on the recipient address contained in the RCPT
47434 command, whereas rejection at other times may cause the client MTA to keep on
47435 trying to deliver the message. It is therefore recommended that you do as much
47436 testing as possible at RCPT time.
47437 </para>
47438 </section>
47439 <section id="SECID190">
47440 <title>The non-SMTP ACLs</title>
47441 <para>
47442 <indexterm role="concept">
47443 <primary>non-SMTP messages</primary>
47444 <secondary>ACLs for</secondary>
47445 </indexterm>
47446 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
47447 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
47448 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
47449 the state of the SMTP connection such as encryption and authentication) are not
47450 relevant and are forbidden in these ACLs. However, the sender and recipients
47451 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
47452 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
47453 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
47454 in any of these ACLs.
47455 </para>
47456 <para>
47457 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
47458 non-SMTP message, before any of the message has been read. (This is the
47459 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
47460 batched SMTP input, it runs after the DATA command has been reached. The
47461 result of this ACL is ignored; it cannot be used to reject a message. If you
47462 really need to, you could set a value in an ACL variable here and reject based
47463 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
47464 controls, and in particular, it can be used to set
47465 </para>
47466 <literallayout class="monospaced">
47467 control = suppress_local_fixups
47468 </literallayout>
47469 <para>
47470 This cannot be used in the other non-SMTP ACLs because by the time they are
47471 run, it is too late.
47472 </para>
47473 <para>
47474 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
47475 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47476 </para>
47477 <para>
47478 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
47479 kind of rejection is treated as permanent, because there is no way of sending a
47480 temporary error for these kinds of message.
47481 </para>
47482 </section>
47483 <section id="SECID191">
47484 <title>The SMTP connect ACL</title>
47485 <para>
47486 <indexterm role="concept">
47487 <primary>SMTP</primary>
47488 <secondary>connection, ACL for</secondary>
47489 </indexterm>
47490 <indexterm role="option">
47491 <primary><option>smtp_banner</option></primary>
47492 </indexterm>
47493 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
47494 session, after the test specified by <option>host_reject_connection</option> (which is now
47495 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
47496 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
47497 the message override the banner message that is otherwise specified by the
47498 <option>smtp_banner</option> option.
47499 </para>
47500 </section>
47501 <section id="SECID192">
47502 <title>The EHLO/HELO ACL</title>
47503 <para>
47504 <indexterm role="concept">
47505 <primary>EHLO</primary>
47506 <secondary>ACL for</secondary>
47507 </indexterm>
47508 <indexterm role="concept">
47509 <primary>HELO</primary>
47510 <secondary>ACL for</secondary>
47511 </indexterm>
47512 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
47513 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
47514 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
47515 Note that a client may issue more than one EHLO or HELO command in an SMTP
47516 session, and indeed is required to issue a new EHLO or HELO after successfully
47517 setting up encryption following a STARTTLS command.
47518 </para>
47519 <para>
47520 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
47521 modifier, the message may not contain more than one line (it will be truncated
47522 at the first newline and a panic logged if it does). Such a message cannot
47523 affect the EHLO options that are listed on the second and subsequent lines of
47524 an EHLO response.
47525 </para>
47526 </section>
47527 <section id="SECID193">
47528 <title>The DATA ACLs</title>
47529 <para>
47530 <indexterm role="concept">
47531 <primary>DATA</primary>
47532 <secondary>ACLs for</secondary>
47533 </indexterm>
47534 Two ACLs are associated with the DATA command, because it is two-stage
47535 command, with two responses being sent to the client.
47536 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
47537 is obeyed. This gives you control after all the RCPT commands, but before
47538 the message itself is received. It offers the opportunity to give a negative
47539 response to the DATA command before the data is transmitted. Header lines
47540 added by MAIL or RCPT ACLs are not visible at this time, but any that
47541 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
47542 </para>
47543 <para>
47544 You cannot test the contents of the message, for example, to verify addresses
47545 in the headers, at RCPT time or when the DATA command is received. Such
47546 tests have to appear in the ACL that is run after the message itself has been
47547 received, before the final response to the DATA command is sent. This is
47548 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
47549 associated with the DATA command.
47550 </para>
47551 <para>
47552 For both of these ACLs, it is not possible to reject individual recipients. An
47553 error response rejects the entire message. Unfortunately, it is known that some
47554 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
47555 before or after the data) correctly &ndash; they keep the message on their queues
47556 and try again later, but that is their problem, though it does waste some of
47557 your resources.
47558 </para>
47559 </section>
47560 <section id="SECID194">
47561 <title>The SMTP MIME ACL</title>
47562 <para>
47563 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
47564 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47565 </para>
47566 </section>
47567 <section id="SECTQUITACL">
47568 <title>The QUIT ACL</title>
47569 <para>
47570 <indexterm role="concept">
47571 <primary>QUIT, ACL for</primary>
47572 </indexterm>
47573 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
47574 does not affect the response code to QUIT, which is always 221. Thus, the ACL
47575 does not in fact control any access. For this reason, the only verbs that are
47576 permitted are <option>accept</option> and <option>warn</option>.
47577 </para>
47578 <para>
47579 This ACL can be used for tasks such as custom logging at the end of an SMTP
47580 session. For example, you can use ACL variables in other ACLs to count
47581 messages, recipients, etc., and log the totals at QUIT time using one or
47582 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
47583 </para>
47584 <para>
47585 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
47586 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
47587 </para>
47588 <para>
47589 You do not need to have a final <option>accept</option>, but if you do, you can use a
47590 <option>message</option> modifier to specify custom text that is sent as part of the 221
47591 response to QUIT.
47592 </para>
47593 <para>
47594 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
47595 failure (for example, failure to open a log file, or when Exim is bombing out
47596 because it has detected an unrecoverable error), all SMTP commands from the
47597 client are given temporary error responses until QUIT is received or the
47598 connection is closed. In these special cases, the QUIT ACL does not run.
47599 </para>
47600 </section>
47601 <section id="SECTNOTQUITACL" revisionflag="changed">
47602 <title>The not-QUIT ACL</title>
47603 <para revisionflag="changed">
47604 The not-QUIT ACL, specified by <option>smtp_notquit_acl</option>, is run in most cases when
47605 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
47606 trouble, such as being unable to write to its log files, this ACL is not run,
47607 because it might try to do things (such as write to log files) that make the
47608 situation even worse.
47609 </para>
47610 <para revisionflag="changed">
47611 Like the QUIT ACL, this ACL is provided to make it possible to do customized
47612 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
47613 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
47614 and <option>warn</option>.
47615 </para>
47616 <para revisionflag="changed">
47617 <indexterm role="variable">
47618 <primary><varname>$smtp_notquit_reason</varname></primary>
47619 </indexterm>
47620 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
47621 to a string that indicates the reason for the termination of the SMTP
47622 connection. The possible values are:
47623 </para>
47624 <informaltable frame="none" revisionflag="changed">
47625 <tgroup cols="2" colsep="0" rowsep="0">
47626 <colspec colwidth="196pt" align="left"/>
47627 <colspec colwidth="254pt" align="left"/>
47628 <tbody>
47629 <row>
47630 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
47631 <entry>Another ACL issued a <option>drop</option> command</entry>
47632 </row>
47633 <row>
47634 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
47635 <entry>Too many unknown or non-mail commands</entry>
47636 </row>
47637 <row>
47638 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
47639 <entry>Timeout while reading SMTP commands</entry>
47640 </row>
47641 <row>
47642 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
47643 <entry>The SMTP connection has been lost</entry>
47644 </row>
47645 <row>
47646 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
47647 <entry>Timeout while reading message data</entry>
47648 </row>
47649 <row>
47650 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
47651 <entry>The <function>local_scan()</function> function crashed</entry>
47652 </row>
47653 <row>
47654 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
47655 <entry>The <function>local_scan()</function> function timed out</entry>
47656 </row>
47657 <row>
47658 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
47659 <entry>SIGTERM or SIGINT</entry>
47660 </row>
47661 <row>
47662 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
47663 <entry>SMTP synchronization error</entry>
47664 </row>
47665 <row>
47666 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
47667 <entry>TLS failed to start</entry>
47668 </row>
47669 </tbody>
47670 </tgroup>
47671 </informaltable>
47672 <para revisionflag="changed">
47673 In most cases when an SMTP connection is closed without having received QUIT,
47674 Exim sends an SMTP response message before actually closing the connection.
47675 With the exception of the <literal>acl-drop</literal> case, the default message can be
47676 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
47677 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
47678 used.
47679 </para>
47680 </section>
47681 <section id="SECID195">
47682 <title>Finding an ACL to use</title>
47683 <para>
47684 <indexterm role="concept">
47685 <primary>access control lists (ACLs)</primary>
47686 <secondary>finding which to use</secondary>
47687 </indexterm>
47688 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
47689 you can use different ACLs in different circumstances. For example,
47690 </para>
47691 <literallayout class="monospaced">
47692 acl_smtp_rcpt = ${if ={25}{$interface_port} \
47693                      {acl_check_rcpt} {acl_check_rcpt_submit} }
47694 </literallayout>
47695 <para>
47696 In the default configuration file there are some example settings for
47697 providing an RFC 4409 message submission service on port 587 and a
47698 non-standard <quote>smtps</quote> service on port 465. You can use a string
47699 expansion like this to choose an ACL for MUAs on these ports which is
47700 more appropriate for this purpose than the default ACL on port 25.
47701 </para>
47702 <para>
47703 The expanded string does not have to be the name of an ACL in the
47704 configuration file; there are other possibilities. Having expanded the
47705 string, Exim searches for an ACL as follows:
47706 </para>
47707 <itemizedlist>
47708 <listitem>
47709 <para>
47710 If the string begins with a slash, Exim uses it as a file name, and reads its
47711 contents as an ACL. The lines are processed in the same way as lines in the
47712 Exim configuration file. In particular, continuation lines are supported, blank
47713 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
47714 If the file does not exist or cannot be read, an error occurs (typically
47715 causing a temporary failure of whatever caused the ACL to be run). For example:
47716 </para>
47717 <literallayout class="monospaced">
47718 acl_smtp_data = /etc/acls/\
47719   ${lookup{$sender_host_address}lsearch\
47720   {/etc/acllist}{$value}{default}}
47721 </literallayout>
47722 <para>
47723 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
47724 back to a default if the lookup fails. If an ACL is successfully read from a
47725 file, it is retained in memory for the duration of the Exim process, so that it
47726 can be re-used without having to re-read the file.
47727 </para>
47728 </listitem>
47729 <listitem>
47730 <para>
47731 If the string does not start with a slash, and does not contain any spaces,
47732 Exim searches the ACL section of the configuration for an ACL whose name
47733 matches the string.
47734 </para>
47735 </listitem>
47736 <listitem>
47737 <para>
47738 If no named ACL is found, or if the string contains spaces, Exim parses
47739 the string as an inline ACL. This can save typing in cases where you just
47740 want to have something like
47741 </para>
47742 <literallayout class="monospaced">
47743 acl_smtp_vrfy = accept
47744 </literallayout>
47745 <para>
47746 in order to allow free use of the VRFY command. Such a string may contain
47747 newlines; it is processed in the same way as an ACL that is read from a file.
47748 </para>
47749 </listitem>
47750 </itemizedlist>
47751 </section>
47752 <section id="SECID196">
47753 <title>ACL return codes</title>
47754 <para>
47755 <indexterm role="concept">
47756 <primary>access control lists (ACLs)</primary>
47757 <secondary>return codes</secondary>
47758 </indexterm>
47759 Except for the QUIT ACL, which does not affect the SMTP return code (see
47760 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
47761 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
47762 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
47763 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
47764 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
47765 This also causes a 4<emphasis>xx</emphasis> return code.
47766 </para>
47767 <para>
47768 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
47769 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
47770 submitters of non-SMTP messages.
47771 </para>
47772 <para>
47773 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
47774 has the effect of <quote>accept</quote>, but causes either the entire message or an
47775 individual recipient address to be discarded. In other words, it is a
47776 blackholing facility. Use it with care.
47777 </para>
47778 <para>
47779 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
47780 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
47781 RCPT ACL is to discard just the one recipient address. If there are no
47782 recipients left when the message&#x2019;s data is received, the DATA ACL is not
47783 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
47784 remaining recipients. The <quote>discard</quote> return is not permitted for the
47785 <option>acl_smtp_predata</option> ACL.
47786 </para>
47787 <para>
47788 <indexterm role="concept">
47789 <primary><function>local_scan()</function> function</primary>
47790 <secondary>when all recipients discarded</secondary>
47791 </indexterm>
47792 The <function>local_scan()</function> function is always run, even if there are no remaining
47793 recipients; it may create new recipients.
47794 </para>
47795 </section>
47796 <section id="SECID197">
47797 <title>Unset ACL options</title>
47798 <para>
47799 <indexterm role="concept">
47800 <primary>access control lists (ACLs)</primary>
47801 <secondary>unset options</secondary>
47802 </indexterm>
47803 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
47804 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
47805 not defined at all. For any defined ACL, the default action when control
47806 reaches the end of the ACL statements is <quote>deny</quote>.
47807 </para>
47808 <para>
47809 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
47810 these two are ACLs that are used only for their side effects. They cannot be
47811 used to accept or reject anything.
47812 </para>
47813 <para>
47814 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
47815 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
47816 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
47817 when the ACL is not defined is <quote>accept</quote>.
47818 </para>
47819 <para>
47820 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
47821 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
47822 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
47823 messages over an SMTP connection. For an example, see the ACL in the default
47824 configuration file.
47825 </para>
47826 </section>
47827 <section id="SECID198">
47828 <title>Data for message ACLs</title>
47829 <para>
47830 <indexterm role="concept">
47831 <primary>access control lists (ACLs)</primary>
47832 <secondary>data for message ACL</secondary>
47833 </indexterm>
47834 <indexterm role="variable">
47835 <primary><varname>$domain</varname></primary>
47836 </indexterm>
47837 <indexterm role="variable">
47838 <primary><varname>$local_part</varname></primary>
47839 </indexterm>
47840 <indexterm role="variable">
47841 <primary><varname>$sender_address</varname></primary>
47842 </indexterm>
47843 <indexterm role="variable">
47844 <primary><varname>$sender_host_address</varname></primary>
47845 </indexterm>
47846 <indexterm role="variable">
47847 <primary><varname>$smtp_command</varname></primary>
47848 </indexterm>
47849 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
47850 that contain information about the host and the message&#x2019;s sender (for example,
47851 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
47852 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
47853 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
47854 is available in <varname>$smtp_command</varname>.
47855 </para>
47856 <para>
47857 When an ACL for the AUTH parameter of MAIL is running, the variables that
47858 contain information about the host are set, but <varname>$sender_address</varname> is not yet
47859 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
47860 how it is used.
47861 </para>
47862 <para>
47863 <indexterm role="variable">
47864 <primary><varname>$message_size</varname></primary>
47865 </indexterm>
47866 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
47867 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
47868 that parameter is not given. The value is updated to the true message size by
47869 the time the final DATA ACL is run (after the message data has been
47870 received).
47871 </para>
47872 <para>
47873 <indexterm role="variable">
47874 <primary><varname>$rcpt_count</varname></primary>
47875 </indexterm>
47876 <indexterm role="variable">
47877 <primary><varname>$recipients_count</varname></primary>
47878 </indexterm>
47879 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
47880 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
47881 accepted, so while an ACL for RCPT is being processed, it contains the number
47882 of previously accepted recipients. At DATA time (for both the DATA ACLs),
47883 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
47884 <varname>$recipients_count</varname> contains the total number of accepted recipients.
47885 </para>
47886 </section>
47887 <section id="SECTdatfornon">
47888 <title>Data for non-message ACLs</title>
47889 <para>
47890 <indexterm role="concept">
47891 <primary>access control lists (ACLs)</primary>
47892 <secondary>data for non-message ACL</secondary>
47893 </indexterm>
47894 <indexterm role="variable">
47895 <primary><varname>$smtp_command_argument</varname></primary>
47896 </indexterm>
47897 <indexterm role="variable">
47898 <primary><varname>$smtp_command</varname></primary>
47899 </indexterm>
47900 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
47901 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
47902 and the entire SMTP command is available in <varname>$smtp_command</varname>.
47903 These variables can be tested using a <option>condition</option> condition. For example,
47904 here is an ACL for use with AUTH, which insists that either the session is
47905 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
47906 does not permit authentication methods that use cleartext passwords on
47907 unencrypted connections.
47908 </para>
47909 <literallayout class="monospaced">
47910 acl_check_auth:
47911   accept encrypted = *
47912   accept condition = ${if eq{${uc:$smtp_command_argument}}\
47913                      {CRAM-MD5}}
47914   deny   message   = TLS encryption or CRAM-MD5 required
47915 </literallayout>
47916 <para>
47917 (Another way of applying this restriction is to arrange for the authenticators
47918 that use cleartext passwords not to be advertised when the connection is not
47919 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
47920 option to do this.)
47921 </para>
47922 </section>
47923 <section id="SECID199">
47924 <title>Format of an ACL</title>
47925 <para>
47926 <indexterm role="concept">
47927 <primary>access control lists (ACLs)</primary>
47928 <secondary>format of</secondary>
47929 </indexterm>
47930 <indexterm role="concept">
47931 <primary>access control lists (ACLs)</primary>
47932 <secondary>verbs, definition of</secondary>
47933 </indexterm>
47934 An individual ACL consists of a number of statements. Each statement starts
47935 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
47936 Modifiers can change the way the verb operates, define error and log messages,
47937 set variables, insert delays, and vary the processing of accepted messages.
47938 </para>
47939 <para>
47940 If all the conditions are met, the verb is obeyed. The same condition may be
47941 used (with different arguments) more than once in the same statement. This
47942 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
47943 example:
47944 </para>
47945 <literallayout class="monospaced">
47946 deny  dnslists = list1.example
47947 dnslists = list2.example
47948 </literallayout>
47949 <para>
47950 If there are no conditions, the verb is always obeyed. Exim stops evaluating
47951 the conditions and modifiers when it reaches a condition that fails. What
47952 happens then depends on the verb (and in one case, on a special modifier). Not
47953 all the conditions make sense at every testing point. For example, you cannot
47954 test a sender address in the ACL that is run for a VRFY command.
47955 </para>
47956 </section>
47957 <section id="SECID200">
47958 <title>ACL verbs</title>
47959 <para>
47960 The ACL verbs are as follows:
47961 </para>
47962 <itemizedlist>
47963 <listitem>
47964 <para>
47965 <indexterm role="concept">
47966 <primary><option>accept</option> ACL verb</primary>
47967 </indexterm>
47968 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
47969 of the conditions are not met, what happens depends on whether <option>endpass</option>
47970 appears among the conditions (for syntax see below). If the failing condition
47971 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
47972 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
47973 check a RCPT command:
47974 </para>
47975 <literallayout class="monospaced">
47976 accept domains = +local_domains
47977 endpass
47978 verify = recipient
47979 </literallayout>
47980 <para>
47981 If the recipient domain does not match the <option>domains</option> condition, control
47982 passes to the next statement. If it does match, the recipient is verified, and
47983 the command is accepted if verification succeeds. However, if verification
47984 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
47985 <option>endpass</option>.
47986 </para>
47987 <para>
47988 The <option>endpass</option> feature has turned out to be confusing to many people, so its
47989 use is not recommended nowadays. It is always possible to rewrite an ACL so
47990 that <option>endpass</option> is not needed, and it is no longer used in the default
47991 configuration.
47992 </para>
47993 <para>
47994 <indexterm role="concept">
47995 <primary><option>message</option> ACL modifier</primary>
47996 <secondary>with <option>accept</option></secondary>
47997 </indexterm>
47998 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
47999 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
48000 (when an <option>accept</option> verb either accepts or passes control to the next
48001 statement), <option>message</option> can be used to vary the message that is sent when an
48002 SMTP command is accepted. For example, in a RCPT ACL you could have:
48003 </para>
48004 <literallayout>
48005 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48006 <literal>        message = OK, I will allow you through today</literal>
48007 </literallayout>
48008 <para>
48009 You can specify an SMTP response code, optionally followed by an <quote>extended
48010 response code</quote> at the start of the message, but the first digit must be the
48011 same as would be sent by default, which is 2 for an <option>accept</option> verb.
48012 </para>
48013 <para>
48014 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
48015 an error message that is used when access is denied. This behaviour is retained
48016 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
48017 of <option>endpass</option>.
48018 </para>
48019 </listitem>
48020 <listitem>
48021 <para>
48022 <indexterm role="concept">
48023 <primary><option>defer</option> ACL verb</primary>
48024 </indexterm>
48025 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
48026 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
48027 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
48028 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
48029 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
48030 be used in any ACL, and even for a recipient it might be a simpler approach.
48031 </para>
48032 </listitem>
48033 <listitem>
48034 <para>
48035 <indexterm role="concept">
48036 <primary><option>deny</option> ACL verb</primary>
48037 </indexterm>
48038 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
48039 the conditions are not met, control is passed to the next ACL statement. For
48040 example,
48041 </para>
48042 <literallayout class="monospaced">
48043 deny dnslists = blackholes.mail-abuse.org
48044 </literallayout>
48045 <para>
48046 rejects commands from hosts that are on a DNS black list.
48047 </para>
48048 </listitem>
48049 <listitem>
48050 <para>
48051 <indexterm role="concept">
48052 <primary><option>discard</option> ACL verb</primary>
48053 </indexterm>
48054 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
48055 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
48056 that are concerned with receiving messages. When all the conditions are true,
48057 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
48058 recipients to be discarded. If it is used in an ACL for RCPT, just the one
48059 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
48060 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
48061 do not appear in the log line when the <option>log_recipients</option> log selector is set.
48062 </para>
48063 <para>
48064 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
48065 its contents are added to the line that is automatically written to the log.
48066 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
48067 </para>
48068 </listitem>
48069 <listitem>
48070 <para>
48071 <indexterm role="concept">
48072 <primary><option>drop</option> ACL verb</primary>
48073 </indexterm>
48074 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
48075 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
48076 </para>
48077 <literallayout class="monospaced">
48078 drop   message   = I don't take more than 20 RCPTs
48079        condition = ${if &gt; {$rcpt_count}{20}}
48080 </literallayout>
48081 <para>
48082 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
48083 The connection is always dropped after sending a 550 response.
48084 </para>
48085 </listitem>
48086 <listitem>
48087 <para>
48088 <indexterm role="concept">
48089 <primary><option>require</option> ACL verb</primary>
48090 </indexterm>
48091 <option>require</option>: If all the conditions are met, control is passed to the next ACL
48092 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
48093 example, when checking a RCPT command,
48094 </para>
48095 <literallayout class="monospaced">
48096 require message = Sender did not verify
48097         verify  = sender
48098 </literallayout>
48099 <para>
48100 passes control to subsequent statements only if the message&#x2019;s sender can be
48101 verified. Otherwise, it rejects the command. Note the positioning of the
48102 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
48103 discussed in section <xref linkend="SECTcondmodproc"/>.
48104 </para>
48105 </listitem>
48106 <listitem>
48107 <para>
48108 <indexterm role="concept">
48109 <primary><option>warn</option> ACL verb</primary>
48110 </indexterm>
48111 <option>warn</option>: If all the conditions are true, a line specified by the
48112 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
48113 to the next ACL statement. If any condition is false, the log line is not
48114 written. If an identical log line is requested several times in the same
48115 message, only one copy is actually written to the log. If you want to force
48116 duplicates to be written, use the <option>logwrite</option> modifier instead.
48117 </para>
48118 <para>
48119 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
48120 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
48121 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
48122 condition. There is more about adding header lines in section
48123 <xref linkend="SECTaddheadacl"/>.
48124 </para>
48125 <para>
48126 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
48127 some sort of defer), the log line specified by <option>log_message</option> is not written.
48128 This does not include the case of a forced failure from a lookup, which
48129 is considered to be a successful completion. After a defer, no further
48130 conditions or modifiers in the <option>warn</option> statement are processed. The incident
48131 is logged, and the ACL continues to be processed, from the next statement
48132 onwards.
48133 </para>
48134 <para>
48135 <indexterm role="variable">
48136 <primary><varname>$acl_verify_message</varname></primary>
48137 </indexterm>
48138 When one of the <option>warn</option> conditions is an address verification that fails, the
48139 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
48140 want this logged, you must set it up explicitly. For example:
48141 </para>
48142 <literallayout class="monospaced">
48143 warn   !verify = sender
48144        log_message = sender verify failed: $acl_verify_message
48145 </literallayout>
48146 </listitem>
48147 </itemizedlist>
48148 <para>
48149 At the end of each ACL there is an implicit unconditional <option>deny</option>.
48150 </para>
48151 <para>
48152 As you can see from the examples above, the conditions and modifiers are
48153 written one to a line, with the first one on the same line as the verb, and
48154 subsequent ones on following lines. If you have a very long condition, you can
48155 continue it onto several physical lines by the usual backslash continuation
48156 mechanism. It is conventional to align the conditions vertically.
48157 </para>
48158 </section>
48159 <section id="SECTaclvariables">
48160 <title>ACL variables</title>
48161 <para>
48162 <indexterm role="concept">
48163 <primary>access control lists (ACLs)</primary>
48164 <secondary>variables</secondary>
48165 </indexterm>
48166 There are some special variables that can be set during ACL processing. They
48167 can be used to pass information between different ACLs, different invocations
48168 of the same ACL in the same SMTP connection, and between ACLs and the routers,
48169 transports, and filters that are used to deliver a message. The names of these
48170 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
48171 an underscore, but the remainder of the name can be any sequence of
48172 alphanumeric characters and underscores that you choose. There is no limit on
48173 the number of ACL variables. The two sets act as follows:
48174 </para>
48175 <itemizedlist>
48176 <listitem>
48177 <para>
48178 The values of those variables whose names begin with <varname>$acl_c</varname> persist
48179 throughout an SMTP connection. They are never reset. Thus, a value that is set
48180 while receiving one message is still available when receiving the next message
48181 on the same SMTP connection.
48182 </para>
48183 </listitem>
48184 <listitem>
48185 <para>
48186 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
48187 while a message is being received. They are reset afterwards. They are also
48188 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
48189 </para>
48190 </listitem>
48191 </itemizedlist>
48192 <para>
48193 When a message is accepted, the current values of all the ACL variables are
48194 preserved with the message and are subsequently made available at delivery
48195 time. The ACL variables are set by a modifier called <option>set</option>. For example:
48196 </para>
48197 <literallayout class="monospaced">
48198 accept hosts = whatever
48199        set acl_m4 = some value
48200 accept authenticated = *
48201        set acl_c_auth = yes
48202 </literallayout>
48203 <para>
48204 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
48205 be set. If you want to set a variable without taking any action, you can use a
48206 <option>warn</option> verb without any other modifiers or conditions.
48207 </para>
48208 <para>
48209 <indexterm role="option">
48210 <primary><option>strict_acl_vars</option></primary>
48211 </indexterm>
48212 What happens if a syntactically valid but undefined ACL variable is
48213 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
48214 false (the default), an empty string is substituted; if it is true, an
48215 error is generated.
48216 </para>
48217 <para>
48218 Versions of Exim before 4.64 have a limited set of numbered variables, but
48219 their names are compatible, so there is no problem with upgrading.
48220 </para>
48221 </section>
48222 <section id="SECTcondmodproc">
48223 <title>Condition and modifier processing</title>
48224 <para>
48225 <indexterm role="concept">
48226 <primary>access control lists (ACLs)</primary>
48227 <secondary>conditions; processing</secondary>
48228 </indexterm>
48229 <indexterm role="concept">
48230 <primary>access control lists (ACLs)</primary>
48231 <secondary>modifiers; processing</secondary>
48232 </indexterm>
48233 An exclamation mark preceding a condition negates its result. For example:
48234 </para>
48235 <literallayout class="monospaced">
48236 deny   domains = *.dom.example
48237       !verify  = recipient
48238 </literallayout>
48239 <para>
48240 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
48241 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
48242 negation can be used on the right-hand side of a condition. For example, these
48243 two statements are equivalent:
48244 </para>
48245 <literallayout class="monospaced">
48246 deny  hosts = !192.168.3.4
48247 deny !hosts =  192.168.3.4
48248 </literallayout>
48249 <para>
48250 However, for many conditions (<option>verify</option> being a good example), only left-hand
48251 side negation of the whole condition is possible.
48252 </para>
48253 <para>
48254 The arguments of conditions and modifiers are expanded. A forced failure
48255 of an expansion causes a condition to be ignored, that is, it behaves as if the
48256 condition is true. Consider these two statements:
48257 </para>
48258 <literallayout class="monospaced">
48259 accept  senders = ${lookup{$host_name}lsearch\
48260                   {/some/file}{$value}fail}
48261 accept  senders = ${lookup{$host_name}lsearch\
48262                   {/some/file}{$value}{}}
48263 </literallayout>
48264 <para>
48265 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
48266 the returned list is searched, but if the lookup fails the behaviour is
48267 different in the two cases. The <option>fail</option> in the first statement causes the
48268 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
48269 therefore succeeds. The second statement, however, generates an empty list when
48270 the lookup fails. No sender can match an empty list, so the condition fails,
48271 and therefore the <option>accept</option> also fails.
48272 </para>
48273 <para>
48274 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
48275 specify actions that are taken as the conditions for a statement are checked;
48276 others specify text for messages that are used when access is denied or a
48277 warning is generated. The <option>control</option> modifier affects the way an incoming
48278 message is handled.
48279 </para>
48280 <para>
48281 The positioning of the modifiers in an ACL statement important, because the
48282 processing of a verb ceases as soon as its outcome is known. Only those
48283 modifiers that have already been encountered will take effect. For example,
48284 consider this use of the <option>message</option> modifier:
48285 </para>
48286 <literallayout class="monospaced">
48287 require message = Can't verify sender
48288         verify  = sender
48289         message = Can't verify recipient
48290         verify  = recipient
48291         message = This message cannot be used
48292 </literallayout>
48293 <para>
48294 If sender verification fails, Exim knows that the result of the statement is
48295 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
48296 so its text is used as the error message. If sender verification succeeds, but
48297 recipient verification fails, the second message is used. If recipient
48298 verification succeeds, the third message becomes <quote>current</quote>, but is never used
48299 because there are no more conditions to cause failure.
48300 </para>
48301 <para>
48302 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
48303 modifier that is used, because all the conditions must be true for rejection to
48304 happen. Specifying more than one <option>message</option> modifier does not make sense, and
48305 the message can even be specified after all the conditions. For example:
48306 </para>
48307 <literallayout class="monospaced">
48308 deny   hosts = ...
48309       !senders = *@my.domain.example
48310        message = Invalid sender from client host
48311 </literallayout>
48312 <para>
48313 The <quote>deny</quote> result does not happen until the end of the statement is reached,
48314 by which time Exim has set up the message.
48315 </para>
48316 </section>
48317 <section id="SECTACLmodi">
48318 <title>ACL modifiers</title>
48319 <para>
48320 <indexterm role="concept">
48321 <primary>access control lists (ACLs)</primary>
48322 <secondary>modifiers; list of</secondary>
48323 </indexterm>
48324 The ACL modifiers are as follows:
48325 </para>
48326 <variablelist>
48327 <varlistentry>
48328 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48329 <listitem>
48330 <para>
48331 This modifier specifies one or more header lines that are to be added to an
48332 incoming message, assuming, of course, that the message is ultimately
48333 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
48334 </para>
48335 </listitem></varlistentry>
48336 <varlistentry>
48337 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48338 <listitem>
48339 <para>
48340 <indexterm role="concept">
48341 <primary><option>continue</option> ACL modifier</primary>
48342 </indexterm>
48343 <indexterm role="concept">
48344 <primary>database</primary>
48345 <secondary>updating in ACL</secondary>
48346 </indexterm>
48347 This modifier does nothing of itself, and processing of the ACL always
48348 continues with the next condition or modifier. The value of <option>continue</option> is in
48349 the side effects of expanding its argument. Typically this could be used to
48350 update a database. It is really just a syntactic tidiness, to avoid having to
48351 write rather ugly lines like this:
48352 </para>
48353 <literallayout>
48354 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
48355 </literallayout>
48356 <para>
48357 Instead, all you need is
48358 </para>
48359 <literallayout>
48360 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
48361 </literallayout>
48362 </listitem></varlistentry>
48363 <varlistentry>
48364 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48365 <listitem>
48366 <para>
48367 <indexterm role="concept">
48368 <primary><option>control</option> ACL modifier</primary>
48369 </indexterm>
48370 This modifier affects the subsequent processing of the SMTP connection or of an
48371 incoming message that is accepted. The effect of the first type of control
48372 lasts for the duration of the connection, whereas the effect of the second type
48373 lasts only until the current message has been received. The message-specific
48374 controls always apply to the whole message, not to individual recipients,
48375 even if the <option>control</option> modifier appears in a RCPT ACL.
48376 </para>
48377 <para>
48378 As there are now quite a few controls that can be applied, they are described
48379 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
48380 in several different ways. For example:
48381 </para>
48382 <itemizedlist>
48383 <listitem>
48384 <para>
48385 It can be at the end of an <option>accept</option> statement:
48386 </para>
48387 <literallayout class="monospaced">
48388     accept  ...some conditions
48389             control = queue_only
48390 </literallayout>
48391 <para>
48392 In this case, the control is applied when this statement yields <quote>accept</quote>, in
48393 other words, when the conditions are all true.
48394 </para>
48395 </listitem>
48396 <listitem>
48397 <para>
48398 It can be in the middle of an <option>accept</option> statement:
48399 </para>
48400 <literallayout class="monospaced">
48401     accept  ...some conditions...
48402             control = queue_only
48403             ...some more conditions...
48404 </literallayout>
48405 <para>
48406 If the first set of conditions are true, the control is applied, even if the
48407 statement does not accept because one of the second set of conditions is false.
48408 In this case, some subsequent statement must yield <quote>accept</quote> for the control
48409 to be relevant.
48410 </para>
48411 </listitem>
48412 <listitem>
48413 <para>
48414 It can be used with <option>warn</option> to apply the control, leaving the
48415 decision about accepting or denying to a subsequent verb. For
48416 example:
48417 </para>
48418 <literallayout class="monospaced">
48419     warn    ...some conditions...
48420             control = freeze
48421     accept  ...
48422 </literallayout>
48423 <para>
48424 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
48425 <option>logwrite</option>, so it does not add anything to the message and does not write a
48426 log entry.
48427 </para>
48428 </listitem>
48429 <listitem>
48430 <para>
48431 If you want to apply a control unconditionally, you can use it with a
48432 <option>require</option> verb. For example:
48433 </para>
48434 <literallayout class="monospaced">
48435     require  control = no_multiline_responses
48436 </literallayout>
48437 </listitem>
48438 </itemizedlist>
48439 </listitem></varlistentry>
48440 <varlistentry>
48441 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
48442 <listitem>
48443 <para>
48444 <indexterm role="concept">
48445 <primary><option>delay</option> ACL modifier</primary>
48446 </indexterm>
48447 <indexterm role="option">
48448 <primary><option>-bh</option></primary>
48449 </indexterm>
48450 This modifier may appear in any ACL. It causes Exim to wait for the time
48451 interval before proceeding. However, when testing Exim using the <option>-bh</option>
48452 option, the delay is not actually imposed (an appropriate message is output
48453 instead). The time is given in the usual Exim notation, and the delay happens
48454 as soon as the modifier is processed. In an SMTP session, pending output is
48455 flushed before the delay is imposed.
48456 </para>
48457 <para>
48458 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
48459 example:
48460 </para>
48461 <literallayout class="monospaced">
48462 deny    ...some conditions...
48463         delay = 30s
48464 </literallayout>
48465 <para>
48466 The delay happens if all the conditions are true, before the statement returns
48467 <quote>deny</quote>. Compare this with:
48468 </para>
48469 <literallayout class="monospaced">
48470 deny    delay = 30s
48471         ...some conditions...
48472 </literallayout>
48473 <para>
48474 which waits for 30s before processing the conditions. The <option>delay</option> modifier
48475 can also be used with <option>warn</option> and together with <option>control</option>:
48476 </para>
48477 <literallayout class="monospaced">
48478 warn    ...some conditions...
48479         delay = 2m
48480         control = freeze
48481 accept  ...
48482 </literallayout>
48483 <para>
48484 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
48485 responses to several commands are no longer buffered and sent in one packet (as
48486 they would normally be) because all output is flushed before imposing the
48487 delay. This optimization is disabled so that a number of small delays do not
48488 appear to the client as one large aggregated delay that might provoke an
48489 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
48490 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
48491 </para>
48492 </listitem></varlistentry>
48493 <varlistentry>
48494 <term><emphasis role="bold">endpass</emphasis></term>
48495 <listitem>
48496 <para>
48497 <indexterm role="concept">
48498 <primary><option>endpass</option> ACL modifier</primary>
48499 </indexterm>
48500 This modifier, which has no argument, is recognized only in <option>accept</option> and
48501 <option>discard</option> statements. It marks the boundary between the conditions whose
48502 failure causes control to pass to the next statement, and the conditions whose
48503 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
48504 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
48505 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
48506 </para>
48507 </listitem></varlistentry>
48508 <varlistentry>
48509 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48510 <listitem>
48511 <para>
48512 <indexterm role="concept">
48513 <primary><option>log_message</option> ACL modifier</primary>
48514 </indexterm>
48515 This modifier sets up a message that is used as part of the log message if the
48516 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
48517 </para>
48518 <literallayout class="monospaced">
48519 require log_message = wrong cipher suite $tls_cipher
48520         encrypted   = DES-CBC3-SHA
48521 </literallayout>
48522 <para>
48523 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
48524 example:
48525 </para>
48526 <literallayout>
48527 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48528 <literal>        log_message = Discarded $local_part@$domain because...</literal>
48529 </literallayout>
48530 <para>
48531 When access is denied, <option>log_message</option> adds to any underlying error message
48532 that may exist because of a condition failure. For example, while verifying a
48533 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
48534 message.
48535 </para>
48536 <para>
48537 The message may be defined before the conditions to which it applies, because
48538 the string expansion does not happen until Exim decides that access is to be
48539 denied. This means that any variables that are set by the condition are
48540 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
48541 variables are set after a DNS black list lookup succeeds. If the expansion of
48542 <option>log_message</option> fails, or if the result is an empty string, the modifier is
48543 ignored.
48544 </para>
48545 <para>
48546 <indexterm role="variable">
48547 <primary><varname>$acl_verify_message</varname></primary>
48548 </indexterm>
48549 If you want to use a <option>warn</option> statement to log the result of an address
48550 verification, you can use <varname>$acl_verify_message</varname> to include the verification
48551 error message.
48552 </para>
48553 <para>
48554 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
48555 the start of the logged message. If the same warning log message is requested
48556 more than once while receiving  a single email message, only one copy is
48557 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
48558 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
48559 is logged for a successful <option>warn</option> statement.
48560 </para>
48561 <para>
48562 If <option>log_message</option> is not present and there is no underlying error message (for
48563 example, from the failure of address verification), but <option>message</option> is present,
48564 the <option>message</option> text is used for logging rejections. However, if any text for
48565 logging contains newlines, only the first line is logged. In the absence of
48566 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
48567 logging rejections.
48568 </para>
48569 </listitem></varlistentry>
48570 <varlistentry>
48571 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
48572 <listitem>
48573 <para>
48574 <indexterm role="concept">
48575 <primary><option>log_reject_target</option> ACL modifier</primary>
48576 </indexterm>
48577 <indexterm role="concept">
48578 <primary>logging in ACL</primary>
48579 <secondary>specifying which log</secondary>
48580 </indexterm>
48581 This modifier makes it possible to specify which logs are used for messages
48582 about ACL rejections. Its argument is a colon-separated list of words that can
48583 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
48584 may be empty, in which case a rejection is not logged at all. For example, this
48585 ACL fragment writes no logging information when access is denied:
48586 </para>
48587 <literallayout>
48588 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48589 <literal>     log_reject_target =</literal>
48590 </literallayout>
48591 <para>
48592 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
48593 permanent and temporary rejections.
48594 </para>
48595 </listitem></varlistentry>
48596 <varlistentry>
48597 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48598 <listitem>
48599 <para>
48600 <indexterm role="concept">
48601 <primary><option>logwrite</option> ACL modifier</primary>
48602 </indexterm>
48603 <indexterm role="concept">
48604 <primary>logging in ACL</primary>
48605 <secondary>immediate</secondary>
48606 </indexterm>
48607 This modifier writes a message to a log file as soon as it is encountered when
48608 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
48609 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
48610 access.) The <option>logwrite</option> modifier can be used to log special incidents in
48611 ACLs. For example:
48612 </para>
48613 <literallayout>
48614 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
48615 <literal>       control  = freeze</literal>
48616 <literal>       logwrite = froze message because ...</literal>
48617 </literallayout>
48618 <para>
48619 By default, the message is written to the main log. However, it may begin
48620 with a colon, followed by a comma-separated list of log names, and then
48621 another colon, to specify exactly which logs are to be written. For
48622 example:
48623 </para>
48624 <literallayout class="monospaced">
48625 logwrite = :main,reject: text for main and reject logs
48626 logwrite = :panic: text for panic log only
48627 </literallayout>
48628 </listitem></varlistentry>
48629 <varlistentry>
48630 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48631 <listitem>
48632 <para>
48633 <indexterm role="concept">
48634 <primary><option>message</option> ACL modifier</primary>
48635 </indexterm>
48636 This modifier sets up a text string that is expanded and used as a response
48637 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
48638 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
48639 there is some complication if <option>endpass</option> is involved; see the description of
48640 <option>accept</option> for details.)
48641 </para>
48642 <para>
48643 The expansion of the message happens at the time Exim decides that the ACL is
48644 to end, not at the time it processes <option>message</option>. If the expansion fails, or
48645 generates an empty string, the modifier is ignored. Here is an example where
48646 <option>message</option> must be specified first, because the ACL ends with a rejection if
48647 the <option>hosts</option> condition fails:
48648 </para>
48649 <literallayout class="monospaced">
48650 require  message = Host not recognized
48651          hosts = 10.0.0.0/8
48652 </literallayout>
48653 <para>
48654 (Once a condition has failed, no further conditions or modifiers are
48655 processed.)
48656 </para>
48657 <para>
48658 <indexterm role="concept">
48659 <primary>SMTP</primary>
48660 <secondary>error codes</secondary>
48661 </indexterm>
48662 <indexterm role="option">
48663 <primary><option>smtp_banner</option></primary>
48664 </indexterm>
48665 For ACLs that are triggered by SMTP commands, the message is returned as part
48666 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
48667 is meaningful only for SMTP, as no message is returned when a non-SMTP message
48668 is accepted. In the case of the connect ACL, accepting with a message modifier
48669 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
48670 accept message may not contain more than one line (otherwise it will be
48671 truncated at the first newline and a panic logged), and it cannot affect the
48672 EHLO options.
48673 </para>
48674 <para>
48675 When SMTP is involved, the message may begin with an overriding response code,
48676 consisting of three digits optionally followed by an <quote>extended response code</quote>
48677 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
48678 </para>
48679 <literallayout class="monospaced">
48680 deny  message = 599 1.2.3 Host not welcome
48681       hosts = 192.168.34.0/24
48682 </literallayout>
48683 <para>
48684 The first digit of the supplied response code must be the same as would be sent
48685 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
48686 access, but for the predata ACL, note that the default success code is 354, not
48687 2<emphasis>xx</emphasis>.
48688 </para>
48689 <para>
48690 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
48691 the message modifier cannot override the 221 response code.
48692 </para>
48693 <para>
48694 The text in a <option>message</option> modifier is literal; any quotes are taken as
48695 literals, but because the string is expanded, backslash escapes are processed
48696 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
48697 response.
48698 </para>
48699 <para>
48700 <indexterm role="variable">
48701 <primary><varname>$acl_verify_message</varname></primary>
48702 </indexterm>
48703 If <option>message</option> is used on a statement that verifies an address, the message
48704 specified overrides any message that is generated by the verification process.
48705 However, the original message is available in the variable
48706 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
48707 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
48708 routers to be passed back as part of the SMTP response, you should either not
48709 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
48710 </para>
48711 <para>
48712 For compatibility with previous releases of Exim, a <option>message</option> modifier that
48713 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
48714 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
48715 all the conditions are true, wherever it appears in an ACL command, whereas
48716 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
48717 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
48718 effect.
48719 </para>
48720 </listitem></varlistentry>
48721 <varlistentry>
48722 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
48723 <listitem>
48724 <para>
48725 <indexterm role="concept">
48726 <primary><option>set</option> ACL modifier</primary>
48727 </indexterm>
48728 This modifier puts a value into one of the ACL variables (see section
48729 <xref linkend="SECTaclvariables"/>).
48730 </para>
48731 </listitem></varlistentry>
48732 </variablelist>
48733 </section>
48734 <section id="SECTcontrols">
48735 <title>Use of the control modifier</title>
48736 <para>
48737 <indexterm role="concept">
48738 <primary><option>control</option> ACL modifier</primary>
48739 </indexterm>
48740 The <option>control</option> modifier supports the following settings:
48741 </para>
48742 <variablelist>
48743 <varlistentry>
48744 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
48745 <listitem>
48746 <para>
48747 This modifier allows a client host to use the SMTP AUTH command even when it
48748 has not been advertised in response to EHLO. Furthermore, because there are
48749 apparently some really broken clients that do this, Exim will accept AUTH after
48750 HELO (rather than EHLO) when this control is set. It should be used only if you
48751 really need it, and you should limit its use to those broken clients that do
48752 not work without it. For example:
48753 </para>
48754 <literallayout class="monospaced">
48755 warn hosts   = 192.168.34.25
48756      control = allow_auth_unadvertised
48757 </literallayout>
48758 <para>
48759 Normally, when an Exim server receives an AUTH command, it checks the name of
48760 the authentication mechanism that is given in the command to ensure that it
48761 matches an advertised mechanism. When this control is set, the check that a
48762 mechanism has been advertised is bypassed. Any configured mechanism can be used
48763 by the client. This control is permitted only in the connection and HELO ACLs.
48764 </para>
48765 </listitem></varlistentry>
48766 <varlistentry>
48767 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
48768 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
48769 <listitem>
48770 <para>
48771 <indexterm role="concept">
48772 <primary>access control lists (ACLs)</primary>
48773 <secondary>case of local part in</secondary>
48774 </indexterm>
48775 <indexterm role="concept">
48776 <primary>case of local parts</primary>
48777 </indexterm>
48778 <indexterm role="variable">
48779 <primary><varname>$local_part</varname></primary>
48780 </indexterm>
48781 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
48782 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
48783 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
48784 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
48785 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
48786 is encountered.
48787 </para>
48788 <para>
48789 These controls affect only the current recipient. Moreover, they apply only to
48790 local part handling that takes place directly in the ACL (for example, as a key
48791 in lookups). If a test to verify the recipient is obeyed, the case-related
48792 handling of the local part during the verification is controlled by the router
48793 configuration (see the <option>caseful_local_part</option> generic router option).
48794 </para>
48795 <para>
48796 This facility could be used, for example, to add a spam score to local parts
48797 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
48798 spam score:
48799 </para>
48800 <literallayout class="monospaced">
48801 warn  control = caseful_local_part
48802       set acl_m4 = ${eval:\
48803                      $acl_m4 + \
48804                      ${if match{$local_part}{[A-Z]}{1}{0}}\
48805                     }
48806       control = caselower_local_part
48807 </literallayout>
48808 <para>
48809 Notice that we put back the lower cased version afterwards, assuming that
48810 is what is wanted for subsequent tests.
48811 </para>
48812 </listitem></varlistentry>
48813 <varlistentry>
48814 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
48815 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
48816 <listitem>
48817 <para>
48818 <indexterm role="concept">
48819 <primary>SMTP</primary>
48820 <secondary>synchronization checking</secondary>
48821 </indexterm>
48822 <indexterm role="concept">
48823 <primary>synchronization checking in SMTP</primary>
48824 </indexterm>
48825 These controls make it possible to be selective about when SMTP synchronization
48826 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
48827 state of the switch (it is true by default). See the description of this option
48828 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
48829 </para>
48830 <para>
48831 The effect of these two controls lasts for the remainder of the SMTP
48832 connection. They can appear in any ACL except the one for the non-SMTP
48833 messages. The most straightforward place to put them is in the ACL defined by
48834 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
48835 before the first synchronization check. The expected use is to turn off the
48836 synchronization checks for badly-behaved hosts that you nevertheless need to
48837 work with.
48838 </para>
48839 </listitem></varlistentry>
48840 <varlistentry>
48841 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
48842 <listitem>
48843 <para>
48844 <indexterm role="concept">
48845 <primary>fake defer</primary>
48846 </indexterm>
48847 <indexterm role="concept">
48848 <primary>defer, fake</primary>
48849 </indexterm>
48850 This control works in exactly the same way as <option>fakereject</option> (described below)
48851 except that it causes an SMTP 450 response after the message data instead of a
48852 550 response. You must take care when using <option>fakedefer</option> because it causes the
48853 messages to be duplicated when the sender retries. Therefore, you should not
48854 use <option>fakedefer</option> if the message is to be delivered normally.
48855 </para>
48856 </listitem></varlistentry>
48857 <varlistentry>
48858 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
48859 <listitem>
48860 <para>
48861 <indexterm role="concept">
48862 <primary>fake rejection</primary>
48863 </indexterm>
48864 <indexterm role="concept">
48865 <primary>rejection, fake</primary>
48866 </indexterm>
48867 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
48868 words, only when an SMTP message is being received. If Exim accepts the
48869 message, instead the final 250 response, a 550 rejection message is sent.
48870 However, Exim proceeds to deliver the message as normal. The control applies
48871 only to the current message, not to any subsequent ones that may be received in
48872 the same SMTP connection.
48873 </para>
48874 <para>
48875 The text for the 550 response is taken from the <option>control</option> modifier. If no
48876 message is supplied, the following is used:
48877 </para>
48878 <literallayout class="monospaced">
48879 550-Your message has been rejected but is being
48880 550-kept for evaluation.
48881 550-If it was a legitimate message, it may still be
48882 550 delivered to the target recipient(s).
48883 </literallayout>
48884 <para>
48885 This facility should be used with extreme caution.
48886 </para>
48887 </listitem></varlistentry>
48888 <varlistentry>
48889 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
48890 <listitem>
48891 <para>
48892 <indexterm role="concept">
48893 <primary>frozen messages</primary>
48894 <secondary>forcing in ACL</secondary>
48895 </indexterm>
48896 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
48897 other words, only when a message is being received. If the message is accepted,
48898 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
48899 current message, not to any subsequent ones that may be received in the same
48900 SMTP connection.
48901 </para>
48902 <para>
48903 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
48904 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
48905 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
48906 are obeyed for the current message have the <literal>/no_tell</literal> option.
48907 </para>
48908 </listitem></varlistentry>
48909 <varlistentry>
48910 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
48911 <listitem>
48912 <para>
48913 <indexterm role="concept">
48914 <primary>SMTP</primary>
48915 <secondary>output flushing, disabling for delay</secondary>
48916 </indexterm>
48917 Exim normally flushes SMTP output before implementing a delay in an ACL, to
48918 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
48919 use. This control, as long as it is encountered before the <option>delay</option> modifier,
48920 disables such output flushing.
48921 </para>
48922 </listitem></varlistentry>
48923 <varlistentry>
48924 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
48925 <listitem>
48926 <para>
48927 <indexterm role="concept">
48928 <primary>SMTP</primary>
48929 <secondary>output flushing, disabling for callout</secondary>
48930 </indexterm>
48931 Exim normally flushes SMTP output before performing a callout in an ACL, to
48932 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
48933 use. This control, as long as it is encountered before the <option>verify</option> condition
48934 that causes the callout, disables such output flushing.
48935 </para>
48936 </listitem></varlistentry>
48937 <varlistentry>
48938 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
48939 <listitem>
48940 <para>
48941 This control is available when Exim is compiled with the content scanning
48942 extension. Content scanning may require a copy of the current message, or parts
48943 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
48944 or spam scanner. Normally, such copies are deleted when they are no longer
48945 needed. If this control is set, the copies are not deleted. The control applies
48946 only to the current message, not to any subsequent ones that may be received in
48947 the same SMTP connection. It is provided for debugging purposes and is unlikely
48948 to be useful in production.
48949 </para>
48950 </listitem></varlistentry>
48951 <varlistentry>
48952 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
48953 <listitem>
48954 <para>
48955 <indexterm role="concept">
48956 <primary>multiline responses, suppressing</primary>
48957 </indexterm>
48958 This control is permitted for any ACL except the one for non-SMTP messages.
48959 It seems that there are broken clients in use that cannot handle multiline
48960 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
48961 </para>
48962 <para>
48963 If this control is set, multiline SMTP responses from ACL rejections are
48964 suppressed. One way of doing this would have been to put out these responses as
48965 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
48966 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
48967 responses might get close to that. So this facility, which is after all only a
48968 sop to broken clients, is implemented by doing two very easy things:
48969 </para>
48970 <itemizedlist>
48971 <listitem>
48972 <para>
48973 Extra information that is normally output as part of a rejection caused by
48974 sender verification failure is omitted. Only the final line (typically <quote>sender
48975 verification failed</quote>) is sent.
48976 </para>
48977 </listitem>
48978 <listitem>
48979 <para>
48980 If a <option>message</option> modifier supplies a multiline response, only the first
48981 line is output.
48982 </para>
48983 </listitem>
48984 </itemizedlist>
48985 <para>
48986 The setting of the switch can, of course, be made conditional on the
48987 calling host. Its effect lasts until the end of the SMTP connection.
48988 </para>
48989 </listitem></varlistentry>
48990 <varlistentry>
48991 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
48992 <listitem>
48993 <para>
48994 <indexterm role="concept">
48995 <primary>PIPELINING</primary>
48996 <secondary>suppressing advertising</secondary>
48997 </indexterm>
48998 This control turns off the advertising of the PIPELINING extension to SMTP in
48999 the current session. To be useful, it must be obeyed before Exim sends its
49000 response to an EHLO command. Therefore, it should normally appear in an ACL
49001 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
49002 <option>pipelining_advertise_hosts</option>.
49003 </para>
49004 </listitem></varlistentry>
49005 <varlistentry>
49006 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
49007 <listitem>
49008 <para>
49009 <indexterm role="option">
49010 <primary><option>queue_only</option></primary>
49011 </indexterm>
49012 <indexterm role="concept">
49013 <primary>queueing incoming messages</primary>
49014 </indexterm>
49015 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49016 other words, only when a message is being received. If the message is accepted,
49017 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
49018 runner. No immediate delivery process is started. In other words, it has the
49019 effect as the <option>queue_only</option> global option. However, the control applies only
49020 to the current message, not to any subsequent ones that may be received in the
49021 same SMTP connection.
49022 </para>
49023 </listitem></varlistentry>
49024 <varlistentry>
49025 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49026 <listitem>
49027 <para>
49028 <indexterm role="concept">
49029 <primary>message</primary>
49030 <secondary>submission</secondary>
49031 </indexterm>
49032 <indexterm role="concept">
49033 <primary>submission mode</primary>
49034 </indexterm>
49035 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
49036 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
49037 the current message is a submission from a local MUA. In this case, Exim
49038 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
49039 necessary. For example, it add a <emphasis>Date:</emphasis> header line if one is not present.
49040 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
49041 late (the message has already been created).
49042 </para>
49043 <para>
49044 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
49045 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
49046 submission mode; the available options for this control are described there.
49047 The control applies only to the current message, not to any subsequent ones
49048 that may be received in the same SMTP connection.
49049 </para>
49050 </listitem></varlistentry>
49051 <varlistentry>
49052 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
49053 <listitem>
49054 <para>
49055 <indexterm role="concept">
49056 <primary>submission fixups, suppressing</primary>
49057 </indexterm>
49058 This control applies to locally submitted (non TCP/IP) messages, and is the
49059 complement of <literal>control</literal> <literal>=</literal> <literal>submission</literal>. It disables the fixups that are
49060 normally applied to locally-submitted messages. Specifically:
49061 </para>
49062 <itemizedlist>
49063 <listitem>
49064 <para>
49065 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
49066 dynamic version of <option>local_sender_retain</option>).
49067 </para>
49068 </listitem>
49069 <listitem>
49070 <para>
49071 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
49072 </para>
49073 </listitem>
49074 <listitem>
49075 <para>
49076 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
49077 </para>
49078 </listitem>
49079 </itemizedlist>
49080 <para>
49081 This control may be useful when a remotely-originated message is accepted,
49082 passed to some scanning program, and then re-submitted for delivery. It can be
49083 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
49084 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
49085 data is read.
49086 </para>
49087 <para>
49088 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
49089 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
49090 </para>
49091 </listitem></varlistentry>
49092 </variablelist>
49093 </section>
49094 <section id="SECTsummesfix">
49095 <title>Summary of message fixup control</title>
49096 <para>
49097 All four possibilities for message fixups can be specified:
49098 </para>
49099 <itemizedlist>
49100 <listitem>
49101 <para>
49102 Locally submitted, fixups applied: the default.
49103 </para>
49104 </listitem>
49105 <listitem>
49106 <para>
49107 Locally submitted, no fixups applied: use <literal>control</literal> <literal>=</literal>
49108 <literal>suppress_local_fixups</literal>.
49109 </para>
49110 </listitem>
49111 <listitem>
49112 <para>
49113 Remotely submitted, no fixups applied: the default.
49114 </para>
49115 </listitem>
49116 <listitem>
49117 <para>
49118 Remotely submitted, fixups applied: use <literal>control</literal> <literal>=</literal> <literal>submission</literal>.
49119 </para>
49120 </listitem>
49121 </itemizedlist>
49122 </section>
49123 <section id="SECTaddheadacl">
49124 <title>Adding header lines in ACLs</title>
49125 <para>
49126 <indexterm role="concept">
49127 <primary>header lines</primary>
49128 <secondary>adding in an ACL</secondary>
49129 </indexterm>
49130 <indexterm role="concept">
49131 <primary>header lines</primary>
49132 <secondary>position of added lines</secondary>
49133 </indexterm>
49134 <indexterm role="concept">
49135 <primary><option>message</option> ACL modifier</primary>
49136 </indexterm>
49137 The <option>add_header</option> modifier can be used to add one or more extra header lines
49138 to an incoming message, as in this example:
49139 </para>
49140 <literallayout class="monospaced">
49141 warn dnslists = sbl.spamhaus.org : \
49142                 dialup.mail-abuse.org
49143      add_header = X-blacklisted-at: $dnslist_domain
49144 </literallayout>
49145 <para>
49146 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
49147 MIME, and non-SMTP ACLs (in other words, those that are concerned with
49148 receiving a message). The message must ultimately be accepted for
49149 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
49150 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
49151 RCPT ACL).
49152 </para>
49153 <para>
49154 If the data for the <option>add_header</option> modifier contains one or more newlines that
49155 are not followed by a space or a tab, it is assumed to contain multiple header
49156 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
49157 front of any line that is not a valid header line.
49158 </para>
49159 <para>
49160 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
49161 They are added to the message before processing the DATA and MIME ACLs.
49162 However, if an identical header line is requested more than once, only one copy
49163 is actually added to the message. Further header lines may be accumulated
49164 during the DATA and MIME ACLs, after which they are added to the message, again
49165 with duplicates suppressed. Thus, it is possible to add two identical header
49166 lines to an SMTP message, but only if one is added before DATA and one after.
49167 In the case of non-SMTP messages, new headers are accumulated during the
49168 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
49169 message is rejected after DATA or by the non-SMTP ACL, all added header lines
49170 are included in the entry that is written to the reject log.
49171 </para>
49172 <para>
49173 <indexterm role="concept">
49174 <primary>header lines</primary>
49175 <secondary>added; visibility of</secondary>
49176 </indexterm>
49177 Header lines are not visible in string expansions until they are added to the
49178 message. It follows that header lines defined in the MAIL, RCPT, and predata
49179 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
49180 header lines that are added by the DATA or MIME ACLs are not visible in those
49181 ACLs. Because of this restriction, you cannot use header lines as a way of
49182 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
49183 this, you can use ACL variables, as described in section
49184 <xref linkend="SECTaclvariables"/>.
49185 </para>
49186 <para>
49187 The <option>add_header</option> modifier acts immediately it is encountered during the
49188 processing of an ACL. Notice the difference between these two cases:
49189 </para>
49190 <literallayout>
49191 <literal>accept add_header = ADDED: some text</literal>
49192 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
49193
49194 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
49195 <literal>       add_header = ADDED: some text</literal>
49196 </literallayout>
49197 <para>
49198 In the first case, the header line is always added, whether or not the
49199 condition is true. In the second case, the header line is added only if the
49200 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
49201 ACL statement. All those that are encountered before a condition fails are
49202 honoured.
49203 </para>
49204 <para>
49205 <indexterm role="concept">
49206 <primary><option>warn</option> ACL verb</primary>
49207 </indexterm>
49208 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
49209 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
49210 effect only if all the conditions are true, even if it appears before some of
49211 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
49212 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
49213 are present on a <option>warn</option> verb, both are processed according to their
49214 specifications.
49215 </para>
49216 <para>
49217 By default, new header lines are added to a message at the end of the existing
49218 header lines. However, you can specify that any particular header line should
49219 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
49220 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
49221 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
49222 </para>
49223 <para>
49224 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
49225 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
49226 header line, respectively. (Header text cannot start with a colon, as there has
49227 to be a header name first.) For example:
49228 </para>
49229 <literallayout class="monospaced">
49230 warn add_header = \
49231        :after_received:X-My-Header: something or other...
49232 </literallayout>
49233 <para>
49234 If more than one header line is supplied in a single <option>add_header</option> modifier,
49235 each one is treated independently and can therefore be placed differently. If
49236 you add more than one line at the start, or after the Received: block, they end
49237 up in reverse order.
49238 </para>
49239 <para>
49240 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
49241 added in an ACL. It does NOT work for header lines that are added in a
49242 system filter or in a router or transport.
49243 </para>
49244 </section>
49245 <section id="SECTaclconditions">
49246 <title>ACL conditions</title>
49247 <para>
49248 <indexterm role="concept">
49249 <primary>access control lists (ACLs)</primary>
49250 <secondary>conditions; list of</secondary>
49251 </indexterm>
49252 Some of conditions listed in this section are available only when Exim is
49253 compiled with the content-scanning extension. They are included here briefly
49254 for completeness. More detailed descriptions can be found in the discussion on
49255 content scanning in chapter <xref linkend="CHAPexiscan"/>.
49256 </para>
49257 <para>
49258 Not all conditions are relevant in all circumstances. For example, testing
49259 senders and recipients does not make sense in an ACL that is being run as the
49260 result of the arrival of an ETRN command, and checks on message headers can be
49261 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
49262 can use the same condition (with different parameters) more than once in the
49263 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
49264 The conditions are as follows:
49265 </para>
49266 <variablelist>
49267 <varlistentry>
49268 <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>
49269 <listitem>
49270 <para>
49271 <indexterm role="concept">
49272 <primary>access control lists (ACLs)</primary>
49273 <secondary>nested</secondary>
49274 </indexterm>
49275 <indexterm role="concept">
49276 <primary>access control lists (ACLs)</primary>
49277 <secondary>indirect</secondary>
49278 </indexterm>
49279 <indexterm role="concept">
49280 <primary><option>acl</option> ACL condition</primary>
49281 </indexterm>
49282 The possible values of the argument are the same as for the
49283 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
49284 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
49285 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
49286 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
49287 condition false. This means that further processing of the <option>warn</option> verb
49288 ceases, but processing of the ACL continues.
49289 </para>
49290 <para>
49291 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
49292 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
49293 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
49294 conditions are tested.
49295 </para>
49296 <para>
49297 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
49298 loops. This condition allows you to use different ACLs in different
49299 circumstances. For example, different ACLs can be used to handle RCPT commands
49300 for different local users or different local domains.
49301 </para>
49302 </listitem></varlistentry>
49303 <varlistentry>
49304 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
49305 <listitem>
49306 <para>
49307 <indexterm role="concept">
49308 <primary><option>authenticated</option> ACL condition</primary>
49309 </indexterm>
49310 <indexterm role="concept">
49311 <primary>authentication</primary>
49312 <secondary>ACL checking</secondary>
49313 </indexterm>
49314 <indexterm role="concept">
49315 <primary>access control lists (ACLs)</primary>
49316 <secondary>testing for authentication</secondary>
49317 </indexterm>
49318 If the SMTP connection is not authenticated, the condition is false. Otherwise,
49319 the name of the authenticator is tested against the list. To test for
49320 authentication by any authenticator, you can set
49321 </para>
49322 <literallayout class="monospaced">
49323 authenticated = *
49324 </literallayout>
49325 </listitem></varlistentry>
49326 <varlistentry>
49327 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
49328 <listitem>
49329 <para>
49330 <indexterm role="concept">
49331 <primary><option>condition</option> ACL condition</primary>
49332 </indexterm>
49333 <indexterm role="concept">
49334 <primary>customizing</primary>
49335 <secondary>ACL condition</secondary>
49336 </indexterm>
49337 <indexterm role="concept">
49338 <primary>access control lists (ACLs)</primary>
49339 <secondary>customized test</secondary>
49340 </indexterm>
49341 <indexterm role="concept">
49342 <primary>access control lists (ACLs)</primary>
49343 <secondary>testing, customized</secondary>
49344 </indexterm>
49345 This feature allows you to make up custom conditions. If the result of
49346 expanding the string is an empty string, the number zero, or one of the strings
49347 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
49348 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
49349 any other value, some error is assumed to have occurred, and the ACL returns
49350 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
49351 ignored. The effect is to treat it as true, whether it is positive or
49352 negative.
49353 </para>
49354 </listitem></varlistentry>
49355 <varlistentry>
49356 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
49357 <listitem>
49358 <para>
49359 <indexterm role="concept">
49360 <primary><option>decode</option> ACL condition</primary>
49361 </indexterm>
49362 This condition is available only when Exim is compiled with the
49363 content-scanning extension, and it is allowed only in the ACL defined by
49364 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
49365 If all goes well, the condition is true. It is false only if there are
49366 problems such as a syntax error or a memory shortage. For more details, see
49367 chapter <xref linkend="CHAPexiscan"/>.
49368 </para>
49369 </listitem></varlistentry>
49370 <varlistentry>
49371 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
49372 <listitem>
49373 <para>
49374 <indexterm role="concept">
49375 <primary><option>demime</option> ACL condition</primary>
49376 </indexterm>
49377 This condition is available only when Exim is compiled with the
49378 content-scanning extension. Its use is described in section
49379 <xref linkend="SECTdemimecond"/>.
49380 </para>
49381 </listitem></varlistentry>
49382 <varlistentry>
49383 <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>
49384 <listitem>
49385 <para>
49386 <indexterm role="concept">
49387 <primary><option>dnslists</option> ACL condition</primary>
49388 </indexterm>
49389 <indexterm role="concept">
49390 <primary>DNS list</primary>
49391 <secondary>in ACL</secondary>
49392 </indexterm>
49393 <indexterm role="concept">
49394 <primary>black list (DNS)</primary>
49395 </indexterm>
49396 <indexterm role="concept">
49397 <primary>access control lists (ACLs)</primary>
49398 <secondary>testing a DNS list</secondary>
49399 </indexterm>
49400 This condition checks for entries in DNS black lists. These are also known as
49401 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
49402 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
49403 different variants of this condition to describe briefly here. See sections
49404 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
49405 </para>
49406 </listitem></varlistentry>
49407 <varlistentry>
49408 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
49409 <listitem>
49410 <para>
49411 <indexterm role="concept">
49412 <primary><option>domains</option> ACL condition</primary>
49413 </indexterm>
49414 <indexterm role="concept">
49415 <primary>domain</primary>
49416 <secondary>ACL checking</secondary>
49417 </indexterm>
49418 <indexterm role="concept">
49419 <primary>access control lists (ACLs)</primary>
49420 <secondary>testing a recipient domain</secondary>
49421 </indexterm>
49422 <indexterm role="variable">
49423 <primary><varname>$domain_data</varname></primary>
49424 </indexterm>
49425 This condition is relevant only after a RCPT command. It checks that the domain
49426 of the recipient address is in the domain list. If percent-hack processing is
49427 enabled, it is done before this test is done. If the check succeeds with a
49428 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
49429 <option>domains</option> test.
49430 </para>
49431 <para>
49432 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
49433 use <option>domains</option> in a DATA ACL.
49434 </para>
49435 </listitem></varlistentry>
49436 <varlistentry>
49437 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
49438 <listitem>
49439 <para>
49440 <indexterm role="concept">
49441 <primary><option>encrypted</option> ACL condition</primary>
49442 </indexterm>
49443 <indexterm role="concept">
49444 <primary>encryption</primary>
49445 <secondary>checking in an ACL</secondary>
49446 </indexterm>
49447 <indexterm role="concept">
49448 <primary>access control lists (ACLs)</primary>
49449 <secondary>testing for encryption</secondary>
49450 </indexterm>
49451 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
49452 name of the cipher suite in use is tested against the list. To test for
49453 encryption without testing for any specific cipher suite(s), set
49454 </para>
49455 <literallayout class="monospaced">
49456 encrypted = *
49457 </literallayout>
49458 </listitem></varlistentry>
49459 <varlistentry>
49460 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
49461 <listitem>
49462 <para>
49463 <indexterm role="concept">
49464 <primary><option>hosts</option> ACL condition</primary>
49465 </indexterm>
49466 <indexterm role="concept">
49467 <primary>host</primary>
49468 <secondary>ACL checking</secondary>
49469 </indexterm>
49470 <indexterm role="concept">
49471 <primary>access control lists (ACLs)</primary>
49472 <secondary>testing the client host</secondary>
49473 </indexterm>
49474 This condition tests that the calling host matches the host list. If you have
49475 name lookups or wildcarded host names and IP addresses in the same host list,
49476 you should normally put the IP addresses first. For example, you could have:
49477 </para>
49478 <literallayout class="monospaced">
49479 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
49480 </literallayout>
49481 <para>
49482 The lookup in this example uses the host name for its key. This is implied by
49483 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
49484 and it wouldn&#x2019;t matter which way round you had these two items.)
49485 </para>
49486 <para>
49487 The reason for the problem with host names lies in the left-to-right way that
49488 Exim processes lists. It can test IP addresses without doing any DNS lookups,
49489 but when it reaches an item that requires a host name, it fails if it cannot
49490 find a host name to compare with the pattern. If the above list is given in the
49491 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
49492 found, even if its IP address is 10.9.8.7.
49493 </para>
49494 <para>
49495 If you really do want to do the name check first, and still recognize the IP
49496 address even if the name lookup fails, you can rewrite the ACL like this:
49497 </para>
49498 <literallayout class="monospaced">
49499 accept hosts = dbm;/etc/friendly/hosts
49500 accept hosts = 10.9.8.7
49501 </literallayout>
49502 <para>
49503 The default action on failing to find the host name is to assume that the host
49504 is not in the list, so the first <option>accept</option> statement fails. The second
49505 statement can then check the IP address.
49506 </para>
49507 <para>
49508 <indexterm role="variable">
49509 <primary><varname>$host_data</varname></primary>
49510 </indexterm>
49511 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
49512 of the lookup is made available in the <varname>$host_data</varname> variable. This
49513 allows you, for example, to set up a statement like this:
49514 </para>
49515 <literallayout class="monospaced">
49516 deny  hosts = net-lsearch;/some/file
49517 message = $host_data
49518 </literallayout>
49519 <para>
49520 which gives a custom error message for each denied host.
49521 </para>
49522 </listitem></varlistentry>
49523 <varlistentry>
49524 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
49525 <listitem>
49526 <para>
49527 <indexterm role="concept">
49528 <primary><option>local_parts</option> ACL condition</primary>
49529 </indexterm>
49530 <indexterm role="concept">
49531 <primary>local part</primary>
49532 <secondary>ACL checking</secondary>
49533 </indexterm>
49534 <indexterm role="concept">
49535 <primary>access control lists (ACLs)</primary>
49536 <secondary>testing a local part</secondary>
49537 </indexterm>
49538 <indexterm role="variable">
49539 <primary><varname>$local_part_data</varname></primary>
49540 </indexterm>
49541 This condition is relevant only after a RCPT command. It checks that the local
49542 part of the recipient address is in the list. If percent-hack processing is
49543 enabled, it is done before this test. If the check succeeds with a lookup, the
49544 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
49545 the next <option>local_parts</option> test.
49546 </para>
49547 </listitem></varlistentry>
49548 <varlistentry>
49549 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
49550 <listitem>
49551 <para>
49552 <indexterm role="concept">
49553 <primary><option>malware</option> ACL condition</primary>
49554 </indexterm>
49555 <indexterm role="concept">
49556 <primary>access control lists (ACLs)</primary>
49557 <secondary>virus scanning</secondary>
49558 </indexterm>
49559 <indexterm role="concept">
49560 <primary>access control lists (ACLs)</primary>
49561 <secondary>scanning for viruses</secondary>
49562 </indexterm>
49563 This condition is available only when Exim is compiled with the
49564 content-scanning extension. It causes the incoming message to be scanned for
49565 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
49566 </para>
49567 </listitem></varlistentry>
49568 <varlistentry>
49569 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
49570 <listitem>
49571 <para>
49572 <indexterm role="concept">
49573 <primary><option>mime_regex</option> ACL condition</primary>
49574 </indexterm>
49575 <indexterm role="concept">
49576 <primary>access control lists (ACLs)</primary>
49577 <secondary>testing by regex matching</secondary>
49578 </indexterm>
49579 This condition is available only when Exim is compiled with the
49580 content-scanning extension, and it is allowed only in the ACL defined by
49581 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
49582 with any of the regular expressions. For details, see chapter
49583 <xref linkend="CHAPexiscan"/>.
49584 </para>
49585 </listitem></varlistentry>
49586 <varlistentry>
49587 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
49588 <listitem>
49589 <para>
49590 <indexterm role="concept">
49591 <primary>rate limiting</primary>
49592 </indexterm>
49593 This condition can be used to limit the rate at which a user or host submits
49594 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
49595 </para>
49596 </listitem></varlistentry>
49597 <varlistentry>
49598 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
49599 <listitem>
49600 <para>
49601 <indexterm role="concept">
49602 <primary><option>recipients</option> ACL condition</primary>
49603 </indexterm>
49604 <indexterm role="concept">
49605 <primary>recipient</primary>
49606 <secondary>ACL checking</secondary>
49607 </indexterm>
49608 <indexterm role="concept">
49609 <primary>access control lists (ACLs)</primary>
49610 <secondary>testing a recipient</secondary>
49611 </indexterm>
49612 This condition is relevant only after a RCPT command. It checks the entire
49613 recipient address against a list of recipients.
49614 </para>
49615 </listitem></varlistentry>
49616 <varlistentry>
49617 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
49618 <listitem>
49619 <para>
49620 <indexterm role="concept">
49621 <primary><option>regex</option> ACL condition</primary>
49622 </indexterm>
49623 <indexterm role="concept">
49624 <primary>access control lists (ACLs)</primary>
49625 <secondary>testing by regex matching</secondary>
49626 </indexterm>
49627 This condition is available only when Exim is compiled with the
49628 content-scanning extension, and is available only in the DATA, MIME, and
49629 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
49630 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
49631 </para>
49632 </listitem></varlistentry>
49633 <varlistentry>
49634 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
49635 <listitem>
49636 <para>
49637 <indexterm role="concept">
49638 <primary><option>sender_domains</option> ACL condition</primary>
49639 </indexterm>
49640 <indexterm role="concept">
49641 <primary>sender</primary>
49642 <secondary>ACL checking</secondary>
49643 </indexterm>
49644 <indexterm role="concept">
49645 <primary>access control lists (ACLs)</primary>
49646 <secondary>testing a sender domain</secondary>
49647 </indexterm>
49648 <indexterm role="variable">
49649 <primary><varname>$domain</varname></primary>
49650 </indexterm>
49651 <indexterm role="variable">
49652 <primary><varname>$sender_address_domain</varname></primary>
49653 </indexterm>
49654 This condition tests the domain of the sender of the message against the given
49655 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
49656 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
49657 of this condition. This is an exception to the general rule for testing domain
49658 lists. It is done this way so that, if this condition is used in an ACL for a
49659 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
49660 influence the sender checking.
49661 </para>
49662 <para>
49663 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49664 relaying, because sender addresses are easily, and commonly, forged.
49665 </para>
49666 </listitem></varlistentry>
49667 <varlistentry>
49668 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
49669 <listitem>
49670 <para>
49671 <indexterm role="concept">
49672 <primary><option>senders</option> ACL condition</primary>
49673 </indexterm>
49674 <indexterm role="concept">
49675 <primary>sender</primary>
49676 <secondary>ACL checking</secondary>
49677 </indexterm>
49678 <indexterm role="concept">
49679 <primary>access control lists (ACLs)</primary>
49680 <secondary>testing a sender</secondary>
49681 </indexterm>
49682 This condition tests the sender of the message against the given list. To test
49683 for a bounce message, which has an empty sender, set
49684 </para>
49685 <literallayout class="monospaced">
49686 senders = :
49687 </literallayout>
49688 <para>
49689 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49690 relaying, because sender addresses are easily, and commonly, forged.
49691 </para>
49692 </listitem></varlistentry>
49693 <varlistentry>
49694 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
49695 <listitem>
49696 <para>
49697 <indexterm role="concept">
49698 <primary><option>spam</option> ACL condition</primary>
49699 </indexterm>
49700 <indexterm role="concept">
49701 <primary>access control lists (ACLs)</primary>
49702 <secondary>scanning for spam</secondary>
49703 </indexterm>
49704 This condition is available only when Exim is compiled with the
49705 content-scanning extension. It causes the incoming message to be scanned by
49706 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
49707 </para>
49708 </listitem></varlistentry>
49709 <varlistentry>
49710 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
49711 <listitem>
49712 <para>
49713 <indexterm role="concept">
49714 <primary><option>verify</option> ACL condition</primary>
49715 </indexterm>
49716 <indexterm role="concept">
49717 <primary>TLS</primary>
49718 <secondary>client certificate verification</secondary>
49719 </indexterm>
49720 <indexterm role="concept">
49721 <primary>certificate</primary>
49722 <secondary>verification of client</secondary>
49723 </indexterm>
49724 <indexterm role="concept">
49725 <primary>access control lists (ACLs)</primary>
49726 <secondary>certificate verification</secondary>
49727 </indexterm>
49728 <indexterm role="concept">
49729 <primary>access control lists (ACLs)</primary>
49730 <secondary>testing a TLS certificate</secondary>
49731 </indexterm>
49732 This condition is true in an SMTP session if the session is encrypted, and a
49733 certificate was received from the client, and the certificate was verified. The
49734 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
49735 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
49736 </para>
49737 </listitem></varlistentry>
49738 <varlistentry>
49739 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
49740 <listitem>
49741 <para>
49742 <indexterm role="concept">
49743 <primary>CSA verification</primary>
49744 </indexterm>
49745 This condition checks whether the sending host (the client) is authorized to
49746 send email. Details of how this works are given in section
49747 <xref linkend="SECTverifyCSA"/>.
49748 </para>
49749 </listitem></varlistentry>
49750 <varlistentry>
49751 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49752 <listitem>
49753 <para>
49754 <indexterm role="concept">
49755 <primary><option>verify</option> ACL condition</primary>
49756 </indexterm>
49757 <indexterm role="concept">
49758 <primary>access control lists (ACLs)</primary>
49759 <secondary>verifying sender in the header</secondary>
49760 </indexterm>
49761 <indexterm role="concept">
49762 <primary>header lines</primary>
49763 <secondary>verifying the sender in</secondary>
49764 </indexterm>
49765 <indexterm role="concept">
49766 <primary>sender</primary>
49767 <secondary>verifying in header</secondary>
49768 </indexterm>
49769 <indexterm role="concept">
49770 <primary>verifying</primary>
49771 <secondary>sender in header</secondary>
49772 </indexterm>
49773 This condition is relevant only in an ACL that is run after a message has been
49774 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49775 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
49776 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
49777 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
49778 However, an address that appears in one of these headers need not be an address
49779 that accepts bounce messages; only sender addresses in envelopes are required
49780 to accept bounces. Therefore, if you use the callout option on this check, you
49781 might want to arrange for a non-empty address in the MAIL command.
49782 </para>
49783 <para>
49784 Details of address verification and the options are given later, starting at
49785 section <xref linkend="SECTaddressverification"/> (callouts are described in section
49786 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
49787 condition to restrict it to bounce messages only:
49788 </para>
49789 <literallayout class="monospaced">
49790 deny    senders = :
49791         message = A valid sender header is required for bounces
49792        !verify  = header_sender
49793 </literallayout>
49794 </listitem></varlistentry>
49795 <varlistentry>
49796 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
49797 <listitem>
49798 <para>
49799 <indexterm role="concept">
49800 <primary><option>verify</option> ACL condition</primary>
49801 </indexterm>
49802 <indexterm role="concept">
49803 <primary>access control lists (ACLs)</primary>
49804 <secondary>verifying header syntax</secondary>
49805 </indexterm>
49806 <indexterm role="concept">
49807 <primary>header lines</primary>
49808 <secondary>verifying syntax</secondary>
49809 </indexterm>
49810 <indexterm role="concept">
49811 <primary>verifying</primary>
49812 <secondary>header syntax</secondary>
49813 </indexterm>
49814 This condition is relevant only in an ACL that is run after a message has been
49815 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49816 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
49817 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
49818 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
49819 permitted only in locally generated messages and from hosts that match
49820 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
49821 appropriate.
49822 </para>
49823 <para>
49824 Note that this condition is a syntax check only. However, a common spamming
49825 ploy used to be to send syntactically invalid headers such as
49826 </para>
49827 <literallayout class="monospaced">
49828 To: @
49829 </literallayout>
49830 <para>
49831 and this condition can be used to reject such messages, though they are not as
49832 common as they used to be.
49833 </para>
49834 </listitem></varlistentry>
49835 <varlistentry>
49836 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
49837 <listitem>
49838 <para>
49839 <indexterm role="concept">
49840 <primary><option>verify</option> ACL condition</primary>
49841 </indexterm>
49842 <indexterm role="concept">
49843 <primary>access control lists (ACLs)</primary>
49844 <secondary>verifying HELO/EHLO</secondary>
49845 </indexterm>
49846 <indexterm role="concept">
49847 <primary>HELO</primary>
49848 <secondary>verifying</secondary>
49849 </indexterm>
49850 <indexterm role="concept">
49851 <primary>EHLO</primary>
49852 <secondary>verifying</secondary>
49853 </indexterm>
49854 <indexterm role="concept">
49855 <primary>verifying</primary>
49856 <secondary>EHLO</secondary>
49857 </indexterm>
49858 <indexterm role="concept">
49859 <primary>verifying</primary>
49860 <secondary>HELO</secondary>
49861 </indexterm>
49862 This condition is true if a HELO or EHLO command has been received from the
49863 client host, and its contents have been verified. If there has been no previous
49864 attempt to verify the HELO/EHLO contents, it is carried out when this
49865 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
49866 <option>helo_try_verify_hosts</option> options for details of how to request verification
49867 independently of this condition.
49868 </para>
49869 <para>
49870 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
49871 option), this condition is always true.
49872 </para>
49873 </listitem></varlistentry>
49874 <varlistentry>
49875 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
49876 <listitem>
49877 <para>
49878 <indexterm role="concept">
49879 <primary>verifying</primary>
49880 <secondary>not blind</secondary>
49881 </indexterm>
49882 <indexterm role="concept">
49883 <primary>bcc recipients, verifying none</primary>
49884 </indexterm>
49885 This condition checks that there are no blind (bcc) recipients in the message.
49886 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
49887 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
49888 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
49889 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
49890 used only in a DATA or non-SMTP ACL.
49891 </para>
49892 <para>
49893 There are, of course, many legitimate messages that make use of blind (bcc)
49894 recipients. This check should not be used on its own for blocking messages.
49895 </para>
49896 </listitem></varlistentry>
49897 <varlistentry>
49898 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49899 <listitem>
49900 <para>
49901 <indexterm role="concept">
49902 <primary><option>verify</option> ACL condition</primary>
49903 </indexterm>
49904 <indexterm role="concept">
49905 <primary>access control lists (ACLs)</primary>
49906 <secondary>verifying recipient</secondary>
49907 </indexterm>
49908 <indexterm role="concept">
49909 <primary>recipient</primary>
49910 <secondary>verifying</secondary>
49911 </indexterm>
49912 <indexterm role="concept">
49913 <primary>verifying</primary>
49914 <secondary>recipient</secondary>
49915 </indexterm>
49916 <indexterm role="variable">
49917 <primary><varname>$address_data</varname></primary>
49918 </indexterm>
49919 This condition is relevant only after a RCPT command. It verifies the current
49920 recipient. Details of address verification are given later, starting at section
49921 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
49922 of <varname>$address_data</varname> is the last value that was set while routing the address.
49923 This applies even if the verification fails. When an address that is being
49924 verified is redirected to a single address, verification continues with the new
49925 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
49926 value for the child address.
49927 </para>
49928 </listitem></varlistentry>
49929 <varlistentry>
49930 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
49931 <listitem>
49932 <para>
49933 <indexterm role="concept">
49934 <primary><option>verify</option> ACL condition</primary>
49935 </indexterm>
49936 <indexterm role="concept">
49937 <primary>access control lists (ACLs)</primary>
49938 <secondary>verifying host reverse lookup</secondary>
49939 </indexterm>
49940 <indexterm role="concept">
49941 <primary>host</primary>
49942 <secondary>verifying reverse lookup</secondary>
49943 </indexterm>
49944 This condition ensures that a verified host name has been looked up from the IP
49945 address of the client host. (This may have happened already if the host name
49946 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
49947 Verification ensures that the host name obtained from a reverse DNS lookup, or
49948 one of its aliases, does, when it is itself looked up in the DNS, yield the
49949 original IP address.
49950 </para>
49951 <para>
49952 If this condition is used for a locally generated message (that is, when there
49953 is no client host involved), it always succeeds.
49954 </para>
49955 </listitem></varlistentry>
49956 <varlistentry>
49957 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49958 <listitem>
49959 <para>
49960 <indexterm role="concept">
49961 <primary><option>verify</option> ACL condition</primary>
49962 </indexterm>
49963 <indexterm role="concept">
49964 <primary>access control lists (ACLs)</primary>
49965 <secondary>verifying sender</secondary>
49966 </indexterm>
49967 <indexterm role="concept">
49968 <primary>sender</primary>
49969 <secondary>verifying</secondary>
49970 </indexterm>
49971 <indexterm role="concept">
49972 <primary>verifying</primary>
49973 <secondary>sender</secondary>
49974 </indexterm>
49975 This condition is relevant only after a MAIL or RCPT command, or after a
49976 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
49977 the message&#x2019;s sender is empty (that is, this is a bounce message), the
49978 condition is true. Otherwise, the sender address is verified.
49979 </para>
49980 <para>
49981 <indexterm role="variable">
49982 <primary><varname>$address_data</varname></primary>
49983 </indexterm>
49984 <indexterm role="variable">
49985 <primary><varname>$sender_address_data</varname></primary>
49986 </indexterm>
49987 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
49988 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
49989 value can be used in subsequent conditions and modifiers in the same ACL
49990 statement. It does not persist after the end of the current statement. If you
49991 want to preserve the value for longer, you can save it in an ACL variable.
49992 </para>
49993 <para>
49994 Details of verification are given later, starting at section
49995 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
49996 to avoid doing it more than once per message.
49997 </para>
49998 </listitem></varlistentry>
49999 <varlistentry>
50000 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50001 <listitem>
50002 <para>
50003 <indexterm role="concept">
50004 <primary><option>verify</option> ACL condition</primary>
50005 </indexterm>
50006 This is a variation of the previous option, in which a modified address is
50007 verified as a sender.
50008 </para>
50009 </listitem></varlistentry>
50010 </variablelist>
50011 </section>
50012 <section id="SECTmorednslists">
50013 <title>Using DNS lists</title>
50014 <para>
50015 <indexterm role="concept">
50016 <primary>DNS list</primary>
50017 <secondary>in ACL</secondary>
50018 </indexterm>
50019 <indexterm role="concept">
50020 <primary>black list (DNS)</primary>
50021 </indexterm>
50022 <indexterm role="concept">
50023 <primary>access control lists (ACLs)</primary>
50024 <secondary>testing a DNS list</secondary>
50025 </indexterm>
50026 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
50027 is on at least one of a number of DNS lists by looking up the inverted IP
50028 address in one or more DNS domains. For example, if the calling host&#x2019;s IP
50029 address is 192.168.62.43, and the ACL statement is
50030 </para>
50031 <literallayout class="monospaced">
50032 deny dnslists = blackholes.mail-abuse.org : \
50033                 dialups.mail-abuse.org
50034 </literallayout>
50035 <para>
50036 the following records are looked up:
50037 </para>
50038 <literallayout class="monospaced">
50039 43.62.168.192.blackholes.mail-abuse.org
50040 43.62.168.192.dialups.mail-abuse.org
50041 </literallayout>
50042 <para>
50043 As soon as Exim finds an existing DNS record, processing of the list stops.
50044 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
50045 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
50046 use two separate conditions:
50047 </para>
50048 <literallayout class="monospaced">
50049 deny dnslists = blackholes.mail-abuse.org
50050      dnslists = dialups.mail-abuse.org
50051 </literallayout>
50052 <para>
50053 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
50054 behaves as if the host does not match the list item, that is, as if the DNS
50055 record does not exist. If there are further items in the DNS list, they are
50056 processed.
50057 </para>
50058 <para>
50059 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
50060 (which is the most common usage), because it prevents a DNS failure from
50061 blocking mail. However, you can change this behaviour by putting one of the
50062 following special items in the list:
50063 </para>
50064 <literallayout>
50065 <literal>+include_unknown </literal>   behave as if the item is on the list
50066 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
50067 <literal>+defer_unknown   </literal>   give a temporary error
50068 </literallayout>
50069 <para>
50070 <indexterm role="concept">
50071 <primary><literal>+include_unknown</literal></primary>
50072 </indexterm>
50073 <indexterm role="concept">
50074 <primary><literal>+exclude_unknown</literal></primary>
50075 </indexterm>
50076 <indexterm role="concept">
50077 <primary><literal>+defer_unknown</literal></primary>
50078 </indexterm>
50079 Each of these applies to any subsequent items on the list. For example:
50080 </para>
50081 <literallayout class="monospaced">
50082 deny dnslists = +defer_unknown : foo.bar.example
50083 </literallayout>
50084 <para>
50085 Testing the list of domains stops as soon as a match is found. If you want to
50086 warn for one list and block for another, you can use two different statements:
50087 </para>
50088 <literallayout class="monospaced">
50089 deny  dnslists = blackholes.mail-abuse.org
50090 warn  message  = X-Warn: sending host is on dialups list
50091       dnslists = dialups.mail-abuse.org
50092 </literallayout>
50093 <para>
50094 DNS list lookups are cached by Exim for the duration of the SMTP session,
50095 so a lookup based on the IP address is done at most once for any incoming
50096 connection. Exim does not share information between multiple incoming
50097 connections (but your local name server cache should be active).
50098 </para>
50099 </section>
50100 <section id="SECID201">
50101 <title>Specifying the IP address for a DNS list lookup</title>
50102 <para>
50103 <indexterm role="concept">
50104 <primary>DNS list</primary>
50105 <secondary>keyed by explicit IP address</secondary>
50106 </indexterm>
50107 By default, the IP address that is used in a DNS list lookup is the IP address
50108 of the calling host. However, you can specify another IP address by listing it
50109 after the domain name, introduced by a slash. For example:
50110 </para>
50111 <literallayout class="monospaced">
50112 deny dnslists = black.list.tld/192.168.1.2
50113 </literallayout>
50114 <para>
50115 This feature is not very helpful with explicit IP addresses; it is intended for
50116 use with IP addresses that are looked up, for example, the IP addresses of the
50117 MX hosts or nameservers of an email sender address. For an example, see section
50118 <xref linkend="SECTmulkeyfor"/> below.
50119 </para>
50120 </section>
50121 <section id="SECID202">
50122 <title>DNS lists keyed on domain names</title>
50123 <para>
50124 <indexterm role="concept">
50125 <primary>DNS list</primary>
50126 <secondary>keyed by domain name</secondary>
50127 </indexterm>
50128 There are some lists that are keyed on domain names rather than inverted IP
50129 addresses (see for example the <emphasis>domain based zones</emphasis> link at
50130 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
50131 with these lists. You can change the name that is looked up in a DNS list by
50132 listing it after the domain name, introduced by a slash. For example,
50133 </para>
50134 <literallayout class="monospaced">
50135 deny  message  = Sender's domain is listed at $dnslist_domain
50136       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
50137 </literallayout>
50138 <para>
50139 This particular example is useful only in ACLs that are obeyed after the
50140 RCPT or DATA commands, when a sender address is available. If (for
50141 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
50142 up by this example is
50143 </para>
50144 <literallayout class="monospaced">
50145 tld.example.dsn.rfc-ignorant.org
50146 </literallayout>
50147 <para>
50148 A single <option>dnslists</option> condition can contain entries for both names and IP
50149 addresses. For example:
50150 </para>
50151 <literallayout class="monospaced">
50152 deny dnslists = sbl.spamhaus.org : \
50153                 dsn.rfc-ignorant.org/$sender_address_domain
50154 </literallayout>
50155 <para>
50156 The first item checks the sending host&#x2019;s IP address; the second checks a domain
50157 name. The whole condition is true if either of the DNS lookups succeeds.
50158 </para>
50159 </section>
50160 <section id="SECTmulkeyfor">
50161 <title>Multiple explicit keys for a DNS list</title>
50162 <para>
50163 <indexterm role="concept">
50164 <primary>DNS list</primary>
50165 <secondary>multiple keys for</secondary>
50166 </indexterm>
50167 The syntax described above for looking up explicitly-defined values (either
50168 names or IP addresses) in a DNS blacklist is a simplification. After the domain
50169 name for the DNS list, what follows the slash can in fact be a list of items.
50170 As with all lists in Exim, the default separator is a colon. However, because
50171 this is a sublist within the list of DNS blacklist domains, it is necessary
50172 either to double the separators like this:
50173 </para>
50174 <literallayout class="monospaced">
50175 dnslists = black.list.tld/name.1::name.2
50176 </literallayout>
50177 <para>
50178 or to change the separator character, like this:
50179 </para>
50180 <literallayout class="monospaced">
50181 dnslists = black.list.tld/&lt;;name.1;name.2
50182 </literallayout>
50183 <para>
50184 If an item in the list is an IP address, it is inverted before the DNS
50185 blacklist domain is appended. If it is not an IP address, no inversion
50186 occurs. Consider this condition:
50187 </para>
50188 <literallayout class="monospaced">
50189 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
50190 </literallayout>
50191 <para>
50192 The DNS lookups that occur are:
50193 </para>
50194 <literallayout class="monospaced">
50195 2.1.168.192.black.list.tld
50196 a.domain.black.list.tld
50197 </literallayout>
50198 <para>
50199 Once a DNS record has been found (that matches a specific IP return
50200 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
50201 are done. If there is a temporary DNS error, the rest of the sublist of domains
50202 or IP addresses is tried. A temporary error for the whole dnslists item occurs
50203 only if no other DNS lookup in this sublist succeeds. In other words, a
50204 successful lookup for any of the items in the sublist overrides a temporary
50205 error for a previous item.
50206 </para>
50207 <para>
50208 The ability to supply a list of items after the slash is in some sense just a
50209 syntactic convenience. These two examples have the same effect:
50210 </para>
50211 <literallayout class="monospaced">
50212 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
50213 dnslists = black.list.tld/a.domain::b.domain
50214 </literallayout>
50215 <para>
50216 However, when the data for the list is obtained from a lookup, the second form
50217 is usually much more convenient. Consider this example:
50218 </para>
50219 <literallayout class="monospaced">
50220 deny message  = The mail servers for the domain \
50221                 $sender_address_domain \
50222                 are listed at $dnslist_domain ($dnslist_value); \
50223                 see $dnslist_text.
50224      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
50225                                    ${lookup dnsdb {&gt;|mxh=\
50226                                    $sender_address_domain} }} }
50227 </literallayout>
50228 <para>
50229 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
50230 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
50231 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
50232 of expanding the condition might be something like this:
50233 </para>
50234 <literallayout class="monospaced">
50235 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
50236 </literallayout>
50237 <para>
50238 Thus, this example checks whether or not the IP addresses of the sender
50239 domain&#x2019;s mail servers are on the Spamhaus black list.
50240 </para>
50241 <para revisionflag="changed">
50242 The key that was used for a successful DNS list lookup is put into the variable
50243 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
50244 </para>
50245 </section>
50246 <section id="SECID203">
50247 <title>Data returned by DNS lists</title>
50248 <para>
50249 <indexterm role="concept">
50250 <primary>DNS list</primary>
50251 <secondary>data returned from</secondary>
50252 </indexterm>
50253 DNS lists are constructed using address records in the DNS. The original RBL
50254 just used the address 127.0.0.1 on the right hand side of each record, but the
50255 RBL+ list and some other lists use a number of values with different meanings.
50256 The values used on the RBL+ list are:
50257 </para>
50258 <literallayout>
50259 127.1.0.1  RBL
50260 127.1.0.2  DUL
50261 127.1.0.3  DUL and RBL
50262 127.1.0.4  RSS
50263 127.1.0.5  RSS and RBL
50264 127.1.0.6  RSS and DUL
50265 127.1.0.7  RSS and DUL and RBL
50266 </literallayout>
50267 <para>
50268 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
50269 different values. Some DNS lists may return more than one address record;
50270 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
50271 </para>
50272 </section>
50273 <section id="SECID204">
50274 <title>Variables set from DNS lists</title>
50275 <para revisionflag="changed">
50276 <indexterm role="concept">
50277 <primary>expansion</primary>
50278 <secondary>variables, set from DNS list</secondary>
50279 </indexterm>
50280 <indexterm role="concept">
50281 <primary>DNS list</primary>
50282 <secondary>variables set from</secondary>
50283 </indexterm>
50284 <indexterm role="variable">
50285 <primary><varname>$dnslist_domain</varname></primary>
50286 </indexterm>
50287 <indexterm role="variable">
50288 <primary><varname>$dnslist_matched</varname></primary>
50289 </indexterm>
50290 <indexterm role="variable">
50291 <primary><varname>$dnslist_text</varname></primary>
50292 </indexterm>
50293 <indexterm role="variable">
50294 <primary><varname>$dnslist_value</varname></primary>
50295 </indexterm>
50296 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
50297 the name of the overall domain that matched (for example,
50298 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
50299 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
50300 the DNS record. When the key is an IP address, it is not reversed in
50301 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
50302 cases, for example:
50303 </para>
50304 <literallayout class="monospaced" revisionflag="changed">
50305 deny dnslists = spamhaus.example
50306 </literallayout>
50307 <para revisionflag="changed">
50308 the key is also available in another variable (in this case,
50309 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
50310 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
50311 might generate a dnslists lookup like this:
50312 </para>
50313 <literallayout class="monospaced" revisionflag="changed">
50314 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
50315 </literallayout>
50316 <para revisionflag="changed">
50317 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
50318 <literal>192.168.6.7</literal> (for example).
50319 </para>
50320 <para>
50321 If more than one address record is returned by the DNS lookup, all the IP
50322 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
50323 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
50324 record. For lists such as RBL+ the TXT record for a merged entry is often not
50325 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
50326 information.
50327 </para>
50328 <para>
50329 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
50330 &ndash; although these appear before the condition in the ACL, they are not
50331 expanded until after it has failed. For example:
50332 </para>
50333 <literallayout class="monospaced">
50334 deny    hosts = !+local_networks
50335         message = $sender_host_address is listed \
50336                   at $dnslist_domain
50337         dnslists = rbl-plus.mail-abuse.example
50338 </literallayout>
50339 </section>
50340 <section id="SECTaddmatcon">
50341 <title>Additional matching conditions for DNS lists</title>
50342 <para>
50343 <indexterm role="concept">
50344 <primary>DNS list</primary>
50345 <secondary>matching specific returned data</secondary>
50346 </indexterm>
50347 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
50348 in order to restrict its action to DNS records with a matching right hand side.
50349 For example,
50350 </para>
50351 <literallayout class="monospaced">
50352 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
50353 </literallayout>
50354 <para>
50355 rejects only those hosts that yield 127.0.0.2. Without this additional data,
50356 any address record is considered to be a match. For the moment, we assume
50357 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
50358 describes how multiple records are handled.
50359 </para>
50360 <para>
50361 More than one IP address may be given for checking, using a comma as a
50362 separator. These are alternatives &ndash; if any one of them matches, the
50363 <option>dnslists</option> condition is true. For example:
50364 </para>
50365 <literallayout class="monospaced">
50366 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
50367 </literallayout>
50368 <para>
50369 If you want to specify a constraining address list and also specify names or IP
50370 addresses to be looked up, the constraining address list must be specified
50371 first. For example:
50372 </para>
50373 <literallayout class="monospaced">
50374 deny dnslists = dsn.rfc-ignorant.org\
50375                 =127.0.0.2/$sender_address_domain
50376 </literallayout>
50377 <para>
50378 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
50379 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
50380 In other words, the listed addresses are used as bit masks. The comparison is
50381 true if all the bits in the mask are present in the address that is being
50382 tested. For example:
50383 </para>
50384 <literallayout class="monospaced">
50385 dnslists = a.b.c&amp;0.0.0.3
50386 </literallayout>
50387 <para>
50388 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
50389 want to test whether one bit or another bit is present (as opposed to both
50390 being present), you must use multiple values. For example:
50391 </para>
50392 <literallayout class="monospaced">
50393 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
50394 </literallayout>
50395 <para>
50396 matches if the final component of the address is an odd number or two times
50397 an odd number.
50398 </para>
50399 </section>
50400 <section id="SECID205">
50401 <title>Negated DNS matching conditions</title>
50402 <para>
50403 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
50404 condition. Whereas
50405 </para>
50406 <literallayout class="monospaced">
50407 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
50408 </literallayout>
50409 <para>
50410 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50411 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
50412 </para>
50413 <literallayout class="monospaced">
50414 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
50415 </literallayout>
50416 <para>
50417 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50418 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
50419 words, the result of the test is inverted if an exclamation mark appears before
50420 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
50421 </para>
50422 <para>
50423 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
50424 host, or address list (which is why the syntax is different).
50425 </para>
50426 <para>
50427 If you are using just one list, the negation syntax does not gain you much. The
50428 previous example is precisely equivalent to
50429 </para>
50430 <literallayout class="monospaced">
50431 deny  dnslists = a.b.c
50432      !dnslists = a.b.c=127.0.0.2,127.0.0.3
50433 </literallayout>
50434 <para>
50435 However, if you are using multiple lists, the negation syntax is clearer.
50436 Consider this example:
50437 </para>
50438 <literallayout class="monospaced">
50439 deny  dnslists = sbl.spamhaus.org : \
50440                  list.dsbl.org : \
50441                  dnsbl.njabl.org!=127.0.0.3 : \
50442                  relays.ordb.org
50443 </literallayout>
50444 <para>
50445 Using only positive lists, this would have to be:
50446 </para>
50447 <literallayout class="monospaced">
50448 deny  dnslists = sbl.spamhaus.org : \
50449                  list.dsbl.org
50450 deny  dnslists = dnsbl.njabl.org
50451      !dnslists = dnsbl.njabl.org=127.0.0.3
50452 deny  dnslists = relays.ordb.org
50453 </literallayout>
50454 <para>
50455 which is less clear, and harder to maintain.
50456 </para>
50457 </section>
50458 <section id="SECThanmuldnsrec">
50459 <title>Handling multiple DNS records from a DNS list</title>
50460 <para>
50461 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
50462 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
50463 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
50464 the match to specific results from the DNS lookup, there are two ways in which
50465 the checking can be handled. For example, consider the condition:
50466 </para>
50467 <literallayout class="monospaced">
50468 dnslists = a.b.c=127.0.0.1
50469 </literallayout>
50470 <para>
50471 What happens if the DNS lookup for the incoming IP address yields both
50472 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
50473 condition true because at least one given value was found, or is it false
50474 because at least one of the found values was not listed? And how does this
50475 affect negated conditions? Both possibilities are provided for with the help of
50476 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
50477 </para>
50478 <itemizedlist>
50479 <listitem>
50480 <para>
50481 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
50482 IP addresses matches one of the listed addresses. For the example above, the
50483 condition is true because 127.0.0.1 matches.
50484 </para>
50485 </listitem>
50486 <listitem>
50487 <para>
50488 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
50489 looked up IP addresses matches one of the listed addresses. If the condition is
50490 changed to:
50491 </para>
50492 <literallayout class="monospaced">
50493 dnslists = a.b.c==127.0.0.1
50494 </literallayout>
50495 <para>
50496 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50497 false because 127.0.0.2 is not listed. You would need to have:
50498 </para>
50499 <literallayout class="monospaced">
50500 dnslists = a.b.c==127.0.0.1,127.0.0.2
50501 </literallayout>
50502 <para>
50503 for the condition to be true.
50504 </para>
50505 </listitem>
50506 </itemizedlist>
50507 <para>
50508 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
50509 the precise opposite of the behaviour above. Thus:
50510 </para>
50511 <itemizedlist>
50512 <listitem>
50513 <para>
50514 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
50515 addresses matches one of the listed addresses. Consider:
50516 </para>
50517 <literallayout class="monospaced">
50518 dnslists = a.b.c!&amp;0.0.0.1
50519 </literallayout>
50520 <para>
50521 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50522 false because 127.0.0.1 matches.
50523 </para>
50524 </listitem>
50525 <listitem>
50526 <para>
50527 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true there is at least one
50528 looked up IP address that does not match. Consider:
50529 </para>
50530 <literallayout class="monospaced">
50531 dnslists = a.b.c!=&amp;0.0.0.1
50532 </literallayout>
50533 <para>
50534 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50535 true, because 127.0.0.2 does not match. You would need to have:
50536 </para>
50537 <literallayout class="monospaced">
50538 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
50539 </literallayout>
50540 <para>
50541 for the condition to be false.
50542 </para>
50543 </listitem>
50544 </itemizedlist>
50545 <para>
50546 When the DNS lookup yields only a single IP address, there is no difference
50547 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
50548 </para>
50549 </section>
50550 <section id="SECTmordetinf">
50551 <title>Detailed information from merged DNS lists</title>
50552 <para>
50553 <indexterm role="concept">
50554 <primary>DNS list</primary>
50555 <secondary>information from merged</secondary>
50556 </indexterm>
50557 When the facility for restricting the matching IP values in a DNS list is used,
50558 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
50559 the true reason for rejection. This happens when lists are merged and the IP
50560 address in the A record is used to distinguish them; unfortunately there is
50561 only one TXT record. One way round this is not to use merged lists, but that
50562 can be inefficient because it requires multiple DNS lookups where one would do
50563 in the vast majority of cases when the host of interest is not on any of the
50564 lists.
50565 </para>
50566 <para>
50567 A less inefficient way of solving this problem is available. If
50568 two domain names, comma-separated, are given, the second is used first to
50569 do an initial check, making use of any IP value restrictions that are set.
50570 If there is a match, the first domain is used, without any IP value
50571 restrictions, to get the TXT record. As a byproduct of this, there is also
50572 a check that the IP being tested is indeed on the first list. The first
50573 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
50574 </para>
50575 <literallayout class="monospaced">
50576 reject message  = \
50577          rejected because $sender_host_address is blacklisted \
50578          at $dnslist_domain\n$dnslist_text
50579        dnslists = \
50580          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
50581          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50582 </literallayout>
50583 <para>
50584 For the first blacklist item, this starts by doing a lookup in
50585 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
50586 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
50587 value, and as long as something is found, it looks for the corresponding TXT
50588 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
50589 The second blacklist item is processed similarly.
50590 </para>
50591 <para>
50592 If you are interested in more than one merged list, the same list must be
50593 given several times, but because the results of the DNS lookups are cached,
50594 the DNS calls themselves are not repeated. For example:
50595 </para>
50596 <literallayout class="monospaced">
50597 reject dnslists = \
50598          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
50599          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
50600          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
50601          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50602 </literallayout>
50603 <para>
50604 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
50605 values matches (or if no record is found), this is the only lookup that is
50606 done. Only if there is a match is one of the more specific lists consulted.
50607 </para>
50608 </section>
50609 <section id="SECTmorednslistslast">
50610 <title>DNS lists and IPv6</title>
50611 <para>
50612 <indexterm role="concept">
50613 <primary>IPv6</primary>
50614 <secondary>DNS black lists</secondary>
50615 </indexterm>
50616 <indexterm role="concept">
50617 <primary>DNS list</primary>
50618 <secondary>IPv6 usage</secondary>
50619 </indexterm>
50620 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
50621 nibble by nibble. For example, if the calling host&#x2019;s IP address is
50622 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
50623 </para>
50624 <literallayout class="monospaced">
50625 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
50626   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
50627 </literallayout>
50628 <para>
50629 (split over two lines here to fit on the page). Unfortunately, some of the DNS
50630 lists contain wildcard records, intended for IPv4, that interact badly with
50631 IPv6. For example, the DNS entry
50632 </para>
50633 <literallayout class="monospaced">
50634 *.3.some.list.example.    A    127.0.0.1
50635 </literallayout>
50636 <para>
50637 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
50638 Unfortunately, it also matches the entire 3::/4 IPv6 network.
50639 </para>
50640 <para>
50641 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
50642 <option>condition</option> condition, as in this example:
50643 </para>
50644 <literallayout class="monospaced">
50645 deny   condition = ${if isip4{$sender_host_address}}
50646        dnslists  = some.list.example
50647 </literallayout>
50648 </section>
50649 <section id="SECTratelimiting">
50650 <title>Rate limiting incoming messages</title>
50651 <para>
50652 <indexterm role="concept">
50653 <primary>rate limiting</primary>
50654 <secondary>client sending</secondary>
50655 </indexterm>
50656 <indexterm role="concept">
50657 <primary>limiting client sending rates</primary>
50658 </indexterm>
50659 <indexterm role="option">
50660 <primary><option>smtp_ratelimit_*</option></primary>
50661 </indexterm>
50662 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
50663 which clients can send email. This is more powerful than the
50664 <option>smtp_ratelimit_*</option> options, because those options control the rate of
50665 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
50666 works across all connections (concurrent and sequential) from the same client
50667 host. The syntax of the <option>ratelimit</option> condition is:
50668 </para>
50669 <literallayout>
50670 <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;
50671 </literallayout>
50672 <para>
50673 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
50674 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
50675 </para>
50676 <para>
50677 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
50678 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
50679 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
50680 of <emphasis>p</emphasis>.
50681 </para>
50682 <para>
50683 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
50684 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
50685 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
50686 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
50687 send in each time interval. It also specifies the number of messages permitted
50688 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
50689 constant, you can allow a client to send more messages in a burst without
50690 changing its overall sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
50691 both small, messages must be sent at an even rate.
50692 </para>
50693 <para>
50694 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
50695 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
50696 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
50697 instructions when it is run with no arguments.
50698 </para>
50699 <para>
50700 The key is used to look up the data for calculating the client&#x2019;s average
50701 sending rate. This data is stored in a database maintained by Exim in its spool
50702 directory, alongside the retry and other hints databases. The default key is
50703 <varname>$sender_host_address</varname>, which applies the limit to each client host IP address.
50704 By changing the key you can change how Exim identifies clients for the purpose
50705 of ratelimiting. For example, to limit the sending rate of each authenticated
50706 user, independent of the computer they are sending from, set the key to
50707 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
50708 example, <varname>$authenticated_id</varname> is only meaningful if the client has
50709 authenticated, and you can check with the <option>authenticated</option> ACL condition.
50710 </para>
50711 <para revisionflag="changed">
50712 If you want to limit the rate at which a recipient receives messages, you can
50713 use the key <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in
50714 a RCPT ACL.
50715 </para>
50716 <para>
50717 Internally, Exim includes the smoothing constant <emphasis>p</emphasis> and the options in the
50718 lookup key because they alter the meaning of the stored data. This is not true
50719 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
50720 still remember clients&#x2019; past behaviour, but if you alter the other ratelimit
50721 parameters Exim forgets past behaviour.
50722 </para>
50723 <para revisionflag="changed">
50724 Each <option>ratelimit</option> condition can have up to three options. One option
50725 specifies what Exim measures the rate of, and the second specifies how Exim
50726 handles excessively fast clients. The third option can be <literal>noupdate</literal>, to
50727 disable updating of the ratelimiting database (see section <xref linkend="rearatdat"/>).
50728 The options are separated by a slash, like the other parameters. They may
50729 appear in any order.
50730 </para>
50731 </section>
50732 <section id="ratoptmea">
50733 <title>Ratelimit options for what is being measured</title>
50734 <para>
50735 The <option>per_conn</option> option limits the client&#x2019;s connection rate.
50736 </para>
50737 <para>
50738 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
50739 the default if none of the <option>per_*</option> options is specified.
50740 </para>
50741 <para>
50742 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. Note that it is
50743 best to use this option in the DATA ACL; if it is used in an earlier ACL it
50744 relies on the SIZE parameter on the MAIL command, which may be inaccurate or
50745 completely missing. You can follow the limit <emphasis>m</emphasis> in the configuration with K,
50746 M, or G to specify limits in kilobytes, megabytes, or gigabytes, respectively.
50747 </para>
50748 <para>
50749 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
50750 condition is processed. This can be used to limit the SMTP command rate. The
50751 alias <option>per_rcpt</option> is provided for use in the RCPT ACL instead of <option>per_cmd</option>
50752 to make it clear that the effect is to limit the rate at which recipients are
50753 accepted. Note that in this case the rate limiting engine will see a message
50754 with many recipients as a large high-speed burst.
50755 </para>
50756 </section>
50757 <section id="ratophanfas">
50758 <title>Ratelimit options for handling fast clients</title>
50759 <para>
50760 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
50761 engine can react in two possible ways, depending on the presence of the
50762 <option>strict</option> or <option>leaky</option> options. This is independent of the other
50763 counter-measures (such as rejecting the message) that may be specified by the
50764 rest of the ACL. The default mode is leaky, which avoids a sender&#x2019;s
50765 over-aggressive retry rate preventing it from getting any email through.
50766 </para>
50767 <para>
50768 The <option>strict</option> option means that the client&#x2019;s recorded rate is always updated.
50769 The effect of this is that Exim measures the client&#x2019;s average rate of attempts
50770 to send email, which can be much higher than the maximum <phrase revisionflag="changed">it is actually
50771 allowed. If the client is over the limit it may be subjected to
50772 counter-measures in the ACL until it slows down below the maximum rate.</phrase> The
50773 smoothing period determines the time it takes for a high sending rate to decay
50774 exponentially to 37% of its peak value, which means that you can work out the
50775 time (the number of smoothing periods) that a client is subjected to
50776 counter-measures after an over-limit burst with this formula:
50777 </para>
50778 <literallayout class="monospaced">
50779 ln(peakrate/maxrate)
50780 </literallayout>
50781 <para>
50782 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
50783 updated if it is above the limit. The effect of this is that Exim measures the
50784 client&#x2019;s average rate of successfully sent email, which cannot be greater than
50785 the maximum allowed. If the client is over the limit it may suffer some
50786 counter-measures (as specified in the ACL), but it will still be able to send
50787 email at the configured maximum rate, whatever the rate of its attempts. This
50788 is generally the better choice if you have clients that retry automatically.
50789 </para>
50790 </section>
50791 <section id="useratlim">
50792 <title>Using rate limiting</title>
50793 <para>
50794 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
50795 when the rate limit is exceeded. This might be anything from logging a warning
50796 (for example, while measuring existing sending rates in order to define
50797 policy), through time delays to slow down fast senders, up to rejecting the
50798 message. For example:
50799 </para>
50800 <literallayout class="monospaced">
50801 # Log all senders' rates
50802 warn ratelimit = 0 / 1h / strict
50803      log_message = Sender rate $sender_rate / $sender_rate_period
50804
50805 # Slow down fast senders; note the need to truncate $sender_rate
50806 # at the decimal point.
50807 warn ratelimit = 100 / 1h / per_rcpt / strict
50808      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
50809                    $sender_rate_limit }s
50810
50811 # Keep authenticated users under control
50812 deny authenticated = *
50813      ratelimit = 100 / 1d / strict / $authenticated_id
50814
50815 # System-wide rate limit
50816 defer message = Sorry, too busy. Try again later.
50817      ratelimit = 10 / 1s / $primary_hostname
50818
50819 # Restrict incoming rate from each host, with a default
50820 # set using a macro and special cases looked up in a table.
50821 defer message = Sender rate exceeds $sender_rate_limit \
50822                messages per $sender_rate_period
50823      ratelimit = ${lookup {$sender_host_address} \
50824                    cdb {DB/ratelimits.cdb} \
50825                    {$value} {RATELIMIT} }
50826 </literallayout>
50827 <para>
50828 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
50829 especially with the <option>per_rcpt</option> option, you may suffer from a performance
50830 bottleneck caused by locking on the ratelimit hints database. Apart from
50831 making your ACLs less complicated, you can reduce the problem by using a
50832 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
50833 this means that Exim will lose its hints data after a reboot (including retry
50834 hints, the callout cache, and ratelimit data).
50835 </para>
50836 </section>
50837 <section id="rearatdat" revisionflag="changed">
50838 <title>Reading ratelimit data without updating</title>
50839 <para revisionflag="changed">
50840 <indexterm role="concept">
50841 <primary>rate limitint</primary>
50842 <secondary>reading data without updating</secondary>
50843 </indexterm>
50844 If the <option>noupdate</option> option is present on a <option>ratelimit</option> ACL condition, Exim
50845 computes the rate and checks the limit as normal, but it does not update the
50846 saved data. This means that, in relevant ACLs, it is possible to lookup the
50847 existence of a specified (or auto-generated) ratelimit key without incrementing
50848 the ratelimit counter for that key. In order for this to be useful, another ACL
50849 entry must set the rate for the same key (otherwise it will always be zero).
50850 For example:
50851 </para>
50852 <literallayout class="monospaced" revisionflag="changed">
50853 acl_check_connect:
50854   deny ratelimit = 100 / 5m / strict / noupdate
50855        log_message = RATE: $sender_rate/$sender_rate_period \
50856                      (max $sender_rate_limit)
50857 </literallayout>
50858 <literallayout revisionflag="changed">
50859 <emphasis>... some other logic and tests...</emphasis>
50860 </literallayout>
50861 <literallayout class="monospaced" revisionflag="changed">
50862 acl_check_mail:
50863   warn ratelimit = 100 / 5m / strict / per_cmd
50864        condition = ${if le{$sender_rate}{$sender_rate_limit}}
50865        logwrite  = RATE UPDATE: $sender_rate/$sender_rate_period \
50866                      (max $sender_rate_limit)
50867 </literallayout>
50868 <para revisionflag="changed">
50869 In this example, the rate is tested and used to deny access (when it is too
50870 high) in the connect ACL, but the actual computation of the remembered rate
50871 happens later, on a per-command basis, in another ACL.
50872 </para>
50873 </section>
50874 <section id="SECTaddressverification">
50875 <title>Address verification</title>
50876 <para>
50877 <indexterm role="concept">
50878 <primary>verifying address</primary>
50879 <secondary>options for</secondary>
50880 </indexterm>
50881 <indexterm role="concept">
50882 <primary>policy control</primary>
50883 <secondary>address verification</secondary>
50884 </indexterm>
50885 Several of the <option>verify</option> conditions described in section
50886 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
50887 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
50888 The verification conditions can be followed by options that modify the
50889 verification process. The options are separated from the keyword and from each
50890 other by slashes, and some of them contain parameters. For example:
50891 </para>
50892 <literallayout class="monospaced">
50893 verify = sender/callout
50894 verify = recipient/defer_ok/callout=10s,defer_ok
50895 </literallayout>
50896 <para>
50897 The first stage of address verification, which always happens, is to run the
50898 address through the routers, in <quote>verify mode</quote>. Routers can detect the
50899 difference between verification and routing for delivery, and their actions can
50900 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
50901 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
50902 The available options are as follows:
50903 </para>
50904 <itemizedlist>
50905 <listitem>
50906 <para>
50907 If the <option>callout</option> option is specified, successful routing to one or more
50908 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
50909 check. Callouts and their sub-options are discussed in the next section.
50910 </para>
50911 </listitem>
50912 <listitem>
50913 <para>
50914 If there is a defer error while doing verification routing, the ACL
50915 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
50916 options, the condition is forced to be true instead. Note that this is a main
50917 verification option as well as a suboption for callouts.
50918 </para>
50919 </listitem>
50920 <listitem>
50921 <para>
50922 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
50923 discusses the reporting of sender address verification failures.
50924 </para>
50925 </listitem>
50926 <listitem>
50927 <para>
50928 The <option>success_on_redirect</option> option causes verification always to succeed
50929 immediately after a successful redirection. By default, if a redirection
50930 generates just one address, that address is also verified. See further
50931 discussion in section <xref linkend="SECTredirwhilveri"/>.
50932 </para>
50933 </listitem>
50934 </itemizedlist>
50935 <para>
50936 <indexterm role="concept">
50937 <primary>verifying address</primary>
50938 <secondary>differentiating failures</secondary>
50939 </indexterm>
50940 <indexterm role="variable">
50941 <primary><varname>$recipient_verify_failure</varname></primary>
50942 </indexterm>
50943 <indexterm role="variable">
50944 <primary><varname>$sender_verify_failure</varname></primary>
50945 </indexterm>
50946 <indexterm role="variable">
50947 <primary><varname>$acl_verify_message</varname></primary>
50948 </indexterm>
50949 After an address verification failure, <varname>$acl_verify_message</varname> contains the
50950 error message that is associated with the failure. It can be preserved by
50951 coding like this:
50952 </para>
50953 <literallayout class="monospaced">
50954 warn  !verify = sender
50955        set acl_m0 = $acl_verify_message
50956 </literallayout>
50957 <para>
50958 If you are writing your own custom rejection message or log message when
50959 denying access, you can use this variable to include information about the
50960 verification failure.
50961 </para>
50962 <para>
50963 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
50964 appropriate) contains one of the following words:
50965 </para>
50966 <itemizedlist>
50967 <listitem>
50968 <para>
50969 <option>qualify</option>: The address was unqualified (no domain), and the message
50970 was neither local nor came from an exempted host.
50971 </para>
50972 </listitem>
50973 <listitem>
50974 <para>
50975 <option>route</option>: Routing failed.
50976 </para>
50977 </listitem>
50978 <listitem>
50979 <para>
50980 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
50981 occurred at or before the MAIL command (that is, on initial
50982 connection, HELO, or MAIL).
50983 </para>
50984 </listitem>
50985 <listitem>
50986 <para>
50987 <option>recipient</option>: The RCPT command in a callout was rejected.
50988 </para>
50989 </listitem>
50990 <listitem>
50991 <para>
50992 <option>postmaster</option>: The postmaster check in a callout was rejected.
50993 </para>
50994 </listitem>
50995 </itemizedlist>
50996 <para>
50997 The main use of these variables is expected to be to distinguish between
50998 rejections of MAIL and rejections of RCPT in callouts.
50999 </para>
51000 </section>
51001 <section id="SECTcallver">
51002 <title>Callout verification</title>
51003 <para>
51004 <indexterm role="concept">
51005 <primary>verifying address</primary>
51006 <secondary>by callout</secondary>
51007 </indexterm>
51008 <indexterm role="concept">
51009 <primary>callout</primary>
51010 <secondary>verification</secondary>
51011 </indexterm>
51012 <indexterm role="concept">
51013 <primary>SMTP</primary>
51014 <secondary>callout verification</secondary>
51015 </indexterm>
51016 For non-local addresses, routing verifies the domain, but is unable to do any
51017 checking of the local part. There are situations where some means of verifying
51018 the local part is desirable. One way this can be done is to make an SMTP
51019 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
51020 a subsequent host for a recipient address, to see if the host accepts the
51021 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
51022 sender address, the callback is not to the client host that is trying to
51023 deliver the message, but to one of the hosts that accepts incoming mail for the
51024 sender&#x2019;s domain.
51025 </para>
51026 <para>
51027 Exim does not do callouts by default. If you want them to happen, you must
51028 request them by setting appropriate options on the <option>verify</option> condition, as
51029 described below. This facility should be used with care, because it can add a
51030 lot of resource usage to the cost of verifying an address. However, Exim does
51031 cache the results of callouts, which helps to reduce the cost. Details of
51032 caching are in section <xref linkend="SECTcallvercache"/>.
51033 </para>
51034 <para>
51035 Recipient callouts are usually used only between hosts that are controlled by
51036 the same administration. For example, a corporate gateway host could use
51037 callouts to check for valid recipients on an internal mailserver. A successful
51038 callout does not guarantee that a real delivery to the address would succeed;
51039 on the other hand, a failing callout does guarantee that a delivery would fail.
51040 </para>
51041 <para>
51042 If the <option>callout</option> option is present on a condition that verifies an address, a
51043 second stage of verification occurs if the address is successfully routed to
51044 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
51045 <command>manualroute</command> router, where the router specifies the hosts. However, if a
51046 router that does not set up hosts routes to an <command>smtp</command> transport with a
51047 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
51048 <option>hosts_override</option> set, its hosts are always used, whether or not the router
51049 supplies a host list.
51050 </para>
51051 <para>
51052 The port that is used is taken from the transport, if it is specified and is a
51053 remote transport. (For routers that do verification only, no transport need be
51054 specified.) Otherwise, the default SMTP port is used. If a remote transport
51055 specifies an outgoing interface, this is used; otherwise the interface is not
51056 specified. Likewise, the text that is used for the HELO command is taken from
51057 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
51058 <varname>$smtp_active_hostname</varname> is used.
51059 </para>
51060 <para>
51061 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
51062 test whether a bounce message could be delivered to the sender address. The
51063 following SMTP commands are sent:
51064 </para>
51065 <literallayout>
51066 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
51067 <literal>MAIL FROM:&lt;&gt;</literal>
51068 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
51069 <literal>QUIT</literal>
51070 </literallayout>
51071 <para>
51072 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
51073 set to <quote>lmtp</quote>.
51074 </para>
51075 <para>
51076 A recipient callout check is similar. By default, it also uses an empty address
51077 for the sender. This default is chosen because most hosts do not make use of
51078 the sender address when verifying a recipient. Using the same address means
51079 that a single cache entry can be used for each recipient. Some sites, however,
51080 do make use of the sender address when verifying. These are catered for by the
51081 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
51082 </para>
51083 <para>
51084 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
51085 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
51086 Exim tries the next host, if any. If there is a problem with all the remote
51087 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
51088 <option>callout</option> option is given, in which case the condition is forced to succeed.
51089 </para>
51090 <para>
51091 <indexterm role="concept">
51092 <primary>SMTP</primary>
51093 <secondary>output flushing, disabling for callout</secondary>
51094 </indexterm>
51095 A callout may take a little time. For this reason, Exim normally flushes SMTP
51096 output before performing a callout in an ACL, to avoid unexpected timeouts in
51097 clients when the SMTP PIPELINING extension is in use. The flushing can be
51098 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
51099 </para>
51100 </section>
51101 <section id="CALLaddparcall">
51102 <title>Additional parameters for callouts</title>
51103 <para>
51104 <indexterm role="concept">
51105 <primary>callout</primary>
51106 <secondary>additional parameters for</secondary>
51107 </indexterm>
51108 The <option>callout</option> option can be followed by an equals sign and a number of
51109 optional parameters, separated by commas. For example:
51110 </para>
51111 <literallayout class="monospaced">
51112 verify = recipient/callout=10s,defer_ok
51113 </literallayout>
51114 <para>
51115 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
51116 separate verify options, is retained for backwards compatibility, but is now
51117 deprecated. The additional parameters for <option>callout</option> are as follows:
51118 </para>
51119 <variablelist>
51120 <varlistentry>
51121 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
51122 <listitem>
51123 <para>
51124 <indexterm role="concept">
51125 <primary>callout</primary>
51126 <secondary>timeout, specifying</secondary>
51127 </indexterm>
51128 This specifies the timeout that applies for the callout attempt to each host.
51129 For example:
51130 </para>
51131 <literallayout class="monospaced">
51132 verify = sender/callout=5s
51133 </literallayout>
51134 <para>
51135 The default is 30 seconds. The timeout is used for each response from the
51136 remote host. It is also used for the initial connection, unless overridden by
51137 the <option>connect</option> parameter.
51138 </para>
51139 </listitem></varlistentry>
51140 <varlistentry>
51141 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
51142 <listitem>
51143 <para>
51144 <indexterm role="concept">
51145 <primary>callout</primary>
51146 <secondary>connection timeout, specifying</secondary>
51147 </indexterm>
51148 This parameter makes it possible to set a different (usually smaller) timeout
51149 for making the SMTP connection. For example:
51150 </para>
51151 <literallayout class="monospaced">
51152 verify = sender/callout=5s,connect=1s
51153 </literallayout>
51154 <para>
51155 If not specified, this timeout defaults to the general timeout value.
51156 </para>
51157 </listitem></varlistentry>
51158 <varlistentry>
51159 <term><emphasis role="bold">defer_ok</emphasis></term>
51160 <listitem>
51161 <para>
51162 <indexterm role="concept">
51163 <primary>callout</primary>
51164 <secondary>defer, action on</secondary>
51165 </indexterm>
51166 When this parameter is present, failure to contact any host, or any other kind
51167 of temporary error, is treated as success by the ACL. However, the cache is not
51168 updated in this circumstance.
51169 </para>
51170 </listitem></varlistentry>
51171 <varlistentry>
51172 <term><emphasis role="bold">fullpostmaster</emphasis></term>
51173 <listitem>
51174 <para>
51175 <indexterm role="concept">
51176 <primary>callout</primary>
51177 <secondary>full postmaster check</secondary>
51178 </indexterm>
51179 This operates like the <option>postmaster</option> option (see below), but if the check for
51180 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
51181 accordance with the specification in RFC 2821. The RFC states that the
51182 unqualified address <emphasis>postmaster</emphasis> should be accepted.
51183 </para>
51184 </listitem></varlistentry>
51185 <varlistentry>
51186 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
51187 <listitem>
51188 <para>
51189 <indexterm role="concept">
51190 <primary>callout</primary>
51191 <secondary>sender when verifying header</secondary>
51192 </indexterm>
51193 When verifying addresses in header lines using the <option>header_sender</option>
51194 verification option, Exim behaves by default as if the addresses are envelope
51195 sender addresses from a message. Callout verification therefore tests to see
51196 whether a bounce message could be delivered, by using an empty address in the
51197 MAIL command. However, it is arguable that these addresses might never be used
51198 as envelope senders, and could therefore justifiably reject bounce messages
51199 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
51200 address to use in the MAIL command. For example:
51201 </para>
51202 <literallayout class="monospaced">
51203 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
51204 </literallayout>
51205 <para>
51206 This parameter is available only for the <option>header_sender</option> verification option.
51207 </para>
51208 </listitem></varlistentry>
51209 <varlistentry>
51210 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
51211 <listitem>
51212 <para>
51213 <indexterm role="concept">
51214 <primary>callout</primary>
51215 <secondary>overall timeout, specifying</secondary>
51216 </indexterm>
51217 This parameter sets an overall timeout for performing a callout verification.
51218 For example:
51219 </para>
51220 <literallayout class="monospaced">
51221 verify = sender/callout=5s,maxwait=30s
51222 </literallayout>
51223 <para>
51224 This timeout defaults to four times the callout timeout for individual SMTP
51225 commands. The overall timeout applies when there is more than one host that can
51226 be tried. The timeout is checked before trying the next host. This prevents
51227 very long delays if there are a large number of hosts and all are timing out
51228 (for example, when network connections are timing out).
51229 </para>
51230 </listitem></varlistentry>
51231 <varlistentry>
51232 <term><emphasis role="bold">no_cache</emphasis></term>
51233 <listitem>
51234 <para>
51235 <indexterm role="concept">
51236 <primary>callout</primary>
51237 <secondary>cache, suppressing</secondary>
51238 </indexterm>
51239 <indexterm role="concept">
51240 <primary>caching callout, suppressing</primary>
51241 </indexterm>
51242 When this parameter is given, the callout cache is neither read nor updated.
51243 </para>
51244 </listitem></varlistentry>
51245 <varlistentry>
51246 <term><emphasis role="bold">postmaster</emphasis></term>
51247 <listitem>
51248 <para>
51249 <indexterm role="concept">
51250 <primary>callout</primary>
51251 <secondary>postmaster; checking</secondary>
51252 </indexterm>
51253 When this parameter is set, a successful callout check is followed by a similar
51254 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
51255 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
51256 the postmaster check is recorded in a cache record; if it is a failure, this is
51257 used to fail subsequent callouts for the domain without a connection being
51258 made, until the cache record expires.
51259 </para>
51260 </listitem></varlistentry>
51261 <varlistentry>
51262 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
51263 <listitem>
51264 <para>
51265 The postmaster check uses an empty sender in the MAIL command by default.
51266 You can use this parameter to do a postmaster check using a different address.
51267 For example:
51268 </para>
51269 <literallayout class="monospaced">
51270 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
51271 </literallayout>
51272 <para>
51273 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
51274 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
51275 </para>
51276 <literallayout class="monospaced">
51277 require  verify = sender/callout=postmaster_mailfrom=
51278 </literallayout>
51279 <para>
51280 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
51281 account of the sender address. It is assumed that either the empty address or
51282 a fixed non-empty address will be used. All that Exim remembers is that the
51283 postmaster check for the domain succeeded or failed.
51284 </para>
51285 </listitem></varlistentry>
51286 <varlistentry>
51287 <term><emphasis role="bold">random</emphasis></term>
51288 <listitem>
51289 <para>
51290 <indexterm role="concept">
51291 <primary>callout</primary>
51292 <secondary><quote>random</quote> check</secondary>
51293 </indexterm>
51294 When this parameter is set, before doing the normal callout check, Exim does a
51295 check for a <quote>random</quote> local part at the same domain. The local part is not
51296 really random &ndash; it is defined by the expansion of the option
51297 <option>callout_random_local_part</option>, which defaults to
51298 </para>
51299 <literallayout class="monospaced">
51300 $primary_host_name-$tod_epoch-testing
51301 </literallayout>
51302 <para>
51303 The idea here is to try to determine whether the remote host accepts all local
51304 parts without checking. If it does, there is no point in doing callouts for
51305 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
51306 a cache record, and used to force the current and subsequent callout checks to
51307 succeed without a connection being made, until the cache record expires.
51308 </para>
51309 </listitem></varlistentry>
51310 <varlistentry>
51311 <term><emphasis role="bold">use_postmaster</emphasis></term>
51312 <listitem>
51313 <para>
51314 <indexterm role="concept">
51315 <primary>callout</primary>
51316 <secondary>sender for recipient check</secondary>
51317 </indexterm>
51318 This parameter applies to recipient callouts only. For example:
51319 </para>
51320 <literallayout class="monospaced">
51321 deny  !verify = recipient/callout=use_postmaster
51322 </literallayout>
51323 <para>
51324 <indexterm role="variable">
51325 <primary><varname>$qualify_domain</varname></primary>
51326 </indexterm>
51327 It causes a non-empty postmaster address to be used in the MAIL command when
51328 performing the callout for the recipient, and also for a <quote>random</quote> check if
51329 that is configured. The local part of the address is <literal>postmaster</literal> and the
51330 domain is the contents of <varname>$qualify_domain</varname>.
51331 </para>
51332 </listitem></varlistentry>
51333 <varlistentry>
51334 <term><emphasis role="bold">use_sender</emphasis></term>
51335 <listitem>
51336 <para>
51337 This option applies to recipient callouts only. For example:
51338 </para>
51339 <literallayout class="monospaced">
51340 require  verify = recipient/callout=use_sender
51341 </literallayout>
51342 <para>
51343 It causes the message&#x2019;s actual sender address to be used in the MAIL
51344 command when performing the callout, instead of an empty address. There is no
51345 need to use this option unless you know that the called hosts make use of the
51346 sender when checking recipients. If used indiscriminately, it reduces the
51347 usefulness of callout caching.
51348 </para>
51349 </listitem></varlistentry>
51350 </variablelist>
51351 <para>
51352 If you use any of the parameters that set a non-empty sender for the MAIL
51353 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
51354 <option>use_sender</option>), you should think about possible loops. Recipient checking is
51355 usually done between two hosts that are under the same management, and the host
51356 that receives the callouts is not normally configured to do callouts itself.
51357 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
51358 these circumstances.
51359 </para>
51360 <para>
51361 However, if you use a non-empty sender address for a callout to an arbitrary
51362 host, there is the likelihood that the remote host will itself initiate a
51363 callout check back to your host. As it is checking what appears to be a message
51364 sender, it is likely to use an empty address in MAIL, thus avoiding a
51365 callout loop. However, to be on the safe side it would be best to set up your
51366 own ACLs so that they do not do sender verification checks when the recipient
51367 is the address you use for header sender or postmaster callout checking.
51368 </para>
51369 <para>
51370 Another issue to think about when using non-empty senders for callouts is
51371 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
51372 by the sender/recipient combination; thus, for any given recipient, many more
51373 actual callouts are performed than when an empty sender or postmaster is used.
51374 </para>
51375 </section>
51376 <section id="SECTcallvercache">
51377 <title>Callout caching</title>
51378 <para>
51379 <indexterm role="concept">
51380 <primary>hints database</primary>
51381 <secondary>callout cache</secondary>
51382 </indexterm>
51383 <indexterm role="concept">
51384 <primary>callout</primary>
51385 <secondary>cache, description of</secondary>
51386 </indexterm>
51387 <indexterm role="concept">
51388 <primary>caching</primary>
51389 <secondary>callout</secondary>
51390 </indexterm>
51391 Exim caches the results of callouts in order to reduce the amount of resources
51392 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
51393 option. A hints database called <quote>callout</quote> is used for the cache. Two
51394 different record types are used: one records the result of a callout check for
51395 a specific address, and the other records information that applies to the
51396 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
51397 </para>
51398 <para>
51399 When an original callout fails, a detailed SMTP error message is given about
51400 the failure. However, for subsequent failures use the cache data, this message
51401 is not available.
51402 </para>
51403 <para>
51404 The expiry times for negative and positive address cache records are
51405 independent, and can be set by the global options <option>callout_negative_expire</option>
51406 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
51407 </para>
51408 <para>
51409 If a host gives a negative response to an SMTP connection, or rejects any
51410 commands up to and including
51411 </para>
51412 <literallayout class="monospaced">
51413 MAIL FROM:&lt;&gt;
51414 </literallayout>
51415 <para>
51416 (but not including the MAIL command with a non-empty address),
51417 any callout attempt is bound to fail. Exim remembers such failures in a
51418 domain cache record, which it uses to fail callouts for the domain without
51419 making new connections, until the domain record times out. There are two
51420 separate expiry times for domain cache records:
51421 <option>callout_domain_negative_expire</option> (default 3h) and
51422 <option>callout_domain_positive_expire</option> (default 7d).
51423 </para>
51424 <para>
51425 Domain records expire when the negative expiry time is reached if callouts
51426 cannot be made for the domain, or if the postmaster check failed.
51427 Otherwise, they expire when the positive expiry time is reached. This
51428 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
51429 will eventually be noticed.
51430 </para>
51431 <para>
51432 The callout caching mechanism is based on the domain of the address that is
51433 being tested. If the domain routes to several hosts, it is assumed that their
51434 behaviour will be the same.
51435 </para>
51436 </section>
51437 <section id="SECTsenaddver">
51438 <title>Sender address verification reporting</title>
51439 <para>
51440 <indexterm role="concept">
51441 <primary>verifying</primary>
51442 <secondary>suppressing error details</secondary>
51443 </indexterm>
51444 See section <xref linkend="SECTaddressverification"/> for a general discussion of
51445 verification. When sender verification fails in an ACL, the details of the
51446 failure are given as additional output lines before the 550 response to the
51447 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
51448 you might see:
51449 </para>
51450 <literallayout class="monospaced">
51451 MAIL FROM:&lt;xyz@abc.example&gt;
51452 250 OK
51453 RCPT TO:&lt;pqr@def.example&gt;
51454 550-Verification failed for &lt;xyz@abc.example&gt;
51455 550-Called:   192.168.34.43
51456 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
51457 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
51458 550 Sender verification failed
51459 </literallayout>
51460 <para>
51461 If more than one RCPT command fails in the same way, the details are given
51462 only for the first of them. However, some administrators do not want to send
51463 out this much information. You can suppress the details by adding
51464 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
51465 example:
51466 </para>
51467 <literallayout class="monospaced">
51468 verify = sender/no_details
51469 </literallayout>
51470 </section>
51471 <section id="SECTredirwhilveri">
51472 <title>Redirection while verifying</title>
51473 <para>
51474 <indexterm role="concept">
51475 <primary>verifying</primary>
51476 <secondary>redirection while</secondary>
51477 </indexterm>
51478 <indexterm role="concept">
51479 <primary>address redirection</primary>
51480 <secondary>while verifying</secondary>
51481 </indexterm>
51482 A dilemma arises when a local address is redirected by aliasing or forwarding
51483 during verification: should the generated addresses themselves be verified,
51484 or should the successful expansion of the original address be enough to verify
51485 it? By default, Exim takes the following pragmatic approach:
51486 </para>
51487 <itemizedlist>
51488 <listitem>
51489 <para>
51490 When an incoming address is redirected to just one child address, verification
51491 continues with the child address, and if that fails to verify, the original
51492 verification also fails.
51493 </para>
51494 </listitem>
51495 <listitem>
51496 <para>
51497 When an incoming address is redirected to more than one child address,
51498 verification does not continue. A success result is returned.
51499 </para>
51500 </listitem>
51501 </itemizedlist>
51502 <para>
51503 This seems the most reasonable behaviour for the common use of aliasing as a
51504 way of redirecting different local parts to the same mailbox. It means, for
51505 example, that a pair of alias entries of the form
51506 </para>
51507 <literallayout class="monospaced">
51508 A.Wol:   aw123
51509 aw123:   :fail: Gone away, no forwarding address
51510 </literallayout>
51511 <para>
51512 work as expected, with both local parts causing verification failure. When a
51513 redirection generates more than one address, the behaviour is more like a
51514 mailing list, where the existence of the alias itself is sufficient for
51515 verification to succeed.
51516 </para>
51517 <para>
51518 It is possible, however, to change the default behaviour so that all successful
51519 redirections count as successful verifications, however many new addresses are
51520 generated. This is specified by the <option>success_on_redirect</option> verification
51521 option. For example:
51522 </para>
51523 <literallayout class="monospaced">
51524 require verify = recipient/success_on_redirect/callout=10s
51525 </literallayout>
51526 <para>
51527 In this example, verification succeeds if a router generates a new address, and
51528 the callout does not occur, because no address was routed to a remote host.
51529 </para>
51530 <para>
51531 When verification is being tested via the <option>-bv</option> option, the treatment of
51532 redirections is as just described, unless the <option>-v</option> or any debugging option is
51533 also specified. In that case, full verification is done for every generated
51534 address and a report is output for each of them.
51535 </para>
51536 </section>
51537 <section id="SECTverifyCSA">
51538 <title>Client SMTP authorization (CSA)</title>
51539 <para>
51540 <indexterm role="concept">
51541 <primary>CSA</primary>
51542 <secondary>verifying</secondary>
51543 </indexterm>
51544 Client SMTP Authorization is a system that allows a site to advertise
51545 which machines are and are not permitted to send email. This is done by placing
51546 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
51547 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
51548 Authorization checks in Exim are performed by the ACL condition:
51549 </para>
51550 <literallayout class="monospaced">
51551 verify = csa
51552 </literallayout>
51553 <para>
51554 This fails if the client is not authorized. If there is a DNS problem, or if no
51555 valid CSA SRV record is found, or if the client is authorized, the condition
51556 succeeds. These three cases can be distinguished using the expansion variable
51557 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
51558 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
51559 be likely to cause problems for legitimate email.
51560 </para>
51561 <para>
51562 The error messages produced by the CSA code include slightly more
51563 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
51564 looking up the CSA SRV record, or problems looking up the CSA target
51565 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
51566 </para>
51567 <itemizedlist>
51568 <listitem>
51569 <para>
51570 The client&#x2019;s host name is explicitly not authorized.
51571 </para>
51572 </listitem>
51573 <listitem>
51574 <para>
51575 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
51576 </para>
51577 </listitem>
51578 <listitem>
51579 <para>
51580 The client&#x2019;s host name is authorized but it has no valid target IP addresses
51581 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
51582 </para>
51583 </listitem>
51584 <listitem>
51585 <para>
51586 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
51587 that all subdomains must be explicitly authorized.
51588 </para>
51589 </listitem>
51590 </itemizedlist>
51591 <para>
51592 The <option>csa</option> verification condition can take an argument which is the domain to
51593 use for the DNS query. The default is:
51594 </para>
51595 <literallayout class="monospaced">
51596 verify = csa/$sender_helo_name
51597 </literallayout>
51598 <para>
51599 This implementation includes an extension to CSA. If the query domain
51600 is an address literal such as [192.0.2.95], or if it is a bare IP
51601 address, Exim searches for CSA SRV records in the reverse DNS as if
51602 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
51603 meaningful to say:
51604 </para>
51605 <literallayout class="monospaced">
51606 verify = csa/$sender_host_address
51607 </literallayout>
51608 <para>
51609 In fact, this is the check that Exim performs if the client does not say HELO.
51610 This extension can be turned off by setting the main configuration option
51611 <option>dns_csa_use_reverse</option> to be false.
51612 </para>
51613 <para>
51614 If a CSA SRV record is not found for the domain itself, a search
51615 is performed through its parent domains for a record which might be
51616 making assertions about subdomains. The maximum depth of this search is limited
51617 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
51618 default. Exim does not look for CSA SRV records in a top level domain, so the
51619 default settings handle HELO domains as long as seven
51620 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
51621 of legitimate HELO domains.
51622 </para>
51623 <para>
51624 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
51625 direct SRV lookups, this is not sufficient because of the extra parent domain
51626 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
51627 addresses into lookups in the reverse DNS space. The result of a successful
51628 lookup such as:
51629 </para>
51630 <literallayout class="monospaced">
51631 ${lookup dnsdb {csa=$sender_helo_name}}
51632 </literallayout>
51633 <para>
51634 has two space-separated fields: an authorization code and a target host name.
51635 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
51636 authorization required but absent, or <quote>?</quote> for unknown.
51637 </para>
51638 </section>
51639 <section id="SECTverifyPRVS">
51640 <title>Bounce address tag validation</title>
51641 <para>
51642 <indexterm role="concept">
51643 <primary>BATV, verifying</primary>
51644 </indexterm>
51645 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
51646 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
51647 Genuine incoming bounce messages should therefore always be addressed to
51648 recipients that have a valid tag. This scheme is a way of detecting unwanted
51649 bounce messages caused by sender address forgeries (often called <quote>collateral
51650 spam</quote>), because the recipients of such messages do not include valid tags.
51651 </para>
51652 <para>
51653 There are two expansion items to help with the implementation of the BATV
51654 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
51655 the original envelope sender address by using a simple key to add a hash of the
51656 address and some time-based randomizing information. The <option>prvs</option> expansion
51657 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
51658 The syntax of these expansion items is described in section
51659 <xref linkend="SECTexpansionitems"/>.
51660 </para>
51661 <para>
51662 As an example, suppose the secret per-address keys are stored in an MySQL
51663 database. A query to look up the key for an address could be defined as a macro
51664 like this:
51665 </para>
51666 <literallayout class="monospaced">
51667 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
51668                 WHERE sender='${quote_mysql:$prvscheck_address}'\
51669                 }{$value}}
51670 </literallayout>
51671 <para>
51672 Suppose also that the senders who make use of BATV are defined by an address
51673 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
51674 use this:
51675 </para>
51676 <literallayout class="monospaced">
51677 # Bounces: drop unsigned addresses for BATV senders
51678 deny message = This address does not send an unsigned reverse path
51679      senders = :
51680      recipients = +batv_senders
51681
51682 # Bounces: In case of prvs-signed address, check signature.
51683 deny message = Invalid reverse path signature.
51684      senders = :
51685      condition  = ${prvscheck {$local_part@$domain}\
51686                   {PRVSCHECK_SQL}{1}}
51687      !condition = $prvscheck_result
51688 </literallayout>
51689 <para>
51690 The first statement rejects recipients for bounce messages that are addressed
51691 to plain BATV sender addresses, because it is known that BATV senders do not
51692 send out messages with plain sender addresses. The second statement rejects
51693 recipients that are prvs-signed, but with invalid signatures (either because
51694 the key is wrong, or the signature has timed out).
51695 </para>
51696 <para>
51697 A non-prvs-signed address is not rejected by the second statement, because the
51698 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
51699 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
51700 the first argument is a syntactically valid prvs-signed address, the yield is
51701 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
51702 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
51703 of the checks (empty for failure, <quote>1</quote> for success).
51704 </para>
51705 <para>
51706 There are two more issues you must consider when implementing prvs-signing.
51707 Firstly, you need to ensure that prvs-signed addresses are not blocked by your
51708 ACLs. A prvs-signed address contains a slash character, but the default Exim
51709 configuration contains this statement in the RCPT ACL:
51710 </para>
51711 <literallayout class="monospaced">
51712 deny    message       = Restricted characters in address
51713         domains       = +local_domains
51714         local_parts   = ^[.] : ^.*[@%!/|]
51715 </literallayout>
51716 <para>
51717 This is a conservative rule that blocks local parts that contain slashes. You
51718 should remove the slash in the last line.
51719 </para>
51720 <para>
51721 Secondly, you have to ensure that the routers accept prvs-signed addresses and
51722 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
51723 router to remove the signature with a configuration along these lines:
51724 </para>
51725 <literallayout class="monospaced">
51726 batv_redirect:
51727   driver = redirect
51728   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
51729 </literallayout>
51730 <para>
51731 This works because, if the third argument of <option>prvscheck</option> is empty, the result
51732 of the expansion of a prvs-signed address is the decoded value of the original
51733 address. This router should probably be the first of your routers that handles
51734 local addresses.
51735 </para>
51736 <para>
51737 To create BATV-signed addresses in the first place, a transport of this form
51738 can be used:
51739 </para>
51740 <literallayout class="monospaced">
51741 external_smtp_batv:
51742   driver = smtp
51743   return_path = ${prvs {$return_path} \
51744                        {${lookup mysql{SELECT \
51745                        secret FROM batv_prvs WHERE \
51746                        sender='${quote_mysql:$sender_address}'} \
51747                        {$value}fail}}}
51748 </literallayout>
51749 <para>
51750 If no key can be found for the existing return path, no signing takes place.
51751 </para>
51752 </section>
51753 <section id="SECTrelaycontrol">
51754 <title>Using an ACL to control relaying</title>
51755 <para>
51756 <indexterm role="concept">
51757 <primary>access control lists (ACLs)</primary>
51758 <secondary>relay control</secondary>
51759 </indexterm>
51760 <indexterm role="concept">
51761 <primary>relaying</primary>
51762 <secondary>control by ACL</secondary>
51763 </indexterm>
51764 <indexterm role="concept">
51765 <primary>policy control</primary>
51766 <secondary>relay control</secondary>
51767 </indexterm>
51768 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
51769 delivers it directly to another host as a result of a remote address contained
51770 within it. Redirecting a local address via an alias or forward file and then
51771 passing the message on to another host is not relaying,
51772 <indexterm role="concept">
51773 <primary><quote>percent hack</quote></primary>
51774 </indexterm>
51775 but a redirection as a result of the <quote>percent hack</quote> is.
51776 </para>
51777 <para>
51778 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
51779 A host which is acting as a gateway or an MX backup is concerned with incoming
51780 relaying from arbitrary hosts to a specific set of domains. On the other hand,
51781 a host which is acting as a smart host for a number of clients is concerned
51782 with outgoing relaying from those clients to the Internet at large. Often the
51783 same host is fulfilling both functions,
51784 but in principle these two kinds of relaying are entirely independent. What is
51785 not wanted is the transmission of mail from arbitrary remote hosts through your
51786 system to arbitrary domains.
51787 </para>
51788 <para>
51789 You can implement relay control by means of suitable statements in the ACL that
51790 runs for each RCPT command. For convenience, it is often easiest to use
51791 Exim&#x2019;s named list facility to define the domains and hosts involved. For
51792 example, suppose you want to do the following:
51793 </para>
51794 <itemizedlist>
51795 <listitem>
51796 <para>
51797 Deliver a number of domains to mailboxes on the local host (or process them
51798 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
51799 <emphasis>my.dom2.example</emphasis>.
51800 </para>
51801 </listitem>
51802 <listitem>
51803 <para>
51804 Relay mail for a number of other domains for which you are the secondary MX.
51805 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
51806 </para>
51807 </listitem>
51808 <listitem>
51809 <para>
51810 Relay mail from the hosts on your local LAN, to whatever domains are involved.
51811 Suppose your LAN is 192.168.45.0/24.
51812 </para>
51813 </listitem>
51814 </itemizedlist>
51815 <para>
51816 In the main part of the configuration, you put the following definitions:
51817 </para>
51818 <literallayout class="monospaced">
51819 domainlist local_domains = my.dom1.example : my.dom2.example
51820 domainlist relay_domains = friend1.example : friend2.example
51821 hostlist   relay_hosts   = 192.168.45.0/24
51822 </literallayout>
51823 <para>
51824 Now you can use these definitions in the ACL that is run for every RCPT
51825 command:
51826 </para>
51827 <literallayout class="monospaced">
51828 acl_check_rcpt:
51829   accept domains = +local_domains : +relay_domains
51830   accept hosts   = +relay_hosts
51831 </literallayout>
51832 <para>
51833 The first statement accepts any RCPT command that contains an address in
51834 the local or relay domains. For any other domain, control passes to the second
51835 statement, which accepts the command only if it comes from one of the relay
51836 hosts. In practice, you will probably want to make your ACL more sophisticated
51837 than this, for example, by including sender and recipient verification. The
51838 default configuration includes a more comprehensive example, which is described
51839 in chapter <xref linkend="CHAPdefconfil"/>.
51840 </para>
51841 </section>
51842 <section id="SECTcheralcon">
51843 <title>Checking a relay configuration</title>
51844 <para>
51845 <indexterm role="concept">
51846 <primary>relaying</primary>
51847 <secondary>checking control of</secondary>
51848 </indexterm>
51849 You can check the relay characteristics of your configuration in the same way
51850 that you can test any ACL behaviour for an incoming SMTP connection, by using
51851 the <option>-bh</option> option to run a fake SMTP session with which you interact.
51852 </para>
51853 <para>
51854 For specifically testing for unwanted relaying, the host
51855 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
51856 host from the host on which Exim is running, using the normal telnet port, you
51857 will see a normal telnet connection message and then quite a long delay. Be
51858 patient. The remote host is making an SMTP connection back to your host, and
51859 trying a number of common probes to test for open relay vulnerability. The
51860 results of the tests will eventually appear on your terminal.
51861 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
51862 </para>
51863 </section>
51864 </chapter>
51865
51866 <chapter id="CHAPexiscan">
51867 <title>Content scanning at ACL time</title>
51868 <para>
51869 <indexterm role="concept" id="IIDcosca" class="startofrange">
51870 <primary>content scanning</primary>
51871 <secondary>at ACL time</secondary>
51872 </indexterm>
51873 The extension of Exim to include content scanning at ACL time, formerly known
51874 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
51875 was integrated into the main source for Exim release 4.50, and Tom continues to
51876 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
51877 specification.
51878 </para>
51879 <para>
51880 It is also possible to scan the content of messages at other times. The
51881 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
51882 scanning after all the ACLs have run. A transport filter can be used to scan
51883 messages at delivery time (see the <option>transport_filter</option> option, described in
51884 chapter <xref linkend="CHAPtransportgeneric"/>).
51885 </para>
51886 <para>
51887 If you want to include the ACL-time content-scanning features when you compile
51888 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
51889 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
51890 </para>
51891 <itemizedlist>
51892 <listitem>
51893 <para>
51894 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
51895 for all MIME parts for SMTP and non-SMTP messages, respectively.
51896 </para>
51897 </listitem>
51898 <listitem>
51899 <para>
51900 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
51901 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
51902 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
51903 </para>
51904 </listitem>
51905 <listitem>
51906 <para>
51907 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
51908 of messages, or parts of messages, for debugging purposes.
51909 </para>
51910 </listitem>
51911 <listitem>
51912 <para>
51913 Additional expansion variables that are set in the new ACL and by the new
51914 conditions.
51915 </para>
51916 </listitem>
51917 <listitem>
51918 <para>
51919 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
51920 </para>
51921 </listitem>
51922 </itemizedlist>
51923 <para>
51924 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
51925 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
51926 condition is compiled, in addition to all the other content-scanning features.
51927 </para>
51928 <para>
51929 Content-scanning is continually evolving, and new features are still being
51930 added. While such features are still unstable and liable to incompatible
51931 changes, they are made available in Exim by setting options whose names begin
51932 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
51933 this manual. You can find out about them by reading the file called
51934 <filename>doc/experimental.txt</filename>.
51935 </para>
51936 <para>
51937 All the content-scanning facilities work on a MBOX copy of the message that is
51938 temporarily created in a file called:
51939 </para>
51940 <literallayout>
51941 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
51942 </literallayout>
51943 <para>
51944 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
51945 expect an MBOX-like structure inside that file. The file is created when the
51946 first content scanning facility is called. Subsequent calls to content
51947 scanning conditions open the same file again. The directory is recursively
51948 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
51949 </para>
51950 <literallayout class="monospaced">
51951 control = no_mbox_unspool
51952 </literallayout>
51953 <para>
51954 has been encountered. When the MIME ACL decodes files, they are put into the
51955 same directory by default.
51956 </para>
51957 <section id="SECTscanvirus">
51958 <title>Scanning for viruses</title>
51959 <para>
51960 <indexterm role="concept">
51961 <primary>virus scanning</primary>
51962 </indexterm>
51963 <indexterm role="concept">
51964 <primary>content scanning</primary>
51965 <secondary>for viruses</secondary>
51966 </indexterm>
51967 <indexterm role="concept">
51968 <primary>content scanning</primary>
51969 <secondary>the <option>malware</option> condition</secondary>
51970 </indexterm>
51971 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
51972 It supports a <quote>generic</quote> interface to scanners called via the shell, and
51973 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
51974 in memory and thus are much faster.
51975 </para>
51976 <para>
51977 <indexterm role="option">
51978 <primary><option>av_scanner</option></primary>
51979 </indexterm>
51980 You can set the <option>av_scanner</option> option in first part of the Exim configuration
51981 file to specify which scanner to use, together with any additional options that
51982 are needed. The basic syntax is as follows:
51983 </para>
51984 <literallayout>
51985 <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>
51986 </literallayout>
51987 <para>
51988 If you do not set <option>av_scanner</option>, it defaults to
51989 </para>
51990 <literallayout class="monospaced">
51991 av_scanner = sophie:/var/run/sophie
51992 </literallayout>
51993 <para>
51994 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
51995 before use. The following scanner types are supported in this release:
51996 </para>
51997 <variablelist>
51998 <varlistentry>
51999 <term><option>aveserver</option></term>
52000 <listitem>
52001 <para>
52002 <indexterm role="concept">
52003 <primary>virus scanners</primary>
52004 <secondary>Kaspersky</secondary>
52005 </indexterm>
52006 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
52007 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
52008 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
52009 example:
52010 </para>
52011 <literallayout class="monospaced">
52012 av_scanner = aveserver:/var/run/aveserver
52013 </literallayout>
52014 </listitem></varlistentry>
52015 <varlistentry>
52016 <term><option>clamd</option></term>
52017 <listitem>
52018 <para>
52019 <indexterm role="concept">
52020 <primary>virus scanners</primary>
52021 <secondary>clamd</secondary>
52022 </indexterm>
52023 This daemon-type scanner is GPL and free. You can get it at
52024 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
52025 unpack MIME containers, so it used to be recommended to unpack MIME attachments
52026 in the MIME ACL. This no longer believed to be necessary. One option is
52027 required: either the path and name of a UNIX socket file, or a hostname or IP
52028 number, and a port, separated by space, as in the second of these examples:
52029 </para>
52030 <literallayout class="monospaced">
52031 av_scanner = clamd:/opt/clamd/socket
52032 av_scanner = clamd:192.168.2.100 1234
52033 </literallayout>
52034 <para>
52035 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
52036 contributing the code for this scanner.
52037 </para>
52038 </listitem></varlistentry>
52039 <varlistentry>
52040 <term><option>cmdline</option></term>
52041 <listitem>
52042 <para>
52043 <indexterm role="concept">
52044 <primary>virus scanners</primary>
52045 <secondary>command line interface</secondary>
52046 </indexterm>
52047 This is the keyword for the generic command line scanner interface. It can be
52048 used to attach virus scanners that are invoked from the shell. This scanner
52049 type takes 3 mandatory options:
52050 </para>
52051 <orderedlist numeration="arabic">
52052 <listitem>
52053 <para>
52054 The full path and name of the scanner binary, with all command line options,
52055 and a placeholder (<literal>%s</literal>) for the directory to scan.
52056 </para>
52057 </listitem>
52058 <listitem>
52059 <para>
52060 A regular expression to match against the STDOUT and STDERR output of the
52061 virus scanner. If the expression matches, a virus was found. You must make
52062 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
52063 the <quote>trigger</quote> expression.
52064 </para>
52065 </listitem>
52066 <listitem>
52067 <para>
52068 Another regular expression, containing exactly one pair of parentheses, to
52069 match the name of the virus found in the scanners output. This is called the
52070 <quote>name</quote> expression.
52071 </para>
52072 </listitem>
52073 </orderedlist>
52074 <para>
52075 For example, Sophos Sweep reports a virus on a line like this:
52076 </para>
52077 <literallayout class="monospaced">
52078 Virus 'W32/Magistr-B' found in file ./those.bat
52079 </literallayout>
52080 <para>
52081 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
52082 name expression, we want to extract the W32/Magistr-B string, so we can match
52083 for the single quotes left and right of it. Altogether, this makes the
52084 configuration setting:
52085 </para>
52086 <literallayout class="monospaced">
52087 av_scanner = cmdline:\
52088              /path/to/sweep -ss -all -rec -archive %s:\
52089              found in file:'(.+)'
52090 </literallayout>
52091 </listitem></varlistentry>
52092 <varlistentry>
52093 <term><option>drweb</option></term>
52094 <listitem>
52095 <para>
52096 <indexterm role="concept">
52097 <primary>virus scanners</primary>
52098 <secondary>DrWeb</secondary>
52099 </indexterm>
52100 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
52101 argument, either a full path to a UNIX socket, or an IP address and port
52102 separated by white space, as in these examples:
52103 </para>
52104 <literallayout class="monospaced">
52105 av_scanner = drweb:/var/run/drwebd.sock
52106 av_scanner = drweb:192.168.2.20 31337
52107 </literallayout>
52108 <para>
52109 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
52110 is used. Thanks to Alex Miller for contributing the code for this scanner.
52111 </para>
52112 </listitem></varlistentry>
52113 <varlistentry>
52114 <term><option>fsecure</option></term>
52115 <listitem>
52116 <para>
52117 <indexterm role="concept">
52118 <primary>virus scanners</primary>
52119 <secondary>F-Secure</secondary>
52120 </indexterm>
52121 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
52122 argument which is the path to a UNIX socket. For example:
52123 </para>
52124 <literallayout class="monospaced">
52125 av_scanner = fsecure:/path/to/.fsav
52126 </literallayout>
52127 <para>
52128 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
52129 Thelmen for contributing the code for this scanner.
52130 </para>
52131 </listitem></varlistentry>
52132 <varlistentry>
52133 <term><option>kavdaemon</option></term>
52134 <listitem>
52135 <para>
52136 <indexterm role="concept">
52137 <primary>virus scanners</primary>
52138 <secondary>Kaspersky</secondary>
52139 </indexterm>
52140 This is the scanner daemon of Kaspersky Version 4. This version of the
52141 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
52142 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
52143 For example:
52144 </para>
52145 <literallayout class="monospaced">
52146 av_scanner = kavdaemon:/opt/AVP/AvpCtl
52147 </literallayout>
52148 <para>
52149 The default path is <filename>/var/run/AvpCtl</filename>.
52150 </para>
52151 </listitem></varlistentry>
52152 <varlistentry>
52153 <term><option>mksd</option></term>
52154 <listitem>
52155 <para>
52156 <indexterm role="concept">
52157 <primary>virus scanners</primary>
52158 <secondary>mksd</secondary>
52159 </indexterm>
52160 This is a daemon type scanner that is aimed mainly at Polish users, though some
52161 parts of documentation are now available in English. You can get it at
52162 <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
52163 the maximum number of processes used simultaneously to scan the attachments,
52164 provided that the demime facility is employed and also provided that mksd has
52165 been run with at least the same number of child processes. For example:
52166 </para>
52167 <literallayout class="monospaced">
52168 av_scanner = mksd:2
52169 </literallayout>
52170 <para>
52171 You can safely omit this option (the default value is 1).
52172 </para>
52173 </listitem></varlistentry>
52174 <varlistentry>
52175 <term><option>sophie</option></term>
52176 <listitem>
52177 <para>
52178 <indexterm role="concept">
52179 <primary>virus scanners</primary>
52180 <secondary>Sophos and Sophie</secondary>
52181 </indexterm>
52182 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
52183 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
52184 for this scanner type is the path to the UNIX socket that Sophie uses for
52185 client communication. For example:
52186 </para>
52187 <literallayout class="monospaced">
52188 av_scanner = sophie:/tmp/sophie
52189 </literallayout>
52190 <para>
52191 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
52192 the option.
52193 </para>
52194 </listitem></varlistentry>
52195 </variablelist>
52196 <para>
52197 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
52198 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
52199 ACL.
52200 </para>
52201 <para>
52202 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
52203 makes it possible to use different scanners. See further below for an example.
52204 The <option>malware</option> condition caches its results, so when you use it multiple times
52205 for the same message, the actual scanning process is only carried out once.
52206 However, using expandable items in <option>av_scanner</option> disables this caching, in
52207 which case each use of the <option>malware</option> condition causes a new scan of the
52208 message.
52209 </para>
52210 <para>
52211 The <option>malware</option> condition takes a right-hand argument that is expanded before
52212 use. It can then be one of
52213 </para>
52214 <itemizedlist>
52215 <listitem>
52216 <para>
52217 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
52218 The condition succeeds if a virus was found, and fail otherwise. This is the
52219 recommended usage.
52220 </para>
52221 </listitem>
52222 <listitem>
52223 <para>
52224 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
52225 the condition fails immediately.
52226 </para>
52227 </listitem>
52228 <listitem>
52229 <para>
52230 A regular expression, in which case the message is scanned for viruses. The
52231 condition succeeds if a virus is found and its name matches the regular
52232 expression. This allows you to take special actions on certain types of virus.
52233 </para>
52234 </listitem>
52235 </itemizedlist>
52236 <para>
52237 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
52238 even if there is a problem with the virus scanner. Otherwise, such a problem
52239 causes the ACL to defer.
52240 </para>
52241 <para>
52242 <indexterm role="variable">
52243 <primary><varname>$malware_name</varname></primary>
52244 </indexterm>
52245 When a virus is found, the condition sets up an expansion variable called
52246 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
52247 <option>message</option> modifier that specifies the error returned to the sender, and/or in
52248 logging data.
52249 </para>
52250 <para>
52251 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
52252 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
52253 <option>malware</option> condition.
52254 </para>
52255 <para>
52256 Here is a very simple scanning example:
52257 </para>
52258 <literallayout class="monospaced">
52259 deny message = This message contains malware ($malware_name)
52260      demime = *
52261      malware = *
52262 </literallayout>
52263 <para>
52264 The next example accepts messages when there is a problem with the scanner:
52265 </para>
52266 <literallayout class="monospaced">
52267 deny message = This message contains malware ($malware_name)
52268      demime = *
52269      malware = */defer_ok
52270 </literallayout>
52271 <para>
52272 The next example shows how to use an ACL variable to scan with both sophie and
52273 aveserver. It assumes you have set:
52274 </para>
52275 <literallayout class="monospaced">
52276 av_scanner = $acl_m0
52277 </literallayout>
52278 <para>
52279 in the main Exim configuration.
52280 </para>
52281 <literallayout class="monospaced">
52282 deny message = This message contains malware ($malware_name)
52283      set acl_m0 = sophie
52284      malware = *
52285
52286 deny message = This message contains malware ($malware_name)
52287      set acl_m0 = aveserver
52288      malware = *
52289 </literallayout>
52290 </section>
52291 <section id="SECTscanspamass">
52292 <title>Scanning with SpamAssassin</title>
52293 <para>
52294 <indexterm role="concept">
52295 <primary>content scanning</primary>
52296 <secondary>for spam</secondary>
52297 </indexterm>
52298 <indexterm role="concept">
52299 <primary>spam scanning</primary>
52300 </indexterm>
52301 <indexterm role="concept">
52302 <primary>SpamAssassin</primary>
52303 </indexterm>
52304 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
52305 score and a report for the message. You can get SpamAssassin at
52306 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
52307 installation, you can use CPAN by running:
52308 </para>
52309 <literallayout class="monospaced">
52310 perl -MCPAN -e 'install Mail::SpamAssassin'
52311 </literallayout>
52312 <para>
52313 SpamAssassin has its own set of configuration files. Please review its
52314 documentation to see how you can tweak it. The default installation should work
52315 nicely, however.
52316 </para>
52317 <para>
52318 <indexterm role="option">
52319 <primary><option>spamd_address</option></primary>
52320 </indexterm>
52321 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
52322 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
52323 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
52324 part of the Exim configuration as follows (example):
52325 </para>
52326 <literallayout class="monospaced">
52327 spamd_address = 192.168.99.45 387
52328 </literallayout>
52329 <para>
52330 You do not need to set this option if you use the default. As of version 2.60,
52331 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
52332 these, supply <option>spamd_address</option> with an absolute file name instead of a
52333 address/port pair:
52334 </para>
52335 <literallayout class="monospaced">
52336 spamd_address = /var/run/spamd_socket
52337 </literallayout>
52338 <para>
52339 You can have multiple <option>spamd</option> servers to improve scalability. These can
52340 reside on other hardware reachable over the network. To specify multiple
52341 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
52342 option, separated with colons:
52343 </para>
52344 <literallayout class="monospaced">
52345 spamd_address = 192.168.2.10 783 : \
52346                 192.168.2.11 783 : \
52347                 192.168.2.12 783
52348 </literallayout>
52349 <para>
52350 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
52351 fashion. When a server fails to respond to the connection attempt, all other
52352 servers are tried until one succeeds. If no server responds, the <option>spam</option>
52353 condition defers.
52354 </para>
52355 <para>
52356 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
52357 multiple <option>spamd</option> servers.
52358 </para>
52359 </section>
52360 <section id="SECID206">
52361 <title>Calling SpamAssassin from an Exim ACL</title>
52362 <para>
52363 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
52364 </para>
52365 <literallayout class="monospaced">
52366 deny message = This message was classified as SPAM
52367      spam = joe
52368 </literallayout>
52369 <para>
52370 The right-hand side of the <option>spam</option> condition specifies a name. This is
52371 relevant if you have set up multiple SpamAssassin profiles. If you do not want
52372 to scan using a specific profile, but rather use the SpamAssassin system-wide
52373 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
52374 However, you must put something on the right-hand side.
52375 </para>
52376 <para>
52377 The name allows you to use per-domain or per-user antispam profiles in
52378 principle, but this is not straightforward in practice, because a message may
52379 have multiple recipients, not necessarily all in the same domain. Because the
52380 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
52381 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
52382 are not set.
52383 </para>
52384 <para>
52385 The right-hand side of the <option>spam</option> condition is expanded before being used, so
52386 you can put lookups or conditions there. When the right-hand side evaluates to
52387 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
52388 </para>
52389 <para>
52390 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
52391 large ones may cause significant performance degradation. As most spam messages
52392 are quite small, it is recommended that you do not scan the big ones. For
52393 example:
52394 </para>
52395 <literallayout class="monospaced">
52396 deny message = This message was classified as SPAM
52397      condition = ${if &lt; {$message_size}{10K}}
52398      spam = nobody
52399 </literallayout>
52400 <para>
52401 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
52402 SpamAssassin profile has been matched or exceeded. If you want to use the
52403 <option>spam</option> condition for its side effects (see the variables below), you can make
52404 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
52405 </para>
52406 <para>
52407 <indexterm role="concept">
52408 <primary>spam scanning</primary>
52409 <secondary>returned variables</secondary>
52410 </indexterm>
52411 When the <option>spam</option> condition is run, it sets up a number of expansion
52412 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
52413 within ACLs; their values are not retained with the message and so cannot be
52414 used at delivery time.
52415 </para>
52416 <variablelist>
52417 <varlistentry>
52418 <term><varname>$spam_score</varname></term>
52419 <listitem>
52420 <para>
52421 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
52422 for inclusion in log or reject messages.
52423 </para>
52424 </listitem></varlistentry>
52425 <varlistentry>
52426 <term><varname>$spam_score_int</varname></term>
52427 <listitem>
52428 <para>
52429 The spam score of the message, multiplied by ten, as an integer value. For
52430 example <quote>34</quote> or <quote>305</quote>. This is useful for numeric comparisons in
52431 conditions. This variable is special; its value is saved with the message, and
52432 written to Exim&#x2019;s spool file. This means that it can be used during the whole
52433 life of the message on your Exim system, in particular, in routers or
52434 transports during the later delivery phase.
52435 </para>
52436 </listitem></varlistentry>
52437 <varlistentry>
52438 <term><varname>$spam_bar</varname></term>
52439 <listitem>
52440 <para>
52441 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
52442 integer part of the spam score value. A spam score of 4.4 would have a
52443 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
52444 headers, since MUAs can match on such strings.
52445 </para>
52446 </listitem></varlistentry>
52447 <varlistentry>
52448 <term><varname>$spam_report</varname></term>
52449 <listitem>
52450 <para>
52451 A multiline text table, containing the full SpamAssassin report for the
52452 message. Useful for inclusion in headers or reject messages.
52453 </para>
52454 </listitem></varlistentry>
52455 </variablelist>
52456 <para>
52457 The <option>spam</option> condition caches its results. If you call it again with the same
52458 user name, it does not scan again, but rather returns the same values as
52459 before.
52460 </para>
52461 <para>
52462 The <option>spam</option> condition returns DEFER if there is any error while running the
52463 message through SpamAssassin. If you want to treat DEFER as FAIL (to pass on to
52464 the next ACL statement block), append <literal>/defer_ok</literal> to the right-hand side of
52465 the spam condition, like this:
52466 </para>
52467 <literallayout class="monospaced">
52468 deny message = This message was classified as SPAM
52469      spam    = joe/defer_ok
52470 </literallayout>
52471 <para>
52472 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
52473 </para>
52474 <para>
52475 Here is a longer, commented example of the use of the <option>spam</option>
52476 condition:
52477 </para>
52478 <literallayout class="monospaced">
52479 # put headers in all messages (no matter if spam or not)
52480 warn  spam = nobody:true
52481       add_header = X-Spam-Score: $spam_score ($spam_bar)
52482       add_header = X-Spam-Report: $spam_report
52483
52484 # add second subject line with *SPAM* marker when message
52485 # is over threshold
52486 warn  spam = nobody
52487       add_header = Subject: *SPAM* $h_Subject:
52488
52489 # reject spam at high scores (&gt; 12)
52490 deny  message = This message scored $spam_score spam points.
52491       spam = nobody:true
52492       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
52493 </literallayout>
52494 </section>
52495 <section id="SECTscanmimepart">
52496 <title>Scanning MIME parts</title>
52497 <para>
52498 <indexterm role="concept">
52499 <primary>content scanning</primary>
52500 <secondary>MIME parts</secondary>
52501 </indexterm>
52502 <indexterm role="concept">
52503 <primary>MIME content scanning</primary>
52504 </indexterm>
52505 <indexterm role="option">
52506 <primary><option>acl_smtp_mime</option></primary>
52507 </indexterm>
52508 <indexterm role="option">
52509 <primary><option>acl_not_smtp_mime</option></primary>
52510 </indexterm>
52511 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
52512 each MIME part of an SMTP message, including multipart types, in the sequence
52513 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
52514 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
52515 options may both refer to the same ACL if you want the same processing in both
52516 cases.
52517 </para>
52518 <para>
52519 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
52520 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
52521 the case of a non-SMTP message. However, a MIME ACL is called only if the
52522 message contains a <phrase revisionflag="changed"><emphasis>Content-Type:</emphasis></phrase> header line. When a call to a MIME
52523 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
52524 result code is sent to the client. In the case of an SMTP message, the
52525 <option>acl_smtp_data</option> ACL is not called when this happens.
52526 </para>
52527 <para>
52528 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
52529 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
52530 condition to match against the raw MIME part. You can also use the
52531 <option>mime_regex</option> condition to match against the decoded MIME part (see section
52532 <xref linkend="SECTscanregex"/>).
52533 </para>
52534 <para>
52535 At the start of a MIME ACL, a number of variables are set from the header
52536 information for the relevant MIME part. These are described below. The contents
52537 of the MIME part are not by default decoded into a disk file except for MIME
52538 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
52539 part into a disk file, you can use the <option>decode</option> condition. The general
52540 syntax is:
52541 </para>
52542 <literallayout>
52543 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
52544 </literallayout>
52545 <para>
52546 The right hand side is expanded before use. After expansion,
52547 the value can be:
52548 </para>
52549 <orderedlist numeration="arabic">
52550 <listitem>
52551 <para>
52552 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
52553 </para>
52554 </listitem>
52555 <listitem>
52556 <para>
52557 The string <quote>default</quote>. In that case, the file is put in the temporary
52558 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
52559 a sequential file name consisting of the message id and a sequence number. The
52560 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
52561 </para>
52562 </listitem>
52563 <listitem>
52564 <para>
52565 A full path name starting with a slash. If the full name is an existing
52566 directory, it is used as a replacement for the default directory. The filename
52567 is then sequentially assigned. If the path does not exist, it is used as
52568 the full path and file name.
52569 </para>
52570 </listitem>
52571 <listitem>
52572 <para>
52573 If the string does not start with a slash, it is used as the
52574 filename, and the default path is then used.
52575 </para>
52576 </listitem>
52577 </orderedlist>
52578 <para>
52579 The <option>decode</option> condition normally succeeds. It is only false for syntax
52580 errors or unusual circumstances such as memory shortages. You can easily decode
52581 a file with its original, proposed filename using
52582 </para>
52583 <literallayout class="monospaced">
52584 decode = $mime_filename
52585 </literallayout>
52586 <para>
52587 However, you should keep in mind that <varname>$mime_filename</varname> might contain
52588 anything. If you place files outside of the default path, they are not
52589 automatically unlinked.
52590 </para>
52591 <para>
52592 For RFC822 attachments (these are messages attached to messages, with a
52593 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
52594 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
52595 variable is set (see below). Attached messages are always decoded to disk
52596 before being checked, and the files are unlinked once the check is done.
52597 </para>
52598 <para>
52599 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
52600 used to match regular expressions against raw and decoded MIME parts,
52601 respectively. They are described in section <xref linkend="SECTscanregex"/>.
52602 </para>
52603 <para>
52604 <indexterm role="concept">
52605 <primary>MIME content scanning</primary>
52606 <secondary>returned variables</secondary>
52607 </indexterm>
52608 The following list describes all expansion variables that are
52609 available in the MIME ACL:
52610 </para>
52611 <variablelist>
52612 <varlistentry>
52613 <term><varname>$mime_boundary</varname></term>
52614 <listitem>
52615 <para>
52616 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
52617 have a boundary string, which is stored in this variable. If the current part
52618 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
52619 contains the empty string.
52620 </para>
52621 </listitem></varlistentry>
52622 <varlistentry>
52623 <term><varname>$mime_charset</varname></term>
52624 <listitem>
52625 <para>
52626 This variable contains the character set identifier, if one was found in the
52627 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
52628 </para>
52629 <literallayout class="monospaced">
52630 us-ascii
52631 gb2312 (Chinese)
52632 iso-8859-1
52633 </literallayout>
52634 <para>
52635 Please note that this value is not normalized, so you should do matches
52636 case-insensitively.
52637 </para>
52638 </listitem></varlistentry>
52639 <varlistentry>
52640 <term><varname>$mime_content_description</varname></term>
52641 <listitem>
52642 <para>
52643 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
52644 header. It can contain a human-readable description of the parts content. Some
52645 implementations repeat the filename for attachments here, but they are usually
52646 only used for display purposes.
52647 </para>
52648 </listitem></varlistentry>
52649 <varlistentry>
52650 <term><varname>$mime_content_disposition</varname></term>
52651 <listitem>
52652 <para>
52653 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
52654 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
52655 </para>
52656 </listitem></varlistentry>
52657 <varlistentry>
52658 <term><varname>$mime_content_id</varname></term>
52659 <listitem>
52660 <para>
52661 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
52662 This is a unique ID that can be used to reference a part from another part.
52663 </para>
52664 </listitem></varlistentry>
52665 <varlistentry>
52666 <term><varname>$mime_content_size</varname></term>
52667 <listitem>
52668 <para>
52669 This variable is set only after the <option>decode</option> modifier (see above) has been
52670 successfully run. It contains the size of the decoded part in kilobytes. The
52671 size is always rounded up to full kilobytes, so only a completely empty part
52672 has a <varname>$mime_content_size</varname> of zero.
52673 </para>
52674 </listitem></varlistentry>
52675 <varlistentry>
52676 <term><varname>$mime_content_transfer_encoding</varname></term>
52677 <listitem>
52678 <para>
52679 This variable contains the normalized content of the
52680 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
52681 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
52682 </para>
52683 </listitem></varlistentry>
52684 <varlistentry>
52685 <term><varname>$mime_content_type</varname></term>
52686 <listitem>
52687 <para>
52688 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
52689 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
52690 are some examples of popular MIME types, as they may appear in this variable:
52691 </para>
52692 <literallayout class="monospaced">
52693 text/plain
52694 text/html
52695 application/octet-stream
52696 image/jpeg
52697 audio/midi
52698 </literallayout>
52699 <para>
52700 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
52701 empty string.
52702 </para>
52703 </listitem></varlistentry>
52704 <varlistentry>
52705 <term><varname>$mime_decoded_filename</varname></term>
52706 <listitem>
52707 <para>
52708 This variable is set only after the <option>decode</option> modifier (see above) has been
52709 successfully run. It contains the full path and file name of the file
52710 containing the decoded data.
52711 </para>
52712 </listitem></varlistentry>
52713 </variablelist>
52714 <para>
52715 <indexterm role="concept">
52716 <primary>RFC 2047</primary>
52717 </indexterm>
52718 </para>
52719 <variablelist>
52720 <varlistentry>
52721 <term><varname>$mime_filename</varname></term>
52722 <listitem>
52723 <para>
52724 This is perhaps the most important of the MIME variables. It contains a
52725 proposed filename for an attachment, if one was found in either the
52726 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
52727 RFC2047 decoded, but no additional sanity checks are done. If no filename was
52728 found, this variable contains the empty string.
52729 </para>
52730 </listitem></varlistentry>
52731 <varlistentry>
52732 <term><varname>$mime_is_coverletter</varname></term>
52733 <listitem>
52734 <para>
52735 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
52736 attached data. It can be used to clamp down on flashy or unnecessarily encoded
52737 content in the cover letter, while not restricting attachments at all.
52738 </para>
52739 <para>
52740 The variable contains 1 (true) for a MIME part believed to be part of the
52741 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
52742 follows:
52743 </para>
52744 <orderedlist numeration="arabic">
52745 <listitem>
52746 <para>
52747 The outermost MIME part of a message is always a cover letter.
52748 </para>
52749 </listitem>
52750 <listitem>
52751 <para>
52752 If a multipart/alternative or multipart/related MIME part is a cover letter,
52753 so are all MIME subparts within that multipart.
52754 </para>
52755 </listitem>
52756 <listitem>
52757 <para>
52758 If any other multipart is a cover letter, the first subpart is a cover letter,
52759 and the rest are attachments.
52760 </para>
52761 </listitem>
52762 <listitem>
52763 <para>
52764 All parts contained within an attachment multipart are attachments.
52765 </para>
52766 </listitem>
52767 </orderedlist>
52768 <para>
52769 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
52770 alternative plain text), while allowing HTML files to be attached. HTML
52771 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
52772 </para>
52773 <literallayout class="monospaced">
52774 deny message = HTML mail is not accepted here
52775 !condition = $mime_is_rfc822
52776 condition = $mime_is_coverletter
52777 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
52778 </literallayout>
52779 </listitem></varlistentry>
52780 <varlistentry>
52781 <term><varname>$mime_is_multipart</varname></term>
52782 <listitem>
52783 <para>
52784 This variable has the value 1 (true) when the current part has the main type
52785 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
52786 Since multipart entities only serve as containers for other parts, you may not
52787 want to carry out specific actions on them.
52788 </para>
52789 </listitem></varlistentry>
52790 <varlistentry>
52791 <term><varname>$mime_is_rfc822</varname></term>
52792 <listitem>
52793 <para>
52794 This variable has the value 1 (true) if the current part is not a part of the
52795 checked message itself, but part of an attached message. Attached message
52796 decoding is fully recursive.
52797 </para>
52798 </listitem></varlistentry>
52799 <varlistentry>
52800 <term><varname>$mime_part_count</varname></term>
52801 <listitem>
52802 <para>
52803 This variable is a counter that is raised for each processed MIME part. It
52804 starts at zero for the very first part (which is usually a multipart). The
52805 counter is per-message, so it is reset when processing RFC822 attachments (see
52806 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
52807 complete, so you can use it in the DATA ACL to determine the number of MIME
52808 parts of a message. For non-MIME messages, this variable contains the value -1.
52809 </para>
52810 </listitem></varlistentry>
52811 </variablelist>
52812 </section>
52813 <section id="SECTscanregex">
52814 <title>Scanning with regular expressions</title>
52815 <para>
52816 <indexterm role="concept">
52817 <primary>content scanning</primary>
52818 <secondary>with regular expressions</secondary>
52819 </indexterm>
52820 <indexterm role="concept">
52821 <primary>regular expressions</primary>
52822 <secondary>content scanning with</secondary>
52823 </indexterm>
52824 You can specify your own custom regular expression matches on the full body of
52825 the message, or on individual MIME parts.
52826 </para>
52827 <para>
52828 The <option>regex</option> condition takes one or more regular expressions as arguments and
52829 matches them against the full message (when called in the DATA ACL) or a raw
52830 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
52831 linewise, with a maximum line length of 32K characters. That means you cannot
52832 have multiline matches with the <option>regex</option> condition.
52833 </para>
52834 <para>
52835 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
52836 to 32K of decoded content (the whole content at once, not linewise). If the
52837 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
52838 is decoded automatically when <option>mime_regex</option> is executed (using default path
52839 and filename values). If the decoded data is larger than  32K, only the first
52840 32K characters are checked.
52841 </para>
52842 <para>
52843 The regular expressions are passed as a colon-separated list. To include a
52844 literal colon, you must double it. Since the whole right-hand side string is
52845 expanded before being used, you must also escape dollar signs and backslashes
52846 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
52847 Here is a simple example that contains two regular expressions:
52848 </para>
52849 <literallayout class="monospaced">
52850 deny message = contains blacklisted regex ($regex_match_string)
52851      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
52852 </literallayout>
52853 <para>
52854 The conditions returns true if any one of the regular expressions matches. The
52855 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
52856 matching regular expression.
52857 </para>
52858 <para>
52859 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
52860 CPU-intensive.
52861 </para>
52862 </section>
52863 <section id="SECTdemimecond">
52864 <title>The demime condition</title>
52865 <para>
52866 <indexterm role="concept">
52867 <primary>content scanning</primary>
52868 <secondary>MIME checking</secondary>
52869 </indexterm>
52870 <indexterm role="concept">
52871 <primary>MIME content scanning</primary>
52872 </indexterm>
52873 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
52874 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
52875 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
52876 ACL functionality, but provides no additional facilities. Please note that this
52877 condition is deprecated and kept only for backward compatibility. You must set
52878 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
52879 use the <option>demime</option> condition.
52880 </para>
52881 <para>
52882 The <option>demime</option> condition unpacks MIME containers in the message. It detects
52883 errors in MIME containers and can match file extensions found in the message
52884 against a list. Using this facility produces files containing the unpacked MIME
52885 parts of the message in the temporary scan directory. If you do antivirus
52886 scanning, it is recommended that you use the <option>demime</option> condition before the
52887 antivirus (<option>malware</option>) condition.
52888 </para>
52889 <para>
52890 On the right-hand side of the <option>demime</option> condition you can pass a
52891 colon-separated list of file extensions that it should match against. For
52892 example:
52893 </para>
52894 <literallayout class="monospaced">
52895 deny message = Found blacklisted file attachment
52896      demime  = vbs:com:bat:pif:prf:lnk
52897 </literallayout>
52898 <para>
52899 If one of the file extensions is found, the condition is true, otherwise it is
52900 false. If there is a temporary error while demimeing (for example, <quote>disk
52901 full</quote>), the condition defers, and the message is temporarily rejected (unless
52902 the condition is on a <option>warn</option> verb).
52903 </para>
52904 <para>
52905 The right-hand side is expanded before being treated as a list, so you can have
52906 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
52907 zero (<quote>0</quote>), no demimeing is done and the condition is false.
52908 </para>
52909 <para>
52910 The <option>demime</option> condition set the following variables:
52911 </para>
52912 <variablelist>
52913 <varlistentry>
52914 <term><varname>$demime_errorlevel</varname></term>
52915 <listitem>
52916 <para>
52917 <indexterm role="variable">
52918 <primary><varname>$demime_errorlevel</varname></primary>
52919 </indexterm>
52920 When an error is detected in a MIME container, this variable contains the
52921 severity of the error, as an integer number. The higher the value, the more
52922 severe the error (the current maximum value is 3). If this variable is unset or
52923 zero, no error occurred.
52924 </para>
52925 </listitem></varlistentry>
52926 <varlistentry>
52927 <term><varname>$demime_reason</varname></term>
52928 <listitem>
52929 <para>
52930 <indexterm role="variable">
52931 <primary><varname>$demime_reason</varname></primary>
52932 </indexterm>
52933 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
52934 human-readable text string describing the MIME error that occurred.
52935 </para>
52936 </listitem></varlistentry>
52937 </variablelist>
52938 <variablelist>
52939 <varlistentry>
52940 <term><varname>$found_extension</varname></term>
52941 <listitem>
52942 <para>
52943 <indexterm role="variable">
52944 <primary><varname>$found_extension</varname></primary>
52945 </indexterm>
52946 When the <option>demime</option> condition is true, this variable contains the file
52947 extension it found.
52948 </para>
52949 </listitem></varlistentry>
52950 </variablelist>
52951 <para>
52952 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
52953 the <option>demime</option> condition, and are not changed on subsequent calls.
52954 </para>
52955 <para>
52956 If you do not want to check for file extensions, but rather use the <option>demime</option>
52957 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
52958 right-hand side value. Here is a more elaborate example of how to use this
52959 facility:
52960 </para>
52961 <literallayout class="monospaced">
52962 # Reject messages with serious MIME container errors
52963 deny  message = Found MIME error ($demime_reason).
52964       demime = *
52965       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
52966
52967 # Reject known virus spreading file extensions.
52968 # Accepting these is pretty much braindead.
52969 deny  message = contains $found_extension file (blacklisted).
52970       demime  = com:vbs:bat:pif:scr
52971
52972 # Freeze .exe and .doc files. Postmaster can
52973 # examine them and eventually thaw them.
52974 deny  log_message = Another $found_extension file.
52975       demime = exe:doc
52976       control = freeze
52977 </literallayout>
52978 <para>
52979 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
52980 </para>
52981 </section>
52982 </chapter>
52983
52984 <chapter id="CHAPlocalscan">
52985 <title>Adding a local scan function to Exim</title>
52986 <titleabbrev>Local scan function</titleabbrev>
52987 <para>
52988 <indexterm role="concept" id="IIDlosca" class="startofrange">
52989 <primary><function>local_scan()</function> function</primary>
52990 <secondary>description of</secondary>
52991 </indexterm>
52992 <indexterm role="concept">
52993 <primary>customizing</primary>
52994 <secondary>input scan using C function</secondary>
52995 </indexterm>
52996 <indexterm role="concept">
52997 <primary>policy control</primary>
52998 <secondary>by local scan function</secondary>
52999 </indexterm>
53000 In these days of email worms, viruses, and ever-increasing spam, some sites
53001 want to apply a lot of checking to messages before accepting them.
53002 </para>
53003 <para>
53004 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
53005 passing messages to external virus and spam scanning software. You can also do
53006 a certain amount in Exim itself through string expansions and the <option>condition</option>
53007 condition in the ACL that runs after the SMTP DATA command or the ACL for
53008 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
53009 </para>
53010 <para>
53011 To allow for further customization to a site&#x2019;s own requirements, there is the
53012 possibility of linking Exim with a private message scanning function, written
53013 in C. If you want to run code that is written in something other than C, you
53014 can of course use a little C stub to call it.
53015 </para>
53016 <para>
53017 The local scan function is run once for every incoming message, at the point
53018 when Exim is just about to accept the message.
53019 It can therefore be used to control non-SMTP messages from local processes as
53020 well as messages arriving via SMTP.
53021 </para>
53022 <para>
53023 Exim applies a timeout to calls of the local scan function, and there is an
53024 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
53025 Zero means <quote>no timeout</quote>.
53026 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
53027 before calling the local scan function, so that the most common types of crash
53028 are caught. If the timeout is exceeded or one of those signals is caught, the
53029 incoming message is rejected with a temporary error if it is an SMTP message.
53030 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
53031 code. The incident is logged on the main and reject logs.
53032 </para>
53033 <section id="SECID207">
53034 <title>Building Exim to use a local scan function</title>
53035 <para>
53036 <indexterm role="concept">
53037 <primary><function>local_scan()</function> function</primary>
53038 <secondary>building Exim to use</secondary>
53039 </indexterm>
53040 To make use of the local scan function feature, you must tell Exim where your
53041 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
53042 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
53043 directory, so you might set
53044 </para>
53045 <literallayout class="monospaced">
53046 LOCAL_SCAN_SOURCE=Local/local_scan.c
53047 </literallayout>
53048 <para>
53049 for example. The function must be called <function>local_scan()</function>. It is called by
53050 Exim after it has received a message, when the success return code is about to
53051 be sent. This is after all the ACLs have been run. The return code from your
53052 function controls whether the message is actually accepted or not. There is a
53053 commented template function (that just accepts the message) in the file
53054 _src/local_scan.c_.
53055 </para>
53056 <para>
53057 If you want to make use of Exim&#x2019;s run time configuration file to set options
53058 for your <function>local_scan()</function> function, you must also set
53059 </para>
53060 <literallayout class="monospaced">
53061 LOCAL_SCAN_HAS_OPTIONS=yes
53062 </literallayout>
53063 <para>
53064 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
53065 </para>
53066 </section>
53067 <section id="SECTapiforloc">
53068 <title>API for local_scan()</title>
53069 <para>
53070 <indexterm role="concept">
53071 <primary><function>local_scan()</function> function</primary>
53072 <secondary>API description</secondary>
53073 </indexterm>
53074 You must include this line near the start of your code:
53075 </para>
53076 <literallayout class="monospaced">
53077 #include "local_scan.h"
53078 </literallayout>
53079 <para>
53080 This header file defines a number of variables and other values, and the
53081 prototype for the function itself. Exim is coded to use unsigned char values
53082 almost exclusively, and one of the things this header defines is a shorthand
53083 for <literal>unsigned char</literal> called <literal>uschar</literal>.
53084 It also contains the following macro definitions, to simplify casting character
53085 strings and pointers to character strings:
53086 </para>
53087 <literallayout class="monospaced">
53088 #define CS   (char *)
53089 #define CCS  (const char *)
53090 #define CSS  (char **)
53091 #define US   (unsigned char *)
53092 #define CUS  (const unsigned char *)
53093 #define USS  (unsigned char **)
53094 </literallayout>
53095 <para>
53096 The function prototype for <function>local_scan()</function> is:
53097 </para>
53098 <literallayout class="monospaced">
53099 extern int local_scan(int fd, uschar **return_text);
53100 </literallayout>
53101 <para>
53102 The arguments are as follows:
53103 </para>
53104 <itemizedlist>
53105 <listitem>
53106 <para>
53107 <option>fd</option> is a file descriptor for the file that contains the body of the message
53108 (the -D file). The file is open for reading and writing, but updating it is not
53109 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
53110 </para>
53111 <para>
53112 The descriptor is positioned at character 19 of the file, which is the first
53113 character of the body itself, because the first 19 characters are the message
53114 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
53115 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
53116 case this changes in some future version.
53117 </para>
53118 </listitem>
53119 <listitem>
53120 <para>
53121 <option>return_text</option> is an address which you can use to return a pointer to a text
53122 string at the end of the function. The value it points to on entry is NULL.
53123 </para>
53124 </listitem>
53125 </itemizedlist>
53126 <para>
53127 The function must return an <option>int</option> value which is one of the following macros:
53128 </para>
53129 <variablelist>
53130 <varlistentry>
53131 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
53132 <listitem>
53133 <para>
53134 <indexterm role="variable">
53135 <primary><varname>$local_scan_data</varname></primary>
53136 </indexterm>
53137 The message is accepted. If you pass back a string of text, it is saved with
53138 the message, and made available in the variable <varname>$local_scan_data</varname>. No
53139 newlines are permitted (if there are any, they are turned into spaces) and the
53140 maximum length of text is 1000 characters.
53141 </para>
53142 </listitem></varlistentry>
53143 <varlistentry>
53144 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
53145 <listitem>
53146 <para>
53147 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53148 queued without immediate delivery, and is frozen.
53149 </para>
53150 </listitem></varlistentry>
53151 <varlistentry>
53152 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
53153 <listitem>
53154 <para>
53155 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53156 queued without immediate delivery.
53157 </para>
53158 </listitem></varlistentry>
53159 <varlistentry>
53160 <term><literal>LOCAL_SCAN_REJECT</literal></term>
53161 <listitem>
53162 <para>
53163 The message is rejected; the returned text is used as an error message which is
53164 passed back to the sender and which is also logged. Newlines are permitted &ndash;
53165 they cause a multiline response for SMTP rejections, but are converted to
53166 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
53167 used.
53168 </para>
53169 </listitem></varlistentry>
53170 <varlistentry>
53171 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
53172 <listitem>
53173 <para>
53174 The message is temporarily rejected; the returned text is used as an error
53175 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
53176 problem</quote> is used.
53177 </para>
53178 </listitem></varlistentry>
53179 <varlistentry>
53180 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
53181 <listitem>
53182 <para>
53183 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
53184 message is not written to the reject log. It has the effect of unsetting the
53185 <option>rejected_header</option> log selector for just this rejection. If
53186 <option>rejected_header</option> is already unset (see the discussion of the
53187 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
53188 same as LOCAL_SCAN_REJECT.
53189 </para>
53190 </listitem></varlistentry>
53191 <varlistentry>
53192 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
53193 <listitem>
53194 <para>
53195 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
53196 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
53197 </para>
53198 </listitem></varlistentry>
53199 </variablelist>
53200 <para>
53201 If the message is not being received by interactive SMTP, rejections are
53202 reported by writing to <option>stderr</option> or by sending an email, as configured by the
53203 <option>-oe</option> command line options.
53204 </para>
53205 </section>
53206 <section id="SECTconoptloc">
53207 <title>Configuration options for local_scan()</title>
53208 <para>
53209 <indexterm role="concept">
53210 <primary><function>local_scan()</function> function</primary>
53211 <secondary>configuration options</secondary>
53212 </indexterm>
53213 It is possible to have option settings in the main configuration file
53214 that set values in static variables in the <function>local_scan()</function> module. If you
53215 want to do this, you must have the line
53216 </para>
53217 <literallayout class="monospaced">
53218 LOCAL_SCAN_HAS_OPTIONS=yes
53219 </literallayout>
53220 <para>
53221 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
53222 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
53223 file, you must define static variables to hold the option values, and a table
53224 to define them.
53225 </para>
53226 <para>
53227 The table must be a vector called <option>local_scan_options</option>, of type
53228 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
53229 and a pointer to the variable that holds the value. The entries must appear in
53230 alphabetical order. Following <option>local_scan_options</option> you must also define a
53231 variable called <option>local_scan_options_count</option> that contains the number of
53232 entries in the table. Here is a short example, showing two kinds of option:
53233 </para>
53234 <literallayout class="monospaced">
53235 static int my_integer_option = 42;
53236 static uschar *my_string_option = US"a default string";
53237
53238 optionlist local_scan_options[] = {
53239   { "my_integer", opt_int,       &amp;my_integer_option },
53240   { "my_string",  opt_stringptr, &amp;my_string_option }
53241 };
53242
53243 int local_scan_options_count =
53244   sizeof(local_scan_options)/sizeof(optionlist);
53245 </literallayout>
53246 <para>
53247 The values of the variables can now be changed from Exim&#x2019;s runtime
53248 configuration file by including a local scan section as in this example:
53249 </para>
53250 <literallayout class="monospaced">
53251 begin local_scan
53252 my_integer = 99
53253 my_string = some string of text...
53254 </literallayout>
53255 <para>
53256 The available types of option data are as follows:
53257 </para>
53258 <variablelist>
53259 <varlistentry>
53260 <term><emphasis role="bold">opt_bool</emphasis></term>
53261 <listitem>
53262 <para>
53263 This specifies a boolean (true/false) option. The address should point to a
53264 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
53265 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
53266 whether such a variable has been set at all, you can initialize it to
53267 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
53268 values.)
53269 </para>
53270 </listitem></varlistentry>
53271 <varlistentry>
53272 <term><emphasis role="bold">opt_fixed</emphasis></term>
53273 <listitem>
53274 <para>
53275 This specifies a fixed point number, such as is used for load averages.
53276 The address should point to a variable of type <literal>int</literal>. The value is stored
53277 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
53278 </para>
53279 </listitem></varlistentry>
53280 <varlistentry>
53281 <term><emphasis role="bold">opt_int</emphasis></term>
53282 <listitem>
53283 <para>
53284 This specifies an integer; the address should point to a variable of type
53285 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
53286 Exim.
53287 </para>
53288 </listitem></varlistentry>
53289 <varlistentry>
53290 <term><emphasis role="bold">opt_mkint</emphasis></term>
53291 <listitem>
53292 <para>
53293 This is the same as <option>opt_int</option>, except that when such a value is output in a
53294 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
53295 printed with the suffix K or M.
53296 </para>
53297 </listitem></varlistentry>
53298 <varlistentry>
53299 <term><emphasis role="bold">opt_octint</emphasis></term>
53300 <listitem>
53301 <para>
53302 This also specifies an integer, but the value is always interpreted as an
53303 octal integer, whether or not it starts with the digit zero, and it is
53304 always output in octal.
53305 </para>
53306 </listitem></varlistentry>
53307 <varlistentry>
53308 <term><emphasis role="bold">opt_stringptr</emphasis></term>
53309 <listitem>
53310 <para>
53311 This specifies a string value; the address must be a pointer to a
53312 variable that points to a string (for example, of type <literal>uschar *</literal>).
53313 </para>
53314 </listitem></varlistentry>
53315 <varlistentry>
53316 <term><emphasis role="bold">opt_time</emphasis></term>
53317 <listitem>
53318 <para>
53319 This specifies a time interval value. The address must point to a variable of
53320 type <literal>int</literal>. The value that is placed there is a number of seconds.
53321 </para>
53322 </listitem></varlistentry>
53323 </variablelist>
53324 <para>
53325 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
53326 out the values of all the <function>local_scan()</function> options.
53327 </para>
53328 </section>
53329 <section id="SECID208">
53330 <title>Available Exim variables</title>
53331 <para revisionflag="changed">
53332 <indexterm role="concept">
53333 <primary><function>local_scan()</function> function</primary>
53334 <secondary>available Exim variables</secondary>
53335 </indexterm>
53336 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
53337 are the only ones that are guaranteed to be maintained from release to release.
53338 Note, however, that you can obtain the value of any Exim expansion variable,
53339 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
53340 C variables are as follows:
53341 </para>
53342 <variablelist>
53343 <varlistentry>
53344 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
53345 <listitem>
53346 <para revisionflag="changed">
53347 This variable contains the number of lines in the message&#x2019;s body.
53348 </para>
53349 </listitem></varlistentry>
53350 <varlistentry revisionflag="changed">
53351 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
53352 <listitem>
53353 <para revisionflag="changed">
53354 This variable contains the number of binary zero bytes in the message&#x2019;s body.
53355 </para>
53356 </listitem></varlistentry>
53357 <varlistentry>
53358 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
53359 <listitem>
53360 <para>
53361 This variable is set to zero when no debugging is taking place. Otherwise, it
53362 is a bitmap of debugging selectors. Two bits are identified for use in
53363 <function>local_scan()</function>; they are defined as macros:
53364 </para>
53365 <itemizedlist>
53366 <listitem>
53367 <para>
53368 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
53369 testing option that is not privileged &ndash; any caller may set it. All the
53370 other selector bits can be set only by admin users.
53371 </para>
53372 </listitem>
53373 <listitem>
53374 <para>
53375 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
53376 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
53377 of debugging bits.
53378 </para>
53379 </listitem>
53380 </itemizedlist>
53381 <para>
53382 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
53383 selected, you should use code like this:
53384 </para>
53385 <literallayout class="monospaced">
53386 if ((debug_selector &amp; D_local_scan) != 0)
53387   debug_printf("xxx", ...);
53388 </literallayout>
53389 </listitem></varlistentry>
53390 <varlistentry>
53391 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
53392 <listitem>
53393 <para>
53394 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
53395 variable <option>expand_string_message</option> contains the error message, zero-terminated.
53396 </para>
53397 </listitem></varlistentry>
53398 <varlistentry>
53399 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
53400 <listitem>
53401 <para>
53402 A pointer to a chain of header lines. The <option>header_line</option> structure is
53403 discussed below.
53404 </para>
53405 </listitem></varlistentry>
53406 <varlistentry>
53407 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
53408 <listitem>
53409 <para>
53410 A pointer to the last of the header lines.
53411 </para>
53412 </listitem></varlistentry>
53413 <varlistentry>
53414 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
53415 <listitem>
53416 <para>
53417 The value of the <option>headers_charset</option> configuration option.
53418 </para>
53419 </listitem></varlistentry>
53420 <varlistentry>
53421 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
53422 <listitem>
53423 <para>
53424 This variable is TRUE during a host checking session that is initiated by the
53425 <option>-bh</option> command line option.
53426 </para>
53427 </listitem></varlistentry>
53428 <varlistentry>
53429 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
53430 <listitem>
53431 <para>
53432 The IP address of the interface that received the message, as a string. This
53433 is NULL for locally submitted messages.
53434 </para>
53435 </listitem></varlistentry>
53436 <varlistentry>
53437 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
53438 <listitem>
53439 <para>
53440 The port on which this message was received. When testing with the <option>-bh</option>
53441 command line option, the value of this variable is -1 unless a port has been
53442 specified via the <option>-oMi</option> option.
53443 </para>
53444 </listitem></varlistentry>
53445 <varlistentry>
53446 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
53447 <listitem>
53448 <para>
53449 This variable contains Exim&#x2019;s message id for the incoming message (the value of
53450 <varname>$message_exim_id</varname>) as a zero-terminated string.
53451 </para>
53452 </listitem></varlistentry>
53453 <varlistentry>
53454 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
53455 <listitem>
53456 <para>
53457 The name of the protocol by which the message was received.
53458 </para>
53459 </listitem></varlistentry>
53460 <varlistentry>
53461 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
53462 <listitem>
53463 <para>
53464 The number of accepted recipients.
53465 </para>
53466 </listitem></varlistentry>
53467 <varlistentry>
53468 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
53469 <listitem>
53470 <para>
53471 <indexterm role="concept">
53472 <primary>recipient</primary>
53473 <secondary>adding in local scan</secondary>
53474 </indexterm>
53475 <indexterm role="concept">
53476 <primary>recipient</primary>
53477 <secondary>removing in local scan</secondary>
53478 </indexterm>
53479 The list of accepted recipients, held in a vector of length
53480 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
53481 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
53482 below). You can delete recipients by removing them from the vector and
53483 adjusting the value in <option>recipients_count</option>. In particular, by setting
53484 <option>recipients_count</option> to zero you remove all recipients. If you then return the
53485 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
53486 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
53487 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
53488 </para>
53489 </listitem></varlistentry>
53490 <varlistentry>
53491 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
53492 <listitem>
53493 <para>
53494 The envelope sender address. For bounce messages this is the empty string.
53495 </para>
53496 </listitem></varlistentry>
53497 <varlistentry>
53498 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
53499 <listitem>
53500 <para>
53501 The IP address of the sending host, as a string. This is NULL for
53502 locally-submitted messages.
53503 </para>
53504 </listitem></varlistentry>
53505 <varlistentry>
53506 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
53507 <listitem>
53508 <para>
53509 The name of the authentication mechanism that was used, or NULL if the message
53510 was not received over an authenticated SMTP connection.
53511 </para>
53512 </listitem></varlistentry>
53513 <varlistentry>
53514 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
53515 <listitem>
53516 <para>
53517 The name of the sending host, if known.
53518 </para>
53519 </listitem></varlistentry>
53520 <varlistentry>
53521 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
53522 <listitem>
53523 <para>
53524 The port on the sending host.
53525 </para>
53526 </listitem></varlistentry>
53527 <varlistentry>
53528 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
53529 <listitem>
53530 <para>
53531 This variable is TRUE for all SMTP input, including BSMTP.
53532 </para>
53533 </listitem></varlistentry>
53534 <varlistentry>
53535 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
53536 <listitem>
53537 <para>
53538 This variable is TRUE for BSMTP input.
53539 </para>
53540 </listitem></varlistentry>
53541 <varlistentry>
53542 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
53543 <listitem>
53544 <para>
53545 The contents of this variable control which pool of memory is used for new
53546 requests. See section <xref linkend="SECTmemhanloc"/> for details.
53547 </para>
53548 </listitem></varlistentry>
53549 </variablelist>
53550 </section>
53551 <section id="SECID209">
53552 <title>Structure of header lines</title>
53553 <para>
53554 The <option>header_line</option> structure contains the members listed below.
53555 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
53556 (see below). You can cause header lines to be ignored (deleted) by setting
53557 their type to *.
53558 </para>
53559 <variablelist>
53560 <varlistentry>
53561 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
53562 <listitem>
53563 <para>
53564 A pointer to the next header line, or NULL for the last line.
53565 </para>
53566 </listitem></varlistentry>
53567 <varlistentry>
53568 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
53569 <listitem>
53570 <para>
53571 A code identifying certain headers that Exim recognizes. The codes are printing
53572 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
53573 Notice in particular that any header line whose type is * is not transmitted
53574 with the message. This flagging is used for header lines that have been
53575 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
53576 lines.) Effectively, * means <quote>deleted</quote>.
53577 </para>
53578 </listitem></varlistentry>
53579 <varlistentry>
53580 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
53581 <listitem>
53582 <para>
53583 The number of characters in the header line, including the terminating and any
53584 internal newlines.
53585 </para>
53586 </listitem></varlistentry>
53587 <varlistentry>
53588 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
53589 <listitem>
53590 <para>
53591 A pointer to the text of the header. It always ends with a newline, followed by
53592 a zero byte. Internal newlines are preserved.
53593 </para>
53594 </listitem></varlistentry>
53595 </variablelist>
53596 </section>
53597 <section id="SECID210">
53598 <title>Structure of recipient items</title>
53599 <para>
53600 The <option>recipient_item</option> structure contains these members:
53601 </para>
53602 <variablelist>
53603 <varlistentry>
53604 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
53605 <listitem>
53606 <para>
53607 This is a pointer to the recipient address as it was received.
53608 </para>
53609 </listitem></varlistentry>
53610 <varlistentry>
53611 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
53612 <listitem>
53613 <para>
53614 This is used in later Exim processing when top level addresses are created by
53615 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
53616 and must always contain -1 at this stage.
53617 </para>
53618 </listitem></varlistentry>
53619 <varlistentry>
53620 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
53621 <listitem>
53622 <para>
53623 If this value is not NULL, bounce messages caused by failing to deliver to the
53624 recipient are sent to the address it contains. In other words, it overrides the
53625 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
53626 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
53627 an unqualified address, Exim qualifies it using the domain from
53628 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
53629 is NULL for all recipients.
53630 </para>
53631 </listitem></varlistentry>
53632 </variablelist>
53633 </section>
53634 <section id="SECID211">
53635 <title>Available Exim functions</title>
53636 <para>
53637 <indexterm role="concept">
53638 <primary><function>local_scan()</function> function</primary>
53639 <secondary>available Exim functions</secondary>
53640 </indexterm>
53641 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
53642 These are the only ones that are guaranteed to be maintained from release to
53643 release:
53644 </para>
53645 <variablelist>
53646 <varlistentry>
53647 <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>
53648 <listitem>
53649 <para>
53650 This function creates a child process that runs the command specified by
53651 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
53652 be NULL if no environment variables are to be passed. A new umask is supplied
53653 for the process in <option>newumask</option>.
53654 </para>
53655 <para>
53656 Pipes to the standard input and output of the new process are set up
53657 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
53658 standard error is cloned to the standard output. If there are any file
53659 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
53660 argument is TRUE, the new process is made into a process group leader.
53661 </para>
53662 <para>
53663 The function returns the pid of the new process, or -1 if things go wrong.
53664 </para>
53665 </listitem></varlistentry>
53666 <varlistentry>
53667 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
53668 <listitem>
53669 <para>
53670 This function waits for a child process to terminate, or for a timeout (in
53671 seconds) to expire. A timeout value of zero means wait as long as it takes. The
53672 return value is as follows:
53673 </para>
53674 <itemizedlist>
53675 <listitem>
53676 <para>
53677 &gt;= 0
53678 </para>
53679 <para>
53680 The process terminated by a normal exit and the value is the process
53681 ending status.
53682 </para>
53683 </listitem>
53684 <listitem>
53685 <para>
53686 &lt; 0 and &gt; &ndash;256
53687 </para>
53688 <para>
53689 The process was terminated by a signal and the value is the negation of the
53690 signal number.
53691 </para>
53692 </listitem>
53693 <listitem>
53694 <para>
53695 &ndash;256
53696 </para>
53697 <para>
53698 The process timed out.
53699 </para>
53700 </listitem>
53701 <listitem>
53702 <para>
53703 &ndash;257
53704 </para>
53705 <para>
53706 The was some other error in wait(); <option>errno</option> is still set.
53707 </para>
53708 </listitem>
53709 </itemizedlist>
53710 </listitem></varlistentry>
53711 <varlistentry>
53712 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
53713 <listitem>
53714 <para>
53715 This function provide you with a means of submitting a new message to
53716 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
53717 want, but this packages it all up for you.) The function creates a pipe,
53718 forks a subprocess that is running
53719 </para>
53720 <literallayout class="monospaced">
53721 exim -t -oem -oi -f &lt;&gt;
53722 </literallayout>
53723 <para>
53724 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
53725 that is connected to the standard input. The yield of the function is the PID
53726 of the subprocess. You can then write a message to the file descriptor, with
53727 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
53728 </para>
53729 <para>
53730 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
53731 finish and to collect its ending status. A timeout value of zero is usually
53732 fine in this circumstance. Unless you have made a mistake with the recipient
53733 addresses, you should get a return code of zero.
53734 </para>
53735 </listitem></varlistentry>
53736 <varlistentry>
53737 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
53738 <listitem>
53739 <para>
53740 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
53741 that it runs is:
53742 </para>
53743 <literallayout>
53744 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
53745 </literallayout>
53746 <para>
53747 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
53748 </para>
53749 </listitem></varlistentry>
53750 <varlistentry>
53751 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
53752 <listitem>
53753 <para>
53754 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
53755 output is written to the standard error stream. If no debugging is selected,
53756 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
53757 conditional on the <literal>local_scan</literal> debug selector by coding like this:
53758 </para>
53759 <literallayout class="monospaced">
53760 if ((debug_selector &amp; D_local_scan) != 0)
53761   debug_printf("xxx", ...);
53762 </literallayout>
53763 </listitem></varlistentry>
53764 <varlistentry>
53765 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
53766 <listitem>
53767 <para>
53768 This is an interface to Exim&#x2019;s string expansion code. The return value is the
53769 expanded string, or NULL if there was an expansion failure.
53770 The C variable <option>expand_string_message</option> contains an error message after an
53771 expansion failure. If expansion does not change the string, the return value is
53772 the pointer to the input string. Otherwise, the return value points to a new
53773 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
53774 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
53775 </para>
53776 </listitem></varlistentry>
53777 <varlistentry>
53778 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
53779 <listitem>
53780 <para>
53781 This function allows you to an add additional header line at the end of the
53782 existing ones. The first argument is the type, and should normally be a space
53783 character. The second argument is a format string and any number of
53784 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
53785 if you want, and you must ensure that the string ends with a newline.
53786 </para>
53787 </listitem></varlistentry>
53788 <varlistentry>
53789 <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>
53790 <listitem>
53791 <para>
53792 This function adds a new header line at a specified point in the header
53793 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
53794 </para>
53795 <para>
53796 If <option>name</option> is NULL, the new header is added at the end of the chain if
53797 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
53798 NULL, the header lines are searched for the first non-deleted header that
53799 matches the name. If one is found, the new header is added before it if
53800 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
53801 found header and any adjacent subsequent ones with the same name (even if
53802 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
53803 option controls where the header is added. If it is true, addition is at the
53804 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
53805 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
53806 </para>
53807 <literallayout class="monospaced">
53808 header_add_at_position(TRUE, US"Received", TRUE,
53809   ' ', "X-xxx: ...");
53810 </literallayout>
53811 <para>
53812 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
53813 there may not be if <option>received_header_text</option> expands to an empty string.
53814 </para>
53815 </listitem></varlistentry>
53816 <varlistentry>
53817 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
53818 <listitem>
53819 <para>
53820 This function removes header lines. If <option>occurrence</option> is zero or negative, all
53821 occurrences of the header are removed. If occurrence is greater than zero, that
53822 particular instance of the header is removed. If no header(s) can be found that
53823 match the specification, the function does nothing.
53824 </para>
53825 </listitem></varlistentry>
53826 <varlistentry>
53827 <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>
53828 <listitem>
53829 <para>
53830 This function tests whether the given header has the given name. It is not just
53831 a string comparison, because white space is permitted between the name and the
53832 colon. If the <option>notdel</option> argument is true, a false return is forced for all
53833 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
53834 </para>
53835 <literallayout class="monospaced">
53836 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
53837 </literallayout>
53838 </listitem></varlistentry>
53839 <varlistentry>
53840 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
53841 <listitem>
53842 <para>
53843 <indexterm role="concept">
53844 <primary>base64 encoding</primary>
53845 <secondary>functions for <function>local_scan()</function> use</secondary>
53846 </indexterm>
53847 This function base64-encodes a string, which is passed by address and length.
53848 The text may contain bytes of any value, including zero. The result is passed
53849 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
53850 zero-terminated.
53851 </para>
53852 </listitem></varlistentry>
53853 <varlistentry>
53854 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
53855 <listitem>
53856 <para>
53857 This function decodes a base64-encoded string. Its arguments are a
53858 zero-terminated base64-encoded string and the address of a variable that is set
53859 to point to the result, which is in dynamic memory. The length of the decoded
53860 string is the yield of the function. If the input is invalid base64 data, the
53861 yield is -1. A zero byte is added to the end of the output string to make it
53862 easy to interpret as a C string (assuming it contains no zeros of its own). The
53863 added zero byte is not included in the returned count.
53864 </para>
53865 </listitem></varlistentry>
53866 <varlistentry>
53867 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
53868 <listitem>
53869 <para>
53870 This function checks for a match in a domain list. Domains are always
53871 matched caselessly. The return value is one of the following:
53872 </para>
53873 <literallayout>
53874 <literal>OK     </literal> match succeeded
53875 <literal>FAIL   </literal> match failed
53876 <literal>DEFER  </literal> match deferred
53877 </literallayout>
53878 <para>
53879 DEFER is usually caused by some kind of lookup defer, such as the
53880 inability to contact a database.
53881 </para>
53882 </listitem></varlistentry>
53883 <varlistentry>
53884 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
53885 <listitem>
53886 <para>
53887 This function checks for a match in a local part list. The third argument
53888 controls case-sensitivity. The return values are as for
53889 <emphasis>lss_match_domain()</emphasis>.
53890 </para>
53891 </listitem></varlistentry>
53892 <varlistentry>
53893 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
53894 <listitem>
53895 <para>
53896 This function checks for a match in an address list. The third argument
53897 controls the case-sensitivity of the local part match. The domain is always
53898 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
53899 </para>
53900 </listitem></varlistentry>
53901 <varlistentry>
53902 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
53903 <listitem>
53904 <para>
53905 This function checks for a match in a host list. The most common usage is
53906 expected to be
53907 </para>
53908 <literallayout class="monospaced">
53909 lss_match_host(sender_host_name, sender_host_address, ...)
53910 </literallayout>
53911 <para>
53912 <indexterm role="variable">
53913 <primary><varname>$sender_host_address</varname></primary>
53914 </indexterm>
53915 An empty address field matches an empty item in the host list. If the host name
53916 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
53917 looked up if a host name is required to match an item in the list. The return
53918 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
53919 returns ERROR in the case when it had to look up a host name, but the lookup
53920 failed.
53921 </para>
53922 </listitem></varlistentry>
53923 <varlistentry>
53924 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
53925 <listitem>
53926 <para>
53927 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
53928 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
53929 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
53930 them. It specifies to which log or logs the message is written. The remaining
53931 arguments are a format and relevant insertion arguments. The string should not
53932 contain any newlines, not even at the end.
53933 </para>
53934 </listitem></varlistentry>
53935 <varlistentry>
53936 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
53937 <listitem>
53938 <para>
53939 This function adds an additional recipient to the message. The first argument
53940 is the recipient address. If it is unqualified (has no domain), it is qualified
53941 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
53942 </para>
53943 <para>
53944 This function does not allow you to specify a private <option>errors_to</option> address (as
53945 described with the structure of <option>recipient_item</option> above), because it pre-dates
53946 the addition of that field to the structure. However, it is easy to add such a
53947 value afterwards. For example:
53948 </para>
53949 <literallayout class="monospaced">
53950  receive_add_recipient(US"monitor@mydom.example", -1);
53951  recipients_list[recipients_count-1].errors_to =
53952    US"postmaster@mydom.example";
53953 </literallayout>
53954 </listitem></varlistentry>
53955 <varlistentry>
53956 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
53957 <listitem>
53958 <para>
53959 This is a convenience function to remove a named recipient from the list of
53960 recipients. It returns true if a recipient was removed, and false if no
53961 matching recipient could be found. The argument must be a complete email
53962 address.
53963 </para>
53964 </listitem></varlistentry>
53965 </variablelist>
53966 <para>
53967 <indexterm role="concept">
53968 <primary>RFC 2047</primary>
53969 </indexterm>
53970 </para>
53971 <variablelist>
53972 <varlistentry>
53973 <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>
53974 <listitem>
53975 <para>
53976 This function decodes strings that are encoded according to RFC 2047. Typically
53977 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
53978 from the Q or B encoding into a byte-string. Then, if provided with the name of
53979 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
53980 made  to translate the result to the named character set. If this fails, the
53981 binary string is returned with an error message.
53982 </para>
53983 <para>
53984 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
53985 maximum MIME word length is enforced. The third argument is the target
53986 encoding, or NULL if no translation is wanted.
53987 </para>
53988 <para>
53989 <indexterm role="concept">
53990 <primary>binary zero</primary>
53991 <secondary>in RFC 2047 decoding</secondary>
53992 </indexterm>
53993 <indexterm role="concept">
53994 <primary>RFC 2047</primary>
53995 <secondary>binary zero in</secondary>
53996 </indexterm>
53997 If a binary zero is encountered in the decoded string, it is replaced by the
53998 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
53999 not be 0 because header lines are handled as zero-terminated strings.
54000 </para>
54001 <para>
54002 The function returns the result of processing the string, zero-terminated; if
54003 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
54004 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
54005 </para>
54006 <para>
54007 If an error is encountered, the function returns NULL and uses the <option>error</option>
54008 argument to return an error message. The variable pointed to by <option>error</option> is
54009 set to NULL if there is no error; it may be set non-NULL even when the function
54010 returns a non-NULL value if decoding was successful, but there was a problem
54011 with translation.
54012 </para>
54013 </listitem></varlistentry>
54014 <varlistentry>
54015 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
54016 <listitem>
54017 <para>
54018 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
54019 below.
54020 </para>
54021 </listitem></varlistentry>
54022 <varlistentry>
54023 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
54024 <listitem>
54025 <para>
54026 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
54027 output stream. You should use this function only when there is an SMTP output
54028 stream, that is, when the incoming message is being received via interactive
54029 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
54030 is FALSE. If you want to test for an incoming message from another host (as
54031 opposed to a local process that used the <option>-bs</option> command line option), you can
54032 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
54033 is involved.
54034 </para>
54035 <para>
54036 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
54037 output function, so it can be used for all forms of SMTP connection.
54038 </para>
54039 <para>
54040 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
54041 must start with an appropriate response code: 550 if you are going to return
54042 LOCAL_SCAN_REJECT, 451 if you are going to return
54043 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
54044 initial lines of a multi-line response, the code must be followed by a hyphen
54045 to indicate that the line is not the final response line. You must also ensure
54046 that the lines you write terminate with CRLF. For example:
54047 </para>
54048 <literallayout class="monospaced">
54049 smtp_printf("550-this is some extra info\r\n");
54050 return LOCAL_SCAN_REJECT;
54051 </literallayout>
54052 <para>
54053 Note that you can also create multi-line responses by including newlines in
54054 the data returned via the <option>return_text</option> argument. The added value of using
54055 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
54056 multiple output lines.
54057 </para>
54058 <para>
54059 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
54060 does not automatically flush pending output, and therefore does not test
54061 the state of the stream. (In the main code of Exim, flushing and error
54062 detection is done when Exim is ready for the next SMTP input command.) If
54063 you want to flush the output and check for an error (for example, the
54064 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
54065 arguments. It flushes the output stream, and returns a non-zero value if there
54066 is an error.
54067 </para>
54068 </listitem></varlistentry>
54069 <varlistentry>
54070 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
54071 <listitem>
54072 <para>
54073 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
54074 chunk of memory whose size is given by the argument. Exim bombs out if it ever
54075 runs out of memory. See the next section for a discussion of memory handling.
54076 </para>
54077 </listitem></varlistentry>
54078 <varlistentry>
54079 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
54080 <listitem>
54081 <para>
54082 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
54083 permanent pool. See the next section for a discussion of memory handling.
54084 </para>
54085 </listitem></varlistentry>
54086 <varlistentry>
54087 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
54088 <listitem>
54089 <para>
54090 See below.
54091 </para>
54092 </listitem></varlistentry>
54093 <varlistentry>
54094 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
54095 <listitem>
54096 <para>
54097 See below.
54098 </para>
54099 </listitem></varlistentry>
54100 <varlistentry>
54101 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
54102 <listitem>
54103 <para>
54104 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
54105 The first makes a copy of an entire string. The second copies up to a maximum
54106 number of characters, indicated by the second argument. The third uses a format
54107 and insertion arguments to create a new string. In each case, the result is a
54108 pointer to a new string in the current memory pool. See the next section for
54109 more discussion.
54110 </para>
54111 </listitem></varlistentry>
54112 </variablelist>
54113 </section>
54114 <section id="SECTmemhanloc">
54115 <title>More about Exim&#x2019;s memory handling</title>
54116 <para>
54117 <indexterm role="concept">
54118 <primary><function>local_scan()</function> function</primary>
54119 <secondary>memory handling</secondary>
54120 </indexterm>
54121 No function is provided for freeing memory, because that is never needed.
54122 The dynamic memory that Exim uses when receiving a message is automatically
54123 recycled if another message is received by the same process (this applies only
54124 to incoming SMTP connections &ndash; other input methods can supply only one
54125 message at a time). After receiving the last message, a reception process
54126 terminates.
54127 </para>
54128 <para>
54129 Because it is recycled, the normal dynamic memory cannot be used for holding
54130 data that must be preserved over a number of incoming messages on the same SMTP
54131 connection. However, Exim in fact uses two pools of dynamic memory; the second
54132 one is not recycled, and can be used for this purpose.
54133 </para>
54134 <para>
54135 If you want to allocate memory that remains available for subsequent messages
54136 in the same SMTP connection, you should set
54137 </para>
54138 <literallayout class="monospaced">
54139 store_pool = POOL_PERM
54140 </literallayout>
54141 <para>
54142 before calling the function that does the allocation. There is no need to
54143 restore the value if you do not need to; however, if you do want to revert to
54144 the normal pool, you can either restore the previous value of <option>store_pool</option> or
54145 set it explicitly to POOL_MAIN.
54146 </para>
54147 <para>
54148 The pool setting applies to all functions that get dynamic memory, including
54149 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
54150 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
54151 block of memory from the permanent pool while preserving the value of
54152 <option>store_pool</option>.
54153 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
54154 </para>
54155 </section>
54156 </chapter>
54157
54158 <chapter id="CHAPsystemfilter">
54159 <title>System-wide message filtering</title>
54160 <para>
54161 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
54162 <primary>filter</primary>
54163 <secondary>system filter</secondary>
54164 </indexterm>
54165 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
54166 <primary>filtering all mail</primary>
54167 </indexterm>
54168 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
54169 <primary>system filter</primary>
54170 </indexterm>
54171 The previous chapters (on ACLs and the local scan function) describe checks
54172 that can be applied to messages before they are accepted by a host. There is
54173 also a mechanism for checking messages once they have been received, but before
54174 they are delivered. This is called the <emphasis>system filter</emphasis>.
54175 </para>
54176 <para>
54177 The system filter operates in a similar manner to users&#x2019; filter files, but it
54178 is run just once per message (however many recipients the message has).
54179 It should not normally be used as a substitute for routing, because <option>deliver</option>
54180 commands in a system router provide new envelope recipient addresses.
54181 The system filter must be an Exim filter. It cannot be a Sieve filter.
54182 </para>
54183 <para>
54184 The system filter is run at the start of a delivery attempt, before any routing
54185 is done. If a message fails to be completely delivered at the first attempt,
54186 the system filter is run again at the start of every retry.
54187 If you want your filter to do something only once per message, you can make use
54188 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
54189 prevent it happening on retries.
54190 </para>
54191 <para>
54192 <indexterm role="variable">
54193 <primary><varname>$domain</varname></primary>
54194 </indexterm>
54195 <indexterm role="variable">
54196 <primary><varname>$local_part</varname></primary>
54197 </indexterm>
54198 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
54199 specific to individual recipient addresses, such as <varname>$local_part</varname> and
54200 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
54201 you want to run a centrally-specified filter for each recipient address
54202 independently, you can do so by setting up a suitable <command>redirect</command> router, as
54203 described in section <xref linkend="SECTperaddfil"/> below.
54204 </para>
54205 <section id="SECID212">
54206 <title>Specifying a system filter</title>
54207 <para>
54208 <indexterm role="concept">
54209 <primary>uid (user id)</primary>
54210 <secondary>system filter</secondary>
54211 </indexterm>
54212 <indexterm role="concept">
54213 <primary>gid (group id)</primary>
54214 <secondary>system filter</secondary>
54215 </indexterm>
54216 The name of the file that contains the system filter must be specified by
54217 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
54218 other than root, you must also set <option>system_filter_user</option> and
54219 <option>system_filter_group</option> as appropriate. For example:
54220 </para>
54221 <literallayout class="monospaced">
54222 system_filter = /etc/mail/exim.filter
54223 system_filter_user = exim
54224 </literallayout>
54225 <para>
54226 If a system filter generates any deliveries directly to files or pipes (via the
54227 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
54228 specified by setting <option>system_filter_file_transport</option> and
54229 <option>system_filter_pipe_transport</option>, respectively. Similarly,
54230 <option>system_filter_reply_transport</option> must be set to handle any messages generated
54231 by the <option>reply</option> command.
54232 </para>
54233 </section>
54234 <section id="SECID213">
54235 <title>Testing a system filter</title>
54236 <para>
54237 You can run simple tests of a system filter in the same way as for a user
54238 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
54239 are permitted only in system filters are recognized.
54240 </para>
54241 <para>
54242 If you want to test the combined effect of a system filter and a user filter,
54243 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
54244 </para>
54245 </section>
54246 <section id="SECID214">
54247 <title>Contents of a system filter</title>
54248 <para>
54249 The language used to specify system filters is the same as for users&#x2019; filter
54250 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
54251 mail filtering</emphasis>. However, there are some additional features that are
54252 available only in system filters; these are described in subsequent sections.
54253 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
54254 they cause errors.
54255 </para>
54256 <para>
54257 <indexterm role="concept">
54258 <primary>frozen messages</primary>
54259 <secondary>manual thaw; testing in filter</secondary>
54260 </indexterm>
54261 There are two special conditions which, though available in users&#x2019; filter
54262 files, are designed for use in system filters. The condition <option>first_delivery</option>
54263 is true only for the first attempt at delivering a message, and
54264 <option>manually_thawed</option> is true only if the message has been frozen, and
54265 subsequently thawed by an admin user. An explicit forced delivery counts as a
54266 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
54267 </para>
54268 <para>
54269 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
54270 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
54271 succeed, it will not be tried again.
54272 If you want Exim to retry an unseen delivery until it succeeds, you should
54273 arrange to set it up every time the filter runs.
54274 </para>
54275 <para>
54276 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
54277 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
54278 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
54279 to which users&#x2019; filter files can refer.
54280 </para>
54281 </section>
54282 <section id="SECID215">
54283 <title>Additional variable for system filters</title>
54284 <para>
54285 <indexterm role="variable">
54286 <primary><varname>$recipients</varname></primary>
54287 </indexterm>
54288 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
54289 of the message (separated by commas and white space), is available in system
54290 filters. It is not available in users&#x2019; filters for privacy reasons.
54291 </para>
54292 </section>
54293 <section id="SECID216">
54294 <title>Defer, freeze, and fail commands for system filters</title>
54295 <para>
54296 <indexterm role="concept">
54297 <primary>freezing messages</primary>
54298 </indexterm>
54299 <indexterm role="concept">
54300 <primary>message</primary>
54301 <secondary>freezing</secondary>
54302 </indexterm>
54303 <indexterm role="concept">
54304 <primary>message</primary>
54305 <secondary>forced failure</secondary>
54306 </indexterm>
54307 <indexterm role="concept">
54308 <primary><option>fail</option></primary>
54309 <secondary>in system filter</secondary>
54310 </indexterm>
54311 <indexterm role="concept">
54312 <primary><option>freeze</option> in system filter</primary>
54313 </indexterm>
54314 <indexterm role="concept">
54315 <primary><option>defer</option> in system filter</primary>
54316 </indexterm>
54317 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
54318 always available in system filters, but are not normally enabled in users&#x2019;
54319 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
54320 for the <command>redirect</command> router.) These commands can optionally be followed by the
54321 word <option>text</option> and a string containing an error message, for example:
54322 </para>
54323 <literallayout class="monospaced">
54324 fail text "this message looks like spam to me"
54325 </literallayout>
54326 <para>
54327 The keyword <option>text</option> is optional if the next character is a double quote.
54328 </para>
54329 <para>
54330 The <option>defer</option> command defers delivery of the original recipients of the
54331 message. The <option>fail</option> command causes all the original recipients to be failed,
54332 and a bounce message to be created. The <option>freeze</option> command suspends all
54333 delivery attempts for the original recipients. In all cases, any new deliveries
54334 that are specified by the filter are attempted as normal after the filter has
54335 run.
54336 </para>
54337 <para>
54338 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
54339 not manually frozen since. This means that automatic freezing by a system
54340 filter can be used as a way of checking out suspicious messages. If a message
54341 is found to be all right, manually unfreezing it allows it to be delivered.
54342 </para>
54343 <para>
54344 <indexterm role="concept">
54345 <primary>log</primary>
54346 <secondary><option>fail</option> command log line</secondary>
54347 </indexterm>
54348 <indexterm role="concept">
54349 <primary><option>fail</option></primary>
54350 <secondary>log line; reducing</secondary>
54351 </indexterm>
54352 The text given with a fail command is used as part of the bounce message as
54353 well as being written to the log. If the message is quite long, this can fill
54354 up a lot of log space when such failures are common. To reduce the size of the
54355 log message, Exim interprets the text in a special way if it starts with the
54356 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
54357 strings is written to the log, and the rest of the text is used in the bounce
54358 message. For example:
54359 </para>
54360 <literallayout class="monospaced">
54361 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
54362      because it contains attachments that we are \
54363      not prepared to receive."
54364 </literallayout>
54365 <para>
54366 <indexterm role="concept">
54367 <primary>loop</primary>
54368 <secondary>caused by <option>fail</option></secondary>
54369 </indexterm>
54370 Take great care with the <option>fail</option> command when basing the decision to fail on
54371 the contents of the message, because the bounce message will of course include
54372 the contents of the original message and will therefore trigger the <option>fail</option>
54373 command again (causing a mail loop) unless steps are taken to prevent this.
54374 Testing the <option>error_message</option> condition is one way to prevent this. You could
54375 use, for example
54376 </para>
54377 <literallayout class="monospaced">
54378 if $message_body contains "this is spam" and not error_message
54379 then fail text "spam is not wanted here" endif
54380 </literallayout>
54381 <para>
54382 though of course that might let through unwanted bounce messages. The
54383 alternative is clever checking of the body and/or headers to detect bounces
54384 generated by the filter.
54385 </para>
54386 <para>
54387 The interpretation of a system filter file ceases after a
54388 <option>defer</option>,
54389 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
54390 set up earlier in the filter file are honoured, so you can use a sequence such
54391 as
54392 </para>
54393 <literallayout class="monospaced">
54394 mail ...
54395 freeze
54396 </literallayout>
54397 <para>
54398 to send a specified message when the system filter is freezing (or deferring or
54399 failing) a message. The normal deliveries for the message do not, of course,
54400 take place.
54401 </para>
54402 </section>
54403 <section id="SECTaddremheasys">
54404 <title>Adding and removing headers in a system filter</title>
54405 <para>
54406 <indexterm role="concept">
54407 <primary>header lines</primary>
54408 <secondary>adding; in system filter</secondary>
54409 </indexterm>
54410 <indexterm role="concept">
54411 <primary>header lines</primary>
54412 <secondary>removing; in system filter</secondary>
54413 </indexterm>
54414 <indexterm role="concept">
54415 <primary>filter</primary>
54416 <secondary>header lines; adding/removing</secondary>
54417 </indexterm>
54418 Two filter commands that are available only in system filters are:
54419 </para>
54420 <literallayout class="monospaced">
54421 headers add &lt;string&gt;
54422 headers remove &lt;string&gt;
54423 </literallayout>
54424 <para>
54425 The argument for the <option>headers add</option> is a string that is expanded and then
54426 added to the end of the message&#x2019;s headers. It is the responsibility of the
54427 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
54428 space is ignored, and if the string is otherwise empty, or if the expansion is
54429 forced to fail, the command has no effect.
54430 </para>
54431 <para>
54432 You can use <quote>\n</quote> within the string, followed by white space, to specify
54433 continued header lines. More than one header may be added in one command by
54434 including <quote>\n</quote> within the string without any following white space. For
54435 example:
54436 </para>
54437 <literallayout class="monospaced">
54438 headers add "X-header-1: ....\n  \
54439              continuation of X-header-1 ...\n\
54440              X-header-2: ...."
54441 </literallayout>
54442 <para>
54443 Note that the header line continuation white space after the first newline must
54444 be placed before the backslash that continues the input string, because white
54445 space after input continuations is ignored.
54446 </para>
54447 <para>
54448 The argument for <option>headers remove</option> is a colon-separated list of header names.
54449 This command applies only to those headers that are stored with the message;
54450 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
54451 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
54452 header with the same name, they are all removed.
54453 </para>
54454 <para>
54455 The <option>headers</option> command in a system filter makes an immediate change to the set
54456 of header lines that was received with the message (with possible additions
54457 from ACL processing). Subsequent commands in the system filter operate on the
54458 modified set, which also forms the basis for subsequent message delivery.
54459 Unless further modified during routing or transporting, this set of headers is
54460 used for all recipients of the message.
54461 </para>
54462 <para>
54463 During routing and transporting, the variables that refer to the contents of
54464 header lines refer only to those lines that are in this set. Thus, header lines
54465 that are added by a system filter are visible to users&#x2019; filter files and to all
54466 routers and transports. This contrasts with the manipulation of header lines by
54467 routers and transports, which is not immediate, but which instead is saved up
54468 until the message is actually being written (see section
54469 <xref linkend="SECTheadersaddrem"/>).
54470 </para>
54471 <para>
54472 If the message is not delivered at the first attempt, header lines that were
54473 added by the system filter are stored with the message, and so are still
54474 present at the next delivery attempt. Header lines that were removed are still
54475 present, but marked <quote>deleted</quote> so that they are not transported with the
54476 message. For this reason, it is usual to make the <option>headers</option> command
54477 conditional on <option>first_delivery</option> so that the set of header lines is not
54478 modified more than once.
54479 </para>
54480 <para>
54481 Because header modification in a system filter acts immediately, you have to
54482 use an indirect approach if you want to modify the contents of a header line.
54483 For example:
54484 </para>
54485 <literallayout class="monospaced">
54486 headers add "Old-Subject: $h_subject:"
54487 headers remove "Subject"
54488 headers add "Subject: new subject (was: $h_old-subject:)"
54489 headers remove "Old-Subject"
54490 </literallayout>
54491 </section>
54492 <section id="SECID217">
54493 <title>Setting an errors address in a system filter</title>
54494 <para>
54495 <indexterm role="concept">
54496 <primary>envelope sender</primary>
54497 </indexterm>
54498 In a system filter, if a <option>deliver</option> command is followed by
54499 </para>
54500 <literallayout class="monospaced">
54501 errors_to &lt;some address&gt;
54502 </literallayout>
54503 <para>
54504 in order to change the envelope sender (and hence the error reporting) for that
54505 delivery, any address may be specified. (In a user filter, only the current
54506 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
54507 might use
54508 </para>
54509 <literallayout class="monospaced">
54510 unseen deliver monitor@spying.example errors_to root@local.example
54511 </literallayout>
54512 <para>
54513 to take a copy which would not be sent back to the normal error reporting
54514 address if its delivery failed.
54515 </para>
54516 </section>
54517 <section id="SECTperaddfil">
54518 <title>Per-address filtering</title>
54519 <para>
54520 <indexterm role="variable">
54521 <primary><varname>$domain</varname></primary>
54522 </indexterm>
54523 <indexterm role="variable">
54524 <primary><varname>$local_part</varname></primary>
54525 </indexterm>
54526 In contrast to the system filter, which is run just once per message for each
54527 delivery attempt, it is also possible to set up a system-wide filtering
54528 operation that runs once for each recipient address. In this case, variables
54529 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
54530 filter file could be made dependent on them. This is an example of a router
54531 which implements such a filter:
54532 </para>
54533 <literallayout class="monospaced">
54534 central_filter:
54535   check_local_user
54536   driver = redirect
54537   domains = +local_domains
54538   file = /central/filters/$local_part
54539   no_verify
54540   allow_filter
54541   allow_freeze
54542 </literallayout>
54543 <para>
54544 The filter is run in a separate process under its own uid. Therefore, either
54545 <option>check_local_user</option> must be set (as above), in which case the filter is run as
54546 the local user, or the <option>user</option> option must be used to specify which user to
54547 use. If both are set, <option>user</option> overrides.
54548 </para>
54549 <para>
54550 Care should be taken to ensure that none of the commands in the filter file
54551 specify a significant delivery if the message is to go on to be delivered to
54552 its intended recipient. The router will not then claim to have dealt with the
54553 address, so it will be passed on to subsequent routers to be delivered in the
54554 normal way.
54555 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
54556 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
54557 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
54558 </para>
54559 </section>
54560 </chapter>
54561
54562 <chapter id="CHAPmsgproc">
54563 <title>Message processing</title>
54564 <para>
54565 <indexterm role="concept" id="IIDmesproc" class="startofrange">
54566 <primary>message</primary>
54567 <secondary>general processing</secondary>
54568 </indexterm>
54569 Exim performs various transformations on the sender and recipient addresses of
54570 all messages that it handles, and also on the messages&#x2019; header lines. Some of
54571 these are optional and configurable, while others always take place. All of
54572 this processing, except rewriting as a result of routing, and the addition or
54573 removal of header lines while delivering, happens when a message is received,
54574 before it is placed on Exim&#x2019;s queue.
54575 </para>
54576 <para>
54577 Some of the automatic processing takes place by default only for
54578 <quote>locally-originated</quote> messages. This adjective is used to describe messages
54579 that are not received over TCP/IP, but instead are passed to an Exim process on
54580 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
54581 set up by the <option>-bs</option> command line option.
54582 </para>
54583 <para>
54584 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
54585 or ::1) are not considered to be locally-originated. Exim does not treat the
54586 loopback interface specially in any way.
54587 </para>
54588 <para>
54589 If you want the loopback interface to be treated specially, you must ensure
54590 that there are appropriate entries in your ACLs.
54591 </para>
54592 <section id="SECTsubmodnon">
54593 <title>Submission mode for non-local messages</title>
54594 <para>
54595 <indexterm role="concept">
54596 <primary>message</primary>
54597 <secondary>submission</secondary>
54598 </indexterm>
54599 <indexterm role="concept">
54600 <primary>submission mode</primary>
54601 </indexterm>
54602 Processing that happens automatically for locally-originated messages (unless
54603 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
54604 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
54605 state. Submission mode is set by the modifier
54606 </para>
54607 <literallayout class="monospaced">
54608 control = submission
54609 </literallayout>
54610 <para>
54611 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
54612 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
54613 a local submission, and is normally used when the source of the message is
54614 known to be an MUA running on a client host (as opposed to an MTA). For
54615 example, to set submission mode for messages originating on the IPv4 loopback
54616 interface, you could include the following in the MAIL ACL:
54617 </para>
54618 <literallayout class="monospaced">
54619 warn  hosts = 127.0.0.1
54620       control = submission
54621 </literallayout>
54622 <para>
54623 <indexterm role="concept">
54624 <primary><option>sender_retain</option> submission option</primary>
54625 </indexterm>
54626 There are some options that can be used when setting submission mode. A slash
54627 is used to separate options. For example:
54628 </para>
54629 <literallayout class="monospaced">
54630 control = submission/sender_retain
54631 </literallayout>
54632 <para>
54633 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
54634 true and <option>local_from_check</option> false for the current incoming message. The first
54635 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
54636 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
54637 authenticated sender. With this setting, Exim still fixes up messages by adding
54638 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
54639 attempt to check sender authenticity in header lines.
54640 </para>
54641 <para>
54642 When <option>sender_retain</option> is not set, a submission mode setting may specify a
54643 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
54644 example:
54645 </para>
54646 <literallayout class="monospaced">
54647 control = submission/domain=some.domain
54648 </literallayout>
54649 <para>
54650 The domain may be empty. How this value is used is described in sections
54651 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
54652 that allows you to specify the user&#x2019;s full name for inclusion in a created
54653 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
54654 </para>
54655 <literallayout class="monospaced">
54656 accept authenticated = *
54657        control = submission/domain=wonderland.example/\
54658                             name=${lookup {$authenticated_id} \
54659                                    lsearch {/etc/exim/namelist}}
54660 </literallayout>
54661 <para>
54662 Because the name may contain any characters, including slashes, the <option>name</option>
54663 option must be given last. The remainder of the string is used as the name. For
54664 the example above, if <filename>/etc/exim/namelist</filename> contains:
54665 </para>
54666 <literallayout class="monospaced">
54667 bigegg:  Humpty Dumpty
54668 </literallayout>
54669 <para>
54670 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
54671 line would be:
54672 </para>
54673 <literallayout class="monospaced">
54674 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
54675 </literallayout>
54676 <para>
54677 <indexterm role="concept">
54678 <primary>return path</primary>
54679 <secondary>in submission mode</secondary>
54680 </indexterm>
54681 By default, submission mode forces the return path to the same address as is
54682 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
54683 specified, the return path is also left unchanged.
54684 </para>
54685 <para>
54686 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
54687 ACL. This means that any sender checks performed before the fix-ups use the
54688 untrusted sender address specified by the user, not the trusted sender address
54689 specified by submission mode. Although this might be slightly unexpected, it
54690 does mean that you can configure ACL checks to spot that a user is trying to
54691 spoof another&#x2019;s address.
54692 </para>
54693 </section>
54694 <section id="SECTlineendings">
54695 <title>Line endings</title>
54696 <para>
54697 <indexterm role="concept">
54698 <primary>line endings</primary>
54699 </indexterm>
54700 <indexterm role="concept">
54701 <primary>carriage return</primary>
54702 </indexterm>
54703 <indexterm role="concept">
54704 <primary>linefeed</primary>
54705 </indexterm>
54706 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
54707 linefeed) is the line ending for messages transmitted over the Internet using
54708 SMTP over TCP/IP. However, within individual operating systems, different
54709 conventions are used. For example, Unix-like systems use just LF, but others
54710 use CRLF or just CR.
54711 </para>
54712 <para>
54713 Exim was designed for Unix-like systems, and internally, it stores messages
54714 using the system&#x2019;s convention of a single LF as a line terminator. When
54715 receiving a message, all line endings are translated to this standard format.
54716 Originally, it was thought that programs that passed messages directly to an
54717 MTA within an operating system would use that system&#x2019;s convention. Experience
54718 has shown that this is not the case; for example, there are Unix applications
54719 that use CRLF in this circumstance. For this reason, and for compatibility with
54720 other MTAs, the way Exim handles line endings for all messages is now as
54721 follows:
54722 </para>
54723 <itemizedlist>
54724 <listitem>
54725 <para>
54726 LF not preceded by CR is treated as a line ending.
54727 </para>
54728 </listitem>
54729 <listitem>
54730 <para>
54731 CR is treated as a line ending; if it is immediately followed by LF, the LF
54732 is ignored.
54733 </para>
54734 </listitem>
54735 <listitem>
54736 <para>
54737 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
54738 nor a local message in the state where a line containing only a dot is a
54739 terminator.
54740 </para>
54741 </listitem>
54742 <listitem>
54743 <para>
54744 If a bare CR is encountered within a header line, an extra space is added after
54745 the line terminator so as not to end the header line. The reasoning behind this
54746 is that bare CRs in header lines are most likely either to be mistakes, or
54747 people trying to play silly games.
54748 </para>
54749 </listitem>
54750 <listitem>
54751 <para>
54752 If the first header line received in a message ends with CRLF, a subsequent
54753 bare LF in a header line is treated in the same way as a bare CR in a header
54754 line.
54755 </para>
54756 </listitem>
54757 </itemizedlist>
54758 </section>
54759 <section id="SECID218">
54760 <title>Unqualified addresses</title>
54761 <para>
54762 <indexterm role="concept">
54763 <primary>unqualified addresses</primary>
54764 </indexterm>
54765 <indexterm role="concept">
54766 <primary>address</primary>
54767 <secondary>qualification</secondary>
54768 </indexterm>
54769 By default, Exim expects every envelope address it receives from an external
54770 host to be fully qualified. Unqualified addresses cause negative responses to
54771 SMTP commands. However, because SMTP is used as a means of transporting
54772 messages from MUAs running on personal workstations, there is sometimes a
54773 requirement to accept unqualified addresses from specific hosts or IP networks.
54774 </para>
54775 <para>
54776 Exim has two options that separately control which hosts may send unqualified
54777 sender or recipient addresses in SMTP commands, namely
54778 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
54779 cases, if an unqualified address is accepted, it is qualified by adding the
54780 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
54781 </para>
54782 <para>
54783 <indexterm role="option">
54784 <primary><option>qualify_domain</option></primary>
54785 </indexterm>
54786 <indexterm role="option">
54787 <primary><option>qualify_recipient</option></primary>
54788 </indexterm>
54789 Unqualified addresses in header lines are automatically qualified for messages
54790 that are locally originated, unless the <option>-bnq</option> option is given on the command
54791 line. For messages received over SMTP, unqualified addresses in header lines
54792 are qualified only if unqualified addresses are permitted in SMTP commands. In
54793 other words, such qualification is also controlled by
54794 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
54795 </para>
54796 </section>
54797 <section id="SECID219">
54798 <title>The UUCP From line</title>
54799 <para>
54800 <indexterm role="concept">
54801 <primary><quote>From</quote> line</primary>
54802 </indexterm>
54803 <indexterm role="concept">
54804 <primary>UUCP</primary>
54805 <secondary><quote>From</quote> line</secondary>
54806 </indexterm>
54807 <indexterm role="concept">
54808 <primary>sender</primary>
54809 <secondary>address</secondary>
54810 </indexterm>
54811 <indexterm role="option">
54812 <primary><option>uucp_from_pattern</option></primary>
54813 </indexterm>
54814 <indexterm role="option">
54815 <primary><option>uucp_from_sender</option></primary>
54816 </indexterm>
54817 <indexterm role="concept">
54818 <primary>envelope sender</primary>
54819 </indexterm>
54820 <indexterm role="concept">
54821 <primary>Sendmail compatibility</primary>
54822 <secondary><quote>From</quote> line</secondary>
54823 </indexterm>
54824 Messages that have come from UUCP (and some other applications) often begin
54825 with a line containing the envelope sender and a timestamp, following the word
54826 <quote>From</quote>. Examples of two common formats are:
54827 </para>
54828 <literallayout class="monospaced">
54829 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
54830 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
54831 </literallayout>
54832 <para>
54833 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
54834 Exim recognizes such lines at the start of messages that are submitted to it
54835 via the command line (that is, on the standard input). It does not recognize
54836 such lines in incoming SMTP messages, unless the sending host matches
54837 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
54838 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
54839 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
54840 default value matches the two common cases shown above and puts the address
54841 that follows <quote>From</quote> into <varname>$1</varname>.
54842 </para>
54843 <para>
54844 <indexterm role="concept">
54845 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
54846 <secondary>in <quote>From </quote> line handling</secondary>
54847 </indexterm>
54848 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
54849 a trusted user, the message&#x2019;s sender address is constructed by expanding the
54850 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
54851 then parsed as an RFC 2822 address. If there is no domain, the local part is
54852 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
54853 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
54854 </para>
54855 <para>
54856 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
54857 sender address is not changed. This is also the case for incoming SMTP messages
54858 that are permitted to contain <quote>From</quote> lines.
54859 </para>
54860 <para>
54861 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
54862 treated as a data line that starts the body of the message, as it is not valid
54863 as a header line. This also happens if a <quote>From</quote> line is present in an
54864 incoming SMTP message from a source that is not permitted to send them.
54865 </para>
54866 </section>
54867 <section id="SECID220">
54868 <title>Resent- header lines</title>
54869 <para>
54870 <indexterm role="concept">
54871 <primary><option>Resent-</option> header lines</primary>
54872 </indexterm>
54873 RFC 2822 makes provision for sets of header lines starting with the string
54874 <literal>Resent-</literal> to be added to a message when it is resent by the original
54875 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
54876 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
54877 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
54878 </para>
54879 <blockquote>
54880 <para>
54881 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
54882 processing of replies or other such automatic actions on messages.</emphasis>
54883 </para>
54884 </blockquote>
54885 <para>
54886 This leaves things a bit vague as far as other processing actions such as
54887 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
54888 follows:
54889 </para>
54890 <itemizedlist>
54891 <listitem>
54892 <para>
54893 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
54894 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
54895 </para>
54896 </listitem>
54897 <listitem>
54898 <para>
54899 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
54900 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
54901 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
54902 </para>
54903 </listitem>
54904 <listitem>
54905 <para>
54906 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
54907 also removed.
54908 </para>
54909 </listitem>
54910 <listitem>
54911 <para>
54912 For a locally-submitted message,
54913 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
54914 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
54915 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
54916 included in log lines in this case.
54917 </para>
54918 </listitem>
54919 <listitem>
54920 <para>
54921 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
54922 <option>Resent-</option> header lines are present.
54923 </para>
54924 </listitem>
54925 </itemizedlist>
54926 </section>
54927 <section id="SECID221">
54928 <title>The Auto-Submitted: header line</title>
54929 <para>
54930 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
54931 includes the header line:
54932 </para>
54933 <literallayout class="monospaced">
54934 Auto-Submitted: auto-replied
54935 </literallayout>
54936 </section>
54937 <section id="SECID222">
54938 <title>The Bcc: header line</title>
54939 <para>
54940 <indexterm role="concept">
54941 <primary><emphasis>Bcc:</emphasis> header line</primary>
54942 </indexterm>
54943 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
54944 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
54945 extracting its addresses). If <option>-t</option> is not present on the command line, any
54946 existing <emphasis>Bcc:</emphasis> is not removed.
54947 </para>
54948 </section>
54949 <section id="SECID223">
54950 <title>The Date: header line</title>
54951 <para>
54952 <indexterm role="concept">
54953 <primary><emphasis>Date:</emphasis> header line</primary>
54954 </indexterm>
54955 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
54956 Exim adds one, using the current date and time, unless the
54957 <option>suppress_local_fixups</option> control has been specified.
54958 </para>
54959 </section>
54960 <section id="SECID224">
54961 <title>The Delivery-date: header line</title>
54962 <para>
54963 <indexterm role="concept">
54964 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
54965 </indexterm>
54966 <indexterm role="option">
54967 <primary><option>delivery_date_remove</option></primary>
54968 </indexterm>
54969 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
54970 set. Exim can be configured to add them to the final delivery of messages. (See
54971 the generic <option>delivery_date_add</option> transport option.) They should not be present
54972 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
54973 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
54974 messages.
54975 </para>
54976 </section>
54977 <section id="SECID225">
54978 <title>The Envelope-to: header line</title>
54979 <para>
54980 <indexterm role="concept">
54981 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
54982 </indexterm>
54983 <indexterm role="option">
54984 <primary><option>envelope_to_remove</option></primary>
54985 </indexterm>
54986 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
54987 Exim can be configured to add them to the final delivery of messages. (See the
54988 generic <option>envelope_to_add</option> transport option.) They should not be present in
54989 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
54990 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
54991 messages.
54992 </para>
54993 </section>
54994 <section id="SECTthefrohea">
54995 <title>The From: header line</title>
54996 <para>
54997 <indexterm role="concept">
54998 <primary><emphasis>From:</emphasis> header line</primary>
54999 </indexterm>
55000 <indexterm role="concept">
55001 <primary>Sendmail compatibility</primary>
55002 <secondary><quote>From</quote> line</secondary>
55003 </indexterm>
55004 <indexterm role="concept">
55005 <primary>message</primary>
55006 <secondary>submission</secondary>
55007 </indexterm>
55008 <indexterm role="concept">
55009 <primary>submission mode</primary>
55010 </indexterm>
55011 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
55012 adds one if either of the following conditions is true:
55013 </para>
55014 <itemizedlist>
55015 <listitem>
55016 <para>
55017 The envelope sender address is not empty (that is, this is not a bounce
55018 message). The added header line copies the envelope sender address.
55019 </para>
55020 </listitem>
55021 <listitem>
55022 <para>
55023 <indexterm role="variable">
55024 <primary><varname>$authenticated_id</varname></primary>
55025 </indexterm>
55026 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
55027 </para>
55028 <orderedlist numeration="arabic">
55029 <listitem>
55030 <para>
55031 <indexterm role="variable">
55032 <primary><varname>$qualify_domain</varname></primary>
55033 </indexterm>
55034 If no domain is specified by the submission control, the local part is
55035 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55036 </para>
55037 </listitem>
55038 <listitem>
55039 <para>
55040 If a non-empty domain is specified by the submission control, the local
55041 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55042 </para>
55043 </listitem>
55044 <listitem>
55045 <para>
55046 If an empty domain is specified by the submission control,
55047 <varname>$authenticated_id</varname> is assumed to be the complete address.
55048 </para>
55049 </listitem>
55050 </orderedlist>
55051 </listitem>
55052 </itemizedlist>
55053 <para>
55054 A non-empty envelope sender takes precedence.
55055 </para>
55056 <para>
55057 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
55058 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
55059 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
55060 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
55061 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
55062 <option>unknown_login</option> configuration option). The address is qualified with
55063 <option>qualify_domain</option>.
55064 </para>
55065 <para>
55066 For compatibility with Sendmail, if an incoming, non-SMTP message has a
55067 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
55068 user, this is replaced by an address containing the user&#x2019;s login name and full
55069 name as described in section <xref linkend="SECTconstr"/>.
55070 </para>
55071 </section>
55072 <section id="SECID226">
55073 <title>The Message-ID: header line</title>
55074 <para>
55075 <indexterm role="concept">
55076 <primary><emphasis>Message-ID:</emphasis> header line</primary>
55077 </indexterm>
55078 <indexterm role="concept">
55079 <primary>message</primary>
55080 <secondary>submission</secondary>
55081 </indexterm>
55082 <indexterm role="option">
55083 <primary><option>message_id_header_text</option></primary>
55084 </indexterm>
55085 If a locally-generated or submission-mode incoming message does not contain a
55086 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
55087 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
55088 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
55089 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
55090 message id, preceded by the letter E to ensure it starts with a letter, and
55091 followed by @ and the primary host name. Additional information can be included
55092 in this header line by setting the <option>message_id_header_text</option> and/or
55093 <option>message_id_header_domain</option> options.
55094 </para>
55095 </section>
55096 <section id="SECID227">
55097 <title>The Received: header line</title>
55098 <para>
55099 <indexterm role="concept">
55100 <primary><emphasis>Received:</emphasis> header line</primary>
55101 </indexterm>
55102 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
55103 contents are defined by the <option>received_header_text</option> configuration option, and
55104 Exim automatically adds a semicolon and a timestamp to the configured string.
55105 </para>
55106 <para>
55107 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
55108 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
55109 line is the time that the message started to be received. This is the value
55110 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
55111 </para>
55112 <para>
55113 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
55114 changed to the time of acceptance, which is (apart from a small delay while the
55115 -H spool file is written) the earliest time at which delivery could start.
55116 </para>
55117 </section>
55118 <section id="SECID228">
55119 <title>The References: header line</title>
55120 <para>
55121 <indexterm role="concept">
55122 <primary><emphasis>References:</emphasis> header line</primary>
55123 </indexterm>
55124 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
55125 header line. This is constructed according to the rules that are described in
55126 section 3.64 of RFC 2822 (which states that replies should contain such a
55127 header line), and section 3.14 of RFC 3834 (which states that automatic
55128 responses are not different in this respect). However, because some mail
55129 processing software does not cope well with very long header lines, no more
55130 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
55131 incoming message. If there are more than 12, the first one and then the final
55132 11 are copied, before adding the message ID of the incoming message.
55133 </para>
55134 </section>
55135 <section id="SECID229">
55136 <title>The Return-path: header line</title>
55137 <para>
55138 <indexterm role="concept">
55139 <primary><emphasis>Return-path:</emphasis> header line</primary>
55140 </indexterm>
55141 <indexterm role="option">
55142 <primary><option>return_path_remove</option></primary>
55143 </indexterm>
55144 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
55145 it does the final delivery of messages. (See the generic <option>return_path_add</option>
55146 transport option.) Therefore, they should not be present in messages in
55147 transit. If the <option>return_path_remove</option> configuration option is set (the
55148 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
55149 </para>
55150 </section>
55151 <section id="SECTthesenhea">
55152 <title>The Sender: header line</title>
55153 <para>
55154 <indexterm role="concept">
55155 <primary><emphasis>Sender:</emphasis> header line</primary>
55156 </indexterm>
55157 <indexterm role="concept">
55158 <primary>message</primary>
55159 <secondary>submission</secondary>
55160 </indexterm>
55161 For a locally-originated message from an untrusted user, Exim may remove an
55162 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
55163 these actions by setting the <option>local_sender_retain</option> option true, the
55164 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
55165 control setting.
55166 </para>
55167 <para>
55168 When a local message is received from an untrusted user and
55169 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
55170 control has not been set, a check is made to see if the address given in the
55171 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
55172 that is expected has the login name as the local part and the value of
55173 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
55174 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
55175 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
55176 line is added to the message.
55177 </para>
55178 <para>
55179 If you set <option>local_from_check</option> false, this checking does not occur. However,
55180 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
55181 <option>local_sender_retain</option> to be true. It is not possible to set both of these
55182 options true at the same time.
55183 </para>
55184 <para>
55185 <indexterm role="concept">
55186 <primary>submission mode</primary>
55187 </indexterm>
55188 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
55189 received over TCP/IP or for messages submitted by trusted users. However, when
55190 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
55191 not specified on the submission control, the following processing takes place:
55192 </para>
55193 <para>
55194 <indexterm role="variable">
55195 <primary><varname>$authenticated_id</varname></primary>
55196 </indexterm>
55197 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
55198 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
55199 created as follows:
55200 </para>
55201 <itemizedlist>
55202 <listitem>
55203 <para>
55204 <indexterm role="variable">
55205 <primary><varname>$qualify_domain</varname></primary>
55206 </indexterm>
55207 If no domain is specified by the submission control, the local part is
55208 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55209 </para>
55210 </listitem>
55211 <listitem>
55212 <para>
55213 If a non-empty domain is specified by the submission control, the local part
55214 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55215 </para>
55216 </listitem>
55217 <listitem>
55218 <para>
55219 If an empty domain is specified by the submission control,
55220 <varname>$authenticated_id</varname> is assumed to be the complete address.
55221 </para>
55222 </listitem>
55223 </itemizedlist>
55224 <para>
55225 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
55226 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
55227 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
55228 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
55229 </para>
55230 <para>
55231 <indexterm role="concept">
55232 <primary>return path</primary>
55233 <secondary>created from <emphasis>Sender:</emphasis></secondary>
55234 </indexterm>
55235 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
55236 the message (the envelope sender address) is changed to be the same address,
55237 except in the case of submission mode when <option>sender_retain</option> is specified.
55238 </para>
55239 </section>
55240 <section id="SECTheadersaddrem">
55241 <title>Adding and removing header lines in routers and transports</title>
55242 <para>
55243 <indexterm role="concept">
55244 <primary>header lines</primary>
55245 <secondary>adding; in router or transport</secondary>
55246 </indexterm>
55247 <indexterm role="concept">
55248 <primary>header lines</primary>
55249 <secondary>removing; in router or transport</secondary>
55250 </indexterm>
55251 When a message is delivered, the addition and removal of header lines can be
55252 specified in a system filter, or on any of the routers and transports that
55253 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
55254 modifying headers in a system filter. Header lines can also be added in an ACL
55255 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
55256 </para>
55257 <para>
55258 In contrast to what happens in a system filter, header modifications that are
55259 specified on routers and transports apply only to the particular recipient
55260 addresses that are being processed by those routers and transports. These
55261 changes do not actually take place until a copy of the message is being
55262 transported. Therefore, they do not affect the basic set of header lines, and
55263 they do not affect the values of the variables that refer to header lines.
55264 </para>
55265 <para>
55266 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
55267 the transport cannot refer to the modified header lines, because such
55268 expansions all occur before the message is actually transported.
55269 </para>
55270 <para>
55271 For both routers and transports, the result of expanding a <option>headers_add</option>
55272 option must be in the form of one or more RFC 2822 header lines, separated by
55273 newlines (coded as <quote>\n</quote>). For example:
55274 </para>
55275 <literallayout class="monospaced">
55276 headers_add = X-added-header: added by $primary_hostname\n\
55277               X-added-second: another added header line
55278 </literallayout>
55279 <para>
55280 Exim does not check the syntax of these added header lines.
55281 </para>
55282 <para>
55283 The result of expanding <option>headers_remove</option> must consist of a colon-separated
55284 list of header names. This is confusing, because header names themselves are
55285 often terminated by colons. In this case, the colons are the list separators,
55286 not part of the names. For example:
55287 </para>
55288 <literallayout class="monospaced">
55289 headers_remove = return-receipt-to:acknowledge-to
55290 </literallayout>
55291 <para>
55292 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
55293 is expanded at routing time, and then associated with all addresses that are
55294 accepted by that router, and also with any new addresses that it generates. If
55295 an address passes through several routers as a result of aliasing or
55296 forwarding, the changes are cumulative.
55297 </para>
55298 <para>
55299 <indexterm role="option">
55300 <primary><option>unseen</option></primary>
55301 </indexterm>
55302 However, this does not apply to multiple routers that result from the use of
55303 the <option>unseen</option> option. Any header modifications that were specified by the
55304 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
55305 </para>
55306 <para>
55307 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
55308 settings cannot be delivered together in a batch, so a transport is always
55309 dealing with a set of addresses that have the same header-processing
55310 requirements.
55311 </para>
55312 <para>
55313 The transport starts by writing the original set of header lines that arrived
55314 with the message, possibly modified by the system filter. As it writes out
55315 these lines, it consults the list of header names that were attached to the
55316 recipient address(es) by <option>headers_remove</option> options in routers, and it also
55317 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
55318 names are on either of these lists are not written out. If there are multiple
55319 instances of any listed header, they are all skipped.
55320 </para>
55321 <para>
55322 After the remaining original header lines have been written, new header
55323 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
55324 the order in which they were attached to the address. These are followed by any
55325 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
55326 </para>
55327 <para>
55328 This way of handling header line modifications in routers and transports has
55329 the following consequences:
55330 </para>
55331 <itemizedlist>
55332 <listitem>
55333 <para>
55334 The original set of header lines, possibly modified by the system filter,
55335 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
55336 to it, at all times.
55337 </para>
55338 </listitem>
55339 <listitem>
55340 <para>
55341 Header lines that are added by a router&#x2019;s
55342 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
55343 expansion syntax in subsequent routers or the transport.
55344 </para>
55345 </listitem>
55346 <listitem>
55347 <para>
55348 Conversely, header lines that are specified for removal by <option>headers_remove</option>
55349 in a router remain visible to subsequent routers and the transport.
55350 </para>
55351 </listitem>
55352 <listitem>
55353 <para>
55354 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
55355 a later router or by a transport.
55356 </para>
55357 </listitem>
55358 <listitem>
55359 <para>
55360 An added header can refer to the contents of an original header that is to be
55361 removed, even it has the same name as the added header. For example:
55362 </para>
55363 <literallayout class="monospaced">
55364 headers_remove = subject
55365 headers_add = Subject: new subject (was: $h_subject:)
55366 </literallayout>
55367 </listitem>
55368 </itemizedlist>
55369 <para>
55370 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
55371 for a <command>redirect</command> router that has the <option>one_time</option> option set.
55372 </para>
55373 </section>
55374 <section id="SECTconstr">
55375 <title>Constructed addresses</title>
55376 <para>
55377 <indexterm role="concept">
55378 <primary>address</primary>
55379 <secondary>constructed</secondary>
55380 </indexterm>
55381 <indexterm role="concept">
55382 <primary>constructed address</primary>
55383 </indexterm>
55384 When Exim constructs a sender address for a locally-generated message, it uses
55385 the form
55386 </para>
55387 <literallayout>
55388 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
55389 </literallayout>
55390 <para>
55391 For example:
55392 </para>
55393 <literallayout class="monospaced">
55394 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
55395 </literallayout>
55396 <para>
55397 The user name is obtained from the <option>-F</option> command line option if set, or
55398 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
55399 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
55400 ampersand character, this is replaced by the login name with the first letter
55401 upper cased, as is conventional in a number of operating systems. See the
55402 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
55403 The <option>unknown_username</option> option can be used to specify user names in cases when
55404 there is no password file entry.
55405 </para>
55406 <para>
55407 <indexterm role="concept">
55408 <primary>RFC 2047</primary>
55409 </indexterm>
55410 In all cases, the user name is made to conform to RFC 2822 by quoting all or
55411 parts of it if necessary. In addition, if it contains any non-printing
55412 characters, it is encoded as described in RFC 2047, which defines a way of
55413 including non-ASCII characters in header lines. The value of the
55414 <option>headers_charset</option> option specifies the name of the encoding that is used (the
55415 characters are assumed to be in this encoding). The setting of
55416 <option>print_topbitchars</option> controls whether characters with the top bit set (that
55417 is, with codes greater than 127) count as printing characters or not.
55418 </para>
55419 </section>
55420 <section id="SECID230">
55421 <title>Case of local parts</title>
55422 <para>
55423 <indexterm role="concept">
55424 <primary>case of local parts</primary>
55425 </indexterm>
55426 <indexterm role="concept">
55427 <primary>local part</primary>
55428 <secondary>case of</secondary>
55429 </indexterm>
55430 RFC 2822 states that the case of letters in the local parts of addresses cannot
55431 be assumed to be non-significant. Exim preserves the case of local parts of
55432 addresses, but by default it uses a lower-cased form when it is routing,
55433 because on most Unix systems, usernames are in lower case and case-insensitive
55434 routing is required. However, any particular router can be made to use the
55435 original case for local parts by setting the <option>caseful_local_part</option> generic
55436 router option.
55437 </para>
55438 <para>
55439 <indexterm role="concept">
55440 <primary>mixed-case login names</primary>
55441 </indexterm>
55442 If you must have mixed-case user names on your system, the best way to proceed,
55443 assuming you want case-independent handling of incoming email, is to set up
55444 your first router to convert incoming local parts in your domains to the
55445 correct case by means of a file lookup. For example:
55446 </para>
55447 <literallayout class="monospaced">
55448 correct_case:
55449   driver = redirect
55450   domains = +local_domains
55451   data = ${lookup{$local_part}cdb\
55452               {/etc/usercased.cdb}{$value}fail}\
55453               @$domain
55454 </literallayout>
55455 <para>
55456 For this router, the local part is forced to lower case by the default action
55457 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
55458 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
55459 on any subsequent routers which process your domains, they will operate on
55460 local parts with the correct case in a case-sensitive manner.
55461 </para>
55462 </section>
55463 <section id="SECID231">
55464 <title>Dots in local parts</title>
55465 <para>
55466 <indexterm role="concept">
55467 <primary>dot</primary>
55468 <secondary>in local part</secondary>
55469 </indexterm>
55470 <indexterm role="concept">
55471 <primary>local part</primary>
55472 <secondary>dots in</secondary>
55473 </indexterm>
55474 RFC 2822 forbids empty components in local parts. That is, an unquoted local
55475 part may not begin or end with a dot, nor have two consecutive dots in the
55476 middle. However, it seems that many MTAs do not enforce this, so Exim permits
55477 empty components for compatibility.
55478 </para>
55479 </section>
55480 <section id="SECID232">
55481 <title>Rewriting addresses</title>
55482 <para>
55483 <indexterm role="concept">
55484 <primary>rewriting</primary>
55485 <secondary>addresses</secondary>
55486 </indexterm>
55487 Rewriting of sender and recipient addresses, and addresses in headers, can
55488 happen automatically, or as the result of configuration options, as described
55489 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
55490 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
55491 </para>
55492 <para>
55493 Automatic rewriting includes qualification, as mentioned above. The other case
55494 in which it can happen is when an incomplete non-local domain is given. The
55495 routing process may cause this to be expanded into the full domain name. For
55496 example, a header such as
55497 </para>
55498 <literallayout class="monospaced">
55499 To: hare@teaparty
55500 </literallayout>
55501 <para>
55502 might get rewritten as
55503 </para>
55504 <literallayout class="monospaced">
55505 To: hare@teaparty.wonderland.fict.example
55506 </literallayout>
55507 <para>
55508 Rewriting as a result of routing is the one kind of message processing that
55509 does not happen at input time, as it cannot be done until the address has
55510 been routed.
55511 </para>
55512 <para>
55513 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
55514 addresses have been routed, in case any of the headers get changed as a
55515 result of routing. However, doing this in practice would hold up many
55516 deliveries for unreasonable amounts of time, just because one address could not
55517 immediately be routed. Exim therefore does not delay other deliveries when
55518 routing of one or more addresses is deferred.
55519 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
55520 </para>
55521 </section>
55522 </chapter>
55523
55524 <chapter id="CHAPSMTP">
55525 <title>SMTP processing</title>
55526 <para>
55527 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
55528 <primary>SMTP</primary>
55529 <secondary>processing details</secondary>
55530 </indexterm>
55531 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
55532 <primary>LMTP</primary>
55533 <secondary>processing details</secondary>
55534 </indexterm>
55535 Exim supports a number of different ways of using the SMTP protocol, and its
55536 LMTP variant, which is an interactive protocol for transferring messages into a
55537 closed mail store application. This chapter contains details of how SMTP is
55538 processed. For incoming mail, the following are available:
55539 </para>
55540 <itemizedlist>
55541 <listitem>
55542 <para>
55543 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
55544 </para>
55545 </listitem>
55546 <listitem>
55547 <para>
55548 SMTP over the standard input and output (the <option>-bs</option> option);
55549 </para>
55550 </listitem>
55551 <listitem>
55552 <para>
55553 Batched SMTP on the standard input (the <option>-bS</option> option).
55554 </para>
55555 </listitem>
55556 </itemizedlist>
55557 <para>
55558 For mail delivery, the following are available:
55559 </para>
55560 <itemizedlist>
55561 <listitem>
55562 <para>
55563 SMTP over TCP/IP (the <command>smtp</command> transport);
55564 </para>
55565 </listitem>
55566 <listitem>
55567 <para>
55568 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
55569 <quote>lmtp</quote>);
55570 </para>
55571 </listitem>
55572 <listitem>
55573 <para>
55574 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
55575 transport);
55576 </para>
55577 </listitem>
55578 <listitem>
55579 <para>
55580 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
55581 the <option>use_bsmtp</option> option set).
55582 </para>
55583 </listitem>
55584 </itemizedlist>
55585 <para>
55586 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
55587 stored in or read from files (or pipes), in a format in which SMTP commands are
55588 used to contain the envelope information.
55589 </para>
55590 <section id="SECToutSMTPTCP">
55591 <title>Outgoing SMTP and LMTP over TCP/IP</title>
55592 <para>
55593 <indexterm role="concept">
55594 <primary>SMTP</primary>
55595 <secondary>outgoing over TCP/IP</secondary>
55596 </indexterm>
55597 <indexterm role="concept">
55598 <primary>outgoing SMTP over TCP/IP</primary>
55599 </indexterm>
55600 <indexterm role="concept">
55601 <primary>LMTP</primary>
55602 <secondary>over TCP/IP</secondary>
55603 </indexterm>
55604 <indexterm role="concept">
55605 <primary>outgoing LMTP over TCP/IP</primary>
55606 </indexterm>
55607 <indexterm role="concept">
55608 <primary>EHLO</primary>
55609 </indexterm>
55610 <indexterm role="concept">
55611 <primary>HELO</primary>
55612 </indexterm>
55613 <indexterm role="concept">
55614 <primary>SIZE option on MAIL command</primary>
55615 </indexterm>
55616 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
55617 The <option>protocol</option> option selects which protocol is to be used, but the actual
55618 processing is the same in both cases.
55619 </para>
55620 <para>
55621 If, in response to its EHLO command, Exim is told that the SIZE
55622 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
55623 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
55624 <option>size_addition</option> option (default 1024) to allow for additions to the message
55625 such as per-transport header lines, or changes made in a
55626 <indexterm role="concept">
55627 <primary>transport</primary>
55628 <secondary>filter</secondary>
55629 </indexterm>
55630 <indexterm role="concept">
55631 <primary>filter</primary>
55632 <secondary>transport filter</secondary>
55633 </indexterm>
55634 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
55635 suppressed.
55636 </para>
55637 <para>
55638 If the remote server advertises support for PIPELINING, Exim uses the
55639 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
55640 required for the transaction.
55641 </para>
55642 <para>
55643 If the remote server advertises support for the STARTTLS command, and Exim
55644 was built to support TLS encryption, it tries to start a TLS session unless the
55645 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
55646 </para>
55647 <para>
55648 If the remote server advertises support for the AUTH command, Exim scans
55649 the authenticators configuration for any suitable client settings, as described
55650 in chapter <xref linkend="CHAPSMTPAUTH"/>.
55651 </para>
55652 <para>
55653 <indexterm role="concept">
55654 <primary>carriage return</primary>
55655 </indexterm>
55656 <indexterm role="concept">
55657 <primary>linefeed</primary>
55658 </indexterm>
55659 Responses from the remote host are supposed to be terminated by CR followed by
55660 LF. However, there are known to be hosts that do not send CR characters, so in
55661 order to be able to interwork with such hosts, Exim treats LF on its own as a
55662 line terminator.
55663 </para>
55664 <para>
55665 If a message contains a number of different addresses, all those with the same
55666 characteristics (for example, the same envelope sender) that resolve to the
55667 same set of hosts, in the same order, are sent in a single SMTP transaction,
55668 even if they are for different domains, unless there are more than the setting
55669 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
55670 they are split into groups containing no more than <option>max_rcpts</option> addresses
55671 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
55672 in parallel sessions. The order of hosts with identical MX values is not
55673 significant when checking whether addresses can be batched in this way.
55674 </para>
55675 <para>
55676 When the <command>smtp</command> transport suffers a temporary failure that is not
55677 message-related, Exim updates its transport-specific database, which contains
55678 records indexed by host name that remember which messages are waiting for each
55679 particular host. It also updates the retry database with new retry times.
55680 </para>
55681 <para>
55682 <indexterm role="concept">
55683 <primary>hints database</primary>
55684 <secondary>retry keys</secondary>
55685 </indexterm>
55686 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
55687 a multi-homed host is broken, it will soon be skipped most of the time.
55688 See the next section for more detail about error handling.
55689 </para>
55690 <para>
55691 <indexterm role="concept">
55692 <primary>SMTP</primary>
55693 <secondary>passed connection</secondary>
55694 </indexterm>
55695 <indexterm role="concept">
55696 <primary>SMTP</primary>
55697 <secondary>batching over TCP/IP</secondary>
55698 </indexterm>
55699 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
55700 looks in the hints database for the transport to see if there are any queued
55701 messages waiting for the host to which it is connected. If it finds one, it
55702 creates a new Exim process using the <option>-MC</option> option (which can only be used by
55703 a process running as root or the Exim user) and passes the TCP/IP socket to it
55704 so that it can deliver another message using the same socket. The new process
55705 does only those deliveries that are routed to the connected host, and may in
55706 turn pass the socket on to a third process, and so on.
55707 </para>
55708 <para>
55709 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
55710 limit the number of messages sent down a single TCP/IP connection.
55711 </para>
55712 <para>
55713 <indexterm role="concept">
55714 <primary>asterisk</primary>
55715 <secondary>after IP address</secondary>
55716 </indexterm>
55717 The second and subsequent messages delivered down an existing connection are
55718 identified in the main log by the addition of an asterisk after the closing
55719 square bracket of the IP address.
55720 </para>
55721 </section>
55722 <section id="SECToutSMTPerr">
55723 <title>Errors in outgoing SMTP</title>
55724 <para>
55725 <indexterm role="concept">
55726 <primary>error</primary>
55727 <secondary>in outgoing SMTP</secondary>
55728 </indexterm>
55729 <indexterm role="concept">
55730 <primary>SMTP</primary>
55731 <secondary>errors in outgoing</secondary>
55732 </indexterm>
55733 <indexterm role="concept">
55734 <primary>host</primary>
55735 <secondary>error</secondary>
55736 </indexterm>
55737 Three different kinds of error are recognized for outgoing SMTP: host errors,
55738 message errors, and recipient errors.
55739 </para>
55740 <variablelist>
55741 <varlistentry>
55742 <term><emphasis role="bold">Host errors</emphasis></term>
55743 <listitem>
55744 <para>
55745 A host error is not associated with a particular message or with a
55746 particular recipient of a message. The host errors are:
55747 </para>
55748 <itemizedlist>
55749 <listitem>
55750 <para>
55751 Connection refused or timed out,
55752 </para>
55753 </listitem>
55754 <listitem>
55755 <para>
55756 Any error response code on connection,
55757 </para>
55758 </listitem>
55759 <listitem>
55760 <para>
55761 Any error response code to EHLO or HELO,
55762 </para>
55763 </listitem>
55764 <listitem>
55765 <para>
55766 Loss of connection at any time, except after <quote>.</quote>,
55767 </para>
55768 </listitem>
55769 <listitem>
55770 <para>
55771 I/O errors at any time,
55772 </para>
55773 </listitem>
55774 <listitem>
55775 <para>
55776 Timeouts during the session, other than in response to MAIL, RCPT or
55777 the <quote>.</quote> at the end of the data.
55778 </para>
55779 </listitem>
55780 </itemizedlist>
55781 <para>
55782 For a host error, a permanent error response on connection, or in response to
55783 EHLO, causes all addresses routed to the host to be failed. Any other host
55784 error causes all addresses to be deferred, and retry data to be created for the
55785 host. It is not tried again, for any message, until its retry time arrives. If
55786 the current set of addresses are not all delivered in this run (to some
55787 alternative host), the message is added to the list of those waiting for this
55788 host, so if it is still undelivered when a subsequent successful delivery is
55789 made to the host, it will be sent down the same SMTP connection.
55790 </para>
55791 </listitem></varlistentry>
55792 <varlistentry>
55793 <term><emphasis role="bold">Message errors</emphasis></term>
55794 <listitem>
55795 <para>
55796 <indexterm role="concept">
55797 <primary>message</primary>
55798 <secondary>error</secondary>
55799 </indexterm>
55800 A message error is associated with a particular message when sent to a
55801 particular host, but not with a particular recipient of the message. The
55802 message errors are:
55803 </para>
55804 <itemizedlist>
55805 <listitem>
55806 <para>
55807 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
55808 the data,
55809 </para>
55810 </listitem>
55811 <listitem>
55812 <para>
55813 Timeout after MAIL,
55814 </para>
55815 </listitem>
55816 <listitem>
55817 <para>
55818 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
55819 timeout after the DATA command itself is treated as a host error, as is loss of
55820 connection at any other time.
55821 </para>
55822 </listitem>
55823 </itemizedlist>
55824 <para>
55825 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
55826 to be failed, and a delivery error report to be returned to the sender. A
55827 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
55828 addresses to be deferred. Retry data is not created for the host, but instead,
55829 a retry record for the combination of host plus message id is created. The
55830 message is not added to the list of those waiting for this host. This ensures
55831 that the failing message will not be sent to this host again until the retry
55832 time arrives. However, other messages that are routed to the host are not
55833 affected, so if it is some property of the message that is causing the error,
55834 it will not stop the delivery of other mail.
55835 </para>
55836 <para>
55837 If the remote host specified support for the SIZE parameter in its response
55838 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
55839 over-large message will cause a message error because the error arrives as a
55840 response to MAIL.
55841 </para>
55842 </listitem></varlistentry>
55843 <varlistentry>
55844 <term><emphasis role="bold">Recipient errors</emphasis></term>
55845 <listitem>
55846 <para>
55847 <indexterm role="concept">
55848 <primary>recipient</primary>
55849 <secondary>error</secondary>
55850 </indexterm>
55851 A recipient error is associated with a particular recipient of a message. The
55852 recipient errors are:
55853 </para>
55854 <itemizedlist>
55855 <listitem>
55856 <para>
55857 Any error response to RCPT,
55858 </para>
55859 </listitem>
55860 <listitem>
55861 <para>
55862 Timeout after RCPT.
55863 </para>
55864 </listitem>
55865 </itemizedlist>
55866 <para>
55867 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
55868 recipient address to be failed, and a bounce message to be returned to the
55869 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
55870 address to be deferred, and routing retry data to be created for it. This is
55871 used to delay processing of the address in subsequent queue runs, until its
55872 routing retry time arrives. This applies to all messages, but because it
55873 operates only in queue runs, one attempt will be made to deliver a new message
55874 to the failing address before the delay starts to operate. This ensures that,
55875 if the failure is really related to the message rather than the recipient
55876 (<quote>message too big for this recipient</quote> is a possible example), other messages
55877 have a chance of getting delivered. If a delivery to the address does succeed,
55878 the retry information gets cleared, so all stuck messages get tried again, and
55879 the retry clock is reset.
55880 </para>
55881 <para>
55882 The message is not added to the list of those waiting for this host. Use of the
55883 host for other messages is unaffected, and except in the case of a timeout,
55884 other recipients are processed independently, and may be successfully delivered
55885 in the current SMTP session. After a timeout it is of course impossible to
55886 proceed with the session, so all addresses get deferred. However, those other
55887 than the one that failed do not suffer any subsequent retry delays. Therefore,
55888 if one recipient is causing trouble, the others have a chance of getting
55889 through when a subsequent delivery attempt occurs before the failing
55890 recipient&#x2019;s retry time.
55891 </para>
55892 </listitem></varlistentry>
55893 </variablelist>
55894 <para>
55895 In all cases, if there are other hosts (or IP addresses) available for the
55896 current set of addresses (for example, from multiple MX records), they are
55897 tried in this run for any undelivered addresses, subject of course to their
55898 own retry data. In other words, recipient error retry data does not take effect
55899 until the next delivery attempt.
55900 </para>
55901 <para>
55902 Some hosts have been observed to give temporary error responses to every
55903 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
55904 would be nice if such circumstances could be recognized, and defer data for the
55905 host itself created, but this is not possible within the current Exim design.
55906 What actually happens is that retry data for every (host, message) combination
55907 is created.
55908 </para>
55909 <para>
55910 The reason that timeouts after MAIL and RCPT are treated specially is that
55911 these can sometimes arise as a result of the remote host&#x2019;s verification
55912 procedures. Exim makes this assumption, and treats them as if a temporary error
55913 response had been received. A timeout after <quote>.</quote> is treated specially because
55914 it is known that some broken implementations fail to recognize the end of the
55915 message if the last character of the last line is a binary zero. Thus, it is
55916 helpful to treat this case as a message error.
55917 </para>
55918 <para>
55919 Timeouts at other times are treated as host errors, assuming a problem with the
55920 host, or the connection to it. If a timeout after MAIL, RCPT,
55921 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
55922 the timeout is likely to occur at some other point in the dialogue, causing it
55923 then to be treated as a host error.
55924 </para>
55925 <para>
55926 There is experimental evidence that some MTAs drop the connection after the
55927 terminating <quote>.</quote> if they do not like the contents of the message for some
55928 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
55929 should be given. That is why Exim treats this case as a message rather than a
55930 host error, in order not to delay other messages to the same host.
55931 </para>
55932 </section>
55933 <section id="SECID233">
55934 <title>Incoming SMTP messages over TCP/IP</title>
55935 <para>
55936 <indexterm role="concept">
55937 <primary>SMTP</primary>
55938 <secondary>incoming over TCP/IP</secondary>
55939 </indexterm>
55940 <indexterm role="concept">
55941 <primary>incoming SMTP over TCP/IP</primary>
55942 </indexterm>
55943 <indexterm role="concept">
55944 <primary>inetd</primary>
55945 </indexterm>
55946 <indexterm role="concept">
55947 <primary>daemon</primary>
55948 </indexterm>
55949 Incoming SMTP messages can be accepted in one of two ways: by running a
55950 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
55951 <filename>/etc/inetd.conf</filename> should be like this:
55952 </para>
55953 <literallayout class="monospaced">
55954 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
55955 </literallayout>
55956 <para>
55957 Exim distinguishes between this case and the case of a locally running user
55958 agent using the <option>-bs</option> option by checking whether or not the standard input is
55959 a socket. When it is, either the port must be privileged (less than 1024), or
55960 the caller must be root or the Exim user. If any other user passes a socket
55961 with an unprivileged port number, Exim prints a message on the standard error
55962 stream and exits with an error code.
55963 </para>
55964 <para>
55965 By default, Exim does not make a log entry when a remote host connects or
55966 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
55967 unexpected. It can be made to write such log entries by setting the
55968 <option>smtp_connection</option> log selector.
55969 </para>
55970 <para>
55971 <indexterm role="concept">
55972 <primary>carriage return</primary>
55973 </indexterm>
55974 <indexterm role="concept">
55975 <primary>linefeed</primary>
55976 </indexterm>
55977 Commands from the remote host are supposed to be terminated by CR followed by
55978 LF. However, there are known to be hosts that do not send CR characters. In
55979 order to be able to interwork with such hosts, Exim treats LF on its own as a
55980 line terminator.
55981 Furthermore, because common code is used for receiving messages from all
55982 sources, a CR on its own is also interpreted as a line terminator. However, the
55983 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
55984 </para>
55985 <para>
55986 <indexterm role="concept">
55987 <primary>EHLO</primary>
55988 <secondary>invalid data</secondary>
55989 </indexterm>
55990 <indexterm role="concept">
55991 <primary>HELO</primary>
55992 <secondary>invalid data</secondary>
55993 </indexterm>
55994 One area that sometimes gives rise to problems concerns the EHLO or
55995 HELO commands. Some clients send syntactically invalid versions of these
55996 commands, which Exim rejects by default. (This is nothing to do with verifying
55997 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
55998 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
55999 match the broken hosts that send invalid commands.
56000 </para>
56001 <para>
56002 <indexterm role="concept">
56003 <primary>SIZE option on MAIL command</primary>
56004 </indexterm>
56005 <indexterm role="concept">
56006 <primary>MAIL</primary>
56007 <secondary>SIZE option</secondary>
56008 </indexterm>
56009 The amount of disk space available is checked whenever SIZE is received on
56010 a MAIL command, independently of whether <option>message_size_limit</option> or
56011 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
56012 false. A temporary error is given if there is not enough space. If
56013 <option>check_spool_space</option> is set, the check is for that amount of space plus the
56014 value given with SIZE, that is, it checks that the addition of the incoming
56015 message will not reduce the space below the threshold.
56016 </para>
56017 <para>
56018 When a message is successfully received, Exim includes the local message id in
56019 its response to the final <quote>.</quote> that terminates the data. If the remote host
56020 logs this text it can help with tracing what has happened to a message.
56021 </para>
56022 <para>
56023 The Exim daemon can limit the number of simultaneous incoming connections it is
56024 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
56025 number of simultaneous incoming connections from a single remote host (see the
56026 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
56027 rejected using the SMTP temporary error code 421.
56028 </para>
56029 <para>
56030 The Exim daemon does not rely on the SIGCHLD signal to detect when a
56031 subprocess has finished, as this can get lost at busy times. Instead, it looks
56032 for completed subprocesses every time it wakes up. Provided there are other
56033 things happening (new incoming calls, starts of queue runs), completed
56034 processes will be noticed and tidied away. On very quiet systems you may
56035 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
56036 it will be noticed when the daemon next wakes up.
56037 </para>
56038 <para>
56039 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
56040 and can also be set up to reject SMTP calls from non-reserved hosts at times of
56041 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
56042 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
56043 applies in both the daemon and <emphasis>inetd</emphasis> cases.
56044 </para>
56045 <para>
56046 Exim normally starts a delivery process for each message received, though this
56047 can be varied by means of the <option>-odq</option> command line option and the
56048 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
56049 number of simultaneously running delivery processes started in this way from
56050 SMTP input can be limited by the <option>smtp_accept_queue</option> and
56051 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
56052 subsequently received messages are just put on the input queue without starting
56053 a delivery process.
56054 </para>
56055 <para>
56056 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
56057 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
56058 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
56059 handled by an entirely independent Exim process. Control by load average is,
56060 however, available with <emphasis>inetd</emphasis>.
56061 </para>
56062 <para>
56063 Exim can be configured to verify addresses in incoming SMTP commands as they
56064 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
56065 to rewrite addresses at this time &ndash; before any syntax checking is done. See
56066 section <xref linkend="SECTrewriteS"/>.
56067 </para>
56068 <para>
56069 Exim can also be configured to limit the rate at which a client host submits
56070 MAIL and RCPT commands in a single SMTP session. See the
56071 <option>smtp_ratelimit_hosts</option> option.
56072 </para>
56073 </section>
56074 <section id="SECID234">
56075 <title>Unrecognized SMTP commands</title>
56076 <para>
56077 <indexterm role="concept">
56078 <primary>SMTP</primary>
56079 <secondary>unrecognized commands</secondary>
56080 </indexterm>
56081 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
56082 commands during a single SMTP connection, it drops the connection after sending
56083 the error response to the last command. The default value for
56084 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
56085 abuse that subvert web servers into making connections to SMTP ports; in these
56086 circumstances, a number of non-SMTP lines are sent first.
56087 </para>
56088 </section>
56089 <section id="SECID235">
56090 <title>Syntax and protocol errors in SMTP commands</title>
56091 <para>
56092 <indexterm role="concept">
56093 <primary>SMTP</primary>
56094 <secondary>syntax errors</secondary>
56095 </indexterm>
56096 <indexterm role="concept">
56097 <primary>SMTP</primary>
56098 <secondary>protocol errors</secondary>
56099 </indexterm>
56100 A syntax error is detected if an SMTP command is recognized, but there is
56101 something syntactically wrong with its data, for example, a malformed email
56102 address in a RCPT command. Protocol errors include invalid command
56103 sequencing such as RCPT before MAIL. If Exim receives more than
56104 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
56105 drops the connection after sending the error response to the last command. The
56106 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
56107 broken clients that loop sending bad commands (yes, it has been seen).
56108 </para>
56109 </section>
56110 <section id="SECID236">
56111 <title>Use of non-mail SMTP commands</title>
56112 <para>
56113 <indexterm role="concept">
56114 <primary>SMTP</primary>
56115 <secondary>non-mail commands</secondary>
56116 </indexterm>
56117 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
56118 DATA. Exim counts such commands, and drops the connection if there are too
56119 many of them in a single SMTP session. This action catches some
56120 denial-of-service attempts and things like repeated failing AUTHs, or a mad
56121 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
56122 defines what <quote>too many</quote> means. Its default value is 10.
56123 </para>
56124 <para>
56125 When a new message is expected, one occurrence of RSET is not counted. This
56126 allows a client to send one RSET between messages (this is not necessary,
56127 but some clients do it). Exim also allows one uncounted occurrence of HELO
56128 or EHLO, and one occurrence of STARTTLS between messages. After
56129 starting up a TLS session, another EHLO is expected, and so it too is not
56130 counted.
56131 </para>
56132 <para>
56133 The first occurrence of AUTH in a connection, or immediately following
56134 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
56135 RCPT, DATA, and QUIT are counted.
56136 </para>
56137 <para>
56138 You can control which hosts are subject to the limit set by
56139 <option>smtp_accept_max_nonmail</option> by setting
56140 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
56141 the limit apply to all hosts. This option means that you can exclude any
56142 specific badly-behaved hosts that you have to live with.
56143 </para>
56144 </section>
56145 <section id="SECID237">
56146 <title>The VRFY and EXPN commands</title>
56147 <para>
56148 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
56149 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
56150 appropriate) in order to decide whether the command should be accepted or not.
56151 If no ACL is defined, the command is rejected.
56152 </para>
56153 <para>
56154 <indexterm role="concept">
56155 <primary>VRFY</primary>
56156 <secondary>processing</secondary>
56157 </indexterm>
56158 When VRFY is accepted, it runs exactly the same code as when Exim is
56159 called with the <option>-bv</option> option.
56160 </para>
56161 <para>
56162 <indexterm role="concept">
56163 <primary>EXPN</primary>
56164 <secondary>processing</secondary>
56165 </indexterm>
56166 When EXPN is accepted, a single-level expansion of the address is done.
56167 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
56168 than a verification (the <option>-bv</option> option). If an unqualified local part is given
56169 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
56170 of VRFY and EXPN commands are logged on the main and reject logs, and
56171 VRFY verification failures are logged on the main log for consistency with
56172 RCPT failures.
56173 </para>
56174 </section>
56175 <section id="SECTETRN">
56176 <title>The ETRN command</title>
56177 <para>
56178 <indexterm role="concept">
56179 <primary>ETRN</primary>
56180 <secondary>processing</secondary>
56181 </indexterm>
56182 RFC 1985 describes an SMTP command called ETRN that is designed to
56183 overcome the security problems of the TURN command (which has fallen into
56184 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
56185 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
56186 should be accepted or not. If no ACL is defined, the command is rejected.
56187 </para>
56188 <para>
56189 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
56190 delivery to certain hosts. As Exim does not organize its message queue by host,
56191 the only form of ETRN that is supported by default is the one where the
56192 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
56193 specific to the SMTP server. A valid ETRN command causes a run of Exim with
56194 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
56195 argument. For example,
56196 </para>
56197 <literallayout class="monospaced">
56198 ETRN #brigadoon
56199 </literallayout>
56200 <para>
56201 runs the command
56202 </para>
56203 <literallayout class="monospaced">
56204 exim -R brigadoon
56205 </literallayout>
56206 <para>
56207 which causes a delivery attempt on all messages with undelivered addresses
56208 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
56209 default), Exim prevents the simultaneous execution of more than one queue run
56210 for the same argument string as a result of an ETRN command. This stops
56211 a misbehaving client from starting more than one queue runner at once.
56212 </para>
56213 <para>
56214 <indexterm role="concept">
56215 <primary>hints database</primary>
56216 <secondary>ETRN serialization</secondary>
56217 </indexterm>
56218 Exim implements the serialization by means of a hints database in which a
56219 record is written whenever a process is started by ETRN, and deleted when
56220 the process completes. However, Exim does not keep the SMTP session waiting for
56221 the ETRN process to complete. Once ETRN is accepted, the client is sent
56222 a <quote>success</quote> return code. Obviously there is scope for hints records to get
56223 left lying around if there is a system or program crash. To guard against this,
56224 Exim ignores any records that are more than six hours old.
56225 </para>
56226 <para>
56227 <indexterm role="option">
56228 <primary><option>smtp_etrn_command</option></primary>
56229 </indexterm>
56230 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
56231 used. This specifies a command that is run whenever ETRN is received,
56232 whatever the form of its argument. For
56233 example:
56234 </para>
56235 <literallayout class="monospaced">
56236 smtp_etrn_command = /etc/etrn_command $domain \
56237                     $sender_host_address
56238 </literallayout>
56239 <para>
56240 <indexterm role="variable">
56241 <primary><varname>$domain</varname></primary>
56242 </indexterm>
56243 The string is split up into arguments which are independently expanded. The
56244 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
56245 and no syntax checking is done on the contents of this argument. Exim does not
56246 wait for the command to complete, so its status code is not checked. Exim runs
56247 under its own uid and gid when receiving incoming SMTP, so it is not possible
56248 for it to change them before running the command.
56249 </para>
56250 </section>
56251 <section id="SECID238">
56252 <title>Incoming local SMTP</title>
56253 <para>
56254 <indexterm role="concept">
56255 <primary>SMTP</primary>
56256 <secondary>local incoming</secondary>
56257 </indexterm>
56258 Some user agents use SMTP to pass messages to their local MTA using the
56259 standard input and output, as opposed to passing the envelope on the command
56260 line and writing the message to the standard input. This is supported by the
56261 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
56262 messages over TCP/IP (including the use of ACLs), except that the envelope
56263 sender given in a MAIL command is ignored unless the caller is trusted. In
56264 an ACL you can detect this form of SMTP input by testing for an empty host
56265 identification. It is common to have this as the first line in the ACL that
56266 runs for RCPT commands:
56267 </para>
56268 <literallayout class="monospaced">
56269 accept hosts = :
56270 </literallayout>
56271 <para>
56272 This accepts SMTP messages from local processes without doing any other tests.
56273 </para>
56274 </section>
56275 <section id="SECTbatchSMTP">
56276 <title>Outgoing batched SMTP</title>
56277 <para>
56278 <indexterm role="concept">
56279 <primary>SMTP</primary>
56280 <secondary>batched outgoing</secondary>
56281 </indexterm>
56282 <indexterm role="concept">
56283 <primary>batched SMTP output</primary>
56284 </indexterm>
56285 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
56286 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
56287 be output in BSMTP format. No SMTP responses are possible for this form of
56288 delivery. All it is doing is using SMTP commands as a way of transmitting the
56289 envelope along with the message.
56290 </para>
56291 <para>
56292 The message is written to the file or pipe preceded by the SMTP commands
56293 MAIL and RCPT, and followed by a line containing a single dot. Lines in
56294 the message that start with a dot have an extra dot added. The SMTP command
56295 HELO is not normally used. If it is required, the <option>message_prefix</option> option
56296 can be used to specify it.
56297 </para>
56298 <para>
56299 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
56300 one recipient address at a time by default. However, you can arrange for them
56301 to handle several addresses at once by setting the <option>batch_max</option> option. When
56302 this is done for BSMTP, messages may contain multiple RCPT commands. See
56303 chapter <xref linkend="CHAPbatching"/> for more details.
56304 </para>
56305 <para>
56306 <indexterm role="variable">
56307 <primary><varname>$host</varname></primary>
56308 </indexterm>
56309 When one or more addresses are routed to a BSMTP transport by a router that
56310 sets up a host list, the name of the first host on the list is available to the
56311 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
56312 router:
56313 </para>
56314 <literallayout class="monospaced">
56315 begin routers
56316 route_append:
56317   driver = manualroute
56318   transport = smtp_appendfile
56319   route_list = domain.example  batch.host.example
56320
56321 begin transports
56322 smtp_appendfile:
56323   driver = appendfile
56324   directory = /var/bsmtp/$host
56325   batch_max = 1000
56326   use_bsmtp
56327   user = exim
56328 </literallayout>
56329 <para>
56330 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
56331 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
56332 message (unless there are more than 1000 recipients).
56333 </para>
56334 </section>
56335 <section id="SECTincomingbatchedSMTP">
56336 <title>Incoming batched SMTP</title>
56337 <para>
56338 <indexterm role="concept">
56339 <primary>SMTP</primary>
56340 <secondary>batched incoming</secondary>
56341 </indexterm>
56342 <indexterm role="concept">
56343 <primary>batched SMTP input</primary>
56344 </indexterm>
56345 The <option>-bS</option> command line option causes Exim to accept one or more messages by
56346 reading SMTP on the standard input, but to generate no responses. If the caller
56347 is trusted, the senders in the MAIL commands are believed; otherwise the
56348 sender is always the caller of Exim. Unqualified senders and receivers are not
56349 rejected (there seems little point) but instead just get qualified. HELO
56350 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
56351 as NOOP; QUIT quits.
56352 </para>
56353 <para>
56354 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
56355 In this respect it is like non-SMTP local input.
56356 </para>
56357 <para>
56358 If an error is detected while reading a message, including a missing <quote>.</quote> at
56359 the end, Exim gives up immediately. It writes details of the error to the
56360 standard output in a stylized way that the calling program should be able to
56361 make some use of automatically, for example:
56362 </para>
56363 <literallayout class="monospaced">
56364 554 Unexpected end of file
56365 Transaction started in line 10
56366 Error detected in line 14
56367 </literallayout>
56368 <para>
56369 It writes a more verbose version, for human consumption, to the standard error
56370 file, for example:
56371 </para>
56372 <literallayout class="monospaced">
56373 An error was detected while processing a file of BSMTP input.
56374 The error message was:
56375
56376 501 '&gt;' missing at end of address
56377
56378 The SMTP transaction started in line 10.
56379 The error was detected in line 12.
56380 The SMTP command at fault was:
56381
56382 rcpt to:&lt;malformed@in.com.plete
56383
56384 1 previous message was successfully processed.
56385 The rest of the batch was abandoned.
56386 </literallayout>
56387 <para>
56388 The return code from Exim is zero only if there were no errors. It is 1 if some
56389 messages were accepted before an error was detected, and 2 if no messages were
56390 accepted.
56391 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
56392 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
56393 </para>
56394 </section>
56395 </chapter>
56396
56397 <chapter id="CHAPemsgcust">
56398 <title>Customizing bounce and warning messages</title>
56399 <titleabbrev>Customizing messages</titleabbrev>
56400 <para>
56401 When a message fails to be delivered, or remains on the queue for more than a
56402 configured amount of time, Exim sends a message to the original sender, or
56403 to an alternative configured address. The text of these messages is built into
56404 the code of Exim, but it is possible to change it, either by adding a single
56405 string, or by replacing each of the paragraphs by text supplied in a file.
56406 </para>
56407 <para>
56408 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
56409 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
56410 option. Exim also adds the line
56411 </para>
56412 <literallayout class="monospaced">
56413 Auto-Submitted: auto-generated
56414 </literallayout>
56415 <para>
56416 to all warning and bounce messages,
56417 </para>
56418 <section id="SECID239">
56419 <title>Customizing bounce messages</title>
56420 <para>
56421 <indexterm role="concept">
56422 <primary>customizing</primary>
56423 <secondary>bounce message</secondary>
56424 </indexterm>
56425 <indexterm role="concept">
56426 <primary>bounce message</primary>
56427 <secondary>customizing</secondary>
56428 </indexterm>
56429 If <option>bounce_message_text</option> is set, its contents are included in the default
56430 message immediately after <quote>This message was created automatically by mail
56431 delivery software.</quote> The string is not expanded. It is not used if
56432 <option>bounce_message_file</option> is set.
56433 </para>
56434 <para>
56435 When <option>bounce_message_file</option> is set, it must point to a template file for
56436 constructing error messages. The file consists of a series of text items,
56437 separated by lines consisting of exactly four asterisks. If the file cannot be
56438 opened, default text is used and a message is written to the main and panic
56439 logs. If any text item in the file is empty, default text is used for that
56440 item.
56441 </para>
56442 <para>
56443 <indexterm role="variable">
56444 <primary><varname>$bounce_recipient</varname></primary>
56445 </indexterm>
56446 <indexterm role="variable">
56447 <primary><varname>$bounce_return_size_limit</varname></primary>
56448 </indexterm>
56449 Each item of text that is read from the file is expanded, and there are two
56450 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
56451 the recipient of an error message while it is being created, and
56452 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
56453 option, rounded to a whole number.
56454 </para>
56455 <para>
56456 The items must appear in the file in the following order:
56457 </para>
56458 <itemizedlist>
56459 <listitem>
56460 <para>
56461 The first item is included in the headers, and should include at least a
56462 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56463 </para>
56464 </listitem>
56465 <listitem>
56466 <para>
56467 The second item forms the start of the error message. After it, Exim lists the
56468 failing addresses with their error messages.
56469 </para>
56470 </listitem>
56471 <listitem>
56472 <para>
56473 The third item is used to introduce any text from pipe transports that is to be
56474 returned to the sender. It is omitted if there is no such text.
56475 </para>
56476 </listitem>
56477 <listitem>
56478 <para>
56479 The fourth item is used to introduce the copy of the message that is returned
56480 as part of the error report.
56481 </para>
56482 </listitem>
56483 <listitem>
56484 <para>
56485 The fifth item is added after the fourth one if the returned message is
56486 truncated because it is bigger than <option>return_size_limit</option>.
56487 </para>
56488 </listitem>
56489 <listitem>
56490 <para>
56491 The sixth item is added after the copy of the original message.
56492 </para>
56493 </listitem>
56494 </itemizedlist>
56495 <para>
56496 The default state (<option>bounce_message_file</option> unset) is equivalent to the
56497 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
56498 other lines have been split in order to fit them on the page:
56499 </para>
56500 <literallayout class="monospaced">
56501 Subject: Mail delivery failed
56502   ${if eq{$sender_address}{$bounce_recipient}
56503   {: returning message to sender}}
56504 ****
56505 This message was created automatically by mail delivery software.
56506
56507 A message ${if eq{$sender_address}{$bounce_recipient}
56508   {that you sent }{sent by
56509
56510 &lt;$sender_address&gt;
56511
56512 }}could not be delivered to all of its recipients.
56513 This is a permanent error. The following address(es) failed:
56514 ****
56515 The following text was generated during the delivery attempt(s):
56516 ****
56517 ------ This is a copy of the message, including all the headers.
56518   ------
56519 ****
56520 ------ The body of the message is $message_size characters long;
56521   only the first
56522 ------ $bounce_return_size_limit or so are included here.
56523 ****
56524 </literallayout>
56525 </section>
56526 <section id="SECTcustwarn">
56527 <title>Customizing warning messages</title>
56528 <para>
56529 <indexterm role="concept">
56530 <primary>customizing</primary>
56531 <secondary>warning message</secondary>
56532 </indexterm>
56533 <indexterm role="concept">
56534 <primary>warning of delay</primary>
56535 <secondary>customizing the message</secondary>
56536 </indexterm>
56537 The option <option>warn_message_file</option> can be pointed at a template file for use when
56538 warnings about message delays are created. In this case there are only three
56539 text sections:
56540 </para>
56541 <itemizedlist>
56542 <listitem>
56543 <para>
56544 The first item is included in the headers, and should include at least a
56545 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56546 </para>
56547 </listitem>
56548 <listitem>
56549 <para>
56550 The second item forms the start of the warning message. After it, Exim lists
56551 the delayed addresses.
56552 </para>
56553 </listitem>
56554 <listitem>
56555 <para>
56556 The third item then ends the message.
56557 </para>
56558 </listitem>
56559 </itemizedlist>
56560 <para>
56561 The default state is equivalent to the following file, except that some lines
56562 have been split here, in order to fit them on the page:
56563 </para>
56564 <literallayout class="monospaced">
56565 Subject: Warning: message $message_exim_id delayed
56566   $warn_message_delay
56567 ****
56568 This message was created automatically by mail delivery software.
56569
56570 A message ${if eq{$sender_address}{$warn_message_recipients}
56571 {that you sent }{sent by
56572
56573 &lt;$sender_address&gt;
56574
56575 }}has not been delivered to all of its recipients after
56576 more than $warn_message_delay on the queue on $primary_hostname.
56577
56578 The message identifier is:     $message_exim_id
56579 The subject of the message is: $h_subject
56580 The date of the message is:    $h_date
56581
56582 The following address(es) have not yet been delivered:
56583 ****
56584 No action is required on your part. Delivery attempts will
56585 continue for some time, and this warning may be repeated at
56586 intervals if the message remains undelivered. Eventually the
56587 mail delivery software will give up, and when that happens,
56588 the message will be returned to you.
56589 </literallayout>
56590 <para>
56591 <indexterm role="variable">
56592 <primary><varname>$warn_message_delay</varname></primary>
56593 </indexterm>
56594 <indexterm role="variable">
56595 <primary><varname>$warn_message_recipients</varname></primary>
56596 </indexterm>
56597 However, in the default state the subject and date lines are omitted if no
56598 appropriate headers exist. During the expansion of this file,
56599 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
56600 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
56601 of recipients for the warning message. There may be more than one if there are
56602 multiple addresses with different <option>errors_to</option> settings on the routers that
56603 handled them.
56604 </para>
56605 </section>
56606 </chapter>
56607
56608 <chapter id="CHAPcomconreq">
56609 <title>Some common configuration settings</title>
56610 <para>
56611 This chapter discusses some configuration settings that seem to be fairly
56612 common. More examples and discussion can be found in the Exim book.
56613 </para>
56614 <section id="SECID240">
56615 <title>Sending mail to a smart host</title>
56616 <para>
56617 <indexterm role="concept">
56618 <primary>smart host</primary>
56619 <secondary>example router</secondary>
56620 </indexterm>
56621 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
56622 should replace the default <command>dnslookup</command> router with a router which does the
56623 routing explicitly:
56624 </para>
56625 <literallayout class="monospaced">
56626 send_to_smart_host:
56627   driver = manualroute
56628   route_list = !+local_domains smart.host.name
56629   transport = remote_smtp
56630 </literallayout>
56631 <para>
56632 You can use the smart host&#x2019;s IP address instead of the name if you wish.
56633 If you are using Exim only to submit messages to a smart host, and not for
56634 receiving incoming messages, you can arrange for it to do the submission
56635 synchronously by setting the <option>mua_wrapper</option> option (see chapter
56636 <xref linkend="CHAPnonqueueing"/>).
56637 </para>
56638 </section>
56639 <section id="SECTmailinglists">
56640 <title>Using Exim to handle mailing lists</title>
56641 <para>
56642 <indexterm role="concept">
56643 <primary>mailing lists</primary>
56644 </indexterm>
56645 Exim can be used to run simple mailing lists, but for large and/or complicated
56646 requirements, the use of additional specialized mailing list software such as
56647 Majordomo or Mailman is recommended.
56648 </para>
56649 <para>
56650 The <command>redirect</command> router can be used to handle mailing lists where each list
56651 is maintained in a separate file, which can therefore be managed by an
56652 independent manager. The <option>domains</option> router option can be used to run these
56653 lists in a separate domain from normal mail. For example:
56654 </para>
56655 <literallayout class="monospaced">
56656 lists:
56657   driver = redirect
56658   domains = lists.example
56659   file = /usr/lists/$local_part
56660   forbid_pipe
56661   forbid_file
56662   errors_to = $local_part-request@lists.example
56663   no_more
56664 </literallayout>
56665 <para>
56666 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
56667 in that domain, it looks for a file that matches the local part. If there is no
56668 such file, the router declines, but because <option>no_more</option> is set, no subsequent
56669 routers are tried, and so the whole delivery fails.
56670 </para>
56671 <para>
56672 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
56673 expanded into a file name or a pipe delivery, which is usually inappropriate in
56674 a mailing list.
56675 </para>
56676 <para>
56677 <indexterm role="option">
56678 <primary><option>errors_to</option></primary>
56679 </indexterm>
56680 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
56681 taken from a mailing list are to be sent to the given address rather than the
56682 original sender of the message. However, before acting on this, Exim verifies
56683 the error address, and ignores it if verification fails.
56684 </para>
56685 <para>
56686 For example, using the configuration above, mail sent to
56687 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
56688 <filename>/usr/lists/dicts</filename>, with error reports directed to
56689 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
56690 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
56691 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
56692 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
56693 or <option>local_part_suffix</option> options) to handle addresses of the form
56694 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
56695 </para>
56696 </section>
56697 <section id="SECID241">
56698 <title>Syntax errors in mailing lists</title>
56699 <para>
56700 <indexterm role="concept">
56701 <primary>mailing lists</primary>
56702 <secondary>syntax errors in</secondary>
56703 </indexterm>
56704 If an entry in redirection data contains a syntax error, Exim normally defers
56705 delivery of the original address. That means that a syntax error in a mailing
56706 list holds up all deliveries to the list. This may not be appropriate when a
56707 list is being maintained automatically from data supplied by users, and the
56708 addresses are not rigorously checked.
56709 </para>
56710 <para>
56711 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
56712 entries that fail to parse, noting the incident in the log. If in addition
56713 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
56714 whenever a broken address is skipped. It is usually appropriate to set
56715 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
56716 </para>
56717 </section>
56718 <section id="SECID242">
56719 <title>Re-expansion of mailing lists</title>
56720 <para>
56721 <indexterm role="concept">
56722 <primary>mailing lists</primary>
56723 <secondary>re-expansion of</secondary>
56724 </indexterm>
56725 Exim remembers every individual address to which a message has been delivered,
56726 in order to avoid duplication, but it normally stores only the original
56727 recipient addresses with a message. If all the deliveries to a mailing list
56728 cannot be done at the first attempt, the mailing list is re-expanded when the
56729 delivery is next tried. This means that alterations to the list are taken into
56730 account at each delivery attempt, so addresses that have been added to
56731 the list since the message arrived will therefore receive a copy of the
56732 message, even though it pre-dates their subscription.
56733 </para>
56734 <para>
56735 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
56736 on the <command>redirect</command> router. If this is done, any addresses generated by the
56737 router that fail to deliver at the first attempt are added to the message as
56738 <quote>top level</quote> addresses, and the parent address that generated them is marked
56739 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
56740 subsequent delivery attempts. The disadvantage of this is that if any of the
56741 failing addresses are incorrect, correcting them in the file has no effect on
56742 pre-existing messages.
56743 </para>
56744 <para>
56745 The original top-level address is remembered with each of the generated
56746 addresses, and is output in any log messages. However, any intermediate parent
56747 addresses are not recorded. This makes a difference to the log only if the
56748 <option>all_parents</option> selector is set, but for mailing lists there is normally only
56749 one level of expansion anyway.
56750 </para>
56751 </section>
56752 <section id="SECID243">
56753 <title>Closed mailing lists</title>
56754 <para>
56755 <indexterm role="concept">
56756 <primary>mailing lists</primary>
56757 <secondary>closed</secondary>
56758 </indexterm>
56759 The examples so far have assumed open mailing lists, to which anybody may
56760 send mail. It is also possible to set up closed lists, where mail is accepted
56761 from specified senders only. This is done by making use of the generic
56762 <option>senders</option> option to restrict the router that handles the list.
56763 </para>
56764 <para>
56765 The following example uses the same file as a list of recipients and as a list
56766 of permitted senders. It requires three routers:
56767 </para>
56768 <literallayout class="monospaced">
56769 lists_request:
56770   driver = redirect
56771   domains = lists.example
56772   local_part_suffix = -request
56773   file = /usr/lists/$local_part$local_part_suffix
56774   no_more
56775
56776 lists_post:
56777   driver = redirect
56778   domains = lists.example
56779   senders = ${if exists {/usr/lists/$local_part}\
56780              {lsearch;/usr/lists/$local_part}{*}}
56781   file = /usr/lists/$local_part
56782   forbid_pipe
56783   forbid_file
56784   errors_to = $local_part-request@lists.example
56785   no_more
56786
56787 lists_closed:
56788   driver = redirect
56789   domains = lists.example
56790   allow_fail
56791   data = :fail: $local_part@lists.example is a closed mailing list
56792 </literallayout>
56793 <para>
56794 All three routers have the same <option>domains</option> setting, so for any other domains,
56795 they are all skipped. The first router runs only if the local part ends in
56796 <option>-request</option>. It handles messages to the list manager(s) by means of an open
56797 mailing list.
56798 </para>
56799 <para>
56800 The second router runs only if the <option>senders</option> precondition is satisfied. It
56801 checks for the existence of a list that corresponds to the local part, and then
56802 checks that the sender is on the list by means of a linear search. It is
56803 necessary to check for the existence of the file before trying to search it,
56804 because otherwise Exim thinks there is a configuration error. If the file does
56805 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
56806 means that the router runs, but because there is no list, declines, and
56807 <option>no_more</option> ensures that no further routers are run. The address fails with an
56808 <quote>unrouteable address</quote> error.
56809 </para>
56810 <para>
56811 The third router runs only if the second router is skipped, which happens when
56812 a mailing list exists, but the sender is not on it. This router forcibly fails
56813 the address, giving a suitable error message.
56814 </para>
56815 </section>
56816 <section id="SECTverp">
56817 <title>Variable Envelope Return Paths (VERP)</title>
56818 <para>
56819 <indexterm role="concept">
56820 <primary>VERP</primary>
56821 </indexterm>
56822 <indexterm role="concept">
56823 <primary>Variable Envelope Return Paths</primary>
56824 </indexterm>
56825 <indexterm role="concept">
56826 <primary>envelope sender</primary>
56827 </indexterm>
56828 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;
56829 are a way of helping mailing list administrators discover which subscription
56830 address is the cause of a particular delivery failure. The idea is to encode
56831 the original recipient address in the outgoing envelope sender address, so that
56832 if the message is forwarded by another host and then subsequently bounces, the
56833 original recipient can be extracted from the recipient address of the bounce.
56834 </para>
56835 <para>
56836 <indexterm role="option">
56837 <primary><option>errors_to</option></primary>
56838 </indexterm>
56839 <indexterm role="option">
56840 <primary><option>return_path</option></primary>
56841 </indexterm>
56842 Envelope sender addresses can be modified by Exim using two different
56843 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
56844 list examples), or the <option>return_path</option> option on a transport. The second of
56845 these is effective only if the message is successfully delivered to another
56846 host; it is not used for errors detected on the local host (see the description
56847 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
56848 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
56849 </para>
56850 <literallayout class="monospaced">
56851 verp_smtp:
56852   driver = smtp
56853   max_rcpt = 1
56854   return_path = \
56855     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56856       {$1-request+$local_part=$domain@your.dom.example}fail}
56857 </literallayout>
56858 <para>
56859 This has the effect of rewriting the return path (envelope sender) on outgoing
56860 SMTP messages, if the local part of the original return path ends in
56861 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
56862 local part and domain of the recipient into the return path. Suppose, for
56863 example, that a message whose return path has been set to
56864 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
56865 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
56866 rewritten as
56867 </para>
56868 <literallayout class="monospaced">
56869 somelist-request+subscriber=other.dom.example@your.dom.example
56870 </literallayout>
56871 <para>
56872 <indexterm role="variable">
56873 <primary><varname>$local_part</varname></primary>
56874 </indexterm>
56875 For this to work, you must tell Exim to send multiple copies of messages that
56876 have more than one recipient, so that each copy has just one recipient. This is
56877 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
56878 might be sent to several different recipients in the same domain, in which case
56879 <varname>$local_part</varname> is not available in the transport, because it is not unique.
56880 </para>
56881 <para>
56882 Unless your host is doing nothing but mailing list deliveries, you should
56883 probably use a separate transport for the VERP deliveries, so as not to use
56884 extra resources in making one-per-recipient copies for other deliveries. This
56885 can easily be done by expanding the <option>transport</option> option in the router:
56886 </para>
56887 <literallayout class="monospaced">
56888 dnslookup:
56889   driver = dnslookup
56890   domains = ! +local_domains
56891   transport = \
56892     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56893       {verp_smtp}{remote_smtp}}
56894   no_more
56895 </literallayout>
56896 <para>
56897 If you want to change the return path using <option>errors_to</option> in a router instead
56898 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
56899 routers that handle mailing list addresses. This will ensure that all delivery
56900 errors, including those detected on the local host, are sent to the VERP
56901 address.
56902 </para>
56903 <para>
56904 On a host that does no local deliveries and has no manual routing, only the
56905 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
56906 SMTP deliveries. Every mailing list recipient has its own return path value,
56907 and so Exim must hand them to the transport one at a time. Here is an example
56908 of a <command>dnslookup</command> router that implements VERP:
56909 </para>
56910 <literallayout class="monospaced">
56911 verp_dnslookup:
56912   driver = dnslookup
56913   domains = ! +local_domains
56914   transport = remote_smtp
56915   errors_to = \
56916     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
56917      {$1-request+$local_part=$domain@your.dom.example}fail}
56918   no_more
56919 </literallayout>
56920 <para>
56921 Before you start sending out messages with VERPed return paths, you must also
56922 configure Exim to accept the bounce messages that come back to those paths.
56923 Typically this is done by setting a <option>local_part_suffix</option> option for a
56924 router, and using this to route the messages to wherever you want to handle
56925 them.
56926 </para>
56927 <para>
56928 The overhead incurred in using VERP depends very much on the size of the
56929 message, the number of recipient addresses that resolve to the same remote
56930 host, and the speed of the connection over which the message is being sent. If
56931 a lot of addresses resolve to the same host and the connection is slow, sending
56932 a separate copy of the message for each address may take substantially longer
56933 than sending a single copy with many recipients (for which VERP cannot be
56934 used).
56935 </para>
56936 </section>
56937 <section id="SECTvirtualdomains">
56938 <title>Virtual domains</title>
56939 <para>
56940 <indexterm role="concept">
56941 <primary>virtual domains</primary>
56942 </indexterm>
56943 <indexterm role="concept">
56944 <primary>domain</primary>
56945 <secondary>virtual</secondary>
56946 </indexterm>
56947 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
56948 meanings:
56949 </para>
56950 <itemizedlist>
56951 <listitem>
56952 <para>
56953 A domain for which there are no real mailboxes; all valid local parts are
56954 aliases for other email addresses. Common examples are organizational
56955 top-level domains and <quote>vanity</quote> domains.
56956 </para>
56957 </listitem>
56958 <listitem>
56959 <para>
56960 One of a number of independent domains that are all handled by the same host,
56961 with mailboxes on that host, but where the mailbox owners do not necessarily
56962 have login accounts on that host.
56963 </para>
56964 </listitem>
56965 </itemizedlist>
56966 <para>
56967 The first usage is probably more common, and does seem more <quote>virtual</quote> than
56968 the second. This kind of domain can be handled in Exim with a straightforward
56969 aliasing router. One approach is to create a separate alias file for each
56970 virtual domain. Exim can test for the existence of the alias file to determine
56971 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
56972 to a router of this form:
56973 </para>
56974 <literallayout class="monospaced">
56975 virtual:
56976   driver = redirect
56977   domains = dsearch;/etc/mail/virtual
56978   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
56979   no_more
56980 </literallayout>
56981 <para>
56982 The <option>domains</option> option specifies that the router is to be skipped, unless there
56983 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
56984 domain that is being processed. When the router runs, it looks up the local
56985 part in the file to find a new address (or list of addresses). The <option>no_more</option>
56986 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
56987 string), Exim gives up on the address without trying any subsequent routers.
56988 </para>
56989 <para>
56990 This one router can handle all the virtual domains because the alias file names
56991 follow a fixed pattern. Permissions can be arranged so that appropriate people
56992 can edit the different alias files. A successful aliasing operation results in
56993 a new envelope recipient address, which is then routed from scratch.
56994 </para>
56995 <para>
56996 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
56997 way. One approach is to create a file for each domain containing a list of
56998 valid local parts, and use it in a router like this:
56999 </para>
57000 <literallayout class="monospaced">
57001 my_domains:
57002   driver = accept
57003   domains = dsearch;/etc/mail/domains
57004   local_parts = lsearch;/etc/mail/domains/$domain
57005   transport = my_mailboxes
57006 </literallayout>
57007 <para>
57008 The address is accepted if there is a file for the domain, and the local part
57009 can be found in the file. The <option>domains</option> option is used to check for the
57010 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
57011 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
57012 because that option is tested after <option>local_parts</option>. The transport is as
57013 follows:
57014 </para>
57015 <literallayout class="monospaced">
57016 my_mailboxes:
57017   driver = appendfile
57018   file = /var/mail/$domain/$local_part
57019   user = mail
57020 </literallayout>
57021 <para>
57022 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
57023 required, to specify which uid is to be used for writing to the mailboxes.
57024 </para>
57025 <para>
57026 The configuration shown here is just one example of how you might support this
57027 requirement. There are many other ways this kind of configuration can be set
57028 up, for example, by using a database instead of separate files to hold all the
57029 information about the domains.
57030 </para>
57031 </section>
57032 <section id="SECTmulbox">
57033 <title>Multiple user mailboxes</title>
57034 <para>
57035 <indexterm role="concept">
57036 <primary>multiple mailboxes</primary>
57037 </indexterm>
57038 <indexterm role="concept">
57039 <primary>mailbox</primary>
57040 <secondary>multiple</secondary>
57041 </indexterm>
57042 <indexterm role="concept">
57043 <primary>local part</primary>
57044 <secondary>prefix</secondary>
57045 </indexterm>
57046 <indexterm role="concept">
57047 <primary>local part</primary>
57048 <secondary>suffix</secondary>
57049 </indexterm>
57050 Heavy email users often want to operate with multiple mailboxes, into which
57051 incoming mail is automatically sorted. A popular way of handling this is to
57052 allow users to use multiple sender addresses, so that replies can easily be
57053 identified. Users are permitted to add prefixes or suffixes to their local
57054 parts for this purpose. The wildcard facility of the generic router options
57055 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
57056 example, consider this router:
57057 </para>
57058 <literallayout class="monospaced">
57059 userforward:
57060   driver = redirect
57061   check_local_user
57062   file = $home/.forward
57063   local_part_suffix = -*
57064   local_part_suffix_optional
57065   allow_filter
57066 </literallayout>
57067 <para>
57068 <indexterm role="variable">
57069 <primary><varname>$local_part_suffix</varname></primary>
57070 </indexterm>
57071 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
57072 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
57073 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
57074 </para>
57075 <literallayout class="monospaced">
57076 if $local_part_suffix contains -special then
57077 save /home/$local_part/Mail/special
57078 endif
57079 </literallayout>
57080 <para>
57081 If the filter file does not exist, or does not deal with such addresses, they
57082 fall through to subsequent routers, and, assuming no subsequent use of the
57083 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
57084 control over which suffixes are valid.
57085 </para>
57086 <para>
57087 Alternatively, a suffix can be used to trigger the use of a different
57088 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
57089 another MTA:
57090 </para>
57091 <literallayout class="monospaced">
57092 userforward:
57093   driver = redirect
57094   check_local_user
57095   file = $home/.forward$local_part_suffix
57096   local_part_suffix = -*
57097   local_part_suffix_optional
57098   allow_filter
57099 </literallayout>
57100 <para>
57101 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
57102 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
57103 does not exist, or does not deal with the address, it is passed on to
57104 subsequent routers, which could, if required, look for an unqualified
57105 <filename>.forward</filename> file to use as a default.
57106 </para>
57107 </section>
57108 <section id="SECID244">
57109 <title>Simplified vacation processing</title>
57110 <para>
57111 <indexterm role="concept">
57112 <primary>vacation processing</primary>
57113 </indexterm>
57114 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
57115 a pipe command in a <filename>.forward</filename> file
57116 (see section <xref linkend="SECTspecitredli"/> for syntax details).
57117 This is prone to error by inexperienced users. There are two features of Exim
57118 that can be used to make this process simpler for users:
57119 </para>
57120 <itemizedlist>
57121 <listitem>
57122 <para>
57123 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
57124 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
57125 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
57126 <filename>.forward</filename> file are then much simpler. For example:
57127 </para>
57128 <literallayout class="monospaced">
57129 spqr, vacation-spqr
57130 </literallayout>
57131 </listitem>
57132 <listitem>
57133 <para>
57134 The <option>require_files</option> generic router option can be used to trigger a
57135 vacation delivery by checking for the existence of a certain file in the
57136 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
57137 ensure that the original delivery also proceeds. In this case, all the user has
57138 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
57139 message.
57140 </para>
57141 </listitem>
57142 </itemizedlist>
57143 <para>
57144 Another advantage of both these methods is that they both work even when the
57145 use of arbitrary pipes by users is locked out.
57146 </para>
57147 </section>
57148 <section id="SECID245">
57149 <title>Taking copies of mail</title>
57150 <para>
57151 <indexterm role="concept">
57152 <primary>message</primary>
57153 <secondary>copying every</secondary>
57154 </indexterm>
57155 Some installations have policies that require archive copies of all messages to
57156 be made. A single copy of each message can easily be taken by an appropriate
57157 command in a system filter, which could, for example, use a different file for
57158 each day&#x2019;s messages.
57159 </para>
57160 <para>
57161 There is also a shadow transport mechanism that can be used to take copies of
57162 messages that are successfully delivered by local transports, one copy per
57163 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
57164 notification of delivery by sites that insist on doing such things.
57165 </para>
57166 </section>
57167 <section id="SECID246">
57168 <title>Intermittently connected hosts</title>
57169 <para>
57170 <indexterm role="concept">
57171 <primary>intermittently connected hosts</primary>
57172 </indexterm>
57173 It has become quite common (because it is cheaper) for hosts to connect to the
57174 Internet periodically rather than remain connected all the time. The normal
57175 arrangement is that mail for such hosts accumulates on a system that is
57176 permanently connected.
57177 </para>
57178 <para>
57179 Exim was designed for use on permanently connected hosts, and so it is not
57180 particularly well-suited to use in an intermittently connected environment.
57181 Nevertheless there are some features that can be used.
57182 </para>
57183 </section>
57184 <section id="SECID247">
57185 <title>Exim on the upstream server host</title>
57186 <para>
57187 It is tempting to arrange for incoming mail for the intermittently connected
57188 host to remain on Exim&#x2019;s queue until the client connects. However, this
57189 approach does not scale very well. Two different kinds of waiting message are
57190 being mixed up in the same queue &ndash; those that cannot be delivered because of
57191 some temporary problem, and those that are waiting for their destination host
57192 to connect. This makes it hard to manage the queue, as well as wasting
57193 resources, because each queue runner scans the entire queue.
57194 </para>
57195 <para>
57196 A better approach is to separate off those messages that are waiting for an
57197 intermittently connected host. This can be done by delivering these messages
57198 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
57199 format, from where they are transmitted by other software when their
57200 destination connects. This makes it easy to collect all the mail for one host
57201 in a single directory, and to apply local timeout rules on a per-message basis
57202 if required.
57203 </para>
57204 <para>
57205 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
57206 you are doing this, you should configure Exim with a long retry period for the
57207 intermittent host. For example:
57208 </para>
57209 <literallayout class="monospaced">
57210 cheshire.wonderland.fict.example    *   F,5d,24h
57211 </literallayout>
57212 <para>
57213 This stops a lot of failed delivery attempts from occurring, but Exim remembers
57214 which messages it has queued up for that host. Once the intermittent host comes
57215 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
57216 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
57217 causes all the queued up messages to be delivered, often down a single SMTP
57218 connection. While the host remains connected, any new messages get delivered
57219 immediately.
57220 </para>
57221 <para>
57222 If the connecting hosts do not have fixed IP addresses, that is, if a host is
57223 issued with a different IP address each time it connects, Exim&#x2019;s retry
57224 mechanisms on the holding host get confused, because the IP address is normally
57225 used as part of the key string for holding retry information. This can be
57226 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
57227 Since this has disadvantages for permanently connected hosts, it is best to
57228 arrange a separate transport for the intermittently connected ones.
57229 </para>
57230 </section>
57231 <section id="SECID248">
57232 <title>Exim on the intermittently connected client host</title>
57233 <para>
57234 The value of <option>smtp_accept_queue_per_connection</option> should probably be
57235 increased, or even set to zero (that is, disabled) on the intermittently
57236 connected host, so that all incoming messages down a single connection get
57237 delivered immediately.
57238 </para>
57239 <para>
57240 <indexterm role="concept">
57241 <primary>SMTP</primary>
57242 <secondary>passed connection</secondary>
57243 </indexterm>
57244 <indexterm role="concept">
57245 <primary>SMTP</primary>
57246 <secondary>multiple deliveries</secondary>
57247 </indexterm>
57248 <indexterm role="concept">
57249 <primary>multiple SMTP deliveries</primary>
57250 </indexterm>
57251 Mail waiting to be sent from an intermittently connected host will probably
57252 not have been routed, because without a connection DNS lookups are not
57253 possible. This means that if a normal queue run is done at connection time,
57254 each message is likely to be sent in a separate SMTP session. This can be
57255 avoided by starting the queue run with a command line option beginning with
57256 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
57257 first pass, routing is done but no deliveries take place. The second pass is a
57258 normal queue run; since all the messages have been previously routed, those
57259 destined for the same host are likely to get sent as multiple deliveries in a
57260 single SMTP connection.
57261 </para>
57262 </section>
57263 </chapter>
57264
57265 <chapter id="CHAPnonqueueing">
57266 <title>Using Exim as a non-queueing client</title>
57267 <titleabbrev>Exim as a non-queueing client</titleabbrev>
57268 <para>
57269 <indexterm role="concept">
57270 <primary>client, non-queueing</primary>
57271 </indexterm>
57272 <indexterm role="concept">
57273 <primary>smart host</primary>
57274 <secondary>suppressing queueing</secondary>
57275 </indexterm>
57276 On a personal computer, it is a common requirement for all
57277 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
57278 configured to operate that way, for all the popular operating systems.
57279 However, there are some MUAs for Unix-like systems that cannot be so
57280 configured: they submit messages using the command line interface of
57281 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
57282 messages this way.
57283 </para>
57284 <para>
57285 If the personal computer runs continuously, there is no problem, because it can
57286 run a conventional MTA that handles delivery to the smart host, and deal with
57287 any delays via its queueing mechanism. However, if the computer does not run
57288 continuously or runs different operating systems at different times, queueing
57289 email is not desirable.
57290 </para>
57291 <para>
57292 There is therefore a requirement for something that can provide the
57293 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
57294 any queueing or retrying facilities. Furthermore, the delivery to the smart
57295 host should be synchronous, so that if it fails, the sending MUA is immediately
57296 informed. In other words, we want something that extends an MUA that submits
57297 to a local MTA via the command line so that it behaves like one that submits
57298 to a remote smart host using TCP/SMTP.
57299 </para>
57300 <para>
57301 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
57302 that do this job. However, people have found them to be lacking in various
57303 ways. For instance, you might want to allow aliasing and forwarding to be done
57304 before sending a message to the smart host.
57305 </para>
57306 <para>
57307 Exim already had the necessary infrastructure for doing this job. Just a few
57308 tweaks were needed to make it behave as required, though it is somewhat of an
57309 overkill to use a fully-featured MTA for this purpose.
57310 </para>
57311 <para>
57312 <indexterm role="option">
57313 <primary><option>mua_wrapper</option></primary>
57314 </indexterm>
57315 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
57316 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
57317 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
57318 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
57319 compatible router and transport configuration. Typically there will be just one
57320 router and one transport, sending everything to a smart host.
57321 </para>
57322 <para>
57323 When run in MUA wrapping mode, the behaviour of Exim changes in the
57324 following ways:
57325 </para>
57326 <itemizedlist>
57327 <listitem>
57328 <para>
57329 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
57330 In other words, the only way to submit messages is via the command line.
57331 </para>
57332 </listitem>
57333 <listitem>
57334 <para>
57335 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
57336 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
57337 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
57338 does not finish until the delivery attempt is complete. If the delivery is
57339 successful, a zero return code is given.
57340 </para>
57341 </listitem>
57342 <listitem>
57343 <para>
57344 Address redirection is permitted, but the final routing for all addresses must
57345 be to the same remote transport, and to the same list of hosts. Furthermore,
57346 the return address (envelope sender) must be the same for all recipients, as
57347 must any added or deleted header lines. In other words, it must be possible to
57348 deliver the message in a single SMTP transaction, however many recipients there
57349 are.
57350 </para>
57351 </listitem>
57352 <listitem>
57353 <para>
57354 If these conditions are not met, or if routing any address results in a
57355 failure or defer status, or if Exim is unable to deliver all the recipients
57356 successfully to one of the smart hosts, delivery of the entire message fails.
57357 </para>
57358 </listitem>
57359 <listitem>
57360 <para>
57361 Because no queueing is allowed, all failures are treated as permanent; there
57362 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
57363 smart host. Furthermore, because only a single yes/no response can be given to
57364 the caller, it is not possible to deliver to some recipients and not others. If
57365 there is an error (temporary or permanent) for any recipient, all are failed.
57366 </para>
57367 </listitem>
57368 <listitem>
57369 <para>
57370 If more than one smart host is listed, Exim will try another host after a
57371 connection failure or a timeout, in the normal way. However, if this kind of
57372 failure happens for all the hosts, the delivery fails.
57373 </para>
57374 </listitem>
57375 <listitem>
57376 <para>
57377 When delivery fails, an error message is written to the standard error stream
57378 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
57379 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
57380 are ever generated.
57381 </para>
57382 </listitem>
57383 <listitem>
57384 <para>
57385 No retry data is maintained, and any retry rules are ignored.
57386 </para>
57387 </listitem>
57388 <listitem>
57389 <para>
57390 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
57391 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
57392 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
57393 </para>
57394 </listitem>
57395 </itemizedlist>
57396 <para>
57397 The overall effect is that Exim makes a single synchronous attempt to deliver
57398 the message, failing if there is any kind of problem. Because no local
57399 deliveries are done and no daemon can be run, Exim does not need root
57400 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
57401 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
57402 the advantages and disadvantages of running without root privilege.
57403 </para>
57404 </chapter>
57405
57406 <chapter id="CHAPlog">
57407 <title>Log files</title>
57408 <para>
57409 <indexterm role="concept" id="IIDloggen" class="startofrange">
57410 <primary>log</primary>
57411 <secondary>general description</secondary>
57412 </indexterm>
57413 <indexterm role="concept">
57414 <primary>log</primary>
57415 <secondary>types of</secondary>
57416 </indexterm>
57417 Exim writes three different logs, referred to as the main log, the reject log,
57418 and the panic log:
57419 </para>
57420 <itemizedlist>
57421 <listitem>
57422 <para>
57423 <indexterm role="concept">
57424 <primary>main log</primary>
57425 </indexterm>
57426 The main log records the arrival of each message and each delivery in a single
57427 line in each case. The format is as compact as possible, in an attempt to keep
57428 down the size of log files. Two-character flag sequences make it easy to pick
57429 out these lines. A number of other events are recorded in the main log. Some of
57430 them are optional, in which case the <option>log_selector</option> option controls whether
57431 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
57432 analysis of main log files, is provided in the Exim distribution (see section
57433 <xref linkend="SECTmailstat"/>).
57434 </para>
57435 </listitem>
57436 <listitem>
57437 <para>
57438 <indexterm role="concept">
57439 <primary>reject log</primary>
57440 </indexterm>
57441 The reject log records information from messages that are rejected as a result
57442 of a configuration option (that is, for policy reasons).
57443 The first line of each rejection is a copy of the line that is also written to
57444 the main log. Then, if the message&#x2019;s header has been read at the time the log
57445 is written, its contents are written to this log. Only the original header
57446 lines are available; header lines added by ACLs are not logged. You can use the
57447 reject log to check that your policy controls are working correctly; on a busy
57448 host this may be easier than scanning the main log for rejection messages. You
57449 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
57450 false.
57451 </para>
57452 </listitem>
57453 <listitem>
57454 <para>
57455 <indexterm role="concept">
57456 <primary>panic log</primary>
57457 </indexterm>
57458 <indexterm role="concept">
57459 <primary>system log</primary>
57460 </indexterm>
57461 When certain serious errors occur, Exim writes entries to its panic log. If the
57462 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
57463 are usually written to the main log as well, but can get lost amid the mass of
57464 other entries. The panic log should be empty under normal circumstances. It is
57465 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
57466 regularly, in order to become aware of any problems. When Exim cannot open its
57467 panic log, it tries as a last resort to write to the system log (syslog). This
57468 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
57469 message itself is written at priority LOG_CRIT.
57470 </para>
57471 </listitem>
57472 </itemizedlist>
57473 <para>
57474 Every log line starts with a timestamp, in the format shown in the following
57475 example. Note that many of the examples shown in this chapter are line-wrapped.
57476 In the log file, this would be all on one line:
57477 </para>
57478 <literallayout class="monospaced">
57479 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
57480   by QUIT
57481 </literallayout>
57482 <para>
57483 By default, the timestamps are in the local timezone. There are two
57484 ways of changing this:
57485 </para>
57486 <itemizedlist>
57487 <listitem>
57488 <para>
57489 You can set the <option>timezone</option> option to a different time zone; in particular, if
57490 you set
57491 </para>
57492 <literallayout class="monospaced">
57493 timezone = UTC
57494 </literallayout>
57495 <para>
57496 the timestamps will be in UTC (aka GMT).
57497 </para>
57498 </listitem>
57499 <listitem>
57500 <para>
57501 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
57502 example:
57503 </para>
57504 <literallayout class="monospaced">
57505 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
57506 </literallayout>
57507 </listitem>
57508 </itemizedlist>
57509 <para>
57510 <indexterm role="concept">
57511 <primary>log</primary>
57512 <secondary>process ids in</secondary>
57513 </indexterm>
57514 <indexterm role="concept">
57515 <primary>pid (process id)</primary>
57516 <secondary>in log lines</secondary>
57517 </indexterm>
57518 Exim does not include its process id in log lines by default, but you can
57519 request that it does so by specifying the <literal>pid</literal> log selector (see section
57520 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
57521 brackets, immediately after the time and date.
57522 </para>
57523 <section id="SECTwhelogwri">
57524 <title>Where the logs are written</title>
57525 <para>
57526 <indexterm role="concept">
57527 <primary>log</primary>
57528 <secondary>destination</secondary>
57529 </indexterm>
57530 <indexterm role="concept">
57531 <primary>log</primary>
57532 <secondary>to file</secondary>
57533 </indexterm>
57534 <indexterm role="concept">
57535 <primary>log</primary>
57536 <secondary>to syslog</secondary>
57537 </indexterm>
57538 <indexterm role="concept">
57539 <primary>syslog</primary>
57540 </indexterm>
57541 The logs may be written to local files, or to syslog, or both. However, it
57542 should be noted that many syslog implementations use UDP as a transport, and
57543 are therefore unreliable in the sense that messages are not guaranteed to
57544 arrive at the loghost, nor is the ordering of messages necessarily maintained.
57545 It has also been reported that on large log files (tens of megabytes) you may
57546 need to tweak syslog to prevent it syncing the file with each write &ndash; on
57547 Linux this has been seen to make syslog take 90% plus of CPU time.
57548 </para>
57549 <para>
57550 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
57551 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
57552 configuration. This latter string is expanded, so it can contain, for example,
57553 references to the host name:
57554 </para>
57555 <literallayout class="monospaced">
57556 log_file_path = /var/log/$primary_hostname/exim_%slog
57557 </literallayout>
57558 <para>
57559 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
57560 rather than at run time, because then the setting is available right from the
57561 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
57562 before it has read the configuration file (for example, an error in the
57563 configuration file) it will not use the path you want, and may not be able to
57564 log at all.
57565 </para>
57566 <para>
57567 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
57568 list, currently limited to at most two items. This is one option where the
57569 facility for changing a list separator may not be used. The list must always be
57570 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
57571 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
57572 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
57573 implying the use of a default path.
57574 </para>
57575 <para>
57576 When Exim encounters an empty item in the list, it searches the list defined by
57577 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
57578 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
57579 mean <quote>use the path specified at build time</quote>. It no such item exists, log
57580 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
57581 equivalent to the setting:
57582 </para>
57583 <literallayout class="monospaced">
57584 log_file_path = $spool_directory/log/%slog
57585 </literallayout>
57586 <para>
57587 If you do not specify anything at build time or run time, that is where the
57588 logs are written.
57589 </para>
57590 <para>
57591 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
57592 use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
57593 </para>
57594 <para>
57595 Here are some examples of possible settings:
57596 </para>
57597 <literallayout>
57598 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
57599 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
57600 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
57601 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
57602 </literallayout>
57603 <para>
57604 If there are more than two paths in the list, the first is used and a panic
57605 error is logged.
57606 </para>
57607 </section>
57608 <section id="SECID285">
57609 <title>Logging to local files that are periodically <quote>cycled</quote></title>
57610 <para>
57611 <indexterm role="concept">
57612 <primary>log</primary>
57613 <secondary>cycling local files</secondary>
57614 </indexterm>
57615 <indexterm role="concept">
57616 <primary>cycling logs</primary>
57617 </indexterm>
57618 <indexterm role="concept">
57619 <primary><emphasis>exicyclog</emphasis></primary>
57620 </indexterm>
57621 <indexterm role="concept">
57622 <primary>log</primary>
57623 <secondary>local files; writing to</secondary>
57624 </indexterm>
57625 Some operating systems provide centralized and standardized methods for cycling
57626 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
57627 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
57628 main and reject logs each time it is called. The maximum number of old logs to
57629 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
57630 </para>
57631 <para>
57632 An Exim delivery process opens the main log when it first needs to write to it,
57633 and it keeps the file open in case subsequent entries are required &ndash; for
57634 example, if a number of different deliveries are being done for the same
57635 message. However, remote SMTP deliveries can take a long time, and this means
57636 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
57637 something similar is being used to rename log files on a regular basis. To
57638 ensure that a switch of log files is noticed as soon as possible, Exim calls
57639 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
57640 does not exist, or its inode has changed, the old file is closed and Exim
57641 tries to open the main log from scratch. Thus, an old log file may remain open
57642 for quite some time, but no Exim processes should write to it once it has been
57643 renamed.
57644 </para>
57645 </section>
57646 <section id="SECTdatlogfil">
57647 <title>Datestamped log files</title>
57648 <para>
57649 <indexterm role="concept">
57650 <primary>log</primary>
57651 <secondary>datestamped files</secondary>
57652 </indexterm>
57653 Instead of cycling the main and reject log files by renaming them
57654 periodically, some sites like to use files whose names contain a datestamp,
57655 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
57656 Exim has support for this way of working. It is enabled by setting the
57657 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
57658 datestamp is required. For example:
57659 </para>
57660 <literallayout class="monospaced">
57661 log_file_path = /var/spool/exim/log/%slog-%D
57662 log_file_path = /var/log/exim-%s-%D.log
57663 log_file_path = /var/spool/exim/log/%D-%slog
57664 </literallayout>
57665 <para>
57666 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
57667 examples of names generated by the above examples:
57668 </para>
57669 <literallayout class="monospaced">
57670 /var/spool/exim/log/mainlog-20021225
57671 /var/log/exim-reject-20021225.log
57672 /var/spool/exim/log/20021225-mainlog
57673 </literallayout>
57674 <para>
57675 When this form of log file is specified, Exim automatically switches to new
57676 files at midnight. It does not make any attempt to compress old logs; you
57677 will need to write your own script if you require this. You should not
57678 run <emphasis>exicyclog</emphasis> with this form of logging.
57679 </para>
57680 <para>
57681 The location of the panic log is also determined by <option>log_file_path</option>, but it
57682 is not datestamped, because rotation of the panic log does not make sense.
57683 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
57684 In addition, if it immediately follows a slash, a following non-alphanumeric
57685 character is removed; otherwise a preceding non-alphanumeric character is
57686 removed. Thus, the three examples above would give these panic log names:
57687 </para>
57688 <literallayout class="monospaced">
57689 /var/spool/exim/log/paniclog
57690 /var/log/exim-panic.log
57691 /var/spool/exim/log/paniclog
57692 </literallayout>
57693 </section>
57694 <section id="SECID249">
57695 <title>Logging to syslog</title>
57696 <para>
57697 <indexterm role="concept">
57698 <primary>log</primary>
57699 <secondary>syslog; writing to</secondary>
57700 </indexterm>
57701 The use of syslog does not change what Exim logs or the format of its messages,
57702 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
57703 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
57704 that, the same strings are written to syslog as to log files. The syslog
57705 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
57706 by default, but you can change these by setting the <option>syslog_facility</option> and
57707 <option>syslog_processname</option> options, respectively. If Exim was compiled with
57708 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
57709 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
57710 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
57711 the time and host name to each line.
57712 The three log streams are mapped onto syslog priorities as follows:
57713 </para>
57714 <itemizedlist>
57715 <listitem>
57716 <para>
57717 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
57718 </para>
57719 </listitem>
57720 <listitem>
57721 <para>
57722 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
57723 </para>
57724 </listitem>
57725 <listitem>
57726 <para>
57727 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
57728 </para>
57729 </listitem>
57730 </itemizedlist>
57731 <para>
57732 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
57733 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
57734 these are routed by syslog to the same place. You can suppress this duplication
57735 by setting <option>syslog_duplication</option> false.
57736 </para>
57737 <para>
57738 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
57739 entries contain multiple lines when headers are included. To cope with both
57740 these cases, entries written to syslog are split into separate <function>syslog()</function>
57741 calls at each internal newline, and also after a maximum of
57742 870 data characters. (This allows for a total syslog line length of 1024, when
57743 additions such as timestamps are added.) If you are running a syslog
57744 replacement that can handle lines longer than the 1024 characters allowed by
57745 RFC 3164, you should set
57746 </para>
57747 <literallayout class="monospaced">
57748 SYSLOG_LONG_LINES=yes
57749 </literallayout>
57750 <para>
57751 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
57752 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
57753 </para>
57754 <para>
57755 To make it easy to re-assemble split lines later, each component of a split
57756 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;]
57757 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
57758 components in the entry. The / delimiter is used when the line was split
57759 because it was too long; if it was split because of an internal newline, the \
57760 delimiter is used. For example, supposing the length limit to be 50 instead of
57761 870, the following would be the result of a typical rejection message to
57762 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
57763 name, and pid as added by syslog:
57764 </para>
57765 <literallayout class="monospaced">
57766 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
57767 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
57768 [3/5]  when scanning for sender: missing or malformed lo
57769 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
57770 [5/5] mple&gt;)
57771 </literallayout>
57772 <para>
57773 The same error might cause the following lines to be written to <quote>rejectlog</quote>
57774 (LOG_NOTICE):
57775 </para>
57776 <literallayout class="monospaced">
57777 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
57778 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
57779 [3/18] er when scanning for sender: missing or malformed
57780 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
57781 [5\18] .example&gt;)
57782 [6\18] Recipients: ph10@some.domain.cam.example
57783 [7\18] P Received: from [127.0.0.1] (ident=ph10)
57784 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
57785 [9\18]        id 16RdAL-0006pc-00
57786 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
57787 [11\18] 09:43 +0100
57788 [12\18] F From: &lt;&gt;
57789 [13\18]   Subject: this is a test header
57790 [18\18]   X-something: this is another header
57791 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
57792 [16\18] le&gt;
57793 [17\18] B Bcc:
57794 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
57795 </literallayout>
57796 <para>
57797 Log lines that are neither too long nor contain newlines are written to syslog
57798 without modification.
57799 </para>
57800 <para>
57801 If only syslog is being used, the Exim monitor is unable to provide a log tail
57802 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
57803 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
57804 where it is.
57805 </para>
57806 </section>
57807 <section id="SECID250">
57808 <title>Log line flags</title>
57809 <para>
57810 One line is written to the main log for each message received, and for each
57811 successful, unsuccessful, and delayed delivery. These lines can readily be
57812 picked out by the distinctive two-character flags that immediately follow the
57813 timestamp. The flags are:
57814 </para>
57815 <literallayout>
57816 <literal>&lt;=</literal>     message arrival
57817 <literal>=&gt;</literal>     normal message delivery
57818 <literal>-&gt;</literal>     additional address in same delivery
57819 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
57820 <literal>**</literal>     delivery failed; address bounced
57821 <literal>==</literal>     delivery deferred; temporary problem
57822 </literallayout>
57823 </section>
57824 <section id="SECID251">
57825 <title>Logging message reception</title>
57826 <para>
57827 <indexterm role="concept">
57828 <primary>log</primary>
57829 <secondary>reception line</secondary>
57830 </indexterm>
57831 The format of the single-line entry in the main log that is written for every
57832 message received is shown in the basic example below, which is split over
57833 several lines in order to fit it on the page:
57834 </para>
57835 <literallayout class="monospaced">
57836 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
57837   H=mailer.fict.example [192.168.123.123] U=exim
57838   P=smtp S=5678 id=&lt;incoming message id&gt;
57839 </literallayout>
57840 <para>
57841 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
57842 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
57843 generated, this is followed by an item of the form
57844 </para>
57845 <literallayout class="monospaced">
57846 R=&lt;message id&gt;
57847 </literallayout>
57848 <para>
57849 which is a reference to the message that caused the bounce to be sent.
57850 </para>
57851 <para>
57852 <indexterm role="concept">
57853 <primary>HELO</primary>
57854 </indexterm>
57855 <indexterm role="concept">
57856 <primary>EHLO</primary>
57857 </indexterm>
57858 For messages from other hosts, the H and U fields identify the remote host and
57859 record the RFC 1413 identity of the user that sent the message, if one was
57860 received. The number given in square brackets is the IP address of the sending
57861 host. If there is a single, unparenthesized  host name in the H field, as
57862 above, it has been verified to correspond to the IP address (see the
57863 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
57864 by the remote host in the SMTP HELO or EHLO command, and has not been
57865 verified. If verification yields a different name to that given for HELO or
57866 EHLO, the verified name appears first, followed by the HELO or EHLO
57867 name in parentheses.
57868 </para>
57869 <para>
57870 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
57871 without brackets, in the HELO or EHLO command, leading to entries in
57872 the log containing text like these examples:
57873 </para>
57874 <literallayout class="monospaced">
57875 H=(10.21.32.43) [192.168.8.34]
57876 H=([10.21.32.43]) [192.168.8.34]
57877 </literallayout>
57878 <para>
57879 This can be confusing. Only the final address in square brackets can be relied
57880 on.
57881 </para>
57882 <para>
57883 For locally generated messages (that is, messages not received over TCP/IP),
57884 the H field is omitted, and the U field contains the login name of the caller
57885 of Exim.
57886 </para>
57887 <para>
57888 <indexterm role="concept">
57889 <primary>authentication</primary>
57890 <secondary>logging</secondary>
57891 </indexterm>
57892 <indexterm role="concept">
57893 <primary>AUTH</primary>
57894 <secondary>logging</secondary>
57895 </indexterm>
57896 For all messages, the P field specifies the protocol used to receive the
57897 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
57898 of incoming SMTP messages, the value indicates whether or not any SMTP
57899 extensions (ESMTP), encryption, or authentication were used. If the SMTP
57900 session was encrypted, there is an additional X field that records the cipher
57901 suite that was used.
57902 </para>
57903 <para>
57904 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
57905 hosts that have authenticated themselves using the SMTP AUTH command. The first
57906 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
57907 there is an additional item A= followed by the name of the authenticator that
57908 was used. If an authenticated identification was set up by the authenticator&#x2019;s
57909 <option>server_set_id</option> option, this is logged too, separated by a colon from the
57910 authenticator name.
57911 </para>
57912 <para>
57913 <indexterm role="concept">
57914 <primary>size</primary>
57915 <secondary>of message</secondary>
57916 </indexterm>
57917 The id field records the existing message id, if present. The size of the
57918 received message is given by the S field. When the message is delivered,
57919 headers may be removed or added, so that the size of delivered copies of the
57920 message may not correspond with this value (and indeed may be different to each
57921 other).
57922 </para>
57923 <para>
57924 The <option>log_selector</option> option can be used to request the logging of additional
57925 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
57926 </para>
57927 </section>
57928 <section id="SECID252">
57929 <title>Logging deliveries</title>
57930 <para>
57931 <indexterm role="concept">
57932 <primary>log</primary>
57933 <secondary>delivery line</secondary>
57934 </indexterm>
57935 The format of the single-line entry in the main log that is written for every
57936 delivery is shown in one of the examples below, for local and remote
57937 deliveries, respectively. Each example has been split into two lines in order
57938 to fit it on the page:
57939 </para>
57940 <literallayout class="monospaced">
57941 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
57942   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
57943 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
57944   monk@holistic.fict.example R=dnslookup T=remote_smtp
57945   H=holistic.fict.example [192.168.234.234]
57946 </literallayout>
57947 <para>
57948 For ordinary local deliveries, the original address is given in angle brackets
57949 after the final delivery address, which might be a pipe or a file. If
57950 intermediate address(es) exist between the original and the final address, the
57951 last of these is given in parentheses after the final address. The R and T
57952 fields record the router and transport that were used to process the address.
57953 </para>
57954 <para>
57955 If a shadow transport was run after a successful local delivery, the log line
57956 for the successful delivery has an item added on the end, of the form
57957 </para>
57958 <literallayout>
57959 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
57960 </literallayout>
57961 <para>
57962 If the shadow transport did not succeed, the error message is put in
57963 parentheses afterwards.
57964 </para>
57965 <para>
57966 <indexterm role="concept">
57967 <primary>asterisk</primary>
57968 <secondary>after IP address</secondary>
57969 </indexterm>
57970 When more than one address is included in a single delivery (for example, two
57971 SMTP RCPT commands in one transaction) the second and subsequent addresses are
57972 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
57973 down a single SMTP connection, an asterisk follows the IP address in the log
57974 lines for the second and subsequent messages.
57975 </para>
57976 <para>
57977 The generation of a reply message by a filter file gets logged as a
57978 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
57979 </para>
57980 <para>
57981 The <option>log_selector</option> option can be used to request the logging of additional
57982 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
57983 </para>
57984 </section>
57985 <section id="SECID253">
57986 <title>Discarded deliveries</title>
57987 <para>
57988 <indexterm role="concept">
57989 <primary>discarded messages</primary>
57990 </indexterm>
57991 <indexterm role="concept">
57992 <primary>message</primary>
57993 <secondary>discarded</secondary>
57994 </indexterm>
57995 <indexterm role="concept">
57996 <primary>delivery</primary>
57997 <secondary>discarded; logging</secondary>
57998 </indexterm>
57999 When a message is discarded as a result of the command <quote>seen finish</quote> being
58000 obeyed in a filter file which generates no deliveries, a log entry of the form
58001 </para>
58002 <literallayout class="monospaced">
58003 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
58004   &lt;low.club@bridge.example&gt; R=userforward
58005 </literallayout>
58006 <para>
58007 is written, to record why no deliveries are logged. When a message is discarded
58008 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
58009 </para>
58010 <literallayout class="monospaced">
58011 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
58012   &lt;hole@nowhere.example&gt; R=blackhole_router
58013 </literallayout>
58014 </section>
58015 <section id="SECID254">
58016 <title>Deferred deliveries</title>
58017 <para>
58018 When a delivery is deferred, a line of the following form is logged:
58019 </para>
58020 <literallayout class="monospaced">
58021 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
58022   R=dnslookup T=smtp defer (146): Connection refused
58023 </literallayout>
58024 <para>
58025 In the case of remote deliveries, the error is the one that was given for the
58026 last IP address that was tried. Details of individual SMTP failures are also
58027 written to the log, so the above line would be preceded by something like
58028 </para>
58029 <literallayout class="monospaced">
58030 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
58031   mail1.endrest.example [192.168.239.239]: Connection refused
58032 </literallayout>
58033 <para>
58034 When a deferred address is skipped because its retry time has not been reached,
58035 a message is written to the log, but this can be suppressed by setting an
58036 appropriate value in <option>log_selector</option>.
58037 </para>
58038 </section>
58039 <section id="SECID255">
58040 <title>Delivery failures</title>
58041 <para>
58042 <indexterm role="concept">
58043 <primary>delivery</primary>
58044 <secondary>failure; logging</secondary>
58045 </indexterm>
58046 If a delivery fails because an address cannot be routed, a line of the
58047 following form is logged:
58048 </para>
58049 <literallayout class="monospaced">
58050 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
58051   &lt;jim@trek99.example&gt;: unknown mail domain
58052 </literallayout>
58053 <para>
58054 If a delivery fails at transport time, the router and transport are shown, and
58055 the response from the remote host is included, as in this example:
58056 </para>
58057 <literallayout class="monospaced">
58058 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
58059   R=dnslookup T=remote_smtp: SMTP error from remote mailer
58060   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
58061   pbmail3.py.example [192.168.63.111]: 553 5.3.0
58062   &lt;ace400@pb.example&gt;...Addressee unknown
58063 </literallayout>
58064 <para>
58065 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
58066 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
58067 disabling PIPELINING. The log lines for all forms of delivery failure are
58068 flagged with <literal>**</literal>.
58069 </para>
58070 </section>
58071 <section id="SECID256">
58072 <title>Fake deliveries</title>
58073 <para>
58074 <indexterm role="concept">
58075 <primary>delivery</primary>
58076 <secondary>fake; logging</secondary>
58077 </indexterm>
58078 If a delivery does not actually take place because the <option>-N</option> option has been
58079 used to suppress it, a normal delivery line is written to the log, except that
58080 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
58081 </para>
58082 </section>
58083 <section id="SECID257">
58084 <title>Completion</title>
58085 <para>
58086 A line of the form
58087 </para>
58088 <literallayout class="monospaced">
58089 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
58090 </literallayout>
58091 <para>
58092 is written to the main log when a message is about to be removed from the spool
58093 at the end of its processing.
58094 </para>
58095 </section>
58096 <section id="SECID258">
58097 <title>Summary of Fields in Log Lines</title>
58098 <para>
58099 <indexterm role="concept">
58100 <primary>log</primary>
58101 <secondary>summary of fields</secondary>
58102 </indexterm>
58103 A summary of the field identifiers that are used in log lines is shown in
58104 the following table:
58105 </para>
58106 <literallayout>
58107 <literal>A   </literal>        authenticator name (and optional id)
58108 <literal>C   </literal>        SMTP confirmation on delivery
58109 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
58110 <literal>CV  </literal>        certificate verification status
58111 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
58112 <literal>DN  </literal>        distinguished name from peer certificate
58113 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
58114 <literal>F   </literal>        sender address (on delivery lines)
58115 <literal>H   </literal>        host name and IP address
58116 <literal>I   </literal>        local interface used
58117 <literal>id  </literal>        message id for incoming message
58118 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
58119 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
58120 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
58121 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
58122 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
58123 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
58124 <literal>S   </literal>        size of message
58125 <literal>ST  </literal>        shadow transport name
58126 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
58127 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
58128 <literal>U   </literal>        local user or RFC 1413 identity
58129 <literal>X   </literal>        TLS cipher suite
58130 </literallayout>
58131 </section>
58132 <section id="SECID259">
58133 <title>Other log entries</title>
58134 <para>
58135 Various other types of log entry are written from time to time. Most should be
58136 self-explanatory. Among the more common are:
58137 </para>
58138 <itemizedlist>
58139 <listitem>
58140 <para>
58141 <indexterm role="concept">
58142 <primary>retry</primary>
58143 <secondary>time not reached</secondary>
58144 </indexterm>
58145 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
58146 during routing or local delivery, and the time to retry has not yet arrived.
58147 This message is not written to an individual message log file unless it happens
58148 during the first delivery attempt.
58149 </para>
58150 </listitem>
58151 <listitem>
58152 <para>
58153 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
58154 temporary errors during remote delivery, and the retry time has not yet arrived
58155 for any of the hosts to which it is routed.
58156 </para>
58157 </listitem>
58158 <listitem>
58159 <para>
58160 <indexterm role="concept">
58161 <primary>spool directory</primary>
58162 <secondary>file locked</secondary>
58163 </indexterm>
58164 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
58165 some other Exim process is already working on the message. This can be quite
58166 common if queue running processes are started at frequent intervals. The
58167 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
58168 doing.
58169 </para>
58170 </listitem>
58171 <listitem>
58172 <para>
58173 <indexterm role="concept">
58174 <primary>error</primary>
58175 <secondary>ignored</secondary>
58176 </indexterm>
58177 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
58178 message:
58179 </para>
58180 <orderedlist numeration="arabic">
58181 <listitem>
58182 <para>
58183 Exim failed to deliver a bounce message whose age was greater than
58184 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
58185 </para>
58186 </listitem>
58187 <listitem>
58188 <para>
58189 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
58190 failed. The delivery was discarded.
58191 </para>
58192 </listitem>
58193 <listitem>
58194 <para>
58195 A delivery set up by a router configured with
58196 </para>
58197 <literallayout class="monospaced">
58198     errors_to = &lt;&gt;
58199 </literallayout>
58200 <para>
58201 failed. The delivery was discarded.
58202 </para>
58203 </listitem>
58204 </orderedlist>
58205 </listitem>
58206 </itemizedlist>
58207 </section>
58208 <section id="SECTlogselector">
58209 <title>Reducing or increasing what is logged</title>
58210 <para>
58211 <indexterm role="concept">
58212 <primary>log</primary>
58213 <secondary>selectors</secondary>
58214 </indexterm>
58215 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
58216 default logging, or you can request additional logging. The value of
58217 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
58218 example:
58219 </para>
58220 <literallayout class="monospaced">
58221 log_selector = +arguments -retry_defer
58222 </literallayout>
58223 <para>
58224 The list of optional log items is in the following table, with the default
58225 selection marked by asterisks:
58226 </para>
58227 <literallayout>
58228 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
58229 <literal> address_rewrite            </literal>  address rewriting
58230 <literal> all_parents                </literal>  all parents in =&gt; lines
58231 <literal> arguments                  </literal>  command line arguments
58232 <literal>*connection_reject          </literal>  connection rejections
58233 <literal>*delay_delivery             </literal>  immediate delivery delayed
58234 <literal> deliver_time               </literal>  time taken to perform delivery
58235 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
58236 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
58237 <literal>*etrn                       </literal>  ETRN commands
58238 <literal>*host_lookup_failed         </literal>  as it says
58239 <literal> ident_timeout              </literal>  timeout for ident connection
58240 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
58241 <literal> incoming_port              </literal>  incoming port on &lt;= lines
58242 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
58243 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
58244 <literal>*queue_run                  </literal>  start and end queue runs
58245 <literal> queue_time                 </literal>  time on queue for one recipient
58246 <literal> queue_time_overall         </literal>  time on queue for whole message
58247 <literal> pid                        </literal>  Exim process id
58248 <literal> received_recipients        </literal>  recipients on &lt;= lines
58249 <literal> received_sender            </literal>  sender on &lt;= lines
58250 <literal>*rejected_header            </literal>  header contents on reject log
58251 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
58252 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
58253 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
58254 <literal>*sender_verify_fail         </literal>  sender verification failures
58255 <literal>*size_reject                </literal>  rejection because too big
58256 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
58257 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
58258 <literal> smtp_connection            </literal>  SMTP connections
58259 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
58260 <literal> smtp_no_mail               </literal>  session with no MAIL commands
58261 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
58262 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
58263 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
58264 <literal> tls_certificate_verified   </literal>  certificate verification status
58265 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
58266 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
58267 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
58268
58269 <literal> all                        </literal>  all of the above
58270 </literallayout>
58271 <para>
58272 More details on each of these items follows:
58273 </para>
58274 <itemizedlist>
58275 <listitem>
58276 <para>
58277 <indexterm role="concept">
58278 <primary><option>warn</option> ACL verb</primary>
58279 <secondary>log when skipping</secondary>
58280 </indexterm>
58281 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
58282 its conditions cannot be evaluated, a log line to this effect is written if
58283 this log selector is set.
58284 </para>
58285 </listitem>
58286 <listitem>
58287 <para>
58288 <indexterm role="concept">
58289 <primary>log</primary>
58290 <secondary>rewriting</secondary>
58291 </indexterm>
58292 <indexterm role="concept">
58293 <primary>rewriting</primary>
58294 <secondary>logging</secondary>
58295 </indexterm>
58296 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
58297 rewrites, but not to rewrites in filters run as an unprivileged user (because
58298 such users cannot access the log).
58299 </para>
58300 </listitem>
58301 <listitem>
58302 <para>
58303 <indexterm role="concept">
58304 <primary>log</primary>
58305 <secondary>full parentage</secondary>
58306 </indexterm>
58307 <option>all_parents</option>: Normally only the original and final addresses are logged on
58308 delivery lines; with this selector, intermediate parents are given in
58309 parentheses between them.
58310 </para>
58311 </listitem>
58312 <listitem>
58313 <para>
58314 <indexterm role="concept">
58315 <primary>log</primary>
58316 <secondary>Exim arguments</secondary>
58317 </indexterm>
58318 <indexterm role="concept">
58319 <primary>Exim arguments, logging</primary>
58320 </indexterm>
58321 <option>arguments</option>: This causes Exim to write the arguments with which it was called
58322 to the main log, preceded by the current working directory. This is a debugging
58323 feature, added to make it easier to find out how certain MUAs call
58324 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
58325 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
58326 that are empty or that contain white space are quoted. Non-printing characters
58327 are shown as escape sequences. This facility cannot log unrecognized arguments,
58328 because the arguments are checked before the configuration file is read. The
58329 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
58330 between the caller and Exim.
58331 </para>
58332 </listitem>
58333 <listitem>
58334 <para>
58335 <indexterm role="concept">
58336 <primary>log</primary>
58337 <secondary>connection rejections</secondary>
58338 </indexterm>
58339 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
58340 connection is rejected, for whatever reason.
58341 </para>
58342 </listitem>
58343 <listitem>
58344 <para>
58345 <indexterm role="concept">
58346 <primary>log</primary>
58347 <secondary>delayed delivery</secondary>
58348 </indexterm>
58349 <indexterm role="concept">
58350 <primary>delayed delivery, logging</primary>
58351 </indexterm>
58352 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
58353 started for an incoming message because the load is too high or too many
58354 messages were received on one connection. Logging does not occur if no delivery
58355 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
58356 </para>
58357 </listitem>
58358 <listitem>
58359 <para>
58360 <indexterm role="concept">
58361 <primary>log</primary>
58362 <secondary>delivery duration</secondary>
58363 </indexterm>
58364 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
58365 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
58366 </para>
58367 </listitem>
58368 <listitem>
58369 <para>
58370 <indexterm role="concept">
58371 <primary>log</primary>
58372 <secondary>message size on delivery</secondary>
58373 </indexterm>
58374 <indexterm role="concept">
58375 <primary>size</primary>
58376 <secondary>of message</secondary>
58377 </indexterm>
58378 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
58379 the <quote>=&gt;</quote> line, tagged with S=.
58380 </para>
58381 </listitem>
58382 <listitem>
58383 <para>
58384 <indexterm role="concept">
58385 <primary>log</primary>
58386 <secondary>dnslist defer</secondary>
58387 </indexterm>
58388 <indexterm role="concept">
58389 <primary>DNS list</primary>
58390 <secondary>logging defer</secondary>
58391 </indexterm>
58392 <indexterm role="concept">
58393 <primary>black list (DNS)</primary>
58394 </indexterm>
58395 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
58396 DNS black list suffers a temporary error.
58397 </para>
58398 </listitem>
58399 <listitem>
58400 <para>
58401 <indexterm role="concept">
58402 <primary>log</primary>
58403 <secondary>ETRN commands</secondary>
58404 </indexterm>
58405 <indexterm role="concept">
58406 <primary>ETRN</primary>
58407 <secondary>logging</secondary>
58408 </indexterm>
58409 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
58410 is run to determine whether or not it is actually accepted. An invalid ETRN
58411 command, or one received within a message transaction is not logged by this
58412 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
58413 </para>
58414 </listitem>
58415 <listitem>
58416 <para>
58417 <indexterm role="concept">
58418 <primary>log</primary>
58419 <secondary>host lookup failure</secondary>
58420 </indexterm>
58421 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
58422 any addresses, or when a lookup of an IP address fails to find a host name, a
58423 log line is written. This logging does not apply to direct DNS lookups when
58424 routing email addresses, but it does apply to <quote>byname</quote> lookups.
58425 </para>
58426 </listitem>
58427 <listitem>
58428 <para>
58429 <indexterm role="concept">
58430 <primary>log</primary>
58431 <secondary>ident timeout</secondary>
58432 </indexterm>
58433 <indexterm role="concept">
58434 <primary>RFC 1413</primary>
58435 <secondary>logging timeout</secondary>
58436 </indexterm>
58437 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
58438 client&#x2019;s ident port times out.
58439 </para>
58440 </listitem>
58441 <listitem>
58442 <para>
58443 <indexterm role="concept">
58444 <primary>log</primary>
58445 <secondary>incoming interface</secondary>
58446 </indexterm>
58447 <indexterm role="concept">
58448 <primary>interface</primary>
58449 <secondary>logging</secondary>
58450 </indexterm>
58451 <option>incoming_interface</option>: The interface on which a message was received is added
58452 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
58453 followed by a colon and the port number. The local interface and port are also
58454 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
58455 rejection lines.
58456 </para>
58457 </listitem>
58458 <listitem>
58459 <para>
58460 <indexterm role="concept">
58461 <primary>log</primary>
58462 <secondary>incoming remote port</secondary>
58463 </indexterm>
58464 <indexterm role="concept">
58465 <primary>port</primary>
58466 <secondary>logging remote</secondary>
58467 </indexterm>
58468 <indexterm role="concept">
58469 <primary>TCP/IP</primary>
58470 <secondary>logging incoming remote port</secondary>
58471 </indexterm>
58472 <indexterm role="variable">
58473 <primary><varname>$sender_fullhost</varname></primary>
58474 </indexterm>
58475 <indexterm role="variable">
58476 <primary><varname>$sender_rcvhost</varname></primary>
58477 </indexterm>
58478 <option>incoming_port</option>: The remote port number from which a message was received is
58479 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
58480 in square brackets, and separated from it by a colon. This is implemented by
58481 changing the value that is put in the <varname>$sender_fullhost</varname> and
58482 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
58483 important with the widening use of NAT (see RFC 2505).
58484 </para>
58485 </listitem>
58486 <listitem>
58487 <para>
58488 <indexterm role="concept">
58489 <primary>log</primary>
58490 <secondary>dropped connection</secondary>
58491 </indexterm>
58492 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
58493 connection is unexpectedly dropped.
58494 </para>
58495 </listitem>
58496 <listitem>
58497 <para>
58498 <indexterm role="concept">
58499 <primary>log</primary>
58500 <secondary>outgoing remote port</secondary>
58501 </indexterm>
58502 <indexterm role="concept">
58503 <primary>port</primary>
58504 <secondary>logging outgoint remote</secondary>
58505 </indexterm>
58506 <indexterm role="concept">
58507 <primary>TCP/IP</primary>
58508 <secondary>logging ougtoing remote port</secondary>
58509 </indexterm>
58510 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
58511 containing =&gt; tags) following the IP address. This option is not included in
58512 the default setting, because for most ordinary configurations, the remote port
58513 number is always 25 (the SMTP port).
58514 </para>
58515 </listitem>
58516 <listitem>
58517 <para>
58518 <indexterm role="concept">
58519 <primary>log</primary>
58520 <secondary>process ids in</secondary>
58521 </indexterm>
58522 <indexterm role="concept">
58523 <primary>pid (process id)</primary>
58524 <secondary>in log lines</secondary>
58525 </indexterm>
58526 <option>pid</option>: The current process id is added to every log line, in square brackets,
58527 immediately after the time and date.
58528 </para>
58529 </listitem>
58530 <listitem>
58531 <para>
58532 <indexterm role="concept">
58533 <primary>log</primary>
58534 <secondary>queue run</secondary>
58535 </indexterm>
58536 <indexterm role="concept">
58537 <primary>queue runner</primary>
58538 <secondary>logging</secondary>
58539 </indexterm>
58540 <option>queue_run</option>: The start and end of every queue run are logged.
58541 </para>
58542 </listitem>
58543 <listitem>
58544 <para>
58545 <indexterm role="concept">
58546 <primary>log</primary>
58547 <secondary>queue time</secondary>
58548 </indexterm>
58549 <option>queue_time</option>: The amount of time the message has been in the queue on the
58550 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
58551 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
58552 includes reception time as well as the delivery time for the current address.
58553 This means that it may be longer than the difference between the arrival and
58554 delivery log line times, because the arrival log line is not written until the
58555 message has been successfully received.
58556 </para>
58557 </listitem>
58558 <listitem>
58559 <para>
58560 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
58561 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
58562 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
58563 message, so it includes reception time as well as the total delivery time.
58564 </para>
58565 </listitem>
58566 <listitem>
58567 <para>
58568 <indexterm role="concept">
58569 <primary>log</primary>
58570 <secondary>recipients</secondary>
58571 </indexterm>
58572 <option>received_recipients</option>: The recipients of a message are listed in the main log
58573 as soon as the message is received. The list appears at the end of the log line
58574 that is written when a message is received, preceded by the word <quote>for</quote>. The
58575 addresses are listed after they have been qualified, but before any rewriting
58576 has taken place.
58577 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
58578 in the list.
58579 </para>
58580 </listitem>
58581 <listitem>
58582 <para>
58583 <indexterm role="concept">
58584 <primary>log</primary>
58585 <secondary>sender reception</secondary>
58586 </indexterm>
58587 <option>received_sender</option>: The unrewritten original sender of a message is added to
58588 the end of the log line that records the message&#x2019;s arrival, after the word
58589 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
58590 </para>
58591 </listitem>
58592 <listitem>
58593 <para>
58594 <indexterm role="concept">
58595 <primary>log</primary>
58596 <secondary>header lines for rejection</secondary>
58597 </indexterm>
58598 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
58599 rejection is written to the reject log, the complete header is added to the
58600 log. Header logging can be turned off individually for messages that are
58601 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
58602 </para>
58603 </listitem>
58604 <listitem>
58605 <para>
58606 <indexterm role="concept">
58607 <primary>log</primary>
58608 <secondary>retry defer</secondary>
58609 </indexterm>
58610 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
58611 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
58612 message is always omitted from individual message logs after the first delivery
58613 attempt.
58614 </para>
58615 </listitem>
58616 <listitem>
58617 <para>
58618 <indexterm role="concept">
58619 <primary>log</primary>
58620 <secondary>return path</secondary>
58621 </indexterm>
58622 <option>return_path_on_delivery</option>: The return path that is being transmitted with
58623 the message is included in delivery and bounce lines, using the tag P=.
58624 This is omitted if no delivery actually happens, for example, if routing fails,
58625 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
58626 </para>
58627 </listitem>
58628 <listitem>
58629 <para>
58630 <indexterm role="concept">
58631 <primary>log</primary>
58632 <secondary>sender on delivery</secondary>
58633 </indexterm>
58634 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
58635 and bounce line, tagged by F= (for <quote>from</quote>).
58636 This is the original sender that was received with the message; it is not
58637 necessarily the same as the outgoing return path.
58638 </para>
58639 </listitem>
58640 <listitem>
58641 <para>
58642 <indexterm role="concept">
58643 <primary>log</primary>
58644 <secondary>sender verify failure</secondary>
58645 </indexterm>
58646 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
58647 gives details of a sender verification failure is not written. Log lines for
58648 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
58649 detail is lost.
58650 </para>
58651 </listitem>
58652 <listitem>
58653 <para>
58654 <indexterm role="concept">
58655 <primary>log</primary>
58656 <secondary>size rejection</secondary>
58657 </indexterm>
58658 <option>size_reject</option>: A log line is written whenever a message is rejected because
58659 it is too big.
58660 </para>
58661 </listitem>
58662 <listitem>
58663 <para>
58664 <indexterm role="concept">
58665 <primary>log</primary>
58666 <secondary>frozen messages; skipped</secondary>
58667 </indexterm>
58668 <indexterm role="concept">
58669 <primary>frozen messages</primary>
58670 <secondary>logging skipping</secondary>
58671 </indexterm>
58672 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
58673 queue run because it is frozen or because another process is already delivering
58674 it.
58675 <indexterm role="concept">
58676 <primary><quote>spool file is locked</quote></primary>
58677 </indexterm>
58678 The message that is written is <quote>spool file is locked</quote>.
58679 </para>
58680 </listitem>
58681 <listitem>
58682 <para>
58683 <indexterm role="concept">
58684 <primary>log</primary>
58685 <secondary>smtp confirmation</secondary>
58686 </indexterm>
58687 <indexterm role="concept">
58688 <primary>SMTP</primary>
58689 <secondary>logging confirmation</secondary>
58690 </indexterm>
58691 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
58692 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
58693 A number of MTAs (including Exim) return an identifying string in this
58694 response.
58695 </para>
58696 </listitem>
58697 <listitem>
58698 <para>
58699 <indexterm role="concept">
58700 <primary>log</primary>
58701 <secondary>SMTP connections</secondary>
58702 </indexterm>
58703 <indexterm role="concept">
58704 <primary>SMTP</primary>
58705 <secondary>logging connections</secondary>
58706 </indexterm>
58707 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
58708 established or closed, unless the connection is from a host that matches
58709 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
58710 only when the closure is unexpected.) This applies to connections from local
58711 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
58712 dropped in the middle of a message, a log line is always written, whether or
58713 not this selector is set, but otherwise nothing is written at the start and end
58714 of connections unless this selector is enabled.
58715 </para>
58716 <para>
58717 For TCP/IP connections to an Exim daemon, the current number of connections is
58718 included in the log message for each new connection, but note that the count is
58719 reset if the daemon is restarted.
58720 Also, because connections are closed (and the closure is logged) in
58721 subprocesses, the count may not include connections that have been closed but
58722 whose termination the daemon has not yet noticed. Thus, while it is possible to
58723 match up the opening and closing of connections in the log, the value of the
58724 logged counts may not be entirely accurate.
58725 </para>
58726 </listitem>
58727 <listitem>
58728 <para>
58729 <indexterm role="concept">
58730 <primary>log</primary>
58731 <secondary>SMTP transaction; incomplete</secondary>
58732 </indexterm>
58733 <indexterm role="concept">
58734 <primary>SMTP</primary>
58735 <secondary>logging incomplete transactions</secondary>
58736 </indexterm>
58737 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
58738 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
58739 and the message sender plus any accepted recipients are included in the log
58740 line. This can provide evidence of dictionary attacks.
58741 </para>
58742 </listitem>
58743 <listitem>
58744 <para>
58745 <indexterm role="concept">
58746 <primary>log</primary>
58747 <secondary>non-MAIL SMTP sessions</secondary>
58748 </indexterm>
58749 <indexterm role="concept">
58750 <primary>MAIL</primary>
58751 <secondary>logging session without</secondary>
58752 </indexterm>
58753 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
58754 connection terminates without having issued a MAIL command. This includes both
58755 the case when the connection is dropped, and the case when QUIT is used. It
58756 does not include cases where the connection is rejected right at the start (by
58757 an ACL, or because there are too many connections, or whatever). These cases
58758 already have their own log lines.
58759 </para>
58760 <para>
58761 The log line that is written contains the identity of the client in the usual
58762 way, followed by D= and a time, which records the duration of the connection.
58763 If the connection was authenticated, this fact is logged exactly as it is for
58764 an incoming message, with an A= item. If the connection was encrypted, CV=,
58765 DN=, and X= items may appear as they do for an incoming message, controlled by
58766 the same logging options.
58767 </para>
58768 <para>
58769 Finally, if any SMTP commands were issued during the connection, a C= item
58770 is added to the line, listing the commands that were used. For example,
58771 </para>
58772 <literallayout class="monospaced">
58773 C=EHLO,QUIT
58774 </literallayout>
58775 <para>
58776 shows that the client issued QUIT straight after EHLO. If there were fewer
58777 than 20 commands, they are all listed. If there were more than 20 commands,
58778 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
58779 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
58780 have been aborted before 20 non-mail commands are processed.
58781 </para>
58782 </listitem>
58783 <listitem>
58784 <para>
58785 <indexterm role="concept">
58786 <primary>log</primary>
58787 <secondary>SMTP protocol error</secondary>
58788 </indexterm>
58789 <indexterm role="concept">
58790 <primary>SMTP</primary>
58791 <secondary>logging protocol error</secondary>
58792 </indexterm>
58793 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
58794 encountered. Exim does not have perfect detection of all protocol errors
58795 because of transmission delays and the use of pipelining. If PIPELINING has
58796 been advertised to a client, an Exim server assumes that the client will use
58797 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
58798 received after rejecting MAIL) as protocol errors.
58799 </para>
58800 </listitem>
58801 <listitem>
58802 <para>
58803 <indexterm role="concept">
58804 <primary>SMTP</primary>
58805 <secondary>logging syntax errors</secondary>
58806 </indexterm>
58807 <indexterm role="concept">
58808 <primary>SMTP</primary>
58809 <secondary>syntax errors; logging</secondary>
58810 </indexterm>
58811 <indexterm role="concept">
58812 <primary>SMTP</primary>
58813 <secondary>unknown command; logging</secondary>
58814 </indexterm>
58815 <indexterm role="concept">
58816 <primary>log</primary>
58817 <secondary>unknown SMTP command</secondary>
58818 </indexterm>
58819 <indexterm role="concept">
58820 <primary>log</primary>
58821 <secondary>SMTP syntax error</secondary>
58822 </indexterm>
58823 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
58824 encountered. An unrecognized command is treated as a syntax error. For an
58825 external connection, the host identity is given; for an internal connection
58826 using <option>-bs</option> the sender identification (normally the calling user) is given.
58827 </para>
58828 </listitem>
58829 <listitem>
58830 <para>
58831 <indexterm role="concept">
58832 <primary>log</primary>
58833 <secondary>subject</secondary>
58834 </indexterm>
58835 <indexterm role="concept">
58836 <primary>subject, logging</primary>
58837 </indexterm>
58838 <option>subject</option>: The subject of the message is added to the arrival log line,
58839 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
58840 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
58841 specifies whether characters with values greater than 127 should be logged
58842 unchanged, or whether they should be rendered as escape sequences.
58843 </para>
58844 </listitem>
58845 <listitem>
58846 <para>
58847 <indexterm role="concept">
58848 <primary>log</primary>
58849 <secondary>certificate verification</secondary>
58850 </indexterm>
58851 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
58852 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
58853 verified, and <literal>CV=no</literal> if not.
58854 </para>
58855 </listitem>
58856 <listitem>
58857 <para>
58858 <indexterm role="concept">
58859 <primary>log</primary>
58860 <secondary>TLS cipher</secondary>
58861 </indexterm>
58862 <indexterm role="concept">
58863 <primary>TLS</primary>
58864 <secondary>logging cipher</secondary>
58865 </indexterm>
58866 <option>tls_cipher</option>: When a message is sent or received over an encrypted
58867 connection, the cipher suite used is added to the log line, preceded by X=.
58868 </para>
58869 </listitem>
58870 <listitem>
58871 <para>
58872 <indexterm role="concept">
58873 <primary>log</primary>
58874 <secondary>TLS peer DN</secondary>
58875 </indexterm>
58876 <indexterm role="concept">
58877 <primary>TLS</primary>
58878 <secondary>logging peer DN</secondary>
58879 </indexterm>
58880 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
58881 connection, and a certificate is supplied by the remote host, the peer DN is
58882 added to the log line, preceded by DN=.
58883 </para>
58884 </listitem>
58885 <listitem>
58886 <para>
58887 <indexterm role="concept">
58888 <primary>log</primary>
58889 <secondary>DNS failure in list</secondary>
58890 </indexterm>
58891 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
58892 result of a list match is failure because a DNS lookup failed.
58893 </para>
58894 </listitem>
58895 </itemizedlist>
58896 </section>
58897 <section id="SECID260">
58898 <title>Message log</title>
58899 <para>
58900 <indexterm role="concept">
58901 <primary>message</primary>
58902 <secondary>log file for</secondary>
58903 </indexterm>
58904 <indexterm role="concept">
58905 <primary>log</primary>
58906 <secondary>message log; description of</secondary>
58907 </indexterm>
58908 <indexterm role="concept">
58909 <primary><filename>msglog</filename> directory</primary>
58910 </indexterm>
58911 <indexterm role="option">
58912 <primary><option>preserve_message_logs</option></primary>
58913 </indexterm>
58914 In addition to the general log files, Exim writes a log file for each message
58915 that it handles. The names of these per-message logs are the message ids, and
58916 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
58917 message log contains copies of the log lines that apply to the message. This
58918 makes it easier to inspect the status of an individual message without having
58919 to search the main log. A message log is deleted when processing of the message
58920 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
58921 only with great care because they can fill up your disk very quickly.
58922 </para>
58923 <para>
58924 On a heavily loaded system, it may be desirable to disable the use of
58925 per-message logs, in order to reduce disk I/O. This can be done by setting the
58926 <option>message_logs</option> option false.
58927 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
58928 </para>
58929 </section>
58930 </chapter>
58931
58932 <chapter id="CHAPutils">
58933 <title>Exim utilities</title>
58934 <para>
58935 <indexterm role="concept" id="IIDutils" class="startofrange">
58936 <primary>utilities</primary>
58937 </indexterm>
58938 A number of utility scripts and programs are supplied with Exim and are
58939 described in this chapter. There is also the Exim Monitor, which is covered in
58940 the next chapter. The utilities described here are:
58941 </para>
58942 <informaltable frame="none">
58943 <tgroup cols="3" colsep="0" rowsep="0">
58944 <colspec colwidth="7*" align="left"/>
58945 <colspec colwidth="15*" align="left"/>
58946 <colspec colwidth="40*" align="left"/>
58947 <tbody>
58948 <row>
58949 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
58950 <entry><emphasis>exiwhat</emphasis></entry>
58951 <entry>list what Exim processes are doing</entry>
58952 </row>
58953 <row>
58954 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
58955 <entry><emphasis>exiqgrep</emphasis></entry>
58956 <entry>grep the queue</entry>
58957 </row>
58958 <row>
58959 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
58960 <entry><emphasis>exiqsumm</emphasis></entry>
58961 <entry>summarize the queue</entry>
58962 </row>
58963 <row>
58964 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
58965 <entry><emphasis>exigrep</emphasis></entry>
58966 <entry>search the main log</entry>
58967 </row>
58968 <row>
58969 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
58970 <entry><emphasis>exipick</emphasis></entry>
58971 <entry>select messages on various criteria</entry>
58972 </row>
58973 <row>
58974 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
58975 <entry><emphasis>exicyclog</emphasis></entry>
58976 <entry>cycle (rotate) log files</entry>
58977 </row>
58978 <row>
58979 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
58980 <entry><emphasis>eximstats</emphasis></entry>
58981 <entry>extract statistics from the log</entry>
58982 </row>
58983 <row>
58984 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
58985 <entry><emphasis>exim_checkaccess</emphasis></entry>
58986 <entry>check address acceptance from given IP</entry>
58987 </row>
58988 <row>
58989 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
58990 <entry><emphasis>exim_dbmbuild</emphasis></entry>
58991 <entry>build a DBM file</entry>
58992 </row>
58993 <row>
58994 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
58995 <entry><emphasis>exinext</emphasis></entry>
58996 <entry>extract retry information</entry>
58997 </row>
58998 <row>
58999 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59000 <entry><emphasis>exim_dumpdb</emphasis></entry>
59001 <entry>dump a hints database</entry>
59002 </row>
59003 <row>
59004 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59005 <entry><emphasis>exim_tidydb</emphasis></entry>
59006 <entry>clean up a hints database</entry>
59007 </row>
59008 <row>
59009 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59010 <entry><emphasis>exim_fixdb</emphasis></entry>
59011 <entry>patch a hints database</entry>
59012 </row>
59013 <row>
59014 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
59015 <entry><emphasis>exim_lock</emphasis></entry>
59016 <entry>lock a mailbox file</entry>
59017 </row>
59018 </tbody>
59019 </tgroup>
59020 </informaltable>
59021 <para>
59022 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
59023 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
59024 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
59025 </para>
59026 <section id="SECTfinoutwha">
59027 <title>Finding out what Exim processes are doing (exiwhat)</title>
59028 <para>
59029 <indexterm role="concept">
59030 <primary><emphasis>exiwhat</emphasis></primary>
59031 </indexterm>
59032 <indexterm role="concept">
59033 <primary>process, querying</primary>
59034 </indexterm>
59035 <indexterm role="concept">
59036 <primary>SIGUSR1</primary>
59037 </indexterm>
59038 On operating systems that can restart a system call after receiving a signal
59039 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
59040 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
59041 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
59042 processes it can find, having first emptied the file. It then waits for one
59043 second to allow the Exim processes to react before displaying the results. In
59044 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
59045 send the signal to the Exim processes, so it is normally run as root.
59046 </para>
59047 <para>
59048 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
59049 use by system administrators. It is not sensible, for example, to set up a
59050 script that sends SIGUSR1 signals to Exim processes at short intervals.
59051 </para>
59052 <para>
59053 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
59054 varies in different operating systems. Not only are different options used,
59055 but the format of the output is different. For this reason, there are some
59056 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
59057 it doesn&#x2019;t seem to be working for you, check the following compile-time
59058 options:
59059 </para>
59060 <literallayout>
59061 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
59062 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
59063 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
59064 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
59065 </literallayout>
59066 <para>
59067 An example of typical output from <emphasis>exiwhat</emphasis> is
59068 </para>
59069 <literallayout class="monospaced">
59070 164 daemon: -q1h, listening on port 25
59071 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
59072 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
59073   [10.19.42.42] (editor@ref.example)
59074 10592 handling incoming call from [192.168.243.242]
59075 10628 accepting a local non-SMTP message
59076 </literallayout>
59077 <para>
59078 The first number in the output line is the process number. The third line has
59079 been split here, in order to fit it on the page.
59080 </para>
59081 </section>
59082 <section id="SECTgreptheque">
59083 <title>Selective queue listing (exiqgrep)</title>
59084 <para>
59085 <indexterm role="concept">
59086 <primary><emphasis>exiqgrep</emphasis></primary>
59087 </indexterm>
59088 <indexterm role="concept">
59089 <primary>queue</primary>
59090 <secondary>grepping</secondary>
59091 </indexterm>
59092 This utility is a Perl script contributed by Matt Hubbard. It runs
59093 </para>
59094 <literallayout class="monospaced">
59095 exim -bpu
59096 </literallayout>
59097 <para>
59098 to obtain a queue listing with undelivered recipients only, and then greps the
59099 output to select messages that match given criteria. The following selection
59100 options are available:
59101 </para>
59102 <variablelist>
59103 <varlistentry>
59104 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59105 <listitem>
59106 <para>
59107 Match the sender address. The field that is tested is enclosed in angle
59108 brackets, so you can test for bounce messages with
59109 </para>
59110 <literallayout class="monospaced">
59111 exiqgrep -f '^&lt;&gt;$'
59112 </literallayout>
59113 </listitem></varlistentry>
59114 <varlistentry>
59115 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59116 <listitem>
59117 <para>
59118 Match a recipient address. The field that is tested is not enclosed in angle
59119 brackets.
59120 </para>
59121 </listitem></varlistentry>
59122 <varlistentry>
59123 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59124 <listitem>
59125 <para>
59126 Match against the size field.
59127 </para>
59128 </listitem></varlistentry>
59129 <varlistentry>
59130 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
59131 <listitem>
59132 <para>
59133 Match messages that are younger than the given time.
59134 </para>
59135 </listitem></varlistentry>
59136 <varlistentry>
59137 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
59138 <listitem>
59139 <para>
59140 Match messages that are older than the given time.
59141 </para>
59142 </listitem></varlistentry>
59143 <varlistentry>
59144 <term><emphasis role="bold">-z</emphasis></term>
59145 <listitem>
59146 <para>
59147 Match only frozen messages.
59148 </para>
59149 </listitem></varlistentry>
59150 <varlistentry>
59151 <term><emphasis role="bold">-x</emphasis></term>
59152 <listitem>
59153 <para>
59154 Match only non-frozen messages.
59155 </para>
59156 </listitem></varlistentry>
59157 </variablelist>
59158 <para>
59159 The following options control the format of the output:
59160 </para>
59161 <variablelist>
59162 <varlistentry>
59163 <term><emphasis role="bold">-c</emphasis></term>
59164 <listitem>
59165 <para>
59166 Display only the count of matching messages.
59167 </para>
59168 </listitem></varlistentry>
59169 <varlistentry>
59170 <term><emphasis role="bold">-l</emphasis></term>
59171 <listitem>
59172 <para>
59173 Long format &ndash; display the full message information as output by Exim. This is
59174 the default.
59175 </para>
59176 </listitem></varlistentry>
59177 <varlistentry>
59178 <term><emphasis role="bold">-i</emphasis></term>
59179 <listitem>
59180 <para>
59181 Display message ids only.
59182 </para>
59183 </listitem></varlistentry>
59184 <varlistentry>
59185 <term><emphasis role="bold">-b</emphasis></term>
59186 <listitem>
59187 <para>
59188 Brief format &ndash; one line per message.
59189 </para>
59190 </listitem></varlistentry>
59191 <varlistentry>
59192 <term><emphasis role="bold">-R</emphasis></term>
59193 <listitem>
59194 <para>
59195 Display messages in reverse order.
59196 </para>
59197 </listitem></varlistentry>
59198 </variablelist>
59199 <para>
59200 There is one more option, <option>-h</option>, which outputs a list of options.
59201 </para>
59202 </section>
59203 <section id="SECTsumtheque">
59204 <title>Summarizing the queue (exiqsumm)</title>
59205 <para>
59206 <indexterm role="concept">
59207 <primary><emphasis>exiqsumm</emphasis></primary>
59208 </indexterm>
59209 <indexterm role="concept">
59210 <primary>queue</primary>
59211 <secondary>summary</secondary>
59212 </indexterm>
59213 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
59214 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
59215 running a command such as
59216 </para>
59217 <literallayout class="monospaced">
59218 exim -bp | exiqsumm
59219 </literallayout>
59220 <para>
59221 The output consists of one line for each domain that has messages waiting for
59222 it, as in the following example:
59223 </para>
59224 <literallayout class="monospaced">
59225 3   2322   74m   66m  msn.com.example
59226 </literallayout>
59227 <para>
59228 Each line lists the number of pending deliveries for a domain, their total
59229 volume, and the length of time that the oldest and the newest messages have
59230 been waiting. Note that the number of pending deliveries is greater than the
59231 number of messages when messages have more than one recipient.
59232 </para>
59233 <para>
59234 A summary line is output at the end. By default the output is sorted on the
59235 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
59236 the output to be sorted by oldest message and by count of messages,
59237 respectively. There are also three options that split the messages for each
59238 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
59239 separates frozen messages, and <option>-s</option> separates messages according to their
59240 sender.
59241 </para>
59242 <para>
59243 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
59244 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
59245 generated by aliasing or forwarding are included (unless the <option>one_time</option>
59246 option of the <command>redirect</command> router has been used to convert them into <quote>top
59247 level</quote> addresses).
59248 </para>
59249 </section>
59250 <section id="SECTextspeinf">
59251 <title>Extracting specific information from the log (exigrep)</title>
59252 <para>
59253 <indexterm role="concept">
59254 <primary><emphasis>exigrep</emphasis></primary>
59255 </indexterm>
59256 <indexterm role="concept">
59257 <primary>log</primary>
59258 <secondary>extracts; grepping for</secondary>
59259 </indexterm>
59260 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
59261 files for entries that match a given pattern. When it finds a match, it
59262 extracts all the log entries for the relevant message, not just those that
59263 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
59264 given message, or all mail for a given user, or for a given host, for example.
59265 The input files can be in Exim log format or syslog format.
59266 If a matching log line is not associated with a specific message, it is
59267 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
59268 </para>
59269 <literallayout>
59270 <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>
59271 </literallayout>
59272 <para>
59273 If no log file names are given on the command line, the standard input is read.
59274 </para>
59275 <para>
59276 The <option>-t</option> argument specifies a number of seconds. It adds an additional
59277 condition for message selection. Messages that are complete are shown only if
59278 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
59279 </para>
59280 <para>
59281 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
59282 makes it case-sensitive. This may give a performance improvement when searching
59283 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
59284 option; with <option>-I</option> they do not. In both cases it is possible to change the
59285 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
59286 </para>
59287 <para>
59288 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
59289 pattern as standing for themselves. Otherwise the pattern must be a Perl
59290 regular expression.
59291 </para>
59292 <para>
59293 The <option>-v</option> option inverts the matching condition. That is, a line is selected
59294 if it does <emphasis>not</emphasis> match the pattern.
59295 </para>
59296 <para>
59297 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
59298 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
59299 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
59300 </para>
59301 </section>
59302 <section id="SECTexipick">
59303 <title>Selecting messages by various criteria (exipick)</title>
59304 <para>
59305 <indexterm role="concept">
59306 <primary><emphasis>exipick</emphasis></primary>
59307 </indexterm>
59308 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
59309 lists messages from the queue according to a variety of criteria. For details
59310 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
59311 <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
59312 the <option>--help</option> option.
59313 </para>
59314 </section>
59315 <section id="SECTcyclogfil">
59316 <title>Cycling log files (exicyclog)</title>
59317 <para>
59318 <indexterm role="concept">
59319 <primary>log</primary>
59320 <secondary>cycling local files</secondary>
59321 </indexterm>
59322 <indexterm role="concept">
59323 <primary>cycling logs</primary>
59324 </indexterm>
59325 <indexterm role="concept">
59326 <primary><emphasis>exicyclog</emphasis></primary>
59327 </indexterm>
59328 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
59329 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
59330 you are using log files with datestamps in their names (see section
59331 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
59332 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
59333 There are two command line options for <emphasis>exicyclog</emphasis>:
59334 </para>
59335 <itemizedlist>
59336 <listitem>
59337 <para>
59338 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
59339 default that is set when Exim is built. The default default is 10.
59340 </para>
59341 </listitem>
59342 <listitem>
59343 <para>
59344 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
59345 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
59346 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
59347 configuration.
59348 </para>
59349 </listitem>
59350 </itemizedlist>
59351 <para>
59352 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
59353 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
59354 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
59355 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
59356 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
59357 logs are handled similarly.
59358 </para>
59359 <para>
59360 If the limit is greater than 99, the script uses 3-digit numbers such as
59361 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
59362 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
59363 any existing log files.
59364 </para>
59365 <para>
59366 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
59367 the end are deleted. All files with numbers greater than 01 are compressed,
59368 using a compression command which is configured by the COMPRESS_COMMAND
59369 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
59370 root <option>crontab</option> entry of the form
59371 </para>
59372 <literallayout class="monospaced">
59373 1 0 * * * su exim -c /usr/exim/bin/exicyclog
59374 </literallayout>
59375 <para>
59376 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
59377 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
59378 </para>
59379 </section>
59380 <section id="SECTmailstat">
59381 <title>Mail statistics (eximstats)</title>
59382 <para>
59383 <indexterm role="concept">
59384 <primary>statistics</primary>
59385 </indexterm>
59386 <indexterm role="concept">
59387 <primary><emphasis>eximstats</emphasis></primary>
59388 </indexterm>
59389 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
59390 information from log files. The output is either plain text, or HTML.
59391 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
59392 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
59393 </para>
59394 <para>
59395 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
59396 latest version is the result of some extensive revision by Steve Campbell. A
59397 lot of information is given by default, but there are options for suppressing
59398 various parts of it. Following any options, the arguments to the script are a
59399 list of files, which should be main log files. For example:
59400 </para>
59401 <literallayout class="monospaced">
59402 eximstats -nr /var/spool/exim/log/mainlog.01
59403 </literallayout>
59404 <para>
59405 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
59406 messages received from or delivered to various hosts. The information is sorted
59407 both by message count and by volume, and the top fifty hosts in each category
59408 are listed on the standard output. Similar information, based on email
59409 addresses or domains instead of hosts can be requested by means of various
59410 options. For messages delivered and received locally, similar statistics are
59411 also produced per user.
59412 </para>
59413 <para>
59414 The output also includes total counts and statistics about delivery errors, and
59415 histograms showing the number of messages received and deliveries made in each
59416 hour of the day. A delivery with more than one address in its envelope (for
59417 example, an SMTP transaction with more than one RCPT command) is counted
59418 as a single delivery by <emphasis>eximstats</emphasis>.
59419 </para>
59420 <para>
59421 Though normally more deliveries than receipts are reported (as messages may
59422 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
59423 messages received than delivered, even though the queue is empty at the start
59424 and end of the period in question. If an incoming message contains no valid
59425 recipients, no deliveries are recorded for it. A bounce message is handled as
59426 an entirely separate message.
59427 </para>
59428 <para>
59429 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
59430 of messages received and deliveries made, and the number of hosts involved in
59431 each case. It also outputs the number of messages that were delayed (that is,
59432 not completely delivered at the first attempt), and the number that had at
59433 least one address that failed.
59434 </para>
59435 <para>
59436 The remainder of the output is in sections that can be independently disabled
59437 or modified by various options. It consists of a summary of deliveries by
59438 transport, histograms of messages received and delivered per time interval
59439 (default per hour), information about the time messages spent on the queue,
59440 a list of relayed messages, lists of the top fifty sending hosts, local
59441 senders, destination hosts, and destination local users by count and by volume,
59442 and a list of delivery errors that occurred.
59443 </para>
59444 <para>
59445 The relay information lists messages that were actually relayed, that is, they
59446 came from a remote host and were directly delivered to some other remote host,
59447 without being processed (for example, for aliasing or forwarding) locally.
59448 </para>
59449 <para>
59450 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
59451 outputs. These are documented in the Perl script itself, and can be extracted
59452 by running the command <command>perldoc</command> on the script. For example:
59453 </para>
59454 <literallayout class="monospaced">
59455 perldoc /usr/exim/bin/eximstats
59456 </literallayout>
59457 </section>
59458 <section id="SECTcheckaccess">
59459 <title>Checking access policy (exim_checkaccess)</title>
59460 <para>
59461 <indexterm role="concept">
59462 <primary><emphasis>exim_checkaccess</emphasis></primary>
59463 </indexterm>
59464 <indexterm role="concept">
59465 <primary>policy control</primary>
59466 <secondary>checking access</secondary>
59467 </indexterm>
59468 <indexterm role="concept">
59469 <primary>checking access</primary>
59470 </indexterm>
59471 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
59472 debugging output, in order to check what Exim is doing when it is applying
59473 policy controls to incoming SMTP mail. However, not everybody is sufficiently
59474 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
59475 sometimes you just want to answer the question <quote>Does this address have
59476 access?</quote> without bothering with any further details.
59477 </para>
59478 <para>
59479 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
59480 two arguments, an IP address and an email address:
59481 </para>
59482 <literallayout class="monospaced">
59483 exim_checkaccess 10.9.8.7 A.User@a.domain.example
59484 </literallayout>
59485 <para>
59486 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
59487 given email address would be accepted in a RCPT command in a TCP/IP
59488 connection from the host with the given IP address. The output of the utility
59489 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
59490 </para>
59491 <literallayout class="monospaced">
59492 Rejected:
59493 550 Relay not permitted
59494 </literallayout>
59495 <para>
59496 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
59497 for the MAIL command, but you can change this by providing additional
59498 options. These are passed directly to the Exim command. For example, to specify
59499 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
59500 you can use:
59501 </para>
59502 <literallayout class="monospaced">
59503 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
59504                  -f himself@there.example
59505 </literallayout>
59506 <para>
59507 Note that these additional Exim command line items must be given after the two
59508 mandatory arguments.
59509 </para>
59510 <para>
59511 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
59512 while running its checks. You can run checks that include callouts by using
59513 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
59514 </para>
59515 </section>
59516 <section id="SECTdbmbuild">
59517 <title>Making DBM files (exim_dbmbuild)</title>
59518 <para>
59519 <indexterm role="concept">
59520 <primary>DBM</primary>
59521 <secondary>building dbm files</secondary>
59522 </indexterm>
59523 <indexterm role="concept">
59524 <primary>building DBM files</primary>
59525 </indexterm>
59526 <indexterm role="concept">
59527 <primary><emphasis>exim_dbmbuild</emphasis></primary>
59528 </indexterm>
59529 <indexterm role="concept">
59530 <primary>lower casing</primary>
59531 </indexterm>
59532 <indexterm role="concept">
59533 <primary>binary zero</primary>
59534 <secondary>in lookup key</secondary>
59535 </indexterm>
59536 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
59537 the format used by the <command>lsearch</command> lookup (see section
59538 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
59539 names as keys and the remainder of the information as data. The lower-casing
59540 can be prevented by calling the program with the <option>-nolc</option> option.
59541 </para>
59542 <para>
59543 A terminating zero is included as part of the key string. This is expected by
59544 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
59545 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
59546 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
59547 files.
59548 </para>
59549 <para>
59550 The program requires two arguments: the name of the input file (which can be a
59551 single hyphen to indicate the standard input), and the name of the output file.
59552 It creates the output under a temporary name, and then renames it if all went
59553 well.
59554 </para>
59555 <para>
59556 <indexterm role="concept">
59557 <primary>USE_DB</primary>
59558 </indexterm>
59559 If the native DB interface is in use (USE_DB is set in a compile-time
59560 configuration file &ndash; this is common in free versions of Unix) the two file
59561 names must be different, because in this mode the Berkeley DB functions create
59562 a single output file using exactly the name given. For example,
59563 </para>
59564 <literallayout class="monospaced">
59565 exim_dbmbuild /etc/aliases /etc/aliases.db
59566 </literallayout>
59567 <para>
59568 reads the system alias file and creates a DBM version of it in
59569 <filename>/etc/aliases.db</filename>.
59570 </para>
59571 <para>
59572 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
59573 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
59574 environment, the suffixes are added to the second argument of
59575 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
59576 when the Berkeley functions are used in compatibility mode (though this is not
59577 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
59578 </para>
59579 <para>
59580 If a duplicate key is encountered, the program outputs a warning, and when it
59581 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
59582 option is used. By default, only the first of a set of duplicates is used &ndash;
59583 this makes it compatible with <command>lsearch</command> lookups. There is an option
59584 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
59585 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
59586 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
59587 return code is 2.
59588 </para>
59589 </section>
59590 <section id="SECTfinindret">
59591 <title>Finding individual retry times (exinext)</title>
59592 <para>
59593 <indexterm role="concept">
59594 <primary>retry</primary>
59595 <secondary>times</secondary>
59596 </indexterm>
59597 <indexterm role="concept">
59598 <primary><emphasis>exinext</emphasis></primary>
59599 </indexterm>
59600 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
59601 fish specific information out of the retry database. Given a mail domain (or a
59602 complete address), it looks up the hosts for that domain, and outputs any retry
59603 information for the hosts or for the domain. At present, the retry information
59604 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
59605 output. For example:
59606 </para>
59607 <literallayout class="monospaced">
59608 $ exinext piglet@milne.fict.example
59609 kanga.milne.example:192.168.8.1 error 146: Connection refused
59610   first failed: 21-Feb-1996 14:57:34
59611   last tried:   21-Feb-1996 14:57:34
59612   next try at:  21-Feb-1996 15:02:34
59613 roo.milne.example:192.168.8.3 error 146: Connection refused
59614   first failed: 20-Jan-1996 13:12:08
59615   last tried:   21-Feb-1996 11:42:03
59616   next try at:  21-Feb-1996 19:42:03
59617   past final cutoff time
59618 </literallayout>
59619 <para>
59620 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
59621 will give any retry information for that local part in your default domain.
59622 A message id can be used to obtain retry information pertaining to a specific
59623 message. This exists only when an attempt to deliver a message to a remote host
59624 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
59625 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
59626 run very often.
59627 </para>
59628 <para>
59629 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
59630 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
59631 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
59632 configuration file, and the second sets macros for use within the configuration
59633 file. These features are mainly to help in testing, but might also be useful in
59634 environments where more than one configuration file is in use.
59635 </para>
59636 </section>
59637 <section id="SECThindatmai">
59638 <title>Hints database maintenance</title>
59639 <para>
59640 <indexterm role="concept">
59641 <primary>hints database</primary>
59642 <secondary>maintenance</secondary>
59643 </indexterm>
59644 <indexterm role="concept">
59645 <primary>maintaining Exim&#x2019;s hints database</primary>
59646 </indexterm>
59647 Three utility programs are provided for maintaining the DBM files that Exim
59648 uses to contain its delivery hint information. Each program requires two
59649 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
59650 second is the name of the database it is to operate on. These are as follows:
59651 </para>
59652 <itemizedlist>
59653 <listitem>
59654 <para>
59655 <emphasis>retry</emphasis>: the database of retry information
59656 </para>
59657 </listitem>
59658 <listitem>
59659 <para>
59660 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
59661 for remote hosts
59662 </para>
59663 </listitem>
59664 <listitem>
59665 <para>
59666 <emphasis>callout</emphasis>: the callout cache
59667 </para>
59668 </listitem>
59669 <listitem>
59670 <para>
59671 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
59672 </para>
59673 </listitem>
59674 <listitem>
59675 <para>
59676 <emphasis>misc</emphasis>: other hints data
59677 </para>
59678 </listitem>
59679 </itemizedlist>
59680 <para>
59681 The <emphasis>misc</emphasis> database is used for
59682 </para>
59683 <itemizedlist>
59684 <listitem>
59685 <para>
59686 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
59687 </para>
59688 </listitem>
59689 <listitem>
59690 <para>
59691 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
59692 <command>smtp</command> transport)
59693 </para>
59694 </listitem>
59695 </itemizedlist>
59696 </section>
59697 <section id="SECID261">
59698 <title>exim_dumpdb</title>
59699 <para>
59700 <indexterm role="concept">
59701 <primary><emphasis>exim_dumpdb</emphasis></primary>
59702 </indexterm>
59703 The entire contents of a database are written to the standard output by the
59704 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
59705 spool and database names. For example, to dump the retry database:
59706 </para>
59707 <literallayout class="monospaced">
59708 exim_dumpdb /var/spool/exim retry
59709 </literallayout>
59710 <para>
59711 Two lines of output are produced for each entry:
59712 </para>
59713 <literallayout class="monospaced">
59714 T:mail.ref.example:192.168.242.242 146 77 Connection refused
59715 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
59716 </literallayout>
59717 <para>
59718 The first item on the first line is the key of the record. It starts with one
59719 of the letters R, or T, depending on whether it refers to a routing or
59720 transport retry. For a local delivery, the next part is the local address; for
59721 a remote delivery it is the name of the remote host, followed by its failing IP
59722 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
59723 transport). If the remote port is not the standard one (port 25), it is added
59724 to the IP address. Then there follows an error code, an additional error code,
59725 and a textual description of the error.
59726 </para>
59727 <para>
59728 The three times on the second line are the time of first failure, the time of
59729 the last delivery attempt, and the computed time for the next attempt. The line
59730 ends with an asterisk if the cutoff time for the last retry rule has been
59731 exceeded.
59732 </para>
59733 <para>
59734 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
59735 consists of a host name followed by a list of ids for messages that are or were
59736 waiting to be delivered to that host. If there are a very large number for any
59737 one host, continuation records, with a sequence number added to the host name,
59738 may be seen. The data in these records is often out of date, because a message
59739 may be routed to several alternative hosts, and Exim makes no effort to keep
59740 cross-references.
59741 </para>
59742 </section>
59743 <section id="SECID262">
59744 <title>exim_tidydb</title>
59745 <para>
59746 <indexterm role="concept">
59747 <primary><emphasis>exim_tidydb</emphasis></primary>
59748 </indexterm>
59749 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
59750 database. If run with no options, it removes all records that are more than 30
59751 days old. The age is calculated from the date and time that the record was last
59752 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
59753 since the first delivery failure. Information about a host that has been down
59754 for more than 30 days will remain in the database, provided that the record is
59755 updated sufficiently often.
59756 </para>
59757 <para>
59758 The cutoff date can be altered by means of the <option>-t</option> option, which must be
59759 followed by a time. For example, to remove all records older than a week from
59760 the retry database:
59761 </para>
59762 <literallayout class="monospaced">
59763 exim_tidydb -t 7d /var/spool/exim retry
59764 </literallayout>
59765 <para>
59766 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
59767 message ids. In the former these appear as data in records keyed by host &ndash;
59768 they were messages that were waiting for that host &ndash; and in the latter they
59769 are the keys for retry information for messages that have suffered certain
59770 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
59771 message ids in database records are those of messages that are still on the
59772 queue. Message ids for messages that no longer exist are removed from
59773 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
59774 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
59775 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
59776 whenever it removes information from the database.
59777 </para>
59778 <para>
59779 Certain records are automatically removed by Exim when they are no longer
59780 needed, but others are not. For example, if all the MX hosts for a domain are
59781 down, a retry record is created for each one. If the primary MX host comes back
59782 first, its record is removed when Exim successfully delivers to it, but the
59783 records for the others remain because Exim has not tried to use those hosts.
59784 </para>
59785 <para>
59786 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
59787 hints databases. You should do this at a quiet time of day, because it requires
59788 a database to be locked (and therefore inaccessible to Exim) while it does its
59789 work. Removing records from a DBM file does not normally make the file smaller,
59790 but all the common DBM libraries are able to re-use the space that is released.
59791 After an initial phase of increasing in size, the databases normally reach a
59792 point at which they no longer get any bigger, as long as they are regularly
59793 tidied.
59794 </para>
59795 <para>
59796 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
59797 databases is likely to keep on increasing.
59798 </para>
59799 </section>
59800 <section id="SECID263">
59801 <title>exim_fixdb</title>
59802 <para>
59803 <indexterm role="concept">
59804 <primary><emphasis>exim_fixdb</emphasis></primary>
59805 </indexterm>
59806 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
59807 Its main use is for testing Exim, but it might also be occasionally useful for
59808 getting round problems in a live system. It has no options, and its interface
59809 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
59810 key of a database record can then be entered, and the data for that record is
59811 displayed.
59812 </para>
59813 <para>
59814 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
59815 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
59816 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
59817 data for individual fields can be changed by typing the field number followed
59818 by new data, for example:
59819 </para>
59820 <literallayout class="monospaced">
59821 &gt; 4 951102:1000
59822 </literallayout>
59823 <para>
59824 resets the time of the next delivery attempt. Time values are given as a
59825 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
59826 used as optional separators.
59827 </para>
59828 </section>
59829 <section id="SECTmailboxmaint">
59830 <title>Mailbox maintenance (exim_lock)</title>
59831 <para>
59832 <indexterm role="concept">
59833 <primary>mailbox</primary>
59834 <secondary>maintenance</secondary>
59835 </indexterm>
59836 <indexterm role="concept">
59837 <primary><emphasis>exim_lock</emphasis></primary>
59838 </indexterm>
59839 <indexterm role="concept">
59840 <primary>locking mailboxes</primary>
59841 </indexterm>
59842 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
59843 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
59844 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
59845 a user agent while investigating a problem. The utility requires the name of
59846 the file as its first argument. If the locking is successful, the second
59847 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
59848 second argument, the value of the SHELL environment variable is used; if this
59849 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
59850 is unlocked and the utility ends. The following options are available:
59851 </para>
59852 <variablelist>
59853 <varlistentry>
59854 <term><option>-fcntl</option></term>
59855 <listitem>
59856 <para>
59857 Use <function>fcntl()</function> locking on the open mailbox.
59858 </para>
59859 </listitem></varlistentry>
59860 <varlistentry>
59861 <term><option>-flock</option></term>
59862 <listitem>
59863 <para>
59864 Use <function>flock()</function> locking on the open mailbox, provided the operating system
59865 supports it.
59866 </para>
59867 </listitem></varlistentry>
59868 <varlistentry>
59869 <term><option>-interval</option></term>
59870 <listitem>
59871 <para>
59872 This must be followed by a number, which is a number of seconds; it sets the
59873 interval to sleep between retries (default 3).
59874 </para>
59875 </listitem></varlistentry>
59876 <varlistentry>
59877 <term><option>-lockfile</option></term>
59878 <listitem>
59879 <para>
59880 Create a lock file before opening the mailbox.
59881 </para>
59882 </listitem></varlistentry>
59883 <varlistentry>
59884 <term><option>-mbx</option></term>
59885 <listitem>
59886 <para>
59887 Lock the mailbox using MBX rules.
59888 </para>
59889 </listitem></varlistentry>
59890 <varlistentry>
59891 <term><option>-q</option></term>
59892 <listitem>
59893 <para>
59894 Suppress verification output.
59895 </para>
59896 </listitem></varlistentry>
59897 <varlistentry>
59898 <term><option>-retries</option></term>
59899 <listitem>
59900 <para>
59901 This must be followed by a number; it sets the number of times to try to get
59902 the lock (default 10).
59903 </para>
59904 </listitem></varlistentry>
59905 <varlistentry>
59906 <term><option>-restore_time</option></term>
59907 <listitem>
59908 <para>
59909 This option causes <option>exim_lock</option> to restore the modified and read times to the
59910 locked file before exiting. This allows you to access a locked mailbox (for
59911 example, to take a backup copy) without disturbing the times that the user
59912 subsequently sees.
59913 </para>
59914 </listitem></varlistentry>
59915 <varlistentry>
59916 <term><option>-timeout</option></term>
59917 <listitem>
59918 <para>
59919 This must be followed by a number, which is a number of seconds; it sets a
59920 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
59921 default), a non-blocking call is used.
59922 </para>
59923 </listitem></varlistentry>
59924 <varlistentry>
59925 <term><option>-v</option></term>
59926 <listitem>
59927 <para>
59928 Generate verbose output.
59929 </para>
59930 </listitem></varlistentry>
59931 </variablelist>
59932 <para>
59933 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
59934 default is to create a lock file and also to use <function>fcntl()</function> locking on the
59935 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
59936 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
59937 requires that the directory containing the file be writeable. Locking by lock
59938 file does not last for ever; Exim assumes that a lock file is expired if it is
59939 more than 30 minutes old.
59940 </para>
59941 <para>
59942 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
59943 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
59944 to be taken out on the open mailbox, and an exclusive lock on the file
59945 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
59946 number of the mailbox file. When the locking is released, if an exclusive lock
59947 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
59948 </para>
59949 <para>
59950 The default output contains verification of the locking that takes place. The
59951 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
59952 suppresses all output except error messages.
59953 </para>
59954 <para>
59955 A command such as
59956 </para>
59957 <literallayout class="monospaced">
59958 exim_lock /var/spool/mail/spqr
59959 </literallayout>
59960 <para>
59961 runs an interactive shell while the file is locked, whereas
59962 </para>
59963 <literallayout>
59964 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
59965 &lt;<emphasis>some commands</emphasis>&gt;
59966 <literal>End</literal>
59967 </literallayout>
59968 <para>
59969 runs a specific non-interactive sequence of commands while the file is locked,
59970 suppressing all verification output. A single command can be run by a command
59971 such as
59972 </para>
59973 <literallayout class="monospaced">
59974 exim_lock -q /var/spool/mail/spqr \
59975   "cp /var/spool/mail/spqr /some/where"
59976 </literallayout>
59977 <para>
59978 Note that if a command is supplied, it must be entirely contained within the
59979 second argument &ndash; hence the quotes.
59980 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
59981 </para>
59982 </section>
59983 </chapter>
59984
59985 <chapter id="CHAPeximon">
59986 <title>The Exim monitor</title>
59987 <para>
59988 <indexterm role="concept" id="IIDeximon" class="startofrange">
59989 <primary>Exim monitor</primary>
59990 <secondary>description</secondary>
59991 </indexterm>
59992 <indexterm role="concept">
59993 <primary>X-windows</primary>
59994 </indexterm>
59995 <indexterm role="concept">
59996 <primary><emphasis>eximon</emphasis></primary>
59997 </indexterm>
59998 <indexterm role="concept">
59999 <primary>Local/eximon.conf</primary>
60000 </indexterm>
60001 <indexterm role="concept">
60002 <primary><filename>exim_monitor/EDITME</filename></primary>
60003 </indexterm>
60004 The Exim monitor is an application which displays in an X window information
60005 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
60006 perform certain operations on messages from this GUI interface; however all
60007 such facilities are also available from the command line, and indeed, the
60008 monitor itself makes use of the command line to perform any actions requested.
60009 </para>
60010 <section id="SECID264">
60011 <title>Running the monitor</title>
60012 <para>
60013 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
60014 script that sets up a number of environment variables, and then runs the
60015 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
60016 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
60017 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
60018 parameters are for.
60019 </para>
60020 <para>
60021 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
60022 a particular invocation by setting up environment variables of the same names,
60023 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
60024 </para>
60025 <literallayout class="monospaced">
60026 EXIMON_LOG_DEPTH=400 eximon
60027 </literallayout>
60028 <para>
60029 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
60030 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
60031 overrides the Exim log file configuration. This makes it possible to have
60032 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
60033 syslog messages are routed to a file on the local host.
60034 </para>
60035 <para>
60036 X resources can be used to change the appearance of the window in the normal
60037 way. For example, a resource setting of the form
60038 </para>
60039 <literallayout class="monospaced">
60040 Eximon*background: gray94
60041 </literallayout>
60042 <para>
60043 changes the colour of the background to light grey rather than white. The
60044 stripcharts are drawn with both the data lines and the reference lines in
60045 black. This means that the reference lines are not visible when on top of the
60046 data. However, their colour can be changed by setting a resource called
60047 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
60048 For example, if your X server is running Unix, you could set up lighter
60049 reference lines in the stripcharts by obeying
60050 </para>
60051 <literallayout class="monospaced">
60052 xrdb -merge &lt;&lt;End
60053 Eximon*highlight: gray
60054 End
60055 </literallayout>
60056 <para>
60057 <indexterm role="concept">
60058 <primary>admin user</primary>
60059 </indexterm>
60060 In order to see the contents of messages on the queue, and to operate on them,
60061 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
60062 </para>
60063 <para>
60064 The monitor&#x2019;s window is divided into three parts. The first contains one or
60065 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
60066 main log file, and the third is a display of the queue of messages awaiting
60067 delivery, with two more action buttons. The following sections describe these
60068 different parts of the display.
60069 </para>
60070 </section>
60071 <section id="SECID265">
60072 <title>The stripcharts</title>
60073 <para>
60074 <indexterm role="concept">
60075 <primary>stripchart</primary>
60076 </indexterm>
60077 The first stripchart is always a count of messages on the queue. Its name can
60078 be configured by setting QUEUE_STRIPCHART_NAME in the
60079 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
60080 configuration script by regular expression matches on log file entries, making
60081 it possible to display, for example, counts of messages delivered to certain
60082 hosts or using certain transports. The supplied defaults display counts of
60083 received and delivered messages, and of local and SMTP deliveries. The default
60084 period between stripchart updates is one minute; this can be adjusted by a
60085 parameter in the <filename>Local/eximon.conf</filename> file.
60086 </para>
60087 <para>
60088 The stripchart displays rescale themselves automatically as the value they are
60089 displaying changes. There are always 10 horizontal lines in each chart; the
60090 title string indicates the value of each division when it is greater than one.
60091 For example, <quote>x2</quote> means that each division represents a value of 2.
60092 </para>
60093 <para>
60094 It is also possible to have a stripchart which shows the percentage fullness of
60095 a particular disk partition, which is useful when local deliveries are confined
60096 to a single partition.
60097 </para>
60098 <para>
60099 <indexterm role="concept">
60100 <primary><option>statvfs</option> function</primary>
60101 </indexterm>
60102 This relies on the availability of the <function>statvfs()</function> function or equivalent in
60103 the operating system. Most, but not all versions of Unix that support Exim have
60104 this. For this particular stripchart, the top of the chart always represents
60105 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
60106 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
60107 <filename>Local/eximon.conf</filename> file.
60108 </para>
60109 </section>
60110 <section id="SECID266">
60111 <title>Main action buttons</title>
60112 <para>
60113 <indexterm role="concept">
60114 <primary>size</primary>
60115 <secondary>of monitor window</secondary>
60116 </indexterm>
60117 <indexterm role="concept">
60118 <primary>Exim monitor</primary>
60119 <secondary>window size</secondary>
60120 </indexterm>
60121 <indexterm role="concept">
60122 <primary>window size</primary>
60123 </indexterm>
60124 Below the stripcharts there is an action button for quitting the monitor. Next
60125 to this is another button marked <quote>Size</quote>. They are placed here so that
60126 shrinking the window to its default minimum size leaves just the queue count
60127 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
60128 the window to expand to its maximum size, unless it is already at the maximum,
60129 in which case it is reduced to its minimum.
60130 </para>
60131 <para>
60132 When expanding to the maximum, if the window cannot be fully seen where it
60133 currently is, it is moved back to where it was the last time it was at full
60134 size. When it is expanding from its minimum size, the old position is
60135 remembered, and next time it is reduced to the minimum it is moved back there.
60136 </para>
60137 <para>
60138 The idea is that you can keep a reduced window just showing one or two
60139 stripcharts at a convenient place on your screen, easily expand it to show
60140 the full window when required, and just as easily put it back to what it was.
60141 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
60142 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
60143 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
60144 </para>
60145 <para>
60146 Normally, the monitor starts up with the window at its full size, but it can be
60147 built so that it starts up with the window at its smallest size, by setting
60148 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
60149 </para>
60150 </section>
60151 <section id="SECID267">
60152 <title>The log display</title>
60153 <para>
60154 <indexterm role="concept">
60155 <primary>log</primary>
60156 <secondary>tail of; in monitor</secondary>
60157 </indexterm>
60158 The second section of the window is an area in which a display of the tail of
60159 the main log is maintained.
60160 To save space on the screen, the timestamp on each log line is shortened by
60161 removing the date and, if <option>log_timezone</option> is set, the timezone.
60162 The log tail is not available when the only destination for logging data is
60163 syslog, unless the syslog lines are routed to a local file whose name is passed
60164 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
60165 </para>
60166 <para>
60167 The log sub-window has a scroll bar at its lefthand side which can be used to
60168 move back to look at earlier text, and the up and down arrow keys also have a
60169 scrolling effect. The amount of log that is kept depends on the setting of
60170 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
60171 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
60172 much more efficient than throwing it away line by line. The sub-window also has
60173 a horizontal scroll bar for accessing the ends of long log lines. This is the
60174 only means of horizontal scrolling; the right and left arrow keys are not
60175 available. Text can be cut from this part of the window using the mouse in the
60176 normal way. The size of this subwindow is controlled by parameters in the
60177 configuration file <filename>Local/eximon.conf</filename>.
60178 </para>
60179 <para>
60180 Searches of the text in the log window can be carried out by means of the ^R
60181 and ^S keystrokes, which default to a reverse and a forward search,
60182 respectively. The search covers only the text that is displayed in the window.
60183 It cannot go further back up the log.
60184 </para>
60185 <para>
60186 The point from which the search starts is indicated by a caret marker. This is
60187 normally at the end of the text in the window, but can be positioned explicitly
60188 by pointing and clicking with the left mouse button, and is moved automatically
60189 by a successful search. If new text arrives in the window when it is scrolled
60190 back, the caret remains where it is, but if the window is not scrolled back,
60191 the caret is moved to the end of the new text.
60192 </para>
60193 <para>
60194 Pressing ^R or ^S pops up a window into which the search text can be typed.
60195 There are buttons for selecting forward or reverse searching, for carrying out
60196 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
60197 happens and the window remains so that further searches can be done. If the
60198 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
60199 ^C is typed the search is cancelled.
60200 </para>
60201 <para>
60202 The searching facility is implemented using the facilities of the Athena text
60203 widget. By default this pops up a window containing both <quote>search</quote> and
60204 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
60205 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
60206 However, the linkers in BSDI and HP-UX seem unable to handle an externally
60207 provided version of <option>TextPop</option> when the remaining parts of the text widget
60208 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
60209 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
60210 on these systems, at the expense of having unwanted items in the search popup
60211 window.
60212 </para>
60213 </section>
60214 <section id="SECID268">
60215 <title>The queue display</title>
60216 <para>
60217 <indexterm role="concept">
60218 <primary>queue</primary>
60219 <secondary>display in monitor</secondary>
60220 </indexterm>
60221 The bottom section of the monitor window contains a list of all messages that
60222 are on the queue, which includes those currently being received or delivered,
60223 as well as those awaiting delivery. The size of this subwindow is controlled by
60224 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
60225 at which it is updated is controlled by another parameter in the same file &ndash;
60226 the default is 5 minutes, since queue scans can be quite expensive. However,
60227 there is an <quote>Update</quote> action button just above the display which can be used
60228 to force an update of the queue display at any time.
60229 </para>
60230 <para>
60231 When a host is down for some time, a lot of pending mail can build up for it,
60232 and this can make it hard to deal with other messages on the queue. To help
60233 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
60234 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
60235 type anything in here and press <quote>Return</quote>, the text is added to a chain of
60236 such texts, and if every undelivered address in a message matches at least one
60237 of the texts, the message is not displayed.
60238 </para>
60239 <para>
60240 If there is an address that does not match any of the texts, all the addresses
60241 are displayed as normal. The matching happens on the ends of addresses so, for
60242 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
60243 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
60244 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
60245 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
60246 a hide request is automatically cancelled after one hour.
60247 </para>
60248 <para>
60249 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
60250 else to the monitor window. For this reason, if you want to cut text from the
60251 queue display to use in the dialogue box, you have to do the cutting before
60252 pressing the <quote>Hide</quote> button.
60253 </para>
60254 <para>
60255 The queue display contains, for each unhidden queued message, the length of
60256 time it has been on the queue, the size of the message, the message id, the
60257 message sender, and the first undelivered recipient, all on one line. If it is
60258 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
60259 recipient to which the message has not yet been delivered, subsequent ones are
60260 listed on additional lines, up to a maximum configured number, following which
60261 an ellipsis is displayed. Recipients that have already received the message are
60262 not shown.
60263 </para>
60264 <para>
60265 <indexterm role="concept">
60266 <primary>frozen messages</primary>
60267 <secondary>display</secondary>
60268 </indexterm>
60269 If a message is frozen, an asterisk is displayed at the left-hand side.
60270 </para>
60271 <para>
60272 The queue display has a vertical scroll bar, and can also be scrolled by means
60273 of the arrow keys. Text can be cut from it using the mouse in the normal way.
60274 The text searching facilities, as described above for the log window, are also
60275 available, but the caret is always moved to the end of the text when the queue
60276 display is updated.
60277 </para>
60278 </section>
60279 <section id="SECID269">
60280 <title>The queue menu</title>
60281 <para>
60282 <indexterm role="concept">
60283 <primary>queue</primary>
60284 <secondary>menu in monitor</secondary>
60285 </indexterm>
60286 If the <option>shift</option> key is held down and the left button is clicked when the mouse
60287 pointer is over the text for any message, an action menu pops up, and the first
60288 line of the queue display for the message is highlighted. This does not affect
60289 any selected text.
60290 </para>
60291 <para>
60292 If you want to use some other event for popping up the menu, you can set the
60293 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
60294 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
60295 value set in this parameter is a standard X event description. For example, to
60296 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
60297 </para>
60298 <literallayout class="monospaced">
60299 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
60300 </literallayout>
60301 <para>
60302 The title of the menu is the message id, and it contains entries which act as
60303 follows:
60304 </para>
60305 <itemizedlist>
60306 <listitem>
60307 <para>
60308 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
60309 in a new text window.
60310 </para>
60311 </listitem>
60312 <listitem>
60313 <para>
60314 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
60315 information and headers is displayed in a new text window. See chapter
60316 <xref linkend="CHAPspool"/> for a description of the format of spool files.
60317 </para>
60318 </listitem>
60319 <listitem>
60320 <para>
60321 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
60322 displayed in a new text window. There is a default limit of 20,000 bytes to the
60323 amount of data displayed. This can be changed by setting the BODY_MAX
60324 option at compile time, or the EXIMON_BODY_MAX option at run time.
60325 </para>
60326 </listitem>
60327 <listitem>
60328 <para>
60329 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
60330 delivery of the message. This causes an automatic thaw if the message is
60331 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
60332 a new text window. The delivery is run in a separate process, to avoid holding
60333 up the monitor while the delivery proceeds.
60334 </para>
60335 </listitem>
60336 <listitem>
60337 <para>
60338 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
60339 that the message be frozen.
60340 </para>
60341 </listitem>
60342 <listitem>
60343 <para>
60344 <indexterm role="concept">
60345 <primary>thawing messages</primary>
60346 </indexterm>
60347 <indexterm role="concept">
60348 <primary>unfreezing messages</primary>
60349 </indexterm>
60350 <indexterm role="concept">
60351 <primary>frozen messages</primary>
60352 <secondary>thawing</secondary>
60353 </indexterm>
60354 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
60355 that the message be thawed.
60356 </para>
60357 </listitem>
60358 <listitem>
60359 <para>
60360 <indexterm role="concept">
60361 <primary>delivery</primary>
60362 <secondary>forcing failure</secondary>
60363 </indexterm>
60364 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
60365 that Exim gives up trying to deliver the message. A bounce message is generated
60366 for any remaining undelivered addresses.
60367 </para>
60368 </listitem>
60369 <listitem>
60370 <para>
60371 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
60372 that the message be deleted from the system without generating a bounce
60373 message.
60374 </para>
60375 </listitem>
60376 <listitem>
60377 <para>
60378 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
60379 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60380 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60381 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60382 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
60383 additional recipient be added to the message, unless the entry box is empty, in
60384 which case no action is taken.
60385 </para>
60386 </listitem>
60387 <listitem>
60388 <para>
60389 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
60390 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60391 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60392 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60393 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
60394 recipient address as already delivered, unless the entry box is empty, in which
60395 case no action is taken.
60396 </para>
60397 </listitem>
60398 <listitem>
60399 <para>
60400 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
60401 mark all recipient addresses as already delivered.
60402 </para>
60403 </listitem>
60404 <listitem>
60405 <para>
60406 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
60407 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
60408 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
60409 in which case no action is taken. If you want to set an empty sender (as in
60410 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
60411 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
60412 the address is qualified with that domain.
60413 </para>
60414 </listitem>
60415 </itemizedlist>
60416 <para>
60417 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
60418 other cases when a call to Exim is made, if there is any output from Exim (in
60419 particular, if the command fails) a window containing the command and the
60420 output is displayed. Otherwise, the results of the action are normally apparent
60421 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
60422 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
60423 if no output is generated.
60424 </para>
60425 <para>
60426 The queue display is automatically updated for actions such as freezing and
60427 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
60428 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
60429 force an update of the display after one of these actions.
60430 </para>
60431 <para>
60432 In any text window that is displayed as result of a menu action, the normal
60433 cut-and-paste facility is available, and searching can be carried out using ^R
60434 and ^S, as described above for the log tail window.
60435 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
60436 </para>
60437 </section>
60438 </chapter>
60439
60440 <chapter id="CHAPsecurity">
60441 <title>Security considerations</title>
60442 <para>
60443 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
60444 <primary>security</primary>
60445 <secondary>discussion of</secondary>
60446 </indexterm>
60447 This chapter discusses a number of issues concerned with security, some of
60448 which are also covered in other parts of this manual.
60449 </para>
60450 <para>
60451 For reasons that this author does not understand, some people have promoted
60452 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
60453 existence of this chapter in the documentation. However, the intent of the
60454 chapter is simply to describe the way Exim works in relation to certain
60455 security concerns, not to make any specific claims about the effectiveness of
60456 its security as compared with other MTAs.
60457 </para>
60458 <para>
60459 What follows is a description of the way Exim is supposed to be. Best efforts
60460 have been made to try to ensure that the code agrees with the theory, but an
60461 absence of bugs can never be guaranteed. Any that are reported will get fixed
60462 as soon as possible.
60463 </para>
60464 <section id="SECID286">
60465 <title>Building a more <quote>hardened</quote> Exim</title>
60466 <para>
60467 <indexterm role="concept">
60468 <primary>security</primary>
60469 <secondary>build-time features</secondary>
60470 </indexterm>
60471 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
60472 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
60473 Exim administrator who does not have the root password, or by someone who has
60474 penetrated the Exim (but not the root) account. These options are as follows:
60475 </para>
60476 <itemizedlist>
60477 <listitem>
60478 <para>
60479 ALT_CONFIG_PREFIX can be set to a string that is required to match the
60480 start of any file names used with the <option>-C</option> option. When it is set, these file
60481 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
60482 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
60483 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
60484 default setting for <option>ALT_CONFIG_PREFIX</option>.
60485 </para>
60486 <para>
60487 If the permitted configuration files are confined to a directory to
60488 which only root has access, this guards against someone who has broken
60489 into the Exim account from running a privileged Exim with an arbitrary
60490 configuration file, and using it to break into other accounts.
60491 </para>
60492 </listitem>
60493 <listitem>
60494 <para>
60495 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
60496 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
60497 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
60498 the possibility of testing a configuration using <option>-C</option> right through message
60499 reception and delivery, even if the caller is root. The reception works, but by
60500 that time, Exim is running as the Exim user, so when it re-execs to regain
60501 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
60502 However, root can test reception and delivery using two separate commands.
60503 ALT_CONFIG_ROOT_ONLY is not set by default.
60504 </para>
60505 </listitem>
60506 <listitem>
60507 <para>
60508 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
60509 is disabled.
60510 </para>
60511 </listitem>
60512 <listitem>
60513 <para>
60514 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
60515 never to be used for any deliveries. This is like the <option>never_users</option> runtime
60516 option, but it cannot be overridden; the runtime option adds additional users
60517 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
60518 is permitted to modify the runtime file from using Exim as a way to get root.
60519 </para>
60520 </listitem>
60521 </itemizedlist>
60522 </section>
60523 <section id="SECID270">
60524 <title>Root privilege</title>
60525 <para>
60526 <indexterm role="concept">
60527 <primary>setuid</primary>
60528 </indexterm>
60529 <indexterm role="concept">
60530 <primary>root privilege</primary>
60531 </indexterm>
60532 The Exim binary is normally setuid to root, which means that it gains root
60533 privilege (runs as root) when it starts execution. In some special cases (for
60534 example, when the daemon is not in use and there are no local deliveries), it
60535 may be possible to run Exim setuid to some user other than root. This is
60536 discussed in the next section. However, in most installations, root privilege
60537 is required for two things:
60538 </para>
60539 <itemizedlist>
60540 <listitem>
60541 <para>
60542 To set up a socket connected to the standard SMTP port (25) when initialising
60543 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
60544 not required.
60545 </para>
60546 </listitem>
60547 <listitem>
60548 <para>
60549 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
60550 perform local deliveries as the receiving user or as specified in the
60551 configuration.
60552 </para>
60553 </listitem>
60554 </itemizedlist>
60555 <para>
60556 It is not necessary to be root to do any of the other things Exim does, such as
60557 receiving messages and delivering them externally over SMTP, and it is
60558 obviously more secure if Exim does not run as root except when necessary.
60559 For this reason, a user and group for Exim to use must be defined in
60560 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
60561 group</quote>. Their values can be changed by the run time configuration, though this
60562 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
60563 <emphasis>mail</emphasis> or another user name altogether.
60564 </para>
60565 <para>
60566 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
60567 abdication; the process cannot regain root afterwards. Prior to release 4.00,
60568 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
60569 </para>
60570 <para>
60571 After a new Exim process has interpreted its command line options, it changes
60572 uid and gid in the following cases:
60573 </para>
60574 <itemizedlist>
60575 <listitem>
60576 <para>
60577 <indexterm role="option">
60578 <primary><option>-C</option></primary>
60579 </indexterm>
60580 <indexterm role="option">
60581 <primary><option>-D</option></primary>
60582 </indexterm>
60583 If the <option>-C</option> option is used to specify an alternate configuration file, or if
60584 the <option>-D</option> option is used to define macro values for the configuration, and the
60585 calling process is not running as root or the Exim user, the uid and gid are
60586 changed to those of the calling process.
60587 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
60588 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
60589 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
60590 </para>
60591 </listitem>
60592 <listitem>
60593 <para>
60594 <indexterm role="option">
60595 <primary><option>-be</option></primary>
60596 </indexterm>
60597 <indexterm role="option">
60598 <primary><option>-bf</option></primary>
60599 </indexterm>
60600 <indexterm role="option">
60601 <primary><option>-bF</option></primary>
60602 </indexterm>
60603 If the expansion test option (<option>-be</option>) or one of the filter testing options
60604 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
60605 calling process.
60606 </para>
60607 </listitem>
60608 <listitem>
60609 <para>
60610 If the process is not a daemon process or a queue runner process or a delivery
60611 process or a process for testing address routing (started with <option>-bt</option>), the
60612 uid and gid are changed to the Exim user and group. This means that Exim always
60613 runs under its own uid and gid when receiving messages. This also applies when
60614 testing address verification
60615 <indexterm role="option">
60616 <primary><option>-bv</option></primary>
60617 </indexterm>
60618 <indexterm role="option">
60619 <primary><option>-bh</option></primary>
60620 </indexterm>
60621 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
60622 option).
60623 </para>
60624 </listitem>
60625 <listitem>
60626 <para>
60627 For a daemon, queue runner, delivery, or address testing process, the uid
60628 remains as root at this stage, but the gid is changed to the Exim group.
60629 </para>
60630 </listitem>
60631 </itemizedlist>
60632 <para>
60633 The processes that initially retain root privilege behave as follows:
60634 </para>
60635 <itemizedlist>
60636 <listitem>
60637 <para>
60638 A daemon process changes the gid to the Exim group and the uid to the Exim
60639 user after setting up one or more listening sockets. The <function>initgroups()</function>
60640 function is called, so that if the Exim user is in any additional groups, they
60641 will be used during message reception.
60642 </para>
60643 </listitem>
60644 <listitem>
60645 <para>
60646 A queue runner process retains root privilege throughout its execution. Its
60647 job is to fork a controlled sequence of delivery processes.
60648 </para>
60649 </listitem>
60650 <listitem>
60651 <para>
60652 A delivery process retains root privilege throughout most of its execution,
60653 but any actual deliveries (that is, the transports themselves) are run in
60654 subprocesses which always change to a non-root uid and gid. For local
60655 deliveries this is typically the uid and gid of the owner of the mailbox; for
60656 remote deliveries, the Exim uid and gid are used. Once all the delivery
60657 subprocesses have been run, a delivery process changes to the Exim uid and gid
60658 while doing post-delivery tidying up such as updating the retry database and
60659 generating bounce and warning messages.
60660 </para>
60661 <para>
60662 While the recipient addresses in a message are being routed, the delivery
60663 process runs as root. However, if a user&#x2019;s filter file has to be processed,
60664 this is done in a subprocess that runs under the individual user&#x2019;s uid and
60665 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
60666 </para>
60667 </listitem>
60668 <listitem>
60669 <para>
60670 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
60671 the routing is done in the same environment as a message delivery.
60672 </para>
60673 </listitem>
60674 </itemizedlist>
60675 </section>
60676 <section id="SECTrunexiwitpri">
60677 <title>Running Exim without privilege</title>
60678 <para>
60679 <indexterm role="concept">
60680 <primary>privilege, running without</primary>
60681 </indexterm>
60682 <indexterm role="concept">
60683 <primary>unprivileged running</primary>
60684 </indexterm>
60685 <indexterm role="concept">
60686 <primary>root privilege</primary>
60687 <secondary>running without</secondary>
60688 </indexterm>
60689 Some installations like to run Exim in an unprivileged state for more of its
60690 operation, for added security. Support for this mode of operation is provided
60691 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
60692 gid are changed to the Exim user and group at the start of a delivery process
60693 (and also queue runner and address testing processes). This means that address
60694 routing is no longer run as root, and the deliveries themselves cannot change
60695 to any other uid.
60696 </para>
60697 <para>
60698 <indexterm role="concept">
60699 <primary>SIGHUP</primary>
60700 </indexterm>
60701 <indexterm role="concept">
60702 <primary>daemon</primary>
60703 <secondary>restarting</secondary>
60704 </indexterm>
60705 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
60706 that the daemon can still be started in the usual way, and it can respond
60707 correctly to SIGHUP because the re-invocation regains root privilege.
60708 </para>
60709 <para>
60710 An alternative approach is to make Exim setuid to the Exim user and also setgid
60711 to the Exim group. If you do this, the daemon must be started from a root
60712 process. (Calling Exim from a root process makes it behave in the way it does
60713 when it is setuid root.) However, the daemon cannot restart itself after a
60714 SIGHUP signal because it cannot regain privilege.
60715 </para>
60716 <para>
60717 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
60718 stops Exim from trying to re-invoke itself to do a delivery after a message has
60719 been received. Such a re-invocation is a waste of resources because it has no
60720 effect.
60721 </para>
60722 <para>
60723 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
60724 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
60725 to the Exim user seems a clean approach, but there is one complication:
60726 </para>
60727 <para>
60728 In this style of operation, Exim is running with the real uid and gid set to
60729 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
60730 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
60731 that is, the real uid/gid should be reset to the effective values so as to
60732 discard any privileges that the caller may have. While some operating systems
60733 have a function that permits this action for a non-root effective uid, quite a
60734 number of them do not. Because of this lack of standardization, Exim does not
60735 address this problem at this time.
60736 </para>
60737 <para>
60738 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
60739 is to keep the Exim binary setuid to root, and to set
60740 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
60741 be used in the most straightforward way.
60742 </para>
60743 <para>
60744 If you configure Exim not to run delivery processes as root, there are a
60745 number of restrictions on what you can do:
60746 </para>
60747 <itemizedlist>
60748 <listitem>
60749 <para>
60750 You can deliver only as the Exim user/group. You should  explicitly use the
60751 <option>user</option> and <option>group</option> options to override routers or local transports that
60752 normally deliver as the recipient. This makes sure that configurations that
60753 work in this mode function the same way in normal mode. Any implicit or
60754 explicit specification of another user causes an error.
60755 </para>
60756 </listitem>
60757 <listitem>
60758 <para>
60759 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
60760 not worthwhile to include them in the configuration.
60761 </para>
60762 </listitem>
60763 <listitem>
60764 <para>
60765 Users who wish to use <filename>.forward</filename> would have to make their home directory and
60766 the file itself accessible to the Exim user. Pipe and append-to-file entries,
60767 and their equivalents in Exim filters, cannot be used. While they could be
60768 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
60769 </para>
60770 </listitem>
60771 <listitem>
60772 <para>
60773 Unless the local user mailboxes are all owned by the Exim user (possible in
60774 some POP3 or IMAP-only environments):
60775 </para>
60776 <orderedlist numeration="arabic">
60777 <listitem>
60778 <para>
60779 They must be owned by the Exim group and be writeable by that group. This
60780 implies you must set <option>mode</option> in the appendfile configuration, as well as the
60781 mode of the mailbox files themselves.
60782 </para>
60783 </listitem>
60784 <listitem>
60785 <para>
60786 You must set <option>no_check_owner</option>, since most or all of the files will not be
60787 owned by the Exim user.
60788 </para>
60789 </listitem>
60790 <listitem>
60791 <para>
60792 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
60793 on a newly created mailbox when unprivileged. This also implies that new
60794 mailboxes need to be created manually.
60795 </para>
60796 </listitem>
60797 </orderedlist>
60798 </listitem>
60799 </itemizedlist>
60800 <para>
60801 These restrictions severely restrict what can be done in local deliveries.
60802 However, there are no restrictions on remote deliveries. If you are running a
60803 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
60804 gives more security at essentially no cost.
60805 </para>
60806 <para>
60807 If you are using the <option>mua_wrapper</option> facility (see chapter
60808 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
60809 </para>
60810 </section>
60811 <section id="SECID271">
60812 <title>Delivering to local files</title>
60813 <para>
60814 Full details of the checks applied by <command>appendfile</command> before it writes to a file
60815 are given in chapter <xref linkend="CHAPappendfile"/>.
60816 </para>
60817 </section>
60818 <section id="SECID272">
60819 <title>IPv4 source routing</title>
60820 <para>
60821 <indexterm role="concept">
60822 <primary>source routing</primary>
60823 <secondary>in IP packets</secondary>
60824 </indexterm>
60825 <indexterm role="concept">
60826 <primary>IP source routing</primary>
60827 </indexterm>
60828 Many operating systems suppress IP source-routed packets in the kernel, but
60829 some cannot be made to do this, so Exim does its own check. It logs incoming
60830 IPv4 source-routed TCP calls, and then drops them. Things are all different in
60831 IPv6. No special checking is currently done.
60832 </para>
60833 </section>
60834 <section id="SECID273">
60835 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
60836 <para>
60837 Support for these SMTP commands is disabled by default. If required, they can
60838 be enabled by defining suitable ACLs.
60839 </para>
60840 </section>
60841 <section id="SECID274">
60842 <title>Privileged users</title>
60843 <para>
60844 <indexterm role="concept">
60845 <primary>trusted users</primary>
60846 </indexterm>
60847 <indexterm role="concept">
60848 <primary>admin user</primary>
60849 </indexterm>
60850 <indexterm role="concept">
60851 <primary>privileged user</primary>
60852 </indexterm>
60853 <indexterm role="concept">
60854 <primary>user</primary>
60855 <secondary>trusted</secondary>
60856 </indexterm>
60857 <indexterm role="concept">
60858 <primary>user</primary>
60859 <secondary>admin</secondary>
60860 </indexterm>
60861 Exim recognizes two sets of users with special privileges. Trusted users are
60862 able to submit new messages to Exim locally, but supply their own sender
60863 addresses and information about a sending host. For other users submitting
60864 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
60865 permit a remote host to be specified.
60866 </para>
60867 <para>
60868 <indexterm role="option">
60869 <primary><option>-f</option></primary>
60870 </indexterm>
60871 However, an untrusted user is permitted to use the <option>-f</option> command line option
60872 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
60873 message should not cause an error report. This affects the message&#x2019;s envelope,
60874 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
60875 permitted to use specific forms of address with the <option>-f</option> option by setting
60876 the <option>untrusted_set_sender</option> option.
60877 </para>
60878 <para>
60879 Trusted users are used to run processes that receive mail messages from some
60880 other mail domain and pass them on to Exim for delivery either locally, or over
60881 the Internet. Exim trusts a caller that is running as root, as the Exim user,
60882 as any user listed in the <option>trusted_users</option> configuration option, or under any
60883 group listed in the <option>trusted_groups</option> option.
60884 </para>
60885 <para>
60886 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
60887 can freeze or thaw messages, cause them to be returned to their senders, remove
60888 them entirely, or modify them in various ways. In addition, admin users can run
60889 the Exim monitor and see all the information it is capable of providing, which
60890 includes the contents of files on the spool.
60891 </para>
60892 <para>
60893 <indexterm role="option">
60894 <primary><option>-M</option></primary>
60895 </indexterm>
60896 <indexterm role="option">
60897 <primary><option>-q</option></primary>
60898 </indexterm>
60899 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
60900 delivery of messages on its queue is restricted to admin users. This
60901 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
60902 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
60903 queue is also restricted to admin users. This restriction can be relaxed by
60904 setting <option>no_queue_list_requires_admin</option>.
60905 </para>
60906 <para>
60907 Exim recognizes an admin user if the calling process is running as root or as
60908 the Exim user or if any of the groups associated with the calling process is
60909 the Exim group. It is not necessary actually to be running under the Exim
60910 group. However, if admin users who are not root or the Exim user are to access
60911 the contents of files on the spool via the Exim monitor (which runs
60912 unprivileged), Exim must be built to allow group read access to its spool
60913 files.
60914 </para>
60915 </section>
60916 <section id="SECID275">
60917 <title>Spool files</title>
60918 <para>
60919 <indexterm role="concept">
60920 <primary>spool directory</primary>
60921 <secondary>files</secondary>
60922 </indexterm>
60923 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
60924 set to the Exim group. The mode for spool files is defined in the
60925 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
60926 any user who is a member of the Exim group can access these files.
60927 </para>
60928 </section>
60929 <section id="SECID276">
60930 <title>Use of argv[0]</title>
60931 <para>
60932 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
60933 of specific strings, Exim assumes certain options. For example, calling Exim
60934 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
60935 to calling it with the option <option>-bS</option>. There are no security implications in
60936 this.
60937 </para>
60938 </section>
60939 <section id="SECID277">
60940 <title>Use of %f formatting</title>
60941 <para>
60942 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
60943 are actually stored in integer variables as 1000 times the load average.
60944 Consequently, their range is limited and so therefore is the length of the
60945 converted output.
60946 </para>
60947 </section>
60948 <section id="SECID278">
60949 <title>Embedded Exim path</title>
60950 <para>
60951 Exim uses its own path name, which is embedded in the code, only when it needs
60952 to re-exec in order to regain root privilege. Therefore, it is not root when it
60953 does so. If some bug allowed the path to get overwritten, it would lead to an
60954 arbitrary program&#x2019;s being run as exim, not as root.
60955 </para>
60956 </section>
60957 <section id="SECID279">
60958 <title>Use of sprintf()</title>
60959 <para>
60960 <indexterm role="concept">
60961 <primary><function>sprintf()</function></primary>
60962 </indexterm>
60963 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
60964 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
60965 The intermediate formatting is done into a large fixed buffer by a function
60966 that runs through the format string itself, and checks the length of each
60967 conversion before performing it, thus preventing buffer overruns.
60968 </para>
60969 <para>
60970 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
60971 the output buffer is known to be sufficiently long to contain the converted
60972 string.
60973 </para>
60974 </section>
60975 <section id="SECID280">
60976 <title>Use of debug_printf() and log_write()</title>
60977 <para>
60978 Arbitrary strings are passed to both these functions, but they do their
60979 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
60980 the format string itself, and checks the length of each conversion.
60981 </para>
60982 </section>
60983 <section id="SECID281">
60984 <title>Use of strcat() and strcpy()</title>
60985 <para>
60986 These are used only in cases where the output buffer is known to be large
60987 enough to hold the result.
60988 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
60989 </para>
60990 </section>
60991 </chapter>
60992
60993 <chapter id="CHAPspool">
60994 <title>Format of spool files</title>
60995 <para>
60996 <indexterm role="concept" id="IIDforspo1" class="startofrange">
60997 <primary>format</primary>
60998 <secondary>spool files</secondary>
60999 </indexterm>
61000 <indexterm role="concept" id="IIDforspo2" class="startofrange">
61001 <primary>spool directory</primary>
61002 <secondary>format of files</secondary>
61003 </indexterm>
61004 <indexterm role="concept" id="IIDforspo3" class="startofrange">
61005 <primary>spool files</primary>
61006 <secondary>format of</secondary>
61007 </indexterm>
61008 <indexterm role="concept">
61009 <primary>spool files</primary>
61010 <secondary>editing</secondary>
61011 </indexterm>
61012 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
61013 followed by -D and -H, respectively. The data portion of the message is kept in
61014 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
61015 kept in the -H file, whose format is described in this chapter. Each of these
61016 two files contains the final component of its own name as its first line. This
61017 is insurance against disk crashes where the directory is lost but the files
61018 themselves are recoverable.
61019 </para>
61020 <para>
61021 Some people are tempted into editing -D files in order to modify messages. You
61022 need to be extremely careful if you do this; it is not recommended and you are
61023 on your own if you do it. Here are some of the pitfalls:
61024 </para>
61025 <itemizedlist>
61026 <listitem>
61027 <para>
61028 You must ensure that Exim does not try to deliver the message while you are
61029 fiddling with it. The safest way is to take out a write lock on the -D file,
61030 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
61031 place, the lock will be retained. If you write a new file and rename it, the
61032 lock will be lost at the instant of rename.
61033 </para>
61034 </listitem>
61035 <listitem>
61036 <para>
61037 <indexterm role="variable">
61038 <primary><varname>$body_linecount</varname></primary>
61039 </indexterm>
61040 If you change the number of lines in the file, the value of
61041 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
61042 present, this value is not used by Exim, but there is no guarantee that this
61043 will always be the case.
61044 </para>
61045 </listitem>
61046 <listitem>
61047 <para>
61048 If the message is in MIME format, you must take care not to break it.
61049 </para>
61050 </listitem>
61051 <listitem>
61052 <para>
61053 If the message is cryptographically signed, any change will invalidate the
61054 signature.
61055 </para>
61056 </listitem>
61057 </itemizedlist>
61058 <para>
61059 All in all, modifying -D files is fraught with danger.
61060 </para>
61061 <para>
61062 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
61063 its subdirectories when <option>split_spool_directory</option> is set). These are journal
61064 files, used to record addresses to which the message has been delivered during
61065 the course of a delivery attempt. If there are still undelivered recipients at
61066 the end, the -H file is updated, and the -J file is deleted. If, however, there
61067 is some kind of crash (for example, a power outage) before this happens, the -J
61068 file remains in existence. When Exim next processes the message, it notices the
61069 -J file and uses it to update the -H file before starting the next delivery
61070 attempt.
61071 </para>
61072 <section id="SECID282">
61073 <title>Format of the -H file</title>
61074 <para>
61075 <indexterm role="concept">
61076 <primary>uid (user id)</primary>
61077 <secondary>in spool file</secondary>
61078 </indexterm>
61079 <indexterm role="concept">
61080 <primary>gid (group id)</primary>
61081 <secondary>in spool file</secondary>
61082 </indexterm>
61083 The second line of the -H file contains the login name for the uid of the
61084 process that called Exim to read the message, followed by the numerical uid and
61085 gid. For a locally generated message, this is normally the user who sent the
61086 message. For a message received over TCP/IP via the daemon, it is
61087 normally the Exim user.
61088 </para>
61089 <para>
61090 The third line of the file contains the address of the message&#x2019;s sender as
61091 transmitted in the envelope, contained in angle brackets. The sender address is
61092 empty for bounce messages. For incoming SMTP mail, the sender address is given
61093 in the MAIL command. For locally generated mail, the sender address is
61094 created by Exim from the login name of the current user and the configured
61095 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
61096 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
61097 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
61098 </para>
61099 <para>
61100 The fourth line contains two numbers. The first is the time that the message
61101 was received, in the conventional Unix form &ndash; the number of seconds since the
61102 start of the epoch. The second number is a count of the number of messages
61103 warning of delayed delivery that have been sent to the sender.
61104 </para>
61105 <para>
61106 There follow a number of lines starting with a hyphen. These can appear in any
61107 order, and are omitted when not relevant:
61108 </para>
61109 <variablelist>
61110 <varlistentry>
61111 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61112 <listitem>
61113 <para>
61114 This item is obsolete, and is not generated from Exim release 4.61 onwards;
61115 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
61116 recognized, to provide backward compatibility. In the old format, a line of
61117 this form is present for every ACL variable that is not empty. The number
61118 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
61119 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
61120 the data string for the variable. The string itself starts at the beginning of
61121 the next line, and is followed by a newline character. It may contain internal
61122 newlines.
61123 </para>
61124 </listitem></varlistentry>
61125 <varlistentry>
61126 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61127 <listitem>
61128 <para>
61129 A line of this form is present for every ACL connection variable that is
61130 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
61131 The length is the length of the data string for the variable. The string itself
61132 starts at the beginning of the next line, and is followed by a newline
61133 character. It may contain internal newlines.
61134 </para>
61135 </listitem></varlistentry>
61136 <varlistentry>
61137 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61138 <listitem>
61139 <para>
61140 A line of this form is present for every ACL message variable that is defined.
61141 Note that there is a space between <option>-aclm</option> and the rest of the name. The
61142 length is the length of the data string for the variable. The string itself
61143 starts at the beginning of the next line, and is followed by a newline
61144 character. It may contain internal newlines.
61145 </para>
61146 </listitem></varlistentry>
61147 <varlistentry>
61148 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
61149 <listitem>
61150 <para>
61151 This is present if, when the message was received over SMTP, the value of
61152 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
61153 </para>
61154 </listitem></varlistentry>
61155 <varlistentry>
61156 <term><option>-allow_unqualified_recipient</option></term>
61157 <listitem>
61158 <para>
61159 This is present if unqualified recipient addresses are permitted in header
61160 lines (to stop such addresses from being qualified if rewriting occurs at
61161 transport time). Local messages that were input using <option>-bnq</option> and remote
61162 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
61163 </para>
61164 </listitem></varlistentry>
61165 <varlistentry>
61166 <term><option>-allow_unqualified_sender</option></term>
61167 <listitem>
61168 <para>
61169 This is present if unqualified sender addresses are permitted in header lines
61170 (to stop such addresses from being qualified if rewriting occurs at transport
61171 time). Local messages that were input using <option>-bnq</option> and remote messages from
61172 hosts that match <option>sender_unqualified_hosts</option> set this flag.
61173 </para>
61174 </listitem></varlistentry>
61175 <varlistentry>
61176 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61177 <listitem>
61178 <para>
61179 The id information for a message received on an authenticated SMTP connection
61180 &ndash; the value of the <varname>$authenticated_id</varname> variable.
61181 </para>
61182 </listitem></varlistentry>
61183 <varlistentry>
61184 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
61185 <listitem>
61186 <para>
61187 The address of an authenticated sender &ndash; the value of the
61188 <varname>$authenticated_sender</varname> variable.
61189 </para>
61190 </listitem></varlistentry>
61191 <varlistentry>
61192 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61193 <listitem>
61194 <para>
61195 This records the number of lines in the body of the message, and is always
61196 present.
61197 </para>
61198 </listitem></varlistentry>
61199 <varlistentry>
61200 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61201 <listitem>
61202 <para>
61203 This records the number of binary zero bytes in the body of the message, and is
61204 present if the number is greater than zero.
61205 </para>
61206 </listitem></varlistentry>
61207 <varlistentry>
61208 <term><option>-deliver_firsttime</option></term>
61209 <listitem>
61210 <para>
61211 This is written when a new message is first added to the spool. When the spool
61212 file is updated after a deferral, it is omitted.
61213 </para>
61214 </listitem></varlistentry>
61215 <varlistentry>
61216 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
61217 <listitem>
61218 <para>
61219 <indexterm role="concept">
61220 <primary>frozen messages</primary>
61221 <secondary>spool data</secondary>
61222 </indexterm>
61223 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
61224 </para>
61225 </listitem></varlistentry>
61226 <varlistentry>
61227 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61228 <listitem>
61229 <para>
61230 This records the host name as specified by a remote host in a HELO or EHLO
61231 command.
61232 </para>
61233 </listitem></varlistentry>
61234 <varlistentry>
61235 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
61236 <listitem>
61237 <para>
61238 This records the IP address of the host from which the message was received and
61239 the remote port number that was used. It is omitted for locally generated
61240 messages.
61241 </para>
61242 </listitem></varlistentry>
61243 <varlistentry>
61244 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61245 <listitem>
61246 <para>
61247 If the message was received on an authenticated SMTP connection, this records
61248 the name of the authenticator &ndash; the value of the
61249 <varname>$sender_host_authenticated</varname> variable.
61250 </para>
61251 </listitem></varlistentry>
61252 <varlistentry>
61253 <term><option>-host_lookup_failed</option></term>
61254 <listitem>
61255 <para>
61256 This is present if an attempt to look up the sending host&#x2019;s name from its IP
61257 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
61258 </para>
61259 </listitem></varlistentry>
61260 <varlistentry>
61261 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61262 <listitem>
61263 <para>
61264 <indexterm role="concept">
61265 <primary>reverse DNS lookup</primary>
61266 </indexterm>
61267 <indexterm role="concept">
61268 <primary>DNS</primary>
61269 <secondary>reverse lookup</secondary>
61270 </indexterm>
61271 This records the name of the remote host from which the message was received,
61272 if the host name was looked up from the IP address when the message was being
61273 received. It is not present if no reverse lookup was done.
61274 </para>
61275 </listitem></varlistentry>
61276 <varlistentry>
61277 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61278 <listitem>
61279 <para>
61280 For locally submitted messages, this records the login of the originating user,
61281 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
61282 ident value. For messages received over TCP/IP, this records the ident string
61283 supplied by the remote host, if any.
61284 </para>
61285 </listitem></varlistentry>
61286 <varlistentry>
61287 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
61288 <listitem>
61289 <para>
61290 This records the IP address of the local interface and the port number through
61291 which a message was received from a remote host. It is omitted for locally
61292 generated messages.
61293 </para>
61294 </listitem></varlistentry>
61295 <varlistentry>
61296 <term><option>-local</option></term>
61297 <listitem>
61298 <para>
61299 The message is from a local sender.
61300 </para>
61301 </listitem></varlistentry>
61302 <varlistentry>
61303 <term><option>-localerror</option></term>
61304 <listitem>
61305 <para>
61306 The message is a locally-generated bounce message.
61307 </para>
61308 </listitem></varlistentry>
61309 <varlistentry>
61310 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
61311 <listitem>
61312 <para>
61313 This records the data string that was returned by the <function>local_scan()</function> function
61314 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
61315 variable. It is omitted if no data was returned.
61316 </para>
61317 </listitem></varlistentry>
61318 <varlistentry>
61319 <term><option>-manual_thaw</option></term>
61320 <listitem>
61321 <para>
61322 The message was frozen but has been thawed manually, that is, by an explicit
61323 Exim command rather than via the auto-thaw process.
61324 </para>
61325 </listitem></varlistentry>
61326 <varlistentry>
61327 <term><option>-N</option></term>
61328 <listitem>
61329 <para>
61330 A testing delivery process was started using the <option>-N</option> option to suppress any
61331 actual deliveries, but delivery was deferred. At any further delivery attempts,
61332 <option>-N</option> is assumed.
61333 </para>
61334 </listitem></varlistentry>
61335 <varlistentry>
61336 <term><option>-received_protocol</option></term>
61337 <listitem>
61338 <para>
61339 This records the value of the <varname>$received_protocol</varname> variable, which contains
61340 the name of the protocol by which the message was received.
61341 </para>
61342 </listitem></varlistentry>
61343 <varlistentry>
61344 <term><option>-sender_set_untrusted</option></term>
61345 <listitem>
61346 <para>
61347 The envelope sender of this message was set by an untrusted local caller (used
61348 to ensure that the caller is displayed in queue listings).
61349 </para>
61350 </listitem></varlistentry>
61351 <varlistentry>
61352 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61353 <listitem>
61354 <para>
61355 If a message was scanned by SpamAssassin, this is present. It records the value
61356 of <varname>$spam_score_int</varname>.
61357 </para>
61358 </listitem></varlistentry>
61359 <varlistentry>
61360 <term><option>-tls_certificate_verified</option></term>
61361 <listitem>
61362 <para>
61363 A TLS certificate was received from the client that sent this message, and the
61364 certificate was verified by the server.
61365 </para>
61366 </listitem></varlistentry>
61367 <varlistentry>
61368 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
61369 <listitem>
61370 <para>
61371 When the message was received over an encrypted connection, this records the
61372 name of the cipher suite that was used.
61373 </para>
61374 </listitem></varlistentry>
61375 <varlistentry>
61376 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
61377 <listitem>
61378 <para>
61379 When the message was received over an encrypted connection, and a certificate
61380 was received from the client, this records the Distinguished Name from that
61381 certificate.
61382 </para>
61383 </listitem></varlistentry>
61384 </variablelist>
61385 <para>
61386 Following the options there is a list of those addresses to which the message
61387 is not to be delivered. This set of addresses is initialized from the command
61388 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
61389 is set; otherwise it starts out empty. Whenever a successful delivery is made,
61390 the address is added to this set. The addresses are kept internally as a
61391 balanced binary tree, and it is a representation of that tree which is written
61392 to the spool file. If an address is expanded via an alias or forward file, the
61393 original address is added to the tree when deliveries to all its child
61394 addresses are complete.
61395 </para>
61396 <para>
61397 If the tree is empty, there is a single line in the spool file containing just
61398 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
61399 Y or N, followed by an address. The address is the value for the node of the
61400 tree, and the letters indicate whether the node has a left branch and/or a
61401 right branch attached to it, respectively. If branches exist, they immediately
61402 follow. Here is an example of a three-node tree:
61403 </para>
61404 <literallayout class="monospaced">
61405 YY darcy@austen.fict.example
61406 NN alice@wonderland.fict.example
61407 NN editor@thesaurus.ref.example
61408 </literallayout>
61409 <para>
61410 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
61411 This is a simple list, preceded by a count. It includes all the original
61412 recipients of the message, including those to whom the message has already been
61413 delivered. In the simplest case, the list contains one address per line. For
61414 example:
61415 </para>
61416 <literallayout class="monospaced">
61417 4
61418 editor@thesaurus.ref.example
61419 darcy@austen.fict.example
61420 rdo@foundation
61421 alice@wonderland.fict.example
61422 </literallayout>
61423 <para>
61424 However, when a child address has been added to the top-level addresses as a
61425 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
61426 line is of the following form:
61427 </para>
61428 <literallayout>
61429 &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;
61430 </literallayout>
61431 <para>
61432 The 01 flag bit indicates the presence of the three other fields that follow
61433 the top-level address. Other bits may be used in future to support additional
61434 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
61435 original parent of the <quote>one time</quote> address. The first two fields are the
61436 envelope sender that is associated with this address and its length. If the
61437 length is zero, there is no special envelope sender (there are then two space
61438 characters in the line). A non-empty field can arise from a <command>redirect</command> router
61439 that has an <option>errors_to</option> setting.
61440 </para>
61441 <para>
61442 A blank line separates the envelope and status information from the headers
61443 which follow. A header may occupy several lines of the file, and to save effort
61444 when reading it in, each header is preceded by a number and an identifying
61445 character. The number is the number of characters in the header, including any
61446 embedded newlines and the terminating newline. The character is one of the
61447 following:
61448 </para>
61449 <informaltable frame="none">
61450 <tgroup cols="2" colsep="0" rowsep="0">
61451 <colspec colwidth="50pt" align="left"/>
61452 <colspec colwidth="254pt" align="left"/>
61453 <tbody>
61454 <row>
61455 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
61456 <entry>header in which Exim has no special interest</entry>
61457 </row>
61458 <row>
61459 <entry><literal>B</literal></entry>
61460 <entry><emphasis>Bcc:</emphasis> header</entry>
61461 </row>
61462 <row>
61463 <entry><literal>C</literal></entry>
61464 <entry><emphasis>Cc:</emphasis> header</entry>
61465 </row>
61466 <row>
61467 <entry><literal>F</literal></entry>
61468 <entry><emphasis>From:</emphasis> header</entry>
61469 </row>
61470 <row>
61471 <entry><literal>I</literal></entry>
61472 <entry><emphasis>Message-id:</emphasis> header</entry>
61473 </row>
61474 <row>
61475 <entry><literal>P</literal></entry>
61476 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
61477 </row>
61478 <row>
61479 <entry><literal>R</literal></entry>
61480 <entry><emphasis>Reply-To:</emphasis> header</entry>
61481 </row>
61482 <row>
61483 <entry><literal>S</literal></entry>
61484 <entry><emphasis>Sender:</emphasis> header</entry>
61485 </row>
61486 <row>
61487 <entry><literal>T</literal></entry>
61488 <entry><emphasis>To:</emphasis> header</entry>
61489 </row>
61490 <row>
61491 <entry><literal>*</literal></entry>
61492 <entry>replaced or deleted header</entry>
61493 </row>
61494 </tbody>
61495 </tgroup>
61496 </informaltable>
61497 <para>
61498 Deleted or replaced (rewritten) headers remain in the spool file for debugging
61499 purposes. They are not transmitted when the message is delivered. Here is a
61500 typical set of headers:
61501 </para>
61502 <literallayout class="monospaced">
61503 111P Received: by hobbit.fict.example with local (Exim 4.00)
61504 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
61505 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
61506 038* X-rewrote-sender: bb@hobbit.fict.example
61507 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
61508 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
61509 099* To: alice@wonderland.fict.example, rdo@foundation,
61510 darcy@austen.fict.example, editor@thesaurus.ref.example
61511 104T To: alice@wonderland.fict.example, rdo@foundation.example,
61512 darcy@austen.fict.example, editor@thesaurus.ref.example
61513 038  Date: Fri, 11 May 2001 10:28:59 +0100
61514 </literallayout>
61515 <para>
61516 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
61517 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
61518 unqualified domain <emphasis>foundation</emphasis>.
61519 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
61520 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
61521 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
61522 </para>
61523 </section>
61524 </chapter>
61525
61526 <chapter id="CHID12">
61527 <title>Adding new drivers or lookup types</title>
61528 <titleabbrev>Adding drivers or lookups</titleabbrev>
61529 <para>
61530 <indexterm role="concept">
61531 <primary>adding drivers</primary>
61532 </indexterm>
61533 <indexterm role="concept">
61534 <primary>new drivers, adding</primary>
61535 </indexterm>
61536 <indexterm role="concept">
61537 <primary>drivers</primary>
61538 <secondary>adding new</secondary>
61539 </indexterm>
61540 The following actions have to be taken in order to add a new router, transport,
61541 authenticator, or lookup type to Exim:
61542 </para>
61543 <orderedlist numeration="arabic">
61544 <listitem>
61545 <para>
61546 Choose a name for the driver or lookup type that does not conflict with any
61547 existing name; I will use <quote>newdriver</quote> in what follows.
61548 </para>
61549 </listitem>
61550 <listitem>
61551 <para>
61552 Add to <filename>src/EDITME</filename> the line:
61553 </para>
61554 <literallayout>
61555 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
61556 </literallayout>
61557 <para>
61558 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
61559 code is not to be included in the binary by default, comment this line out. You
61560 should also add any relevant comments about the driver or lookup type.
61561 </para>
61562 </listitem>
61563 <listitem>
61564 <para>
61565 Add to <filename>src/config.h.defaults</filename> the line:
61566 </para>
61567 <literallayout class="monospaced">
61568 #define &lt;type&gt;_NEWDRIVER
61569 </literallayout>
61570 </listitem>
61571 <listitem>
61572 <para>
61573 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
61574 and create a table entry as is done for all the other drivers and lookup types.
61575 </para>
61576 </listitem>
61577 <listitem>
61578 <para>
61579 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
61580 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
61581 driver or lookup type and add it to the definition of OBJ.
61582 </para>
61583 </listitem>
61584 <listitem>
61585 <para>
61586 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
61587 <filename>src</filename>.
61588 </para>
61589 </listitem>
61590 <listitem>
61591 <para>
61592 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
61593 as for other drivers and lookups.
61594 </para>
61595 </listitem>
61596 </orderedlist>
61597 <para>
61598 Then all you need to do is write the code! A good way to start is to make a
61599 proforma by copying an existing module of the same type, globally changing all
61600 occurrences of the name, and cutting out most of the code. Note that any
61601 options you create must be listed in alphabetical order, because the tables are
61602 searched using a binary chop procedure.
61603 </para>
61604 <para>
61605 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
61606 the interface that is expected.
61607 </para>
61608 <?sdop
61609   format="newpage"
61610   foot_right_recto="&chaptertitle;"
61611   foot_right_verso="&chaptertitle;"
61612 ?>
61613 </chapter>
61614
61615 <index role="option">
61616 <title>Options index</title>
61617 </index>
61618
61619 <index role="variable">
61620 <title>Variables index</title>
61621 </index>
61622
61623 <index role="concept">
61624 <title>Concept index</title>
61625 </index>
61626
61627 </book>